diff --git a/PhysicsAnalysis/TopPhys/KLFitter/CMakeLists.txt b/PhysicsAnalysis/TopPhys/KLFitter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e0f6a897b0ec9cdef21218fd7d5c83312a5c3d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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/* ) diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/BoostedLikelihoodTopLeptonJets.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/BoostedLikelihoodTopLeptonJets.h new file mode 100644 index 0000000000000000000000000000000000000000..a2cff5438ad7f4a347945b664e9753fc7d423597 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/BoostedLikelihoodTopLeptonJets.h @@ -0,0 +1,420 @@ +/* + 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 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_7TeV.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_7TeV.h new file mode 100644 index 0000000000000000000000000000000000000000..17b43a6a9e44543adbe6b722ef941c5a7c5296d1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_7TeV.h @@ -0,0 +1,257 @@ +/* + 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ö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; + + /** + * The energy resolution of gluon jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyGluonJet_eta1; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta2; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta3; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta4; + + /** + * The energy resolution of electrons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyElectron_eta1; + KLFitter::ResolutionBase * fResEnergyElectron_eta2; + KLFitter::ResolutionBase * fResEnergyElectron_eta3; + KLFitter::ResolutionBase * fResEnergyElectron_eta4; + + /** + * The energy resolution of muons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyMuon_eta1; + KLFitter::ResolutionBase * fResEnergyMuon_eta2; + KLFitter::ResolutionBase * fResEnergyMuon_eta3; + + /** + * The energy resolution of photons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyPhoton_eta1; + KLFitter::ResolutionBase * fResEnergyPhoton_eta2; + KLFitter::ResolutionBase * fResEnergyPhoton_eta3; + KLFitter::ResolutionBase * fResEnergyPhoton_eta4; + + /** + * The eta resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaLightJet_eta1; + KLFitter::ResolutionBase * fResEtaLightJet_eta2; + KLFitter::ResolutionBase * fResEtaLightJet_eta3; + KLFitter::ResolutionBase * fResEtaLightJet_eta4; + + /** + * The eta resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaBJet_eta1; + KLFitter::ResolutionBase * fResEtaBJet_eta2; + KLFitter::ResolutionBase * fResEtaBJet_eta3; + KLFitter::ResolutionBase * fResEtaBJet_eta4; + + /** + * The phi resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiLightJet_eta1; + KLFitter::ResolutionBase * fResPhiLightJet_eta2; + KLFitter::ResolutionBase * fResPhiLightJet_eta3; + KLFitter::ResolutionBase * fResPhiLightJet_eta4; + + /** + * The phi resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiBJet_eta1; + KLFitter::ResolutionBase * fResPhiBJet_eta2; + KLFitter::ResolutionBase * fResPhiBJet_eta3; + KLFitter::ResolutionBase * fResPhiBJet_eta4; + + /** + * The eta binning for jets + */ + double fJetEtaBin_1; + double fJetEtaBin_2; + double fJetEtaBin_3; + double fJetEtaBin_4; + double fJetEtaBin_5; + + /** + * The eta binning for electrons + */ + double fElectronEtaBin_1; + double fElectronEtaBin_2; + double fElectronEtaBin_3; + double fElectronEtaBin_4; + + /** + * The eta binning for muons + */ + double fMuonEtaBin_1; + double fMuonEtaBin_2; + double fMuonEtaBin_3; + + /** + * The eta binning for muons + */ + double fPhotonEtaBin_1; + double fPhotonEtaBin_2; + double fPhotonEtaBin_3; + double fPhotonEtaBin_4; + + + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_8TeV.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_8TeV.h new file mode 100644 index 0000000000000000000000000000000000000000..08153c022334f0d18a2ddef8ead6d5e515040b06 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorAtlas_8TeV.h @@ -0,0 +1,257 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::DetectorAtlas_8TeV + * \brief A class for describing of the ATLAS detector. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class holds the description of the ATLAS detector. + */ + +// --------------------------------------------------------- + +#ifndef DETECTORATLAS_8TEV +#define DETECTORATLAS_8TEV + +// --------------------------------------------------------- + +#include "DetectorBase.h" +#include <string> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class DetectorAtlas_8TeV : public DetectorBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param folder The folder with transfer function parameters. + */ + DetectorAtlas_8TeV(std::string folder = ""); + + /** + * The default destructor. + */ + virtual ~DetectorAtlas_8TeV(); + + /* @} */ + /** \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; + + /** + * The energy resolution of gluon jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyGluonJet_eta1; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta2; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta3; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta4; + + /** + * The energy resolution of electrons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyElectron_eta1; + KLFitter::ResolutionBase * fResEnergyElectron_eta2; + KLFitter::ResolutionBase * fResEnergyElectron_eta3; + KLFitter::ResolutionBase * fResEnergyElectron_eta4; + + /** + * The energy resolution of muons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyMuon_eta1; + KLFitter::ResolutionBase * fResEnergyMuon_eta2; + KLFitter::ResolutionBase * fResEnergyMuon_eta3; + + /** + * The energy resolution of photons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyPhoton_eta1; + KLFitter::ResolutionBase * fResEnergyPhoton_eta2; + KLFitter::ResolutionBase * fResEnergyPhoton_eta3; + KLFitter::ResolutionBase * fResEnergyPhoton_eta4; + + /** + * The eta resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaLightJet_eta1; + KLFitter::ResolutionBase * fResEtaLightJet_eta2; + KLFitter::ResolutionBase * fResEtaLightJet_eta3; + KLFitter::ResolutionBase * fResEtaLightJet_eta4; + + /** + * The eta resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaBJet_eta1; + KLFitter::ResolutionBase * fResEtaBJet_eta2; + KLFitter::ResolutionBase * fResEtaBJet_eta3; + KLFitter::ResolutionBase * fResEtaBJet_eta4; + + /** + * The phi resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiLightJet_eta1; + KLFitter::ResolutionBase * fResPhiLightJet_eta2; + KLFitter::ResolutionBase * fResPhiLightJet_eta3; + KLFitter::ResolutionBase * fResPhiLightJet_eta4; + + /** + * The phi resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiBJet_eta1; + KLFitter::ResolutionBase * fResPhiBJet_eta2; + KLFitter::ResolutionBase * fResPhiBJet_eta3; + KLFitter::ResolutionBase * fResPhiBJet_eta4; + + /** + * The eta binning for jets + */ + double fJetEtaBin_1; + double fJetEtaBin_2; + double fJetEtaBin_3; + double fJetEtaBin_4; + double fJetEtaBin_5; + + /** + * The eta binning for electrons + */ + double fElectronEtaBin_1; + double fElectronEtaBin_2; + double fElectronEtaBin_3; + double fElectronEtaBin_4; + + /** + * The eta binning for muons + */ + double fMuonEtaBin_1; + double fMuonEtaBin_2; + double fMuonEtaBin_3; + + /** + * The eta binning for muons + */ + double fPhotonEtaBin_1; + double fPhotonEtaBin_2; + double fPhotonEtaBin_3; + double fPhotonEtaBin_4; + + + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorBase.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorBase.h new file mode 100644 index 0000000000000000000000000000000000000000..8a4759df4274f19dc21f27903dff0570833646da --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/DetectorBase.h @@ -0,0 +1,299 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::DetectorBase + * \brief A base class for describing detectors. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This base class contains the energy resolution of different + * objects. More information (angular resolutions, acceptance, + * correections, etc.) can be added here. + */ + +// --------------------------------------------------------- + +#ifndef DETECTORBASE +#define DETECTORBASE + +// --------------------------------------------------------- + +#include <string> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResolutionBase; + + class DetectorBase + { + + public: + + /** \name Enumerators */ + /* @{ */ + + /** + * Enumerate for beam centre-of-mass energy + */ + enum BeamCMEnergy {k7TeV,k8TeV, k10TeV}; + + /* @} */ + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param folder The folder with transfer function parameters. + */ + DetectorBase(std::string /*folder*/ = ""); + + /** + * The default destructor. + */ + virtual ~DetectorBase(); + + /* @} */ + /** \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. + */ + virtual KLFitter::ResolutionBase * ResEnergyLightJet(double /*eta*/ = 0.) + { return fResEnergyLightJet; }; + + /** + * Return the energy resolution of b jets. + * @param eta The eta of the particle. + * @return A pointer to the energy resolution object. + */ + virtual KLFitter::ResolutionBase * ResEnergyBJet(double /*eta*/ = 0.) + { return fResEnergyBJet; }; + + /** + * Return the energy resolution of gluon jets. + * @param eta The eta of the particle. + * @return A pointer to the energy resolution object. + */ + virtual KLFitter::ResolutionBase * ResEnergyGluonJet(double /*eta*/ = 0.) + { return fResEnergyGluonJet; }; + + /** + * Return the energy resolution of electrons. + * @param eta The eta of the particle. + * @return A pointer to the energy resolution object. + */ + virtual KLFitter::ResolutionBase * ResEnergyElectron(double /*eta*/ = 0.) + { return fResEnergyElectron; }; + + /** + * Return the energy resolution of muons. + * @param eta The eta of the particle. + * @return A pointer to the energy resolution object. + */ + virtual KLFitter::ResolutionBase * ResEnergyMuon(double /*eta*/= 0.) + { return fResEnergyMuon; }; + + /** + * Return the energy resolution of photons. + * @param eta The eta of the particle. + * @return A pointer to the energy resolution object. + */ + virtual KLFitter::ResolutionBase * ResEnergyPhoton(double /*eta*/ = 0.) + { return fResEnergyPhoton; }; + + /** + * Return the missing ET resolution. + * @return A pointer to the missing ET resolution. + */ + virtual KLFitter::ResolutionBase * ResMissingET() + { return fResMissingET; }; + + /** + * Return the eta resolution of light jets. + * @param eta The eta of the particle. + * @return A pointer to the eta resolution object. + */ + virtual KLFitter::ResolutionBase * ResEtaLightJet(double /*eta*/ = 0.) + { return fResEtaLightJet; }; + + /** + * Return the eta resolution of b jets. + * @param eta The eta of the particle. + * @return A pointer to the eta resolution object. + */ + virtual KLFitter::ResolutionBase * ResEtaBJet(double /*eta*/ = 0.) + { return fResEtaBJet; }; + + /** + * Return the phi resolution of light jets. + * @param eta The phi of the particle. + * @return A pointer to the phi resolution object. + */ + virtual KLFitter::ResolutionBase * ResPhiLightJet(double /*eta*/ = 0.) + { return fResPhiLightJet; }; + + /** + * Return the phi resolution of b jets. + * @param eta The phi of the particle. + * @return A pointer to the phi resolution object. + */ + virtual KLFitter::ResolutionBase * ResPhiBJet(double /*eta*/ = 0.) + { return fResPhiBJet; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the energy resolution parameterization of b jets. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyBJet(KLFitter::ResolutionBase * res); + + /** + * Set the energy resolution parameterization of light jets. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyLightJet(KLFitter::ResolutionBase * res); + + /** + * Set the energy resolution parameterization of gluon jets. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyGluonJet(KLFitter::ResolutionBase * res); + + /** + * Set the energy resolution parameterization of electrons. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyElectron(KLFitter::ResolutionBase * res); + + /** + * Set the energy resolution parameterization of muons. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyMuon(KLFitter::ResolutionBase * res); + + /** + * Set the energy resolution parameterization of photons. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResEnergyPhoton(KLFitter::ResolutionBase * res); + + /** + * Set the missing ET resolution parameterization. + * @param res A pointer to the resolution object. + * @return An error code. + */ + int SetResMissingET(KLFitter::ResolutionBase * res); + + /** + * Set the beam centre-of-mass energy in the current detector. + * @param beamenergy The beam energy. + * @return An error code. + */ + int SetBeamCMEnergy(KLFitter::DetectorBase::BeamCMEnergy beamenergy) + {fBeamCMEnergy = beamenergy; return 1;}; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + int Status(); + + /** + * Get the beam centre-of-mass energy in the current detector. + * @return An error code. + */ + KLFitter::DetectorBase::BeamCMEnergy GetBeamCMEnergy() + {return fBeamCMEnergy;}; + /* @} */ + + protected: + + /** + * The energy resolution of light jets. + */ + KLFitter::ResolutionBase * fResEnergyLightJet; + + /** + * The energy resolution of b jets. + */ + KLFitter::ResolutionBase * fResEnergyBJet; + + /** + * The energy resolution of gluon jets. + */ + KLFitter::ResolutionBase * fResEnergyGluonJet; + + /** + * The energy resolution of electrons. + */ + KLFitter::ResolutionBase * fResEnergyElectron; + + /** + * The energy resolution of muons. + */ + KLFitter::ResolutionBase * fResEnergyMuon; + + /** + * The energy resolution of photons. + */ + KLFitter::ResolutionBase * fResEnergyPhoton; + + /** + * The missing ET resolution. + */ + KLFitter::ResolutionBase * fResMissingET; + + /** + * The eta resolution of light jets. + */ + KLFitter::ResolutionBase * fResEtaLightJet; + + /** + * The eta resolution of b jets. + */ + KLFitter::ResolutionBase * fResEtaBJet; + + /** + * The phi resolution of light jets. + */ + KLFitter::ResolutionBase * fResPhiLightJet; + + /** + * The phi resolution of b jets. + */ + KLFitter::ResolutionBase * fResPhiBJet; + + /** + * The current beam centre-of-mass energy in the detector + */ + KLFitter::DetectorBase::BeamCMEnergy fBeamCMEnergy; + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Fitter.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Fitter.h new file mode 100644 index 0000000000000000000000000000000000000000..7ba0f6a3c124b35f427948df62b13ee5e4d902de --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Fitter.h @@ -0,0 +1,308 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::Fitter + * \brief The fitter class. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class owns all particles, the detector description, the + * likelihood, etc. This is the class seen by the user. + */ + +// --------------------------------------------------------- + +#ifndef FITTER +#define FITTER + +#include <vector> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Particles; + class DetectorBase; + class LikelihoodBase; + class Permutations; + + class Fitter + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + Fitter(); + + /** + * The default destructor. + */ + virtual ~Fitter(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the detector. + * @return A pointer to the detector. + */ + KLFitter::DetectorBase * Detector() + { return fDetector; }; + + /** + * Return the measured particles. + * @return A pointer to the particles. + */ + KLFitter::Particles * Particles() + { return fParticles; }; + KLFitter::Particles ** PParticles() + { return &fParticles; }; + + /** + * Return the permutation object. + * @return A pointer to the permutation object. + **/ + KLFitter::Permutations * Permutations() + { return fPermutations; }; + KLFitter::Permutations ** PPermutations() + { return &fPermutations; }; + + /** + * Return the lieklihood . + * @return A pointer to the likelihood object. + **/ + KLFitter::LikelihoodBase * Likelihood() + { return fLikelihood; }; + KLFitter::LikelihoodBase ** PLikelihood() + { return &fLikelihood; }; + + /** + * Return the Minuit status + * @return The Minuit stats + */ + int MinuitStatus() + { return fMinuitStatus; }; + + /** + * Return the convergence status bit. + * @return The convergence status bit. + */ + unsigned int ConvergenceStatus() + { return fConvergenceStatus; } + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the detector description. + * @param detector A pointer to the detector. + * @return An error code. + */ + int SetDetector(KLFitter::DetectorBase * detector); + + /** + * Set the particles. + * @param particles A pointer to a set of particles. + * @param nPartonsInPermutations The number of partons per permutation (can be smaller than the number of added partons). + * @return An error flag. + */ + int SetParticles(KLFitter::Particles * particles, int nPartonsInPermutations = -1); + + /** + * Set truth particles. + * @param particles A pointer to a set of particles. + * @return An error flag. + */ + int SetMyParticlesTruth(KLFitter::Particles * particles); + + /** + * Set x and y component of the missing ET. + * @param etx component of the missing ET. + * @param ety component of the missing ET. + * @param sumet The measured scalar sum of transverse energy. + * @return An error flag. + */ + int SetET_miss_XY_SumET(double etx, double ety, double sumet); + + /** + * Set the likelihood for the actual fit. + * @param likelihood A pointer to the likelihood. + * @return An error code. + */ + int SetLikelihood(KLFitter::LikelihoodBase * likelihood); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Perform the fit for a single permutation of jets and leptons. + * @param index The permutation index. + * @return An error code. + */ + int Fit(int index); + + /** + * Perform the fit for all permutations of jets and leptons. + * @return An error code. + */ + int Fit(); + + /** + * Check if detector, likelihood, etc. are all set. + * @return A status code. + */ + int Status(); + + /** + * Turn of simulated annealing. + */ + void TurnOffSA() { fTurnOffSA = true; }; + + /** + * Enumerator for convergence errors. + */ + enum ConvergenceErrors { + MinuitDidNotConverge = 1, + FitAbortedDueToNaN = 2, + AtLeastOneFitParameterAtItsLimit = 3, + InvalidTransferFunctionAtConvergence = 4 + }; + + /** + * Bit masks for convergence errors. + */ + static const unsigned int MinuitDidNotConvergeMask = 0x1 << MinuitDidNotConverge; + static const unsigned int FitAbortedDueToNaNMask = 0x1 << FitAbortedDueToNaN; + static const unsigned int AtLeastOneFitParameterAtItsLimitMask = 0x1 << AtLeastOneFitParameterAtItsLimit; + static const unsigned int InvalidTransferFunctionAtConvergenceMask = 0x1 << InvalidTransferFunctionAtConvergence; + + /** + * Enumerator for the minimization methods. + */ + enum kMinimizationMethod { kMinuit, kSimulatedAnnealing, kMarkovChainMC }; + + /** + * Set the minimization method. + * @param method The minimization method. + */ + void SetMinimizationMethod(kMinimizationMethod method) { fMinimizationMethod = method; } + + /** + * Write fCachedMinuitStatus and fCachedConvergenceStatus to + * fCachedMinuitStatusVector.at(iperm) + * and fCachedConvergenceStatusVector.at(iperm) + * @param iperm Current permutation + * @return An error code. + */ + int SetFitStatusToCache(int iperm, int nperms); + + /** + * Write parameters from fCachedMinuitStatusVector.at(iperm) + * and fCachedConvergenceStatusVector.at(iperm) to fCachedMinuitStatus + * and fCachedConvergenceStatus + * @param iperm Current permutation + * @return An error code. + */ + int GetFitStatusFromCache(int iperm); + + /* @} */ + + private: + + /** + * A pointer to the detector. + */ + KLFitter::DetectorBase * fDetector; + + /** + * A pointer to the set of original particles. + */ + KLFitter::Particles * fParticles; + + /** + * The x and y component of the missing ET and the sumET. + */ + double ETmiss_x; + double ETmiss_y; + double SumET; + + /** + * A pointer to the set of permuted particles. + */ + KLFitter::Particles * fParticlesPermuted; + + /** + * A pointer to the set of truth particles. + */ + KLFitter::Particles * fMyParticlesTruth; + + /** + * A pointer to the likelihood. + */ + KLFitter::LikelihoodBase * fLikelihood; + + /** + * A pointer to the permutation object. + */ + KLFitter::Permutations * fPermutations; + + /** + * The TMinuit status + */ + int fMinuitStatus; + + /** + * The convergence status bit + */ + unsigned int fConvergenceStatus; + + /** + * Flag for turning off simulated annealing. + */ + int fTurnOffSA; + + /** + * The minimization method. + */ + kMinimizationMethod fMinimizationMethod; + + /** + * A vector of cached Minuit status + */ + std::vector<int> fCachedMinuitStatusVector; + + /** + * A vector of cached convergence status + */ + std::vector<unsigned int> fCachedConvergenceStatusVector; + + /** + * Resets the values of all parameter cache vectors + * @return An error code. + */ + int ResetCache(); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodBase.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodBase.h new file mode 100644 index 0000000000000000000000000000000000000000..867f9ee06e50d9c9d1f84934899ccc41924f5ff0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodBase.h @@ -0,0 +1,535 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodBase + * \brief A base class for likelihoods. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODBASE +#define LIKELIHOODBASE + +// --------------------------------------------------------- + +#include "Particles.h" + +#include "BAT/BCLog.h" +#include "BAT/BCModel.h" + +#include <TLorentzVector.h> + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class PhysicsConstants; + class Permutations; + class DetectorBase; + + class LikelihoodBase : public BCModel + { + + public: + /** + * Enumerate for b-tagging possibilities + */ + enum BtaggingMethod{ + kNotag, + kVeto, + kVetoNoFit, + kVetoNoFitLight, + kVetoNoFitBoth, + kWorkingPoint, + kVetoLight, + kVetoBoth + }; + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param particles A pointer to the measured particles. + */ + LikelihoodBase(Particles ** particles = 0); + + /** + * The default destructor. + */ + virtual ~LikelihoodBase(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the table of physics constants. + * @return A pointer to the physics constants. + */ + KLFitter::PhysicsConstants* PhysicsConstants() + { return fPhysicsConstants; }; + + /** + * Return the detector. + * @return A pointer to the detector. + */ + KLFitter::DetectorBase* Detector() + { return *fDetector; }; + + /** + * Return the set of measured particles. + * @return A pointer to the particles. + */ + KLFitter::Particles** PParticlesPermuted() + { return fParticlesPermuted; }; + + /** + * Return the set of model particles. + * @return A pointer to the particles. + */ + virtual KLFitter::Particles* ParticlesModel() + { return fParticlesModel; }; + virtual KLFitter::Particles** PParticlesModel() + { return &fParticlesModel; }; + + /** + * Return the number of model particles. + * @return The number of model particles. + */ + int NParticlesModel() + { return int(fParticlesModel -> NParticles()); }; + + /** + * Return the number of parameters. + * @return The number of parameters of the model. + */ + int NParameters() + { return this -> GetNParameters(); }; + + /** + * Return the lower boundary of a parameter + * @param index The index of the parameter. + * @return The lower boundary. + */ + double ParMin(int index); + + /** + * Return the upper boundary of a parameter + * @param index The index of the parameter. + * @return The upper boundary. + */ + double ParMax(int index); + + /** + * Set flag to use b-tagging or not. + * @param flag The flag. + * @return An error flag. + */ + BtaggingMethod GetBTagging() { return fBTagMethod;} + + bool FlagIntegrate() { return fFlagIntegrate; } + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the physics constants + * @param physicsconstants A pointer to physics constants. + * @return An error flag + */ + int SetPhysicsConstants(KLFitter::PhysicsConstants* physicsconstants); + + /** + * Set the detector + * @param detector A pointer to a pointer of the detector. + * @return An error flag + */ + int SetDetector(KLFitter::DetectorBase** detector); + + /** + * Set the measured particles. + * @param particles The measured particles. + * @return An error flag. + */ + int SetParticlesPermuted(KLFitter::Particles** particles); + + /** + * Set the truth particles. + * @param particles The truth particles. + * @return An error flag. + */ + int SetMyParticlesTruth(KLFitter::Particles** particles); + + + /** + * 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. + */ + virtual int SetET_miss_XY_SumET(double /*etx*/, double /*ety*/, double /*sumet*/) { return 0; } + + /** + * Set the permutation object. + * @param permutations The permutation object. + * @return An error flag. + */ + int SetPermutations(KLFitter::Permutations ** permutations); + + /** + * Set the range of a model parameter. + * @param index The index of the parameter. + * @param parmin The minimum value. + * @param parmax The maximum value. + */ + int SetParameterRange(int index, double parmin, double parmax); + + /** + * Set the initial values for the minimization, etc. + * @param parameters The initial values. + * @return An error flag. + */ + int SetInitialParameters(std::vector<double> const& parameters); + + /** + * Set the initial values for the minimization, etc. for each chain + * @param parameters The initial values. + * @return An error flag. + */ + int SetInitialParametersNChains(std::vector<double> const& parameters, unsigned int nchains); + + /** + * Set which b-tagging you wish to use. + * @param btagmethod The enum of btagging method. + * @param cutvalue The btagger cut value. + * @param btageff The btagging efficiency at this cut value. + * @param btagrej The btagging rejection at this cut value. + * @return An error flag. + */ + int SetBTagging(BtaggingMethod btagmethod) { fBTagMethod = btagmethod; return 1; }; + + /** + * THIS IS AN OUTDATED METHOD - JUST HERE FOR BACKWARD COMPATIBILITY. + * Set flag to use b-tagging or not. + * @param flag The flag. + * @return An error flag. + */ + int SetFlagBTagging(bool flag) { + std::cout << "LikelihoodBase::SetFlagBTagging(bool flag) is an outdated method - please use SetBTagging(BtaggingMethod btagmethod, double cutvalue, double btageff, double btagrej)." << std::endl; + fBTagMethod = flag ? kVeto : kNotag; + return 1; + } + + /** + * Set flag FlagIsNan. This Flag should be true if Minuit gave parameters with NaN values to LogLikelihood. + * @param flag The flag. + * @return An error flag. + */ + int SetFlagIsNan(bool flag) { fFlagIsNan=flag; return 1; } + + /** + * Get flag FlagIsNan. This Flag should be true if Minuit gave parameters with NaN values to LogLikelihood. + * @return The flag. + */ + bool GetFlagIsNan(void) { return fFlagIsNan; } + + /** + * Set flag to integrate or not. + * @param flag The flag. + * @return An error flag. + */ + int SetFlagIntegrate(bool flag) { fFlagIntegrate = flag; return 1; } + + + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Initialize the likelihood for the event + * @return An error code + */ + virtual int Initialize() + { return 1; }; + + /** + * Propagate the b-tagging information from the permuted (measured) particles to the model particles. + */ + void PropagateBTaggingInformation(); + + + + /* @} */ + /** \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*/) + { return 0; } + + /** + * 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. + */ + virtual std::vector<double> LogLikelihoodComponents(std::vector <double> /*parameters*/) + { return std::vector<double>(0); } + + /** + * Return BCH1D histograms calculated inside + * LikelihoodTopDilepton::MCMCIterationsInterface per event + */ + virtual BCH1D * GetHistMttbar() { BCH1D * h(0); return h; } + virtual BCH1D * GetHistCosTheta() { BCH1D * h(0); return h; } + + /** + * Return the log of the event probability fof the current + * combination + * @return The event probability + */ + virtual double LogEventProbability(); + + /** + * Return the contribution from b tagging to the log of the + * event probability for the current combination + * @return The event probability contribution + */ + virtual double LogEventProbabilityBTag(); + + + /** + * Remove invariant particle permutations. + * @return An error code. + */ + virtual int RemoveInvariantParticlePermutations() + { return 1; }; + + /** + * Remove forbidden particle permutations. + * @return An error code. + */ + virtual int RemoveForbiddenParticlePermutations() + { return 1; }; + + /** + * Get initial values for the parameters. + * @return vector of initial values. + */ + virtual std::vector<double> GetInitialParameters() + { std::vector<double> v; return v; }; + + /** + * Check if there are TF problems. + * @return Return false if TF problem. + */ + virtual bool NoTFProblem(std::vector<double> /*parameters*/) + { return true; }; + + /** + * Returns the best fit parameters, overloaded from BCModel + * @return The best fit parameters */ + std::vector <double> GetBestFitParameters(); + + /** + * Returns the best fit parameters from the BCModel class + * @return The best fit parameters */ + using BCModel::GetBestFitParameters; + + /** + * Returns the errors of the best fit parameters, overloaded from BCModel + * @return The errors of the best fit parameters */ + std::vector <double> GetBestFitParameterErrors(); + + /** + * Returns the errors of the best fit parameters from the BCModel class + * @return The errors of the best fit parameters */ + using BCModel::GetBestFitParameterErrors; +// + /** + * Returns the best fit parameters, overloaded from BCModel + * @return The best fit parameters */ + double GetBestFitParameter(unsigned int index); + + /** + * Returns the best fit parameter at position (i) from the BCModel class + * @return The best fit parameter at position (i) */ + using BCModel::GetBestFitParameter; + + /** + * Returns the errors of the best fit parameter i, overloaded from BCModel + * @return The errors of the best fit parameters */ + double GetBestFitParameterError(unsigned int index); + + /** + * Returns the errors of the best fit parameter i from the BCModel class + * @return The errors of the best fit parameters */ + using BCModel::GetBestFitParameterError; +// + /** + * Check if the permutation is LH invariant. + * @param iperm Current permutation + * @param nperms Total number of permutations + * @return Permutation of the invariant partner, -1 if there is no one. + */ + virtual int LHInvariantPermutationPartner(int /*iperm*/, int /*nperms*/, int &/*switchpar1*/, int &/*switchpar2*/) + { return -1; }; + + /** + * Write parameters from fCachedParametersVector.at(iperm) to fCachedParameters + * @param iperm Current permutation + * @return An error code. + */ + int GetParametersFromCache(int iperm); + + /** + * Write parameters to fCachedParametersVector.at(iperm) from GetBestFitParameter() + * @param iperm Current permutation + * @return An error code. + */ + int SetParametersToCache(int iperm, int nperms); + + /** + * @return The normalization factor of the probability, overloaded from BCModel */ + double GetIntegral(); + + /** + * @return The normalization factor of the probability from the BCModel class */ + using BCIntegrate::GetIntegral; + + /** + * Resets the values of all parameter cache vectors + * @return An error code. + */ + int ResetCache(); + + + + + /* @} */ + + protected: + + /** + * A pointer to the measured particles. + */ + KLFitter::Particles** fParticlesPermuted; + + /** + * A pointer to the permutation object. + */ + KLFitter::Permutations** fPermutations; + + /** + * A pointer to the model particles. + */ + KLFitter::Particles* fParticlesModel; + + /** + * A pointer to the measured particles. + */ + KLFitter::Particles** fMyParticlesTruth; + + /** + * A pointer to the table of physics constants + */ + KLFitter::PhysicsConstants* fPhysicsConstants; + + /** + * A pointer to the detector + */ + KLFitter::DetectorBase** fDetector; + + /** + * The event probabilities for the different permutations + */ + std::vector<double> fEventProbability; + + /** + * A flag to integrate over the likelihood or not + */ + bool fFlagIntegrate; + + /** + * A flag for knowing that Minuit gave parameters with NaN values to LogLikelihood + */ + bool fFlagIsNan; + + /** + * Name of btagging enum + */ + BtaggingMethod fBTagMethod; + + /** + * The cached parameters used for the current permutation + */ + std::vector<double> fCachedParameters; + + /** + * The cached parameter errors used for the current permutation + */ + std::vector<double> fCachedParameterErrors; + + /** + * A vector of cached parameters, one for each permutation. Has to be set via fitter. + */ + std::vector<std::vector<double> > fCachedParametersVector; + + /** + * A vector of cached parameter errors, one for each permutation. Has to be set via fitter. + */ + std::vector<std::vector<double> > fCachedParameterErrorsVector; + + /** + * The cached normalization, needed for the overloaded BCIntegrate::GetIntegral + */ + double fCachedNormalization; + + /** + * A vector of cached parameters, one for each permutation. Has to be set via fitter. + */ + std::vector<double> fCachedNormalizationVector; + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodSgTopWtLJ.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodSgTopWtLJ.h new file mode 100644 index 0000000000000000000000000000000000000000..76288bd03c3b9d8edd1a670654c50bd5ff748515 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodSgTopWtLJ.h @@ -0,0 +1,391 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodSgTopWtLJ + * \brief A class implementing a likelihood for the SgTop Wt -> lepton+jets channel. + * \author Kevin Kröninger, Thomas Loddenkötter + * \version 1.3 + * \date 03.12.2009 + * + * This class represents a likelihood for the single top Wt channel into lepton+jets. + */ + +// --------------------------------------------------------- + +#ifndef __LIKELIHOODSGTOPWTLJ__H +#define __LIKELIHOODSGTOPWTLJ__H + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "ResolutionBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodSgTopWtLJ : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodSgTopWtLJ(); + + /** + * The default destructor. + */ + virtual ~LikelihoodSgTopWtLJ(); + + /* @} */ + /** \name Member functions (Get) */ + + /** + * @brief Get a pointer to the lepton in a particles object, depending on value of fTypeLepton + * @return Pointer to the lepton's TLorentzVector + */ + TLorentzVector* GetLepton(KLFitter::Particles* particles) ; + + /** + * @brief Return the lepton type + * @return fTypeLepton + */ + int GetLeptonType() ; + + /** + * @brief Return the top decay hypothesis + * @return fHadronicTop + */ + bool GetHadronicTop() + { return fHadronicTop; }; + + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Enumerator for the lepton type. + */ + enum LeptonType { kElectron, kMuon }; + + /** + * Enumerator for the parameters. + */ + enum Parameters { parBE, parLQ1E, parLQ2E, parLepE, parNuPx, parNuPy, parNuPz }; + + /** + * 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); + + /** + * Associate the hadronic leg of the event to the top quark for likelihood calculation. + */ + void SetHadronicTop() + { fHadronicTop = kTRUE; }; + + /** + * Associate the leptonic leg of the event to the top quark for likelihood calculation. + */ + void SetLeptonicTop() + { fHadronicTop = kFALSE; }; + + void SetFlagUseJetMass(bool flag) + { fFlagUseJetMass = flag; }; + + /** + * 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); + + /** + * Get initial values for the parameters. + * @return vector of initial values. + */ + virtual std::vector<double> GetInitialParameters(); + + /** + * 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> 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(); + + /** + * Build the model particles from the best fit parameters. + * @return An error code. + */ + int BuildModelParticles(); + + /* @} */ + + protected: + + /** + * A flag for associating either the hadronic (true) + * or the leponic (false) leg of the event to the top quark + * for likelihood calculation. + */ + bool fHadronicTop; + + /** + * A flag for using the measured jet masses (true) instead of + * parton masses (false); + */ + bool fFlagUseJetMass; + + /** + * Calculates 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(); + + /** + * 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. + */ + int fTypeLepton; + + /** + * Global variable for TF problems. + */ + bool fTFgood; + + /** + * Save resolution functions since the eta of the partons is not fitted. + */ + ResolutionBase * fResEnergyB; + ResolutionBase * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + ResolutionBase * fResLepton; + ResolutionBase * fResMET; + + /** + * Save measured particle values for frequent calls + */ + double b_meas_e; + double b_meas_p; + double b_meas_m; + double b_meas_deteta; + double b_meas_eta; + double b_meas_phi; + double b_meas_px; + double b_meas_py; + double b_meas_pz; + + double lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_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 b_fit_e; + double b_fit_px; + double b_fit_py; + double b_fit_pz; + + double lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_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 // __LIKELIHOODSGTOPWTLJ__H + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTHLeptonJets.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTHLeptonJets.h new file mode 100644 index 0000000000000000000000000000000000000000..e652680ed3d8aa9459befb03b3bbdda89ca682eb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTHLeptonJets.h @@ -0,0 +1,489 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTHLeptonJets + * \brief A class implementing a likelihood for the ttH lepton+jets channel. + * \primary author: Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * \modified by: Leonid Serkin + * \date 01.12.2011 + * + * This class represents a likelihood for the ttH in lepton+jets channel. + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTHLEPTONJETS +#define LIKELIHOODTTHLEPTONJETS + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTHLeptonJets : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTTHLeptonJets(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTHLeptonJets(); + + /* @} */ + /** \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, parLQ1E, parLQ2E, parLepE, parNuPx, parNuPy, parNuPz, parTopM, parBHiggs1E, parBHiggs2E, parHiggsM}; + + /** + * 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; }; + + /** + * Set a flag. If flag is true the invariant Higgs mass is fixed + * @param flag The flag. + */ + void SetFlagHiggsMassFixed(bool flag) + { fFlagHiggsMassFixed = flag; }; + + + void SetFlagUseJetMass(bool flag) + { fFlagUseJetMass = 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_lq1 + * 3: TF_lq2 + * 4: TF_BHiggs1 + * 5: TF_BHiggs2 + * 6: TF_lep + * 7: TF_METx + * 8: TF_METy + * 9: BW_Whad + * 10: BW_Wlep + * 11: BW_Thad + * 12: BW_Tlep + * 13: BW_Higgs + */ + 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 a fixed Higgs mass (true) or not (false). + */ + bool fFlagHiggsMassFixed; + + /** + * A flag for using the measured jet masses (true) instead of + * parton masses (false); + */ + bool fFlagUseJetMass; + + /** + * 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 * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + ResolutionBase * fResEnergyBHiggs1; + ResolutionBase * fResEnergyBHiggs2; + 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 lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_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; + + //++++++++++++++++// + double BHiggs1_meas_e; + double BHiggs1_meas_p; + double BHiggs1_meas_m; + double BHiggs1_meas_deteta; + double BHiggs1_meas_eta; + double BHiggs1_meas_phi; + double BHiggs1_meas_px; + double BHiggs1_meas_py; + double BHiggs1_meas_pz; + + double BHiggs2_meas_e; + double BHiggs2_meas_p; + double BHiggs2_meas_m; + double BHiggs2_meas_deteta; + double BHiggs2_meas_eta; + double BHiggs2_meas_phi; + double BHiggs2_meas_px; + double BHiggs2_meas_py; + double BHiggs2_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 lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_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; + + //++++++++++++++++// + double BHiggs1_fit_e; + double BHiggs1_fit_px; + double BHiggs1_fit_py; + double BHiggs1_fit_pz; + + double BHiggs2_fit_e; + double BHiggs2_fit_px; + double BHiggs2_fit_py; + double BHiggs2_fit_pz; + + double Higgs_fit_m; + //++++++++++++++++// + + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTZTrilepton.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTZTrilepton.h new file mode 100644 index 0000000000000000000000000000000000000000..635de1e4d824508ee270e46b9ec5e576aebbf04b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTTZTrilepton.h @@ -0,0 +1,535 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! -*- mode: c++; -*- + + * \class KLFitter::LikelihoodTTZTrilepton + * \brief A class implementing a likelihood for the ttZ trilepton channel. + * \primary author: Knut Zoch + * \version 1.0 + * \date June 2016 + * + * This class represents a KLFitter likelihood for the ttZ trilepton + * channel. It is largely based on the LikelihoodTopLeptonJets class + * authored by Kevin Kroeninger. + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTZTRILEPTON +#define LIKELIHOODTTZTRILEPTON + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTZTrilepton : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTTZTrilepton(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTZTrilepton(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Get the cut-off value of the 1/E^2 distribution. + */ + inline double GetInvMassCutoff() + { return fInvMassCutoff; } + + /** + * Get the fraction of on-shell events. + */ + inline float GetOnShellFraction() + { return fOnShellFraction; } + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Enumerator for the lepton type. + */ + enum LeptonType { kElectron, kMuon }; + + /** + * Enumerator for the parameters. + */ + enum Parameters { parBhadE, parBlepE, parLQ1E, parLQ2E, parLepE, parNuPx, parNuPy, parNuPz, parTopM, parLepZ1E, parLepZ2E, parZM}; + + /** + * 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 the cut-off value of the 1/E^2 distribution. + */ + inline void SetInvMassCutoff(double cutoff) + { fInvMassCutoff = cutoff; } + + /** + * Set the fraction of on-shell events. + */ + inline void SetOnShellFraction(double fraction) + { fOnShellFraction = fraction; } + + /** + * 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_lq1 + * 3: TF_lq2 + * 4: TF_lepZ1 + * 5: TF_lepZ2 + * 6: TF_lep + * 7: TF_METx + * 8: TF_METy + * 9: BW_Whad + * 10: BW_Wlep + * 11: BW_Thad + * 12: BW_Tlep + * 13: BW_Z + */ + 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) */ + /* @{ */ + + /** + * Provide a local modification of BCMath::LogBreitWignerRel such + * that the relativistic Breit-Wigner distribution is normalised + * to 1. The function then returns the log of this distribution. + * + * @param Value to be evaluated. + * @param The mean of the distribution, i.e. Z pole mass. + * @param The FWHM of the distribution, i.e. the Z decay width. + * @return Log of the relativistic B-W. + */ + double LogBreitWignerRelNorm(const double& x, const double& mean, const double& gamma); + + /** + * Evaluate a combined Z/y invariant mass distribution. The B-W + * function and the 1/E^2 distribution are weighted according to + * fOnShellFraction. + * + * @param Value to be evaluated. + * @param The mean of the distribution, i.e. Z pole mass. + * @param The FWHM of the distribution, i.e. the Z decay width. + * @return Log of combined mass distribution. + */ + double LogZCombinedDistribution(const double& x, const double& mean, const double& gamma); + + /** + * 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; + + /** + * Cut-off value for the 1/E^2 distribution (in GeV). + */ + double fInvMassCutoff; + + /** + * Fraction of on-shell events, i.e. weighting factor between + * on-shell and off-shell distribution. A value of 1 corresponds + * to a pure on-shell distribution, 0 to a pure off-shell + * distribution. + */ + double fOnShellFraction; + + /** + * Save resolution functions since the eta of the partons is not fitted. + */ + ResolutionBase * fResEnergyBhad; + ResolutionBase * fResEnergyBlep; + ResolutionBase * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + ResolutionBase * fResLeptonZ1; + ResolutionBase * fResLeptonZ2; + 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 lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_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; + + double lepZ1_meas_e; + double lepZ1_meas_deteta; + double lepZ1_meas_sintheta; + double lepZ1_meas_pt; + double lepZ1_meas_px; + double lepZ1_meas_py; + double lepZ1_meas_pz; + + double lepZ2_meas_e; + double lepZ2_meas_deteta; + double lepZ2_meas_sintheta; + double lepZ2_meas_pt; + double lepZ2_meas_px; + double lepZ2_meas_py; + double lepZ2_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 lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_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; + + double lepZ1_fit_e; + double lepZ1_fit_px; + double lepZ1_fit_py; + double lepZ1_fit_pz; + + double lepZ2_fit_e; + double lepZ2_fit_px; + double lepZ2_fit_py; + double lepZ2_fit_pz; + + double Z_fit_m; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopAllHadronic.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopAllHadronic.h new file mode 100644 index 0000000000000000000000000000000000000000..feadec3b8fd5d7276e6f1683bf489cb5bdf57977 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopAllHadronic.h @@ -0,0 +1,386 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTopAllHadronic + * \brief A class implementing a likelihood for the ttbar allhadronic channel. + * \author Stefanie Adomeit + * + * This class represents a likelihood for the ttbar allhadronic channel. + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTOPALLHADRONIC +#define LIKELIHOODTOPALLHADRONIC + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTopAllHadronic : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopAllHadronic(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopAllHadronic(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + + /** + * Enumerator for the parameters. + */ + enum Parameters { parBhad1E, parBhad2E, parLQ1E, parLQ2E, parLQ3E, parLQ4E, parTopM }; + + + /** + * 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; }; + + /* @} */ + /** \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_bhad1 + * 1: TF_bhad2 + * 2: TF_lq1 + * 3: TF_lq2 + * 4: TF_lq3 + * 5: TF_lq4 + * 6: BW_Whad1 + * 7: BW_Whad2 + * 8: BW_Thad1 + * 9: BW_Thad2 + */ + 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(); + + + /** + * 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(); + + + /** + * Remove forbidden particle permutations - forcing b-jets on the position of a b parton. + * @return An error code. + */ +// int RemoveForbiddenBParticlePermutations(); + + /** + * 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; + + /** + * 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; + } + + + /** + * Global variable for TF problems. + */ + bool fTFgood; + + /** + * Save resolution functions since the eta of the partons is not fitted. + */ + ResolutionBase * fResEnergyBhad1; + ResolutionBase * fResEnergyBhad2; + ResolutionBase * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + ResolutionBase * fResEnergyLQ3; + ResolutionBase * fResEnergyLQ4; + + /** + * Save measured particle values for frequent calls + */ + double bhad1_meas_e; + double bhad1_meas_p; + double bhad1_meas_m; + double bhad1_meas_deteta; + double bhad1_meas_eta; + double bhad1_meas_phi; + double bhad1_meas_px; + double bhad1_meas_py; + double bhad1_meas_pz; + + double bhad2_meas_e; + double bhad2_meas_p; + double bhad2_meas_m; + double bhad2_meas_deteta; + double bhad2_meas_eta; + double bhad2_meas_phi; + double bhad2_meas_px; + double bhad2_meas_py; + double bhad2_meas_pz; + + double lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_meas_pz; + + double lq3_meas_e; + double lq3_meas_p; + double lq3_meas_m; + double lq3_meas_deteta; + double lq3_meas_eta; + double lq3_meas_phi; + double lq3_meas_px; + double lq3_meas_py; + double lq3_meas_pz; + + double lq4_meas_e; + double lq4_meas_p; + double lq4_meas_m; + double lq4_meas_deteta; + double lq4_meas_eta; + double lq4_meas_phi; + double lq4_meas_px; + double lq4_meas_py; + double lq4_meas_pz; + + /** + * Save fit particle values for frequent calls + */ + double bhad1_fit_e; + double bhad1_fit_px; + double bhad1_fit_py; + double bhad1_fit_pz; + + double bhad2_fit_e; + double bhad2_fit_px; + double bhad2_fit_py; + double bhad2_fit_pz; + + double lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_fit_pz; + + double lq3_fit_e; + double lq3_fit_px; + double lq3_fit_py; + double lq3_fit_pz; + + double lq4_fit_e; + double lq4_fit_px; + double lq4_fit_py; + double lq4_fit_pz; + + double whad1_fit_m; + double whad2_fit_m; + double thad1_fit_m; + double thad2_fit_m; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopDilepton.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopDilepton.h new file mode 100644 index 0000000000000000000000000000000000000000..ccce55845fd3bede4887b93795edddf0ce34b257 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopDilepton.h @@ -0,0 +1,534 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTopDilepton + * \brief A class implementing a likelihood for the ttbar dilepton channel. + * \author Tamara Vazquez Schröder + * + * This class represents a likelihood for the ttbar dilepton channel. + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTOPDILEPTON +#define LIKELIHOODTOPDILEPTON + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" +#include <assert.h> +#include <iostream> +#include <cmath> + +#include "BAT/BCModel.h" +#include "BAT/BCH1D.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + // Neutrino Solution Set + class NuSolutions { + public: + TLorentzVector nu1, nu2; + int NSolutions; + NuSolutions():NSolutions(0) {}; + ~NuSolutions() {}; + }; + + class LikelihoodTopDilepton : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopDilepton(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopDilepton(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Enumerator for the lepton type. + */ + enum LeptonType { kElectron, kMuon }; + + /** + * Enumerator for the parameters. + */ + //enum Parameters { parTopM=0, parB1E, parB2E, parLep1E, parLep2E, parNuEta, parAntiNuEta /*parNuPx, parNuPy, parNuPz,parTopM*/ }; + enum Parameters { parTopM=0, parB1E, parB2E, parLep1E, parLep2E, parAntiNuEta, parNuEta }; + + /** + * 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; }; + + /** + * Set the neutrino pseudorapidity sigma linear dependency on mtop + * according to SM expectations + */ + void SetEtaNuParams(std::vector<double> etanuparam) + { nueta_params = etanuparam; }; + + /** + * Set the type of lepton + * @param leptontype The type of lepton: kElectron or kMuon + */ + void SetLeptonType(LeptonType leptontype_1, LeptonType leptontype_2); + + /** + * Set the type of lepton + * @param leptontype The type of lepton: electron(1) or muon (2) + */ + void SetLeptonType(int leptontype_1, int leptontype_2); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + /** \name Member functions (BAT) */ + /* @{ */ + + /** + * Define the parameters of the fit. + */ + virtual void DefineParameters(); + + /** + * Define sharp gauss prior for mtop par if mtop fixed + */ + virtual void DefinePrior(); + + /** + * Define BCH1D and TH1D histograms to be filled + * in MCMCIterationInterface + */ + void DefineHistograms(); + + /** + * 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: NuWT + * 1: TF_b1 + * 2: TF_b2 + * 3: TF_lep1 + * 4: TF_lep2 + * 5: AntiNu_Eta + * 6: Nu_Eta + * 7: Minv(lep,jet) + */ + 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(); + + /** + * 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; + }; + + /** + * Return Gaussian term for neutrino + * pseudorapidity. + * @return A double. + */ + double GaussNuEta(std::vector<double> parameters); + /** + * Return Gaussian term for antineutrino + * pseudorapidity. + * @return A double. + */ + double GaussAntiNuEta(std::vector<double> parameters); + /** + * Return NuWT weight + * @return A double. + */ + double CalculateWeight(const std::vector<double> & parameters); + /** + * Return NuWT weight for a set of jet1, jet2, lep1, lep2 + * @return A double. + */ + double CalculateWeightPerm(TLorentzVector * l1, TLorentzVector * l2, TLorentzVector * j1, TLorentzVector * j2, const std::vector<double> & parameters); + /** + * Return set of neutrino/antineutrino kinematic solutions + * (up to 2) + * @return A KLFitter::NuSolutions object. + */ + KLFitter::NuSolutions SolveForNuMom(TLorentzVector * l, TLorentzVector * b, double mtop, double nueta); + /** + * Return neutrino weight for a given nu solution and antinu solution + * @return A double. + */ + double neutrino_weight(TLorentzVector nu,TLorentzVector nubar); + /** + * Return sum of invariant masses of each (lep,jet) pair, + * including a tuning factor alpha. + * @return A double. + */ + double CalculateMLepJet(const std::vector<double> & parameters); + + /** + * Set a flag. If flag is true the sumloglikelihood + * option is used, instead of the default best-permutation + * @param flag The flag. + */ + void SetDoSumLogLik(bool flag) + { doSumloglik = flag; }; + + /* @} */ + + 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(); + + /** + * Calculate other variables out of the KLFitter parameters for each MCMCiteration + * + */ + void MCMCIterationInterface(); + + /** + * Get BAT BCH1D histograms of Mttbar + * @return BCH1D histograms + */ + BCH1D * GetHistMttbar() { return fHistMttbar; } + + /** + * Get BAT BCH1D histograms of CosTheta + * @return BCH1D histograms + */ + BCH1D * GetHistCosTheta() { return fHistCosTheta; } + + /** + * calculate cos(theta*) for both top and antitop + */ + std::pair<float, float> CalculateCosTheta(std::vector <TLorentzVector> *particles); + + /* @} */ + + 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; + + /** + * 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; + + /** + * Lepton 1 Type (electron or muon) + */ + LeptonType fTypeLepton_1; + /** + * Lepton 2 Type (electron or muon) + */ + LeptonType fTypeLepton_2; + + /** + * vector including nu pseudorapidity sigma + * dependency on mtop ( if sigma=a + b*mtop => + * vector[0]=a, vector[1]=b) + */ + std::vector<double> nueta_params; + + /** + * A flag for using sumloglikelihood option + */ + bool doSumloglik; + + /** + * Global variable for TF problems. + */ + bool fTFgood; + + public: + + /** + * TH1D histograms to be filled + * with functions of interest, e.g.: mttbar, + * costheta*,etc. for each MCNCiteration + */ + TH1D * hist_mttbar; + TH1D * hist_costheta; + + protected: + + /** + * BAT BCH1D Histogram for mttbar + */ + BCH1D * fHistMttbar; + + /** + * BAT BCH1D Histogram cos(theta*) + */ + BCH1D * fHistCosTheta; + + /** + * BAT BCH1D Histogram for dR(truth top, fit top) + */ + BCH1D * fHistdRTop; + /** + * BAT BCH1D Histogram for dR(truth antitop, fit antitop) + */ + BCH1D * fHistdRAntiTop; + /** + * BAT BCH1D Histogram for dR(truth nu, fit nu) + */ + BCH1D * fHistdRNu; + /** + * BAT BCH1D Histogram for dR(truth antinu, fit antinu) + */ + BCH1D * fHistdRAntiNu; + + + /** + * Save resolution functions since the eta of the partons is not fitted. + */ + ResolutionBase * fResEnergyB1; + ResolutionBase * fResEnergyB2; + ResolutionBase * fResLepton1; + ResolutionBase * fResLepton2; + ResolutionBase * fResMET; + + /** + * Save measured particle values for frequent calls + */ + + double b1_meas_e; + double b1_meas_p; + double b1_meas_m; + double b1_meas_deteta; + double b1_meas_eta; + double b1_meas_phi; + double b1_meas_px; + double b1_meas_py; + double b1_meas_pz; + + double b2_meas_e; + double b2_meas_p; + double b2_meas_m; + double b2_meas_deteta; + double b2_meas_eta; + double b2_meas_phi; + double b2_meas_px; + double b2_meas_py; + double b2_meas_pz; + + double lep1_meas_e; + double lep1_meas_deteta; + float lep1_meas_charge; + double lep1_meas_sintheta; + double lep1_meas_pt; + double lep1_meas_px; + double lep1_meas_py; + double lep1_meas_pz; + + double lep2_meas_e; + double lep2_meas_deteta; + float lep2_meas_charge; + double lep2_meas_sintheta; + double lep2_meas_pt; + double lep2_meas_px; + double lep2_meas_py; + double lep2_meas_pz; + + /** + * Save fit particle values for frequent calls + */ + + double lep1_fit_e; + double lep1_fit_px; + double lep1_fit_py; + double lep1_fit_pz; + + double lep2_fit_e; + double lep2_fit_px; + double lep2_fit_py; + double lep2_fit_pz; + + double b1_fit_e; + double b1_fit_px; + double b1_fit_py; + double b1_fit_pz; + + double b2_fit_e; + double b2_fit_px; + double b2_fit_py; + double b2_fit_pz; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets.h new file mode 100644 index 0000000000000000000000000000000000000000..1c4e44ee0316c391ef796e9958f6208b6d146b16 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets.h @@ -0,0 +1,439 @@ +/* + 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 LIKELIHOODTOPLEPTONJETS +#define LIKELIHOODTOPLEPTONJETS + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTopLeptonJets : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopLeptonJets(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopLeptonJets(); + + /* @} */ + /** \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, parLQ1E, parLQ2E, 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_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 + */ + 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 * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + 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 lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_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 lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_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 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJetsUDSep.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJetsUDSep.h new file mode 100644 index 0000000000000000000000000000000000000000..221575de2645b068b7794a7dabc8582323b3e4aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJetsUDSep.h @@ -0,0 +1,312 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTopLeptonJetsUDSep + * \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 LIKELIHOODTOPLEPTONJETSUDSEP +#define LIKELIHOODTOPLEPTONJETSUDSEP + +// --------------------------------------------------------- + +#include "LikelihoodTopLeptonJets.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" +#include "TH1F.h" +#include "TH2F.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTopLeptonJetsUDSep : public KLFitter::LikelihoodTopLeptonJets + { + + public: + + /** + * Enumerate for lJet reweighting methods + */ + enum LJetSeparationMethod{ + kNone, + kPermReweight, + kPermReweight2D + }; + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopLeptonJetsUDSep(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopLeptonJetsUDSep(); + + /* @} */ + + /** + * Define the parameters of the fit. + */ + virtual void DefineParameters(); + + /** + * Return the log of the event probability fof the current + * combination + * @return The event probability + */ + double LogEventProbability(); + + /** + * Return the contribution from b tagging to the log of the + * event probability for the current combination + * @return The event probability contribution + */ + double LogEventProbabilityBTag(); + + /** + * Return the contribution from pT and b tag weight probability (by LJetSeparationMethod) + * to the log of the event probability for the current combination + * @return The event probability contribution + */ + double LogEventProbabilityLJetReweight(); + + /** + * Returns the probability of a jet to have the pT of an up type jet. + * @return The probability. + */ + double UpJetPt(double pt); + + /** + * Returns the probability of a jet to have the pT of an down type jet. + * @return The probability. + */ + double DownJetPt(double pt); + + /** + * Returns the probability of a jet to have the pT of an b type jet. + * @return The probability. + */ + double BJetPt(double pt); + + /** + * Returns the probability of a jet to have the tag weight of an up type jet. + * @return The probability. + */ + double UpJetTagWeight(double tagweight); + + /** + * Returns the probability of a jet to have the tag weight of an down type jet. + * @return The probability. + */ + double DownJetTagWeight(double tagweight); + + /** + * Returns the probability of a jet to have the tag weight of an b type jet. + * @return The probability. + */ + double BJetTagWeight(double tagweight); +// + /** + * Returns the probability of a jet to have the tag weight and pT of an up type jet. + * @return The probability. + */ + double UpJetProb(double tagweight, double pt); + + /** + * Returns the probability of a jet to have the tag weight and pT of an down type jet. + * @return The probability. + */ + double DownJetProb(double tagweight, double pt); + + /** + * Returns the probability of a jet to have the tag weight and pT of an b type jet. + * @return The probability. + */ + double BJetProb(double tagweight, double pt); +// + + /** + * Set histogram for pT distribution of up jets (reco level). + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetUpJetPtHisto(TH1F* hist) { fUpJetPtHisto = hist; return 1; } + + /** + * Set histogram for pT distribution of down jets (reco level). + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetDownJetPtHisto(TH1F* hist) { fDownJetPtHisto = hist; return 1; } + + /** + * Set histogram for pT distribution of b jets (reco level). + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetBJetPtHisto(TH1F* hist) { fBJetPtHisto = hist; return 1; } + + /** + * Set histogram for tag weight distribution of up type jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetUpJetTagWeightHisto(TH1F* hist) { fUpJetTagWeightHisto = hist; return 1; } + + /** + * Set histogram for tag weight distribution of down type jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetDownJetTagWeightHisto(TH1F* hist) { fDownJetTagWeightHisto = hist; return 1; } + + /** + * Set histogram for tag weight distribution of b jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetBJetTagWeightHisto(TH1F* hist) { fBJetTagWeightHisto = hist; return 1; } + + /** + * Set a flag. If flag is true the permutations are reweighted with the pT and tag weight probabilities. + * @param flag The flag. + */ + void SetLJetSeparationMethod(KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod flag) + { fLJetSeparationMethod = flag; }; + + /** + * Check if the permutation is LH invariant. + * @return Permutation of the invariant partner, -1 if there is no one. + */ + int LHInvariantPermutationPartner(int iperm, int nperms, int &switchpar1, int &switchpar2); + + /** + * Set histogram for tag weight distribution of up type jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetUpJet2DWeightHisto(TH2F* hist) { fUpJet2DWeightHisto = hist; return 1; } + + /** + * Set histogram for tag weight distribution of down type jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetDownJet2DWeightHisto(TH2F* hist) { fDownJet2DWeightHisto = hist; return 1; } + + /** + * Set histogram for tag weight distribution of b jets. + * @param hist Pointer to histogram. + * @return An error flag. + */ + int SetBJet2DWeightHisto(TH2F* hist) { fBJet2DWeightHisto = hist; return 1; } + + + protected: + + /** \name Member functions (misc) */ + /* @{ */ + + + /** + * 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() + { return 1; }; + + + /** + * A flag for using an additional reweighting of the permutations with the pT and tag weight probability (default: false); + */ + KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod fLJetSeparationMethod; + + /** + * A pointer to the histogram of the up type jet pT distribution. + */ + TH1F* fUpJetPtHisto; + + /** + * A pointer to the histogram of the down type jet pT distribution. + */ + TH1F* fDownJetPtHisto; + + /** + * A pointer to the histogram of the down b jet pT distribution. + */ + TH1F* fBJetPtHisto; + + /** + * A pointer to the histogram of the up quark tag weight distribution. + */ + TH1F* fUpJetTagWeightHisto; + + /** + * A pointer to the histogram of the down quark tag weight distribution. + */ + TH1F* fDownJetTagWeightHisto; + + /** + * A pointer to the histogram of the up b tag weight distribution. + */ + TH1F* fBJetTagWeightHisto; + + /** + * A pointer to the 2d histogram "tag weight vs. pT for upQuarks" + */ + TH2F* fUpJet2DWeightHisto; + + /** + * A pointer to the 2d histogram "tag weight vs. pT for downQuarks" + */ + TH2F* fDownJet2DWeightHisto; + + /** + * A pointer to the 2d histogram "tag weight vs. pT for bQuarks" + */ + TH2F* fBJet2DWeightHisto; + + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_Angular.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_Angular.h new file mode 100644 index 0000000000000000000000000000000000000000..85905e5818414ee13f90a696af53dc074e0eda0f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_Angular.h @@ -0,0 +1,441 @@ +/* + 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 LIKELIHOODTOPLEPTONJETS_ANGULAR +#define LIKELIHOODTOPLEPTONJETS_ANGULAR + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" +#include "ResolutionBase.h" + +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTopLeptonJets_Angular : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopLeptonJets_Angular(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopLeptonJets_Angular(); + + /* @} */ + /** \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, parLQ1E, parLQ2E, 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; }; + + /** + * 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_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 + */ + 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; + + /** + * 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 * fResEnergyLQ1; + ResolutionBase * fResEnergyLQ2; + 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 lq1_meas_e; + double lq1_meas_p; + double lq1_meas_m; + double lq1_meas_deteta; + double lq1_meas_eta; + double lq1_meas_phi; + double lq1_meas_px; + double lq1_meas_py; + double lq1_meas_pz; + + double lq2_meas_e; + double lq2_meas_p; + double lq2_meas_m; + double lq2_meas_deteta; + double lq2_meas_eta; + double lq2_meas_phi; + double lq2_meas_px; + double lq2_meas_py; + double lq2_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 lq1_fit_e; + double lq1_fit_px; + double lq1_fit_py; + double lq1_fit_pz; + + double lq2_fit_e; + double lq2_fit_px; + double lq2_fit_py; + double lq2_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 wlep_fit_e; + double wlep_fit_px; + double wlep_fit_py; + double wlep_fit_pz; + + double whad_fit_e; + double whad_fit_px; + double whad_fit_py; + double whad_fit_pz; + + double whad_fit_m; + double wlep_fit_m; + double thad_fit_m; + double tlep_fit_m; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_JetAngles.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_JetAngles.h new file mode 100644 index 0000000000000000000000000000000000000000..47af5e756c0ab6089f86c2feb9a595a6585e6209 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/LikelihoodTopLeptonJets_JetAngles.h @@ -0,0 +1,256 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTopLeptonJets_JetAngles + * \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 LIKELIHOODTOPLEPTONJETS_JETANGLES +#define LIKELIHOODTOPLEPTONJETS_JETANGLES + +// --------------------------------------------------------- + +#include "LikelihoodBase.h" +#include "TLorentzVector.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTopLeptonJets_JetAngles : public KLFitter::LikelihoodBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + LikelihoodTopLeptonJets_JetAngles(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTopLeptonJets_JetAngles(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Enumerator for the lepton type. + */ + enum LeptonType { kElectron, kMuon }; + + /** + * Set the values for the missing ET x and y components. + * @param etx missing ET x component. + * @param ety missing ET y component. + * @return An error flag. + */ + int SetET_miss_XY(double etx, double ety); + + /** + * 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; }; + + /** + * 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); + + /** + * 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); + + /* @} */ + + 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(); + + /* @} */ + + 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; + + /** + * 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); + + /** + * 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; + + /** + * An index deciding if the event is electron (1) or muon (2) plus + * jets. + */ + LeptonType fTypeLepton; + + /** + * The value of pi stored here for CPU time reasons. + */ + double fPi; + + /** + * The value of 2*pi stored here for CPU time reasons. + */ + double fTwoPi; + + /** + * Global variable for TF problems. + */ + bool fTFgood; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Particles.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Particles.h new file mode 100644 index 0000000000000000000000000000000000000000..45d138a3b6cb7e0fc054784f8d2a4b6867490cbf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Particles.h @@ -0,0 +1,649 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::Particles + * \brief A class describing particles. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class contains sets of TLorentzVectors for quarks, leptons, + * etc. + */ + +// --------------------------------------------------------- + +#ifndef PARTICLES +#define PARTICLES + +// --------------------------------------------------------- + +#include <TLorentzVector.h> +#include <vector> +#include <string> + +// --------------------------------------------------------- + +class TLorentzVector; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Particles + { + + public: + + /** \name Enumerators */ + /* @{ */ + + /** + * An enumerator for the particle types + */ + enum ParticleType { kParton, kElectron, kMuon, kTau, kNeutrino, kBoson, kPhoton }; + + /** + * An enumerator for the true jet flavor. + */ + enum TrueFlavorType { kLight, kB, kLightUp, kLightDown, kNone }; + + /* @} */ + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + Particles(); + + /** + * The default destructor. + */ + virtual ~Particles(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of partons. + * @return The number of partons. + */ + int NPartons() + { return int(fPartons -> size()); }; + + /** + * Return the number of electrons. + * @return The number of electrons. + */ + int NElectrons() + { return int (fElectrons -> size()); }; + + /** + * Return the number of muons. + * @return The number of muons. + */ + int NMuons() + { return int (fMuons -> size()); }; + + /** + * Return the number of taus. + * @return The number of taus. + */ + int NTaus() + { return int (fTaus -> size()); }; + + /** + * Return the number of neutrinos. + * @return The number of neutrinos. + */ + int NNeutrinos() + { return int (fNeutrinos -> size()); }; + + /** + * Return the number of bosons. + * @return The number of bosons. + */ + int NBosons() + { return int (fBosons -> size()); }; + + /** + * Return the number of photons. + * @return The number of photons. + */ + int NPhotons() + { return int (fPhotons -> size()); }; + + /** + * Return the particle with a certain name + * @param name The name of the particle. + * @return A pointer to the TLorentzVector of the particle. + */ + TLorentzVector * Particle(std::string name); + + /** + * Return a particle with some index and type. + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return A pointer to the TLorentzVector of the particle. + */ + TLorentzVector * Particle(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Find a particle by name. + * @param name The name of the particle. + * @param particle A reference to the pointer to the 4-vector. + * @param index The reference of the index. + * @param ptype The reference of the particle type. + * @return A flag (1: found, 0: not found). + */ + int FindParticle(std::string name, TLorentzVector * &particle, int &index, KLFitter::Particles::ParticleType &ptype); + + /** + * Return the parton at some index. + * @param index The parton index + * @return A pointer to the TLorentzVector of the parton. + */ + TLorentzVector * Parton(int index); + + /** + * Return the electron at some index. + * @param index The electron index + * @return A pointer to the TLorentzVector of the electron. + */ + TLorentzVector * Electron(int index); + + /** + * Return the muon at some index. + * @param index The muon index + * @return A pointer to the TLorentzVector of the muon. + */ + TLorentzVector * Muon(int index); + + /** + * Return the tau at some index. + * @param index The tau index + * @return A pointer to the TLorentzVector of the tau. + */ + TLorentzVector * Tau(int index); + + /** + * Return the boson at some index. + * @param index The boson index + * @return A pointer to the TLorentzVector of the boson. + */ + TLorentzVector * Boson(int index); + + /** + * Return the neutrino at some index. + * @param index The neutrino index + * @return A pointer to the TLorentzVector of the neutrino. + */ + TLorentzVector * Neutrino(int index); + + /** + * Return the photon at some index. + * @param index The photon index + * @return A pointer to the TLorentzVector of the photon. + */ + TLorentzVector * Photon(int index); + + /** + * Return the number of particles. + * @return The number of particles. + */ + int NParticles() + { return int(fPartons -> size() + fElectrons -> size() + fMuons -> size() + fTaus -> size() + fNeutrinos -> size() + fBosons -> size() + fPhotons -> size()); }; + + /** + * Return the number of particles of a certain type. + * @param ptype The particle type. + * @return The number of particles. + */ + int NParticles(KLFitter::Particles::ParticleType ptype); + + /** + * Return the name of a particle. + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return The name of the particle. + */ + std::string NameParticle(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Return the name of a electron. + * @param index The index of the electron. + * @return The name of the electron. + */ + std::string NameElectron(int index); + + /** + * Return the name of a muon. + * @param index The index of the muon. + * @return The name of the muon. + */ + std::string NameMuon(int index); + + /** + * Return the name of a tau. + * @param index The index of the tau. + * @return The name of the tau. + */ + std::string NameTau(int index); + + /** + * Return the name of a boson. + * @param index The index of the boson. + * @return The name of the boson. + */ + std::string NameBoson(int index); + + /** + * Return the name of a neutrino. + * @param index The index of the neutrino. + * @return The name of the neutrino. + */ + std::string NameNeutrino(int index); + + /** + * Return the name of a photon. + * @param index The index of the photon. + * @return The name of the photon. + */ + std::string NamePhoton(int index); + + /** + * Return the corresponding measured particle. + * @param index The index of the model particle. + * @param index The index of the measured particle. + */ + int JetIndex(int index); + + int ElectronIndex(int index); + + int MuonIndex(int index); + + int PhotonIndex(int index); + + /** + * Return the true flavor of a parton. + * @param index The parton index + * @return The parton true flavor. + */ + TrueFlavorType TrueFlavor(int index) { return (*fTrueFlavor)[index]; } + + /** + * Return has the jet been b-tagged? + * @param index The parton index + * @return The parton b-tagging boolean. + */ + bool IsBTagged(int index) { return (*fIsBTagged)[index]; } + + /** + * Return the jet b-tagging efficiency. + * @param index The parton index + * @return The jet b-tagging efficiency. + */ + double BTaggingEfficiency(int index) { return (*fBTaggingEfficiency)[index]; } + + /** + * Return the jet b-tagging rejection. + * @param index The parton index + * @return The jet b-tagging rejection. + */ + double BTaggingRejection(int index) { return (*fBTaggingRejection)[index]; } + + /** + * Return the jet b-tagging weight. + * @param index The parton index + * @return The jet b-tagging weight. + */ + double BTagWeight(int index) { return (*fBTagWeight)[index]; } + + /** + * Return the bool of a set tagging weight. + * @param index The parton index + * @return The bool of a set tagging weight + */ + bool BTagWeightSet(int index) { return (*fBTagWeightSet)[index]; } + + /** + * Return the detector eta of a particle with some index and type. + * @param index The index of the particle + * @param ptype The particle type. + * @return The detector eta of the particle + */ + double DetEta(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Return the charge of the lepton with some index and type. + * @param index The index of the particle + * @param ptype The particle type. + * @return The charge of the lepton. + */ + float LeptonCharge(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Return the number of b-tags. + */ + int NBTags(); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set has the jet been b-tagged? + * @param index The parton index + * @param isBtagged The parton b-tagging boolean. + * @return An error flag. + */ + int SetIsBTagged(int index, bool isBTagged); + + /** + * Set the jet b-tagging efficiency. + * @param index The parton index + * @param btagEff The b-tagging efficiency. + * @return An error flag. + */ + int SetBTaggingEfficiency(int index, double btagEff); + + /** + * Set the jet b-tagging rejection. + * @param index The parton index + * @param btagRej The b-tagging probability. + * @return The jet b-tagging rejection. + */ + int SetBTaggingRejection(int index, double btagRej); + + /** + * Set the jet b-tagging weight. + * @param index The parton index + * @param btagRej The b-tagging weight. + * @return An error flag. + */ + int SetBTagWeight(int index, double btagweight); + + /** + * Set bool for set jet b-tagging weight. + * @param index The parton index + * @param btagRej The b-tagging probability. + * @return An error flag. + */ + int SetBTagWeightSet(int index, bool btagweightset); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Add a particle to a list of particles. + * @param particle A pointer to the particle. + * @param DetEta The Detector Eta of the particle. + * @param LepEta The Charge of the particle. + * @param ptype The type of particle. + * @param name The name of the particle. + * @param measuredindex The index of the associated measured particle. + * @param isBtagged Has the particle been b-tagged? + * @param bTagEff B-tagging efficiency of the particle. + * @param bTagRej B-tagging rejection of the particle. + * @param trueflav The true flavor (only for model particles). + * @param btagweight The b tagger weight). + * @return An error code. + */ + int AddParticle(TLorentzVector * particle, double DetEta, float LepCharge, KLFitter::Particles::ParticleType ptype, std::string name = "", int measuredindex = -1); + + /** + * Add a particle to a list of particles. + * @param particle A pointer to the particle. + * @param DetEta The Detector Eta of the particle. + * @param ptype The type of particle. + * @param name The name of the particle. + * @param measuredindex The index of the associated measured particle. + * @param isBtagged Has the particle been b-tagged? + * @param bTagEff B-tagging efficiency of the particle. + * @param bTagRej B-tagging rejection of the particle. + * @param trueflav The true flavor (only for model particles). + * @param btagweight The b tagger weight). + * @return An error code. + */ + int AddParticle(TLorentzVector * particle, double DetEta, KLFitter::Particles::ParticleType ptype, std::string name = "", int measuredindex = -1, bool isBtagged = false, double bTagEff = -1., double bTagRej = -1., TrueFlavorType trueflav = kNone, double btagweight = 999); + + + /** + * Add a particle to a list of particles. + * @param particle A pointer to the particle. + * @param ptype The type of particle. + * @param name The name of the particle. + * @param isBtagged Has the particle been b-tagged? + * @param bTagEff B-tagging efficiency of the particle. + * @param bTagRej B-tagging rejection of the particle. + * @param measuredindex The index of the associated measured particle. + * @param trueflav The true flavor (only for model particles). + * @param btagweight The b tagger weight). + * @return An error code. + */ + int AddParticle(TLorentzVector * particle, KLFitter::Particles::ParticleType ptype, std::string name = "", int measuredindex = -1, bool isBtagged = false, double bTagEff = -1., double bTagRej = -1., TrueFlavorType trueflav = kNone, double btagweight = 999); + + /** + * Add a particle to a list of particles (especially for model particles). + * @param particle A pointer to the particle. + * @param ptype The type of particle. + * @param name The name of the particle. + * @param measuredindex The index of the associated measured particle. + * @param trueflav The true flavor (only for model particles). + * @param btagweight The b tagger weight). + * @return An error code. + */ + int AddParticle(TLorentzVector * particle, KLFitter::Particles::ParticleType ptype, std::string name, int measuredindex, TrueFlavorType trueflav, double btagweight = 999); + + /** + * Removes a particle from a list of particles. + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return An error code. + */ + int RemoveParticle(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Removes a particle from a list of particles. + * @param name The name of the particle. + * @return An error code. + */ + int RemoveParticle(std::string name); + + /** + * Return the particle container of a type of particles + * @param ptype The type of the particle. + * @return The particle container. + */ + std::vector <TLorentzVector *> * ParticleContainer(KLFitter::Particles::ParticleType ptype); + + /** + * Return the particle name container of a type of particles + * @param ptype The type of the particle. + * @return The particle name container. + */ + std::vector <std::string> * ParticleNameContainer(KLFitter::Particles::ParticleType ptype); + + /** + * Checks if the index is within range. + * @param container The particle container. + * @param index The index of particle. + * @return An error flag. + */ + int CheckIndex(std::vector <TLorentzVector *> * container, int index); + + /* @} */ + + private: + + protected: + + private: + + /** + * A set of quarks and gluons. + */ + std::vector <TLorentzVector *> * fPartons; + + /** + * A set of electrons. + */ + std::vector <TLorentzVector *> * fElectrons; + + /** + * A set of muons. + */ + std::vector <TLorentzVector *> * fMuons; + + /** + * A set of taus. + */ + std::vector <TLorentzVector *> * fTaus; + + /** + * A set of neutrinos. + */ + std::vector <TLorentzVector *> * fNeutrinos; + + /** + * A set of bosons. + */ + std::vector <TLorentzVector *> * fBosons; + + /** + * A set of photons. + */ + std::vector <TLorentzVector *> * fPhotons; + + /** + * The name of the partons. + */ + std::vector <std::string> * fNamePartons; + + /** + * The name of the electrons. + */ + std::vector <std::string> * fNameElectrons; + + /** + * The name of the muons. + */ + std::vector <std::string> * fNameMuons; + + /** + * The name of the taus. + */ + std::vector <std::string> * fNameTaus; + + /** + * The name of the neutrinos. + */ + std::vector <std::string> * fNameNeutrinos; + + /** + * The name of the bosons. + */ + std::vector <std::string> * fNameBosons; + + /** + * The name of the photons. + */ + std::vector <std::string> * fNamePhotons; + + /** + * The index of the corresponding measured parton. + */ + std::vector <int> * fJetIndex; + + /** + * The index of the corresponding measured electron. + */ + std::vector <int> * fElectronIndex; + + /** + * The index of the corresponding measured muon. + */ + std::vector <int> * fMuonIndex; + + /** + * The index of the corresponding measured photon. + */ + std::vector <int> * fPhotonIndex; + + /** + * Vector containing the true flavor. + */ + std::vector<TrueFlavorType> * fTrueFlavor; + + /** + * Vector containing a boolean for the b-tagging. + */ + std::vector<bool> * fIsBTagged; + + /** + * Vector containing the b-tagging efficiencies for the jets. + */ + std::vector<double> * fBTaggingEfficiency; + + /** + * Vector containing the b-tagging rejection for the jets. + */ + std::vector<double> * fBTaggingRejection; + + /** + * Vector containing the b-tagging weights for the jets. + */ + std::vector<double> * fBTagWeight; + + /** + * Vector containing the bool if b-tagging weights for the jets were set. + */ + std::vector<bool> * fBTagWeightSet; + + /** + * Vector containing the detector eta of electrons. + */ + std::vector <double> * fElectronDetEta; + /** + * Vector containing the detector eta of muons. + */ + std::vector <double> * fMuonDetEta; + /** + * Vector containing the detector eta of jets. + */ + std::vector <double> * fJetDetEta; + /** + * Vector containing the detector eta of photons. + */ + std::vector <double> * fPhotonDetEta; + /** + * Vector containing the charge of electrons. + */ + std::vector <float> * fElectronCharge; + /** + * Vector containing the charge of muons. + */ + std::vector <float> * fMuonCharge; + + }; + +} // namespace KLFitter + +inline +KLFitter::Particles::ParticleType &operator++(KLFitter::Particles::ParticleType &ptype) +{ + return ptype = KLFitter::Particles::ParticleType(ptype + 1); +} + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Permutations.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Permutations.h new file mode 100644 index 0000000000000000000000000000000000000000..9309138efb770e6a6b78ead731010867e1fedd80 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/Permutations.h @@ -0,0 +1,239 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::Permutations + * \brief A class permuting jets, electrons, muons and photons. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * The class gets a pointer to the orignal set of particles and a + * pointer to the currently used permutations. It can calculate all + * permutations and created a table. The pointer of the current + * permutation is set to the entry in the table. + */ + +// --------------------------------------------------------- + +#ifndef PERMUTATIONS +#define PERMUTATIONS + +// --------------------------------------------------------- + +#include "Particles.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Permutations + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param p A pointer to the pointer to the original set of particles. + * @param pp A pointer to the pointer to the permutated set of particles. + */ + Permutations(KLFitter::Particles** p, KLFitter::Particles** pp); + + /** + * The default destructor. + */ + virtual ~Permutations(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the original particles. + * @return A pointer to the particles. + */ + KLFitter::Particles* Particles() + { return *fParticles; }; + + /** + * Return the current permutation of jets and leptons. + * @return A pointer to the permuted particles. + */ + KLFitter::Particles* ParticlesPermuted() + { return *fParticlesPermuted; }; + + /** + * Return the permutation table. + * @return A pointer to the permutation table. + */ + std::vector<std::vector<int>* >* PermutationTable(); + + /** + * Return the number of permutations. + */ + int NPermutations() + { return int(fParticlesTable -> size()); }; + + /** + * Return the current permutation index. + * @return The current permutation index. + */ + int PermutationIndex() + { return fPermutationIndex; }; + + std::vector<std::vector<int>*>* TablePartons() + { return fTablePartons; }; + + std::vector<std::vector<int>*>* TableElectrons() + { return fTableElectrons; }; + + std::vector<std::vector<int>*>* TableMuons() + { return fTableMuons; }; + + std::vector<std::vector<int>*>* TablePhotons() + { return fTablePhotons; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the original particles. + * @param particles A set of particles. + * @return An error code. + */ + int SetParticles(KLFitter::Particles* particles); + + /** + * Set the permutation. + * @param index The permutation index. + * @return An error code. + */ + int SetPermutation(int index); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Create all possible permutations of jets and leptons. + * However, make permutations with exactly nPartonsInPermutations. + */ + int CreatePermutations(int nPartonsInPermutations = -1); + + /** + * Remove permutations in which all indices in the vector indexVector are exchanged + * for the given particle type. + * This is useful to reduce the number of permutations if + * interchanging for example jets doesn't have any effect, e.g., + * if two jets come from a W (top). + * @param ptype The type of the particle. + * @param indexVector Vector of indices. + * @return An error code. + */ + int InvariantParticlePermutations(KLFitter::Particles::ParticleType ptype, std::vector<int> indexVector); + + /** + * Remove permutations in which all indices in the vector indexVectorPosition1 are exchanged with the corresponding indices in indexVectorPosition2 + * for the given particle type. + * This is useful to reduce the number of permutations if + * interchanging a whole set of particles doesn't have any effect, e.g., + * the particles coming from the two hadronic top quarks in the fully hadronic channel. + * @param ptype The type of the particle. + * @param indexVectorPosition1 Vector of indices of first set of particle. + * @param indexVectorPosition2 Vector of corresponding indices for second set of particle. + * @return An error code. + */ + int InvariantParticleGroupPermutations(KLFitter::Particles::ParticleType ptype, std::vector<int> indexVectorPosition1, std::vector<int> indexVectorPosition2); + + /** + * Remove permutations in which a certain particles is in a certain position. + * This is useful to reduce the number of permutations if for example + * a b-tagged jet is forbidden in the position of a light jet. + * @param ptype The type of the particle. + * @param index The index of the particle. + * @param position The position in which it is forbidden. + * @return An error code. + */ + int RemoveParticlePermutations(KLFitter::Particles::ParticleType ptype, int index, int position); + + /** + * Reset Permutations. + * @return An error code. + */ + int Reset(); + + /** + * Creates table of permutations. + */ + int CreateSubTable(int Nobj, std::vector<std::vector<int>*>* table, int Nmax = -1); + + /* @} */ + + private: + + /** + * Check if particles are defined. + */ + int CheckParticles(); + + protected: + + private: + + /** + * Helper functions to efficienctly create permutations of N particles of only M selected particles. + */ + + std::vector<int> Get_int_vector(int i); + std::vector<int> Get_int_plus_vector(int i, std::vector<int> v); + std::vector<std::vector<int> > Get_M_from_N(unsigned int N, unsigned int M, unsigned int start = 0); + + private: + + /** + * A pointer to the pointer of original particles. + */ + KLFitter::Particles** fParticles; + + /** + * A pointer to the pointer of permuted particles. + */ + KLFitter::Particles** fParticlesPermuted; + + /** + * A table of permuted particles (jets and leptons). + */ + std::vector <KLFitter::Particles*>* fParticlesTable; + + /** + * A table of permutations. Needed for the math. + */ + std::vector < std::vector <int>*>* fPermutationTable; + + /** + * The permutation index + */ + int fPermutationIndex; + + std::vector<std::vector<int>*>* fTablePartons; + std::vector<std::vector<int>*>* fTableElectrons; + std::vector<std::vector<int>*>* fTableMuons; + std::vector<std::vector<int>*>* fTablePhotons; + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/PhysicsConstants.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/PhysicsConstants.h new file mode 100644 index 0000000000000000000000000000000000000000..a6da15c1d5a2beead2fc68d11d8ef3a981fa4304 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/PhysicsConstants.h @@ -0,0 +1,280 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::PhysicsConstants + * \brief A class containing physics constants. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * \added ttH constants: Leonid Serkin + * \date 01.12.2011 + * + * This class contains physics constants. + */ + +// --------------------------------------------------------- + +#ifndef PHYSICSCONSTANTS +#define PHYSICSCONSTANTS + +// --------------------------------------------------------- + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class PhysicsConstants + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + PhysicsConstants(); + + /** + * The default destructor. + */ + virtual ~PhysicsConstants(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the mass of the bottom quark in GeV/c2. + * @return The mass of the particle in GeV/c2. + */ + double MassBottom() + { return fMassBottom; }; + + /** + * Return the msas of the W boson in GeV/c2. + * @return The mass of the particle in GeV/c2. + */ + double MassW() + { return fMassW; }; + + /** + * Return the mass of the Z boson in GeV/c2. + * @return The mass of the particle in GeV/c2. + */ + double MassZ() + { return fMassZ; }; + + /** + * Return the msas of the top quark in GeV/c2 + * @return The mass of the particle in GeV/c2. + */ + double MassTop() + { return fMassTop; }; + + /** + * Return the msas of the Higgs boson in GeV/c2 + * @return The mass of the particle in GeV/c2. + */ + double MassHiggs() + { return fMassHiggs; }; + + /** + * Return the width of the W boson in GeV/c2. + * @return The width of the particle in GeV/c2. + */ + double GammaW() + { return fGammaW; }; + + /** + * Return the width of the Z boson in GeV/c2. + * @return The width of the particle in GeV/c2. + */ + double GammaZ() + { return fGammaZ; }; + + /** + * Return the width of the top quark in GeV/c2 + * @return The width of the particle in GeV/c2. + */ + double GammaTop() + { return fGammaTop; }; + + + /** + * Return the width of the Higgs boson in GeV/c2 + * @return The width of the particle in GeV/c2. + */ + double GammaHiggs() + { return fGammaHiggs; }; + + + double MassTopUnc() + { return fMassTopUnc; }; + + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the mass of the bottom quark in GeV/c2. + * @param mass The mass of the particle in GeV/c2. + * @return An error code. + */ + int SetMassBottom(double mass); + + /** + * Set the mass of the top quark in GeV/c2. + * @param mass The mass of the particle in GeV/c2. + * @return An error code. + */ + int SetMassTop(double mass); + + /** + * Set the mass of the Higgs boson in GeV/c2. + * @param mass The mass of the particle in GeV/c2. + * @return An error code. + */ + int SetMassHiggs(double mass); + + /** + * Set the mass of the W boson in GeV/c2. + * @param mass The mass of the particle in GeV/c2. + * @return An error code. + */ + int SetMassW(double mass); + + /** + * Set the mass of the Z boson in GeV/c2. + * @param mass The mass of the particle in GeV/c2. + * @return An error code. + */ + int SetMassZ(double mass); + + /** + * Set the width of the W boson in GeV/c2. + * @param gamma The width of the particle in GeV/c2. + * @return An error code. + */ + int SetGammaW(double gamma); + + /** + * Set the width of the Z boson in GeV/c2. + * @param gamma The width of the particle in GeV/c2. + * @return An error code. + */ + int SetGammaZ(double gamma); + + /** + * Set the width of the top quark in GeV/c2. + * @param gamma The width of the particle in GeV/c2. + * @return An error code. + */ + int SetGammaTop(double gamma); + + + /** + * Set the width of the Higgs boson in GeV/c2. + * @param gamma The width of the particle in GeV/c2. + * @return An error code. + */ + int SetGammaHiggs(double gamma); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Calculates the top width at NLO. + */ + void CalculateGammaTop(); + + + /** + * Calculates the Higgs width using HDECAY. + */ + void CalculateGammaHiggs(); + + /* @} */ + + protected: + + private: + + /** + * The bottom quark pole mass in GeV/c2. + */ + double fMassBottom; + + /** + * The W boson pole mass in GeV/c2. + */ + double fMassW; + + /** + * The Z boson pole mass in GeV/c2. + */ + double fMassZ; + + /** + * The top quark pole mass in GeV/c2. + */ + double fMassTop; + + /** + * The Higgs boson mass in GeV/c2. + */ + double fMassHiggs; + + /** + * The W boson width in GeV/c2. + */ + double fGammaW; + + /** + * The Z boson width in GeV/c2. + */ + double fGammaZ; + + /** + * The top quark width in GeV/c2. + */ + double fGammaTop; + + /** + * The Higgs boson width in GeV/c2. + */ + double fGammaHiggs; + + /** + * The Fermi constant. + */ + double fGF; + + /** + * alpha_S at m_Z + */ + double fAlphaS; + + /** + * The top quark mass LHC uncertainty in GeV/c2. + */ + double fMassTopUnc; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussBase.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussBase.h new file mode 100644 index 0000000000000000000000000000000000000000..92d5f85931305f98213578f446baf162b2e98391 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussBase.h @@ -0,0 +1,172 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussBase + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSBASE +#define RESDOUBLEGAUSSBASE + +#include <vector> +#include "ResolutionBase.h" +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussBase : public ResolutionBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussBase(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussBase(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussBase(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x) = 0; + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x) = 0; + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x) = 0; + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x) = 0; + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x) = 0; + + /** + * Return the approximate width of the TF depending on the measured value of x. + * Used to adjust the range of the fit parameter that correspond to the TF. + * @param xmeas The measured value of x. + * @return The width. + */ + virtual double GetSigma(double xmeas); + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @return The probability. + */ + virtual double p(double x, double xmeas, bool &good); + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @param par Optional additional parameter (SumET in case of MET TF). + * @return The probability. + */ + virtual double p(double /*x*/, double /*xmeas*/, bool &good, double /*par*/) + { good = true; return 0; } + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + /** + * Sanity check for double gaussian parameters p2, p3 and p5 (1st sigma, scale and 2nd sigma). + * @param p2 (the 1st sigma). + * @param p3 (the scale parameter). + * @param p5 (the 2nd sigma). + * @return False if problem with TF. + */ + inline static bool CheckDoubleGaussianSanity(double &sigma1, double &litude2, double &sigma2) { + if (amplitude2 < 0.) amplitude2 = 0.; + if (sigma1 < 0.) { +// std::cout << "KLFitter::ResDoubleGauss::CheckDoubleGaussianSanity() ERROR IN TRANSFERFUNCTIONS the sigma of the 1st Gaussian is < 0 - FIT RESULT MAY NOT BE RELIABLE" << std::endl; +// std::cout << "--> Fitter is in a bad condition! Please check your input files (E out of validation scope?)." << std::endl; + sigma1 = 0.00000001; + return false; + } + if (sigma2 < 0.) { +// std::cout << "KLFitter::ResDoubleGauss::CheckDoubleGaussianSanity() ERROR IN TRANSFERFUNCTIONS the sigma of the 2nd Gaussian is < 0 - FIT RESULT MAY NOT BE RELIABLE" << std::endl; +// std::cout << "--> Fitter is in a bad condition! Please check your input files (E out of validation scope?)." << std::endl; + sigma2 = 0.000000001; + return false; + } + + return true; + } + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_1.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_1.h new file mode 100644 index 0000000000000000000000000000000000000000..6b58989e0f7ba529fe447c15c29c350d15dff338 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_1.h @@ -0,0 +1,115 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussE_1 + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSE_1 +#define RESDOUBLEGAUSSE_1 + +#include <vector> +#include "ResDoubleGaussBase.h" +#include <iostream> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussE_1 : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussE_1(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussE_1(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussE_1(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_2.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_2.h new file mode 100644 index 0000000000000000000000000000000000000000..9d2a348b8a8fa844310838cf37c6b0b904520bb4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_2.h @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussE_2 + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSE_2 +#define RESDOUBLEGAUSSE_2 + +#include <vector> +#include "ResDoubleGaussBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussE_2 : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussE_2(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussE_2(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussE_2(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_3.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_3.h new file mode 100644 index 0000000000000000000000000000000000000000..6e02530dfe6add730ee08db157ddac3974b3db5f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_3.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussE_3 + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSE_3 +#define RESDOUBLEGAUSSE_3 + +#include <vector> +#include "ResDoubleGaussBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussE_3 : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussE_3(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussE_3(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussE_3(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_4.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_4.h new file mode 100644 index 0000000000000000000000000000000000000000..6faf4b1dfa647d788961b82cf0678b9b70a3de83 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_4.h @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussE_4 + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSE_4 +#define RESDOUBLEGAUSSE_4 + +#include <vector> +#include "ResDoubleGaussBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussE_4 : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussE_4(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussE_4(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussE_4(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_5.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_5.h new file mode 100644 index 0000000000000000000000000000000000000000..b83c0839f827d59da5e7b2600f9c0dfb854826b4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussE_5.h @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussE_5 + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSE_5 +#define RESDOUBLEGAUSSE_5 + +#include <vector> +#include "ResDoubleGaussBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussE_5 : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussE_5(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussE_5(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussE_5(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussPt.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussPt.h new file mode 100644 index 0000000000000000000000000000000000000000..dd4339124609199fc69975b2c0c7e605d153cd9e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResDoubleGaussPt.h @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResDoubleGaussPt + * \brief A class describing a resolution parameterized with a double Gaussian. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a double Gaussian with energy dependent + * parameters. + */ + +// --------------------------------------------------------- + +#ifndef RESDOUBLEGAUSSPT +#define RESDOUBLEGAUSSPT + +#include <vector> +#include "ResDoubleGaussBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResDoubleGaussPt : public ResDoubleGaussBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResDoubleGaussPt(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResDoubleGaussPt(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResDoubleGaussPt(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Calculate the mean of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean1(double x); + + /** + * Calculate the width of the first Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma1(double x); + + /** + * Calculate the amplitude of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetAmplitude2(double x); + + /** + * Calculate the mean of the second Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetMean2(double x); + + /** + * Calculate the width of the sedcond Gaussian from the TF parameters and the value of x. + * @param x The value of x. + * @return The width. + */ + virtual double GetSigma2(double x); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss.h new file mode 100644 index 0000000000000000000000000000000000000000..fd4836726eaf711e211fa0c93fe807ccad964f1a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResGauss + * \brief A class describing a Gaussian resolution. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a Gaussian with a width of a constant times the + * square root of the true parameter. + */ + +// --------------------------------------------------------- + +#ifndef RESGAUSS +#define RESGAUSS + +#include "ResolutionBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResGauss : public ResolutionBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResGauss(const char * filename); + + /** + * A constructor. + * @param sigma The width of the Gaussian. + */ + ResGauss(double sigma); + + /** + * The default destructor. + */ + virtual ~ResGauss(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the width of the TF depending on the measured value of x. + * Used to adjust the range of the fit parameter that correspond to the TF. + * @param dummy Dummy parameter. Only needed to satisfy the interface. + * @return The width. + */ + virtual double GetSigma(double dummy = 0) ; + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @return The probability. + */ + double p(double x, double xmeas, bool &good); + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @param par Optional additional parameter (SumET in case of MET TF). + * @return The probability. + */ + virtual double p(double /*x*/, double /*xmeas*/, bool &good, double /*par*/) + { good = true; return 0; } + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the width of the Gaussian + * @param sigma The width of the Gaussian. + */ + void SetSigma(double sigma) + { if (sigma < 0) sigma = - sigma; this -> SetPar(0, sigma); }; + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss_MET.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss_MET.h new file mode 100644 index 0000000000000000000000000000000000000000..7eb0d465ad723f230bc6e2a14c2afd64bbf7cfe2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResGauss_MET.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResGauss_MET + * \brief A class describing a Gaussian resolution, parametrized for MET. + * \author Kevin Kröninger + * \version 1.4 + * \date 24.06.2011 + * + * This class offers a simple parameterization of a resolution. The + * parameterization is a Gaussian with a width of a constant times the + * square root of the true parameter. + */ + +// --------------------------------------------------------- + +#ifndef RESGAUSS_MET +#define RESGAUSS_MET + +#include "ResolutionBase.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResGauss_MET : public ResolutionBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ResGauss_MET(const char * filename); + + /** + * A constructor. + * @param parameters The parameters of the parameterization. + */ + ResGauss_MET(std::vector<double> const& parameters); + + /** + * The default destructor. + */ + virtual ~ResGauss_MET(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the width of the TF depending on the value of sumET. + * Used to adjust the range of the fit parameter that correspond to the TF. + * @param sumet SumET as parameter for the MET TF. + * @return The width. + */ + virtual double GetSigma(double sumet); + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @return The probability. + */ + virtual double p(double /*x*/, double /*xmeas*/, bool &good) + { good = true; return 0; } + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param sumet SumET, as the width of the TF depends on this. + * @param good False if problem with TF. + * @return The probability. + */ + double p(double x, double xmeas, bool &good, double sumet); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the width of the Gaussian + * @param sigma The width of the Gaussian. + */ + void SetSigma(double sigma) + { if (sigma < 0) sigma = - sigma; this -> SetPar(0, sigma); }; + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResolutionBase.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResolutionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..3d7871ae245dc9e555b7f4b85bc5017f71e79ceb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitter/ResolutionBase.h @@ -0,0 +1,160 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ResolutionBase + * \brief A base class for describing resolutions. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This base class can be used to decribe resolutions. + */ + +// --------------------------------------------------------- + +#ifndef RESOLUTIONBASE +#define RESOLUTIONBASE + +// --------------------------------------------------------- + +#include <vector> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ResolutionBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param npar The number of parameters needed for the parameterization. + */ + ResolutionBase(int npar); + + /** + * A constructor. + * @param parameters A vector with the parameters. + */ + ResolutionBase(std::vector<double> parameters); + + /** + * The default destructor. + */ + virtual ~ResolutionBase(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the (approximate) width of the TF depending on the relevant parameter + * (mostly xmeas, but sumET in case of ResGauss_MET). + * Use to adjust the range of the fit parameter that correspond to the TF. + * @param par Parameter on which the width depends + * @return The width. + */ + virtual double GetSigma(double /*par*/) = 0; + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @return The probability. + */ + virtual double p(double /*x*/, double /*xmeas*/, bool &good) + { good = true; return 0; } + + /** + * Return the probability of the true value of x given the + * measured value, xmeas. + * @param x The true value of x. + * @param xmeas The measured value of x. + * @param good False if problem with TF. + * @param par Optional additional parameter (SumET in case of MET TF). + * @return The probability. + */ + virtual double p(double /*x*/, double /*xmeas*/, bool &good, double /*par*/) + { good = true; return 0; } + + /** + * Return a parameter of the parameterization. + * @param index The parameter index. + * @param par The parameter value. + * @return An error flag. + */ + int Par(int index, double &par); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set a parameter value. + * @param index The parameter index. + * @param value The parameter value. + * @return An error code. + */ + int SetPar(int index, double value); + + /** + * Set all parameter values. + * @param parameters A vector of parameters. + * @return An error code. + */ + int SetPar(std::vector<double> parameters); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Read parameter values from ASCII file. + * @param filename The name of the file. + * @param nparameters The number of parameters. + * @return An error code. + */ + int ReadParameters(const char * filename, int nparameters); + + /** + * Return a status code. + * @return A status code (1: ok, 0: error). + */ + int Status(); + + /* @} */ + + protected: + + /** + * The number of parameters. + */ + int fNParameters; + + /** + * The parameter values. + */ + std::vector <double> fParameters; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorAtlas_10TeV.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorAtlas_10TeV.h new file mode 100644 index 0000000000000000000000000000000000000000..aa72ca1f08d36869d01abebf30b8bf3d95f0cd66 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorAtlas_10TeV.h @@ -0,0 +1,212 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::DetectorAtlas_10TeV + * \brief A class for describing of the ATLAS detector. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class holds the description of the ATLAS detector. + */ + +// --------------------------------------------------------- + +#ifndef DETECTORATLAS_10TeV +#define DETECTORATLAS_10TeV + +// --------------------------------------------------------- + +#include "KLFitter/DetectorBase.h" +#include <string> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class DetectorAtlas_10TeV : public DetectorBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param folder The folder with transfer function parameters. + */ + DetectorAtlas_10TeV(std::string folder = ""); + + /** + * The default destructor. + */ + virtual ~DetectorAtlas_10TeV(); + + /* @} */ + /** \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; + + /** + * The energy resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyBJet_eta1; + KLFitter::ResolutionBase * fResEnergyBJet_eta2; + KLFitter::ResolutionBase * fResEnergyBJet_eta3; + + /** + * The energy resolution of gluon jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyGluonJet_eta1; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta2; + KLFitter::ResolutionBase * fResEnergyGluonJet_eta3; + + /** + * The energy resolution of electrons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyElectron_eta1; + KLFitter::ResolutionBase * fResEnergyElectron_eta2; + KLFitter::ResolutionBase * fResEnergyElectron_eta3; + + /** + * The energy resolution of muons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyMuon_eta1; + KLFitter::ResolutionBase * fResEnergyMuon_eta2; + KLFitter::ResolutionBase * fResEnergyMuon_eta3; + + /** + * The energy resolution of photons for different eta regions. + */ + KLFitter::ResolutionBase * fResEnergyPhoton_eta1; + KLFitter::ResolutionBase * fResEnergyPhoton_eta2; + KLFitter::ResolutionBase * fResEnergyPhoton_eta3; + + /** + * The eta resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaLightJet_eta1; + KLFitter::ResolutionBase * fResEtaLightJet_eta2; + KLFitter::ResolutionBase * fResEtaLightJet_eta3; + + /** + * The eta resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResEtaBJet_eta1; + KLFitter::ResolutionBase * fResEtaBJet_eta2; + KLFitter::ResolutionBase * fResEtaBJet_eta3; + + /** + * The phi resolution of light jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiLightJet_eta1; + KLFitter::ResolutionBase * fResPhiLightJet_eta2; + KLFitter::ResolutionBase * fResPhiLightJet_eta3; + + /** + * The phi resolution of b jets for different eta regions. + */ + KLFitter::ResolutionBase * fResPhiBJet_eta1; + KLFitter::ResolutionBase * fResPhiBJet_eta2; + KLFitter::ResolutionBase * fResPhiBJet_eta3; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorDummy.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorDummy.h new file mode 100644 index 0000000000000000000000000000000000000000..a0092ad0342c4b01d3851d339e9840a6173a7eb1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/DetectorDummy.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::DetectorDummy + * \brief A class for describing a dummy detector. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class holds the description of a dummy detector. + */ + +// --------------------------------------------------------- + +#ifndef DETECTORDUMMY +#define DETECTORDUMMY + +#include "KLFitter/DetectorBase.h" +#include <string> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class DetectorDummy : public DetectorBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param folder The folder with transfer function parameters. + */ + DetectorDummy(std::string folder = ""); + + /** + * The default destructor. + */ + virtual ~DetectorDummy(); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceBase.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceBase.h new file mode 100644 index 0000000000000000000000000000000000000000..f4921474a6a3e3d7266075b4b790cba3e7fe326f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceBase.h @@ -0,0 +1,135 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceBase + * \brief A base class for interfacing input data. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class is a base class for interfaces to input data, e.g. to + * ROOT trees. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEBASE +#define INTERFACEBASE + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Particles; + + class InterfaceBase + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceBase(); + + /** + * The default destructor. + */ + virtual ~InterfaceBase(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return a set of particles. + * @return A pointer to the set of particles. + */ + KLFitter::Particles * Particles() + { return fParticles; }; + + KLFitter::Particles ** PParticles() + { return &fParticles; }; + + /** + * Return a set of particles. + * @return A pointer to the set of particles. + */ + KLFitter::Particles * ParticlesTruth() + { return fParticlesTruth; }; + + /** + * Return a pointer to a pointer of a set of particles. + * @return A pointer to the pointer of a set of particles. + */ + KLFitter::Particles ** PParticlesTruth() + { return &fParticlesTruth; }; + + /** + * Return the number of events. + * @return The number of events + */ + virtual int NEvents() + { return 0; }; + + /** + * Get event weight (MC@NLO) + * @return Pointer to event weight. + */ + virtual double Weight() + { return fWeight; }; + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + virtual double ET_miss() + { return 0; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /* @} */ + + protected: + + /** + * A set of particles. + */ + KLFitter::Particles * fParticles; + + /** + * A set of truth particles. + */ + KLFitter::Particles * fParticlesTruth; + + /** + * The event weight + */ + double fWeight; + + private: + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD.h new file mode 100644 index 0000000000000000000000000000000000000000..e4a568d61ef75733a4c20d41c3e3746a550eba97 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD.h @@ -0,0 +1,252 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PD + * \brief A class for interfacing a Root file. + * \author Olaf Nackenhorst + * \version 1.3 + * \date 03.12.2009 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACED3PD +#define INTERFACED3PD + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return MET_RefFinal_em_tight_et / 1000.; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return MET_RefFinal_em_tight_etx / 1000.; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return MET_RefFinal_em_tight_ety / 1000.; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return MET_RefFinal_em_tight_sumet / 1000. ; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t EventNumber; + std::vector<std::vector<double> >* mcevt_weight; + + int mu_n; + std::vector<float> * mu_E; + std::vector<float> * mu_px; + std::vector<float> * mu_py; + std::vector<float> * mu_pz; + std::vector<float> * mu_eta; + + int el_n; + std::vector<float> * el_E; + std::vector<float> * el_eta; + std::vector<float> * el_deteta; + std::vector<float> * el_phi; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_deteta; + std::vector<float> * jet_phi; + std::vector<float> * jet_flavor_weight_SV0; + + float MET_RefFinal_em_tight_et; + float MET_RefFinal_em_tight_etx; + float MET_RefFinal_em_tight_ety; + float MET_RefFinal_em_tight_sumet; + + // internal variables for the truth mapping + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_b; // b quark + int TruthIdx_bbar; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + int TruthIdx_lplus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_lminus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_n; // neutrino + int TruthIdx_nbar; // antineutrino + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_Allhadronic.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_Allhadronic.h new file mode 100644 index 0000000000000000000000000000000000000000..9d8454433241acbc81f0a24cb0e21ad8cf6fa136 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_Allhadronic.h @@ -0,0 +1,250 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PDAllhadronic + * \brief A class for interfacing a Root file + * \author + * \version + * \date + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef InterfaceD3PD_ALLHADRONIC +#define InterfaceD3PD_ALLHADRONIC + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD_Allhadronic : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD_Allhadronic(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD_Allhadronic(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return MET_RefFinal_em_tightpp_et / 1000.; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return MET_RefFinal_em_tightpp_etx / 1000.; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return MET_RefFinal_em_tightpp_ety / 1000.; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return MET_RefFinal_em_tightpp_sumet / 1000. ; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t EventNumber; + std::vector<std::vector<double> >* mcevt_weight; + + int mu_n; + std::vector<float> * mu_E; + std::vector<float> * mu_px; + std::vector<float> * mu_py; + std::vector<float> * mu_pz; + std::vector<float> * mu_eta; + + int el_n; + std::vector<float> * el_E; + std::vector<float> * el_eta; + std::vector<float> * el_deteta; + std::vector<float> * el_phi; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_deteta; + std::vector<float> * jet_phi; + std::vector<float> * jet_flavor_weight_JetFitterCOMBNN; + + float MET_RefFinal_em_tightpp_et; + float MET_RefFinal_em_tightpp_etx; + float MET_RefFinal_em_tightpp_ety; + float MET_RefFinal_em_tightpp_sumet; + + // internal variables for the truth mapping + // internal variables for the truth mapping + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_b; // b quark + int TruthIdx_bbar; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + + + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_dilepton.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_dilepton.h new file mode 100644 index 0000000000000000000000000000000000000000..798af5d4ceda146241ac0bc43a98d2d6deff94f9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_dilepton.h @@ -0,0 +1,249 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PD_dilepton + * \brief A class for interfacing a Root file. + * \author Olaf Nackenhorst, Tamara Vazquez Schröder + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACED3PDDILEPTON +#define INTERFACED3PDDILEPTON + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD_dilepton : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD_dilepton(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD_dilepton(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return met_et ; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return met_x ; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return met_y ; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return met_sumet ; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t eventNumber; + Float_t eventWeight; + + std::vector<float> * mu_E; + std::vector<float> * mu_eta; + std::vector<float> * mu_phi; + std::vector<float> * mu_pt; + std::vector<float> * mu_charge; + + std::vector<float> * el_E; + std::vector<float> * el_eta; + std::vector<float> * el_deteta; + std::vector<float> * el_phi; + std::vector<float> * el_charge; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_det_eta; + std::vector<float> * jet_phi; + std::vector<float> * jet_MV1; + + float met_et; + float met_x; + float met_y; + float met_sumet; + + // internal variables for the truth mapping + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_b; // b quark + int TruthIdx_bbar; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + int TruthIdx_lplus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_lminus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_n; // neutrino + int TruthIdx_nbar; // antineutrino + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ljets.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ljets.h new file mode 100644 index 0000000000000000000000000000000000000000..2bb1e7c4bc70dcedb751e8a1afbae1321ece25d1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ljets.h @@ -0,0 +1,249 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PD_ljets + * \brief A class for interfacing a Root file. + * \author Olaf Nackenhorst + * \version 1.3 + * \date 03.12.2009 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACED3PDLJETS +#define INTERFACED3PDLJETS + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD_ljets : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD_ljets(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD_ljets(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return met_et ; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return met_x ; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return met_y ; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return met_sumet ; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t eventNumber; + Float_t eventWeight; + + std::vector<float> * mu_E; + std::vector<float> * mu_eta; + std::vector<float> * mu_phi; + std::vector<float> * mu_pt; + + std::vector<float> * el_E; + std::vector<float> * el_eta; + std::vector<float> * el_deteta; + std::vector<float> * el_phi; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_det_eta; + std::vector<float> * jet_phi; + std::vector<float> * jet_MV1; + + float met_et; + float met_x; + float met_y; + float met_sumet; + + // internal variables for the truth mapping + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_b; // b quark + int TruthIdx_bbar; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + int TruthIdx_lplus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_lminus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_n; // neutrino + int TruthIdx_nbar; // antineutrino + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ttH.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ttH.h new file mode 100644 index 0000000000000000000000000000000000000000..af68e0ccc35dfb78bcd0946e94af6b2493045e9e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_ttH.h @@ -0,0 +1,272 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PD_ttH + * \brief A class for interfacing a Root file. + * \author Kevin Kroeninger + * \version 1.0 + * \date 18.12.2012 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACED3PDTTH +#define INTERFACED3PDTTH + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD_ttH : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD_ttH(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD_ttH(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the transverse mass of the W boson. + * @return The MWT + */ + double MWT() + { return (double) mwt; }; + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return (double) met_et; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return met_x; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return met_y; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return met_sumet; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + void CheckTauChildren(int); + + bool DecaysIntoItself(int); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t EventNumber; + // std::vector<std::vector<double> >* eventWeight_SF; + // std::vector<double> * eventWeight_SF; + float eventWeight_SF; + + int mu_n; + std::vector<float> * mu_E; + std::vector<float> * mu_pt; + std::vector<float> * mu_phi; + std::vector<float> * mu_eta; + + int el_n; + std::vector<float> * el_E; + std::vector<float> * el_pt; + std::vector<float> * el_phi; + std::vector<float> * el_track_eta; + std::vector<float> * el_cl_eta; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_deteta; + std::vector<float> * jet_phi; + std::vector<float> * jet_MV1; + std::vector<float> * jet_jvf; + + float mwt; + float met_et; + float met_x; + float met_y; + float met_sumet; + + // internal variables for the truth mapping + int TruthIdx_H; //H + int TruthIdx_bfromH; // b quark + int TruthIdx_bbarfromH; // antib quark + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_bfromt; // b quark + int TruthIdx_bbarfromtbar; // antib quark + int TruthIdx_bhad; // b quark + int TruthIdx_blep; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + int TruthIdx_lplus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_lminus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_n; // neutrino + int TruthIdx_nbar; // antineutrino + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + bool HadronicTauDecay; + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_udsep.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_udsep.h new file mode 100644 index 0000000000000000000000000000000000000000..4bab01a6219bb1a1a1a6f00ec623974e0fd185c2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceD3PD_udsep.h @@ -0,0 +1,249 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceD3PD_udsep + * \brief A class for interfacing a Root file, including modifications for u/d separation. + * \author Olaf Nackenhorst, Boris Lemmer + * \version 1.4 + * \date 03.12.2009 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef InterfaceD3PD_UDSEP +#define InterfaceD3PD_UDSEP + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceD3PD_udsep : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceD3PD_udsep(); + + /** + * The default destructor. + */ + virtual ~InterfaceD3PD_udsep(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return met_et ; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return met_x ; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return met_y ; }; + + /** + * Return the measured scalar sum of transverse energy. + * @return The summed ET + */ + double Sum_ET() + { return met_sumet ; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given tree directly, skip OpenRootFile. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(TTree * fTree); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /** + * Define indices of truth particles. + * @return An error code. + */ + int TruthMapper(); + + /** + * Checks whether particle originates from certain pdg id. + * @param truthIdx The index of the particle to check. + * @param pdg The pdg id which is under test. + * @return true if particle with index truthIdx originates directly from a particle with pdgid 'pdg' + */ + bool OriginatesFromPDG(int truthIdx,long pdg); + + /** + * Checks whether event is proper and sane MC event. + * @return true if event is sane + */ + bool IsProperMCEvent(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + UInt_t eventNumber; + Float_t eventWeight; + + std::vector<float> * mu_E; + std::vector<float> * mu_eta; + std::vector<float> * mu_phi; + std::vector<float> * mu_pt; + + std::vector<float> * el_E; + std::vector<float> * el_eta; + std::vector<float> * el_deteta; + std::vector<float> * el_phi; + + int jet_n; + std::vector<float> * jet_E; + std::vector<float> * jet_pt; + std::vector<float> * jet_eta; + std::vector<float> * jet_det_eta; + std::vector<float> * jet_phi; + std::vector<float> * jet_MV1; + + float met_et; + float met_x; + float met_y; + float met_sumet; + + // internal variables for the truth mapping + int TruthIdx_t; //top quark + int TruthIdx_tbar; //antitop quark + int TruthIdx_b; // b quark + int TruthIdx_bbar; // antib quark + int TruthIdx_Wplus; // W+ + int TruthIdx_Wminus; // W- + int TruthIdx_QfromWplus; // the quark from W+ + int TruthIdx_QbarfromWplus; // the antiquark from W+ + int TruthIdx_QfromWminus; // the quark from W- + int TruthIdx_QbarfromWminus; // the antiquark from W- + int TruthIdx_lplus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_lminus; // the lepton (e, mu, tau) with positive charge + int TruthIdx_n; // neutrino + int TruthIdx_nbar; // antineutrino + bool Truth_WplusHad; // true if W+ decayed hadronically + bool Truth_WminusHad; // true if W- decayed hadronically + + // Truth branch variables to read from D3PDs + std::vector<float> * mc_eta; + std::vector<float> * mc_phi; + std::vector<float> * mc_pt; + std::vector<int> * mc_pdgId; + std::vector<float> * mc_m; + std::vector<int> * mc_status; + std::vector<std::vector<int> > *mc_parent_index; + std::vector<std::vector<int> > *mc_child_index; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceDummy.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceDummy.h new file mode 100644 index 0000000000000000000000000000000000000000..0f310bce9d0691d670a856d6fa97bb3f5a44e627 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceDummy.h @@ -0,0 +1,214 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceRoot + * \brief A class for interfacing a Root file. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEDUMMY +#define INTERFACEDUMMY + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitter/Particles.h" +#include "TFile.h" +#include "TTree.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceDummy : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceDummy(); + + /** + * The default destructor. + */ + virtual ~InterfaceDummy(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Fill measured particles with data from tree. + * @param index The event number. + * @return An error code. + */ + virtual int Event(int index); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return MET_Et; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return MET_Etx; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return MET_Ety; }; + + /* @} */ + + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + + /** \name Tree variables */ + /* @{ */ + + double fBhad_E; + double fBhad_px; + double fBhad_py; + double fBhad_pz; + + double fQup_E; + double fQup_px; + double fQup_py; + double fQup_pz; + + double fQdown_E; + double fQdown_px; + double fQdown_py; + double fQdown_pz; + + double fBlep_E; + double fBlep_px; + double fBlep_py; + double fBlep_pz; + + double fLepton_E; + double fLepton_px; + double fLepton_py; + double fLepton_pz; + + double fPhoton_E; + double fPhoton_px; + double fPhoton_py; + double fPhoton_pz; + + double MET_Et; + double MET_Etx; + double MET_Ety; + double MET_Phi; + + double fTrue_Bhad_E; + double fTrue_Bhad_px; + double fTrue_Bhad_py; + double fTrue_Bhad_pz; + + double fTrue_Qup_E; + double fTrue_Qup_px; + double fTrue_Qup_py; + double fTrue_Qup_pz; + + double fTrue_Qdown_E; + double fTrue_Qdown_px; + double fTrue_Qdown_py; + double fTrue_Qdown_pz; + + double fTrue_Blep_E; + double fTrue_Blep_px; + double fTrue_Blep_py; + double fTrue_Blep_pz; + + double fTrue_Lepton_E; + double fTrue_Lepton_px; + double fTrue_Lepton_py; + double fTrue_Lepton_pz; + + double fTrue_Photon_E; + double fTrue_Photon_px; + double fTrue_Photon_py; + double fTrue_Photon_pz; + + double fTrue_Neutrino_E; + double fTrue_Neutrino_px; + double fTrue_Neutrino_py; + double fTrue_Neutrino_pz; + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceGoTopTree.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceGoTopTree.h new file mode 100644 index 0000000000000000000000000000000000000000..e89e08118c8d708d302d8441260f88627cd70500 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceGoTopTree.h @@ -0,0 +1,249 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceGoTopTree + * \brief A class for interfacing a Root file. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class interfaces to a Root file which contains events. The + * events are stored in a Root tree of a certain structure. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEGoTopTree +#define INTERFACEGoTopTree + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include <TChain.h> +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceGoTopTree : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceGoTopTree(); + + /** + * The default destructor. + */ + virtual ~InterfaceGoTopTree(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the number of events. + * @return The number of events + */ + int NEvents(); + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + double ET_miss() + { return MET_Et; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + double ET_miss_x() + { return MET_Etx; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + double ET_miss_y() + { return MET_Ety; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + int OpenRootFile(const char * filename, Option_t * opt = "READ"); + + /** + * Open Root files containing trees. + * @param filenames vector containing the filenames. + * @param opt Options. + * @return An error code. + */ + int OpenRootFiles(std::vector<std::string> filenames, Option_t * opt = "READ"); + + /** + * Get a tree from Root file and set branch addresses. + * @param treename The name of the tree. + * @return An error code. + */ + int ConnectTree(const char * treename); + + /** + * Set branch addresses for a given Chain directly, skip OpenRootFile. + * @param fChain The name of the Chain. + * @return An error code. + */ + int ConnectChain(TChain * fChain); + + /** + * Get event from Root tree. + * @param index The event index. + * @return An error code. + */ + int Event(int index); + + /** + * Fill list of particles. + * @return An error code. + */ + int FillParticles(); + + /* @} */ + + protected: + + private: + + /** + * The Root tree. + */ + TTree * fTree; + /** + * The Root chain. + */ + TChain * fChain; + /** \name Tree variables */ + /* @{ */ + + int Event_EventNumber; + + int Muon_N; + std::vector<double> * Muon_E; + std::vector<double> * Muon_Px; + std::vector<double> * Muon_Py; + std::vector<double> * Muon_Pz; + std::vector<double> * Muon_Pt; + std::vector<double> * Muon_Eta; + std::vector<double> * Muon_Phi; + std::vector<bool> * Muon_IsTopInputs; + + int Electron_N; + std::vector<double> * Electron_E; + std::vector<double> * Electron_Px; + std::vector<double> * Electron_Py; + std::vector<double> * Electron_Pz; + std::vector<double> * Electron_Pt; + std::vector<double> * Electron_Eta; + std::vector<double> * Electron_DetEta; + std::vector<double> * Electron_Phi; + std::vector<bool> * Electron_IsTopInputs; + + int Jet_N; + std::vector<double> * Jet_E; + std::vector<double> * Jet_Px; + std::vector<double> * Jet_Py; + std::vector<double> * Jet_Pz; + std::vector<double> * Jet_Pt; + std::vector<double> * Jet_Eta; + std::vector<double> * Jet_DetEta; + std::vector<double> * Jet_Phi; + std::vector<double> * Jet_SV0_Weight; + std::vector<bool> * Jet_IsTopInputs; + + int Photon_N; + std::vector<double> * Photon_E; + std::vector<double> * Photon_Px; + std::vector<double> * Photon_Py; + std::vector<double> * Photon_Pz; + std::vector<double> * Photon_Pt; + std::vector<double> * Photon_Eta; + std::vector<double> * Photon_Phi; + std::vector<bool> * Photon_IsTopInputs; + + double MET_Et; + double MET_Phi; + double MET_Etx; + double MET_Ety; + + bool Truth_IsProperMCEvent; + + int TruthPart_N; + std::vector<long> * TruthPart_PDG; + std::vector<int> * TruthPart_NParents; + std::vector< std::vector<int> > * TruthPart_ParentIdx; + std::vector<int> * TruthPart_NChildren; + std::vector< std::vector<int> > * TruthPart_ChildIdx; + std::vector<double> * TruthPart_E; + std::vector<double> * TruthPart_Px; + std::vector<double> * TruthPart_Py; + std::vector<double> * TruthPart_Pz; + std::vector<double> * TruthPart_Eta; + std::vector<double> * TruthPart_Phi; + std::vector<double> * TruthPart_Pt; + + // debugKK + // bool Truth_WplusHad; + // bool Truth_WminusHad; + char Truth_WplusHad; + char Truth_WminusHad; + + int TruthIdx_b; + int TruthIdx_bbar; + int TruthIdx_Wminus; + int TruthIdx_Wplus; + int TruthIdx_lminus; + int TruthIdx_lplus; + int TruthIdx_n; + int TruthIdx_nbar; + int TruthIdx_t; + int TruthIdx_tbar; + int TruthIdx_QfromWminus; + int TruthIdx_QfromWplus; + int TruthIdx_QbarfromWminus; + int TruthIdx_QbarfromWplus; + int TruthIdx_photon; + + /* @} */ + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput.h new file mode 100644 index 0000000000000000000000000000000000000000..8157acd4879aff6f81f2d0e6df0a1fceeae73ec8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput.h @@ -0,0 +1,398 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceOutput + * \brief An output interface + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class is an interface for output data. The data will be + * written to a Root tree. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEOUTPUT +#define INTERFACEOUTPUT + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitter/Particles.h" + +#include <string> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Fitter; + class SelectionTool; + class MatchingTool; + + class InterfaceOutput : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceOutput(); + + /** + * The default destructor. + */ + virtual ~InterfaceOutput(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set pointer to fitter. + * @param fitter A fitter. + * @return An error code. + */ + int SetFitter(KLFitter::Fitter * fitter); + + /** + * Set pointer to matching tool. + * @param matchingtool A matching tool. + * @return An error code. + */ + int SetMatchingTool(KLFitter::MatchingTool * matchingtool); + + /** + * Set pointer to selection tool. + * @param selectiontool A selection tool. + * @return An error code. + */ + int SetSelectionTool(KLFitter::SelectionTool * selectiontool); + + /** + * Set pointer to a set of truth particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesTruth(KLFitter::Particles ** pparticles) + { fParticlesTruth = pparticles; return 1; }; + + /** + * Set pointer to a set of measured particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesMeasured(KLFitter::Particles ** pparticles) + { fParticlesMeasured = pparticles; return 1; }; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt options. + * @return An error code. + */ + virtual int OpenRootFile(const char * filename, Option_t * opt = "RECREATE"); + + /** + * Close Root file. + * @return An error code. + */ + virtual int CloseRootFile(); + + /** + * Creates trees for the truth, model and measured particles. + * @return An error code. + */ + int CreateTrees(); + + /** + * Creates a tree for the model particles. + * @return An error code. + */ + int CreateTreeModel(); + + /** + * Creates a tree for the measured particles. + * @return An error code. + */ + int CreateTreeMeasured(); + + /** + * Creates a tree for the selected particles. + * @return An error code. + */ + int CreateTreeSelected(); + + /** + * Creates a tree for the truth particles. + * @return An error code. + */ + int CreateTreeTruth(); + + /** + * Creates a tree for the matching information. + * @return An error code. + */ + int CreateTreeMatching(); + + /** + * Creates a tree for the mapping information. + * @return An error code. + */ + int CreateTreeMap(); + + /** + * Fills copies of the model particles of the current permutation + * into the tree variables. + * @return An error code. + */ + int FillTreeModelPermutation(); + + /** + * Deletes all but the n best permutation from TreeModel. + * @param n Number of best permutations which should be kept. + * @return An error code. + */ + int TreeModelDeleteAllButNBestPermutations(unsigned int n); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeMeasured(); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeSelected(); + + /** + * Fills copies of the truth particles into the tree variables. + * @return An error code. + */ + int FillTreeTruth(); + + /** + * Fill copies of the matching information in the tree variables. + * @return An error code. + */ + int FillTreeMatching(); + + /** + * Fill copies of the mapping information in the tree variables. + * @return An error code. + */ + int FillTreeMap(); + + /** + * Fill the trees. + * @return An error code. + */ + int FillTrees(); + + /** + * Fill the event weight. + * @return An error code. + */ + int SetEventWeight(double weight); + + /** + * Fill the photon type. + * @return An error code. + */ + int SetPhotonType(bool isNotClassified, bool isRadTopProd, bool isHadTopRadDecay, bool isLepTopRadDecay, bool isHadWRadDecay, bool isLepWRadDecay); + + /** + * A helper class which removes blanks from a string. + * @param str A string. + * @return A string. + */ + std::string ModifyString(std::string str); + + /* @} */ + + protected: + + /** + * A pointer to a pointer to a set of truth particles. + */ + KLFitter::Particles ** fParticlesTruth; + + /** + * A pointer to a pointer to a set of model particles. + */ + KLFitter::Particles ** fParticlesModel; + + /** + * A pointer to a pointer to a set of measured particles. + */ + KLFitter::Particles ** fParticlesMeasured; + + /** + * A pointer to a pointer to a set of selected particles. + */ + KLFitter::Particles ** fParticlesSelected; + + /** + * A pointer to the matching tool + */ + KLFitter::MatchingTool * fMatchingTool; + + /** + * A pointer to the selection tool + */ + KLFitter::SelectionTool * fSelectionTool; + + /** + * A pointer to a fitter + */ + KLFitter::Fitter * fFitter; + + /** + * The Root tree for the truth particles + */ + TTree * fTreeTruth; + + /** + * The Root tree for the model particles + */ + TTree * fTreeModel; + + /** + * The Root tree for the measured particles + */ + TTree * fTreeMeasured; + + /** + * The Root tree for the selected particles + */ + TTree * fTreeSelected; + + /** + * The Root tree for the matching information + */ + TTree * fTreeMatching; + + /** + * The Root tree for mapping the selected to the measured particles + */ + TTree * fTreeMap; + + private: + + /** + * A helper method for resizing vectors of vectors. + * @param v The vector of vectors. + * @param length The new length. + */ + template<class type> void Resize(std::vector<std::vector<type> * > * v, unsigned int length); + + /** + * A helper method for creating the branch names for TreeMeasured + * @param The type of the particle + * @return Particle name - empty string for particles that cannot be measured directly + */ + + std::string TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType); + + /** \name The tree variables */ + /* @{ */ + + int fTreeVarEventNumber; + int fTreeVarNPermutations; + int fTreeVarNBTags; + std::vector<int> * fTreeVarBestPermutation; + std::vector<double> * fTreeVarLogLikelihood; +// std::vector<std::vector<double> > * fTreeVarLogLikelihoodComponents; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_bhad; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_blep; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq1; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq2; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lep; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_METx; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_METy; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Whad; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Wlep; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Thad; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Tlep; + + std::vector<double> * fTreeVarMinuitStatus; + std::vector<unsigned int> * fTreeVarConvergenceStatus; + std::vector<double> * fTreeVarIntegral; + std::vector<double> * fTreeVarEventProbability; + + int fTreeVarNPartonsMeasured; + int fTreeVarNElectronsMeasured; + int fTreeVarNMuonsMeasured; + int fTreeVarNPhotonsMeasured; + + int fTreeVarNPartonsSelected; + int fTreeVarNElectronsSelected; + int fTreeVarNMuonsSelected; + int fTreeVarNPhotonsSelected; + + std::vector <std::vector<double> *> * fTreeVarParameters; + std::vector <std::vector<double> *> * fTreeVarParameterErrors; + std::vector <std::vector<double> *> * fTreeVarModel; + std::vector <std::vector<int> *> * fTreeIntVarModel; + std::vector <std::vector<double> *> * fTreeVarMeasured; + std::vector <std::vector<double> *> * fTreeVarSelected; + std::vector <std::vector<double> *> * fTreeVarTruth; + + std::vector <int *> * fTreeVarNMatchedPartons; + std::vector <int *> * fTreeVarNMatchedElectrons; + std::vector <int *> * fTreeVarNMatchedMuons; + std::vector <int *> * fTreeVarNMatchedPhotons; + + std::vector <std::vector<int> *> * fTreeVarMatchedPartons; + std::vector <std::vector<int> *> * fTreeVarMatchedElectrons; + std::vector <std::vector<int> *> * fTreeVarMatchedMuons; + std::vector <std::vector<int> *> * fTreeVarMatchedPhotons; + + std::vector<int> * fTreeVarMapJets; + std::vector<int> * fTreeVarMapElectrons; + std::vector<int> * fTreeVarMapMuons; + std::vector<int> * fTreeVarMapPhotons; + + double fEventWeight; + + bool fIsNotClassified; + bool fIsRadTopProd; + bool fIsHadTopRadDecay; + bool fIsLepTopRadDecay; + bool fIsHadWRadDecay; + bool fIsLepWRadDecay; + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_Allhadronic.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_Allhadronic.h new file mode 100644 index 0000000000000000000000000000000000000000..0abefdfb9420ea15736f0d182c1462d5d73b44ec --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_Allhadronic.h @@ -0,0 +1,401 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceOutput_Allhadronic + * \brief An output interface + * + * This class is an interface for output data. The data will be + * written to a Root tree. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEOUTPUT_ALLHADRONIC +#define INTERFACEOUTPUT_ALLHADRONIC + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitter/Particles.h" + +#include <string> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Fitter; + class SelectionTool; + class MatchingTool; + + class InterfaceOutput_Allhadronic : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceOutput_Allhadronic(); + + /** + * The default destructor. + */ + virtual ~InterfaceOutput_Allhadronic(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set pointer to fitter. + * @param fitter A fitter. + * @return An error code. + */ + int SetFitter(KLFitter::Fitter * fitter); + + /** + * Set pointer to matching tool. + * @param matchingtool A matching tool. + * @return An error code. + */ + int SetMatchingTool(KLFitter::MatchingTool * matchingtool); + + /** + * Set pointer to selection tool. + * @param selectiontool A selection tool. + * @return An error code. + */ + int SetSelectionTool(KLFitter::SelectionTool * selectiontool); + + /** + * Set pointer to a set of truth particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesTruth(KLFitter::Particles ** pparticles) + { fParticlesTruth = pparticles; return 1; }; + + /** + * Set pointer to a set of measured particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesMeasured(KLFitter::Particles ** pparticles) + { fParticlesMeasured = pparticles; return 1; }; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt options. + * @return An error code. + */ + virtual int OpenRootFile(const char * filename, Option_t * opt = "RECREATE"); + + /** + * Close Root file. + * @return An error code. + */ + virtual int CloseRootFile(); + + /** + * Creates trees for the truth, model and measured particles. + * @return An error code. + */ + int CreateTrees(); + + /** + * Creates a tree for the model particles. + * @return An error code. + */ + int CreateTreeModel(); + + /** + * Creates a tree for the measured particles. + * @return An error code. + */ + int CreateTreeMeasured(); + + /** + * Creates a tree for the selected particles. + * @return An error code. + */ + int CreateTreeSelected(); + + /** + * Creates a tree for the truth particles. + * @return An error code. + */ + int CreateTreeTruth(); + + /** + * Creates a tree for the matching information. + * @return An error code. + */ + int CreateTreeMatching(); + + /** + * Creates a tree for the mapping information. + * @return An error code. + */ + int CreateTreeMap(); + + /** + * Fills copies of the model particles of the current permutation + * into the tree variables. + * @return An error code. + */ + int FillTreeModelPermutation(); + + /** + * Deletes all but the n best permutation from TreeModel. + * @param n Number of best permutations which should be kept. + * @return An error code. + */ + int TreeModelDeleteAllButNBestPermutations(unsigned int n); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeMeasured(); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeSelected(); + + /** + * Fills copies of the truth particles into the tree variables. + * @return An error code. + */ + int FillTreeTruth(); + + /** + * Fill copies of the matching information in the tree variables. + * @return An error code. + */ + int FillTreeMatching(); + + /** + * Fill copies of the mapping information in the tree variables. + * @return An error code. + */ + int FillTreeMap(); + + /** + * Fill the trees. + * @return An error code. + */ + int FillTrees(); + + /** + * Fill the event weight. + * @return An error code. + */ + int SetEventWeight(double weight); + + /** + * Fill the pileup weight. + * @return An error code. + */ + int SetPileupWeight(double weight); + + /** + * Fill the photon type. + * @return An error code. + */ + int SetPhotonType(bool isNotClassified, bool isRadTopProd, bool isHadTopRadDecay, bool isLepTopRadDecay, bool isHadWRadDecay, bool isLepWRadDecay); + + /** + * A helper class which removes blanks from a string. + * @param str A string. + * @return A string. + */ + std::string ModifyString(std::string str); + + /* @} */ + + protected: + + /** + * A pointer to a pointer to a set of truth particles. + */ + KLFitter::Particles ** fParticlesTruth; + + /** + * A pointer to a pointer to a set of model particles. + */ + KLFitter::Particles ** fParticlesModel; + + /** + * A pointer to a pointer to a set of measured particles. + */ + KLFitter::Particles ** fParticlesMeasured; + + /** + * A pointer to a pointer to a set of selected particles. + */ + KLFitter::Particles ** fParticlesSelected; + + /** + * A pointer to the matching tool + */ + KLFitter::MatchingTool * fMatchingTool; + + /** + * A pointer to the selection tool + */ + KLFitter::SelectionTool * fSelectionTool; + + /** + * A pointer to a fitter + */ + KLFitter::Fitter * fFitter; + + /** + * The Root tree for the truth particles + */ + TTree * fTreeTruth; + + /** + * The Root tree for the model particles + */ + TTree * fTreeModel; + + /** + * The Root tree for the measured particles + */ + TTree * fTreeMeasured; + + /** + * The Root tree for the selected particles + */ + TTree * fTreeSelected; + + /** + * The Root tree for the matching information + */ + TTree * fTreeMatching; + + /** + * The Root tree for mapping the selected to the measured particles + */ + TTree * fTreeMap; + + private: + + /** + * A helper method for resizing vectors of vectors. + * @param v The vector of vectors. + * @param length The new length. + */ + template<class type> void Resize(std::vector<std::vector<type> * > * v, unsigned int length); + + /** + * A helper method for creating the branch names for TreeMeasured + * @param The type of the particle + * @return Particle name - empty string for particles that cannot be measured directly + */ + + std::string TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType); + + /** \name The tree variables */ + /* @{ */ + + int fTreeVarEventNumber; + int fTreeVarNPermutations; + int fTreeVarNBTags; + std::vector<int> * fTreeVarBestPermutation; + std::vector<double> * fTreeVarLogLikelihood; +// std::vector<std::vector<double> > * fTreeVarLogLikelihoodComponents; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_bhad1; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_bhad2; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq1; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq2; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq3; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lq4; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Whad1; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Whad2; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Thad1; + std::vector<double> * fTreeVarLogLikelihoodComp_BW_Thad2; + + std::vector<double> * fTreeVarMinuitStatus; + std::vector<unsigned int> * fTreeVarConvergenceStatus; + std::vector<double> * fTreeVarIntegral; + std::vector<double> * fTreeVarEventProbability; + + int fTreeVarNPartonsMeasured; + int fTreeVarNElectronsMeasured; + int fTreeVarNMuonsMeasured; + int fTreeVarNPhotonsMeasured; + + int fTreeVarNPartonsSelected; + int fTreeVarNElectronsSelected; + int fTreeVarNMuonsSelected; + int fTreeVarNPhotonsSelected; + + std::vector <std::vector<double> *> * fTreeVarParameters; + std::vector <std::vector<double> *> * fTreeVarParameterErrors; + std::vector <std::vector<double> *> * fTreeVarModel; + std::vector <std::vector<int> *> * fTreeIntVarModel; + std::vector <std::vector<double> *> * fTreeVarMeasured; + std::vector <std::vector<double> *> * fTreeVarSelected; + std::vector <std::vector<double> *> * fTreeVarTruth; + + std::vector <int *> * fTreeVarNMatchedPartons; + std::vector <int *> * fTreeVarNMatchedElectrons; + std::vector <int *> * fTreeVarNMatchedMuons; + std::vector <int *> * fTreeVarNMatchedPhotons; + + std::vector <std::vector<int> *> * fTreeVarMatchedPartons; + std::vector <std::vector<int> *> * fTreeVarMatchedElectrons; + std::vector <std::vector<int> *> * fTreeVarMatchedMuons; + std::vector <std::vector<int> *> * fTreeVarMatchedPhotons; + + std::vector<int> * fTreeVarMapJets; + std::vector<int> * fTreeVarMapElectrons; + std::vector<int> * fTreeVarMapMuons; + std::vector<int> * fTreeVarMapPhotons; + + double fEventWeight; + double fPileupWeight; + + bool fIsNotClassified; + bool fIsRadTopProd; + bool fIsHadTopRadDecay; + bool fIsLepTopRadDecay; + bool fIsHadWRadDecay; + bool fIsLepWRadDecay; + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_dilepton.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_dilepton.h new file mode 100644 index 0000000000000000000000000000000000000000..10059d5b16db3aabd82de6d23aa246b400e07efa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceOutput_dilepton.h @@ -0,0 +1,393 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceOutput_dilepton + * \brief An output interface + * \author Kevin Kröninger, Tamara Vazquez Schröder + * + * This class is an interface for output data. The data will be + * written to a Root tree. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEOUTPUT_DILEPTON +#define INTERFACEOUTPUT_DILEPTON + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitter/Particles.h" + +#include <string> + +// --------------------------------------------------------- + +class TTree; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Fitter; + class SelectionTool; + class MatchingTool; + + class InterfaceOutput_dilepton : public InterfaceRoot + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceOutput_dilepton(); + + /** + * The default destructor. + */ + virtual ~InterfaceOutput_dilepton(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set pointer to fitter. + * @param fitter A fitter. + * @return An error code. + */ + int SetFitter(KLFitter::Fitter * fitter); + + /** + * Set pointer to matching tool. + * @param matchingtool A matching tool. + * @return An error code. + */ + int SetMatchingTool(KLFitter::MatchingTool * matchingtool); + + /** + * Set pointer to selection tool. + * @param selectiontool A selection tool. + * @return An error code. + */ + int SetSelectionTool(KLFitter::SelectionTool * selectiontool); + + /** + * Set pointer to a set of truth particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesTruth(KLFitter::Particles ** pparticles) + { fParticlesTruth = pparticles; return 1; }; + + /** + * Set pointer to a set of measured particles. + * @param pparticles A set of particles. + * @return An error code. + */ + int SetParticlesMeasured(KLFitter::Particles ** pparticles) + { fParticlesMeasured = pparticles; return 1; }; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt options. + * @return An error code. + */ + virtual int OpenRootFile(const char * filename, Option_t * opt = "RECREATE"); + + /** + * Close Root file. + * @return An error code. + */ + virtual int CloseRootFile(); + + /** + * Creates trees for the truth, model and measured particles. + * @return An error code. + */ + int CreateTrees(); + + /** + * Creates a tree for the model particles. + * @return An error code. + */ + int CreateTreeModel(); + + /** + * Creates a tree for the measured particles. + * @return An error code. + */ + int CreateTreeMeasured(); + + /** + * Creates a tree for the selected particles. + * @return An error code. + */ + int CreateTreeSelected(); + + /** + * Creates a tree for the truth particles. + * @return An error code. + */ + int CreateTreeTruth(); + + /** + * Creates a tree for the matching information. + * @return An error code. + */ + int CreateTreeMatching(); + + /** + * Creates a tree for the mapping information. + * @return An error code. + */ + int CreateTreeMap(); + + /** + * Fills copies of the model particles of the current permutation + * into the tree variables. + * @return An error code. + */ + int FillTreeModelPermutation(); + + /** + * Deletes all but the n best permutation from TreeModel. + * @param n Number of best permutations which should be kept. + * @return An error code. + */ + int TreeModelDeleteAllButNBestPermutations(unsigned int n); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeMeasured(); + + /** + * Fills copies of the measured particles into the tree variables. + * @return An error code. + */ + int FillTreeSelected(); + + /** + * Fills copies of the truth particles into the tree variables. + * @return An error code. + */ + int FillTreeTruth(); + + /** + * Fill copies of the matching information in the tree variables. + * @return An error code. + */ + int FillTreeMatching(); + + /** + * Fill copies of the mapping information in the tree variables. + * @return An error code. + */ + int FillTreeMap(); + + /** + * Fill the trees. + * @return An error code. + */ + int FillTrees(); + + /** + * Fill the event weight. + * @return An error code. + */ + int SetEventWeight(double weight); + + /** + * Fill the photon type. + * @return An error code. + */ + int SetPhotonType(bool isNotClassified, bool isRadTopProd, bool isHadTopRadDecay, bool isLepTopRadDecay, bool isHadWRadDecay, bool isLepWRadDecay); + + /** + * A helper class which removes blanks from a string. + * @param str A string. + * @return A string. + */ + std::string ModifyString(std::string str); + + /* @} */ + + protected: + + /** + * A pointer to a pointer to a set of truth particles. + */ + KLFitter::Particles ** fParticlesTruth; + + /** + * A pointer to a pointer to a set of model particles. + */ + KLFitter::Particles ** fParticlesModel; + + /** + * A pointer to a pointer to a set of measured particles. + */ + KLFitter::Particles ** fParticlesMeasured; + + /** + * A pointer to a pointer to a set of selected particles. + */ + KLFitter::Particles ** fParticlesSelected; + + /** + * A pointer to the matching tool + */ + KLFitter::MatchingTool * fMatchingTool; + + /** + * A pointer to the selection tool + */ + KLFitter::SelectionTool * fSelectionTool; + + /** + * A pointer to a fitter + */ + KLFitter::Fitter * fFitter; + + /** + * The Root tree for the truth particles + */ + TTree * fTreeTruth; + + /** + * The Root tree for the model particles + */ + TTree * fTreeModel; + + /** + * The Root tree for the measured particles + */ + TTree * fTreeMeasured; + + /** + * The Root tree for the selected particles + */ + TTree * fTreeSelected; + + /** + * The Root tree for the matching information + */ + TTree * fTreeMatching; + + /** + * The Root tree for mapping the selected to the measured particles + */ + TTree * fTreeMap; + + private: + + /** + * A helper method for resizing vectors of vectors. + * @param v The vector of vectors. + * @param length The new length. + */ + template<class type> void Resize(std::vector<std::vector<type> * > * v, unsigned int length); + + /** + * A helper method for creating the branch names for TreeMeasured + * @param The type of the particle + * @return Particle name - empty string for particles that cannot be measured directly + */ + + std::string TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType); + + /** \name The tree variables */ + /* @{ */ + + int fTreeVarEventNumber; + int fTreeVarNPermutations; + int fTreeVarNBTags; + std::vector<int> * fTreeVarBestPermutation; + std::vector<double> * fTreeVarLogLikelihood; +// std::vector<std::vector<double> > * fTreeVarLogLikelihoodComponents; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_NuWT; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_b1; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_b2; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lep1; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_lep2; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_antinueta; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_nueta; + std::vector<double> * fTreeVarLogLikelihoodComp_TF_minv; + + /* std::vector<double> * fTreeVarMinuitStatus; */ +/* std::vector<unsigned int> * fTreeVarConvergenceStatus; */ + std::vector<double> * fTreeVarIntegral; + std::vector<double> * fTreeVarEventProbability; + + int fTreeVarNPartonsMeasured; + int fTreeVarNElectronsMeasured; + int fTreeVarNMuonsMeasured; + int fTreeVarNPhotonsMeasured; + + int fTreeVarNPartonsSelected; + int fTreeVarNElectronsSelected; + int fTreeVarNMuonsSelected; + int fTreeVarNPhotonsSelected; + + std::vector <std::vector<double> *> * fTreeVarParameters; + //std::vector <std::vector<double> *> * fTreeVarParameterErrors; + std::vector <std::vector<double> *> * fTreeVarModel; + std::vector <std::vector<int> *> * fTreeIntVarModel; + std::vector <std::vector<double> *> * fTreeVarMeasured; + std::vector <std::vector<double> *> * fTreeVarSelected; + std::vector <std::vector<double> *> * fTreeVarTruth; + + std::vector <int *> * fTreeVarNMatchedPartons; + std::vector <int *> * fTreeVarNMatchedElectrons; + std::vector <int *> * fTreeVarNMatchedMuons; + std::vector <int *> * fTreeVarNMatchedPhotons; + + std::vector <std::vector<int> *> * fTreeVarMatchedPartons; + std::vector <std::vector<int> *> * fTreeVarMatchedElectrons; + std::vector <std::vector<int> *> * fTreeVarMatchedMuons; + std::vector <std::vector<int> *> * fTreeVarMatchedPhotons; + + std::vector<int> * fTreeVarMapJets; + std::vector<int> * fTreeVarMapElectrons; + std::vector<int> * fTreeVarMapMuons; + std::vector<int> * fTreeVarMapPhotons; + + double fEventWeight; + + bool fIsNotClassified; + bool fIsRadTopProd; + bool fIsHadTopRadDecay; + bool fIsLepTopRadDecay; + bool fIsHadWRadDecay; + bool fIsLepWRadDecay; + + /* @} */ + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceRoot.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceRoot.h new file mode 100644 index 0000000000000000000000000000000000000000..e3c5a2cbe010d8b7b971f4732f64a711a274ce03 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/InterfaceRoot.h @@ -0,0 +1,202 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::InterfaceRoot + * \brief A class for interfacing a Root file. + * \author Kevin Kröninger + * \version 1.3 + * \date 03.12.2009 + * + * This class interfaces to a Root file. + */ + +// --------------------------------------------------------- + +#ifndef INTERFACEROOT +#define INTERFACEROOT + +// --------------------------------------------------------- + +#include "KLFitterExtras/InterfaceBase.h" + +#include <TROOT.h> +#include <fstream> + +// --------------------------------------------------------- + +class TFile; + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class InterfaceRoot : public InterfaceBase + { + + public: + + /** \name Enumerators */ + /* @{ */ + + /** + * Enumerate for signal MC generator + */ + enum MCGenerator {kHerwig, kAcer}; + + /* @} */ + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + InterfaceRoot(); + + /** + * The default destructor. + */ + virtual ~InterfaceRoot(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Fill measured particles with data from tree. + * @param index The event number. + * @return An error code. + */ + virtual int Event(int /*index*/) + { return 0; }; + + /** + * Return the number of events. + * @return The number of events + */ + virtual int NEvents() + { return 0; }; + + /** + * Return the measured missing transverse energy. + * @return The missing ET + */ + virtual double ET_miss() + { return 0; }; + + /** + * Return the transverse mass of the W boson + * @return The MWT + */ + virtual double MWT() + { return 0; }; + + /** + * Return the measured missing transverse energy (x component). + * @return The missing ET (x component) + */ + virtual double ET_miss_x() + { return 0; }; + + /** + * Return the measured missing transverse energy (y component). + * @return The missing ET (y component) + */ + virtual double ET_miss_y() + { return 0; }; + + /** + * Return the measured total scalar transverse energy. + * @return The total scalar ET + */ + virtual double Sum_ET() + { return 0; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set FlagWriteSignalMCTruth and chose the corresponding signal MC generator with default kHerwig. + * @param flag If true, truth particle container is filled. + * @param mcgen The current signal MC generator for TruthMapping. + * @return An error code. + */ + int WriteSignalMCTruth(bool flag, KLFitter::InterfaceRoot::MCGenerator mcgen = KLFitter::InterfaceRoot::kHerwig) + { fFlagWriteSignalMCTruth = flag; fSignalMCGen = mcgen; return 1; }; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Open Root file containing tree. + * @param filename The filename. + * @param opt Options. + * @return An error code. + */ + virtual int OpenRootFile(const char * filename, Option_t * opt = "READ"); + + /** + * Open Root files containing tree. + * @param filenames The filenames. + * @param opt Options. + * @return An error code. + */ + virtual int OpenRootFiles(std::vector<std::string> /*filenames*/, Option_t * /*opt*/= "READ") + { return 1; }; + + /** + * Close Root file. + * @return An error code. + */ + virtual int CloseRootFile(); + /** + * Read input files from txt-file. + * @param filename The name of the txt-file. + * @return An error code. + */ + virtual std::vector<std::string> ReadInputFiles(const char * filename); + + + /** + * Set the proper (global) b-tagging (SV0) cut-value, efficiencies and rejections. + */ + void SetBtaggingInformation(double cut, double eff, double rej) { fBtagCut = cut; fBtagEff = eff; fBtagRej = rej; }; + + /* @} */ + + protected: + /** + * A flag for writing Signal MC truth to output. + */ + bool fFlagWriteSignalMCTruth; + + /** + * The current Signal MC generator for TruthMapping. + */ + KLFitter::InterfaceRoot::MCGenerator fSignalMCGen; + /** + * The Root file. + */ + TFile * fRootFile; + + /** + * B-tagging stuff + */ + double fBtagCut; + double fBtagEff; + double fBtagRej; + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma.h new file mode 100644 index 0000000000000000000000000000000000000000..4ee45d4246ccb41cc5beca8b34886506ec157692 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma.h @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_RadTopProd + * \brief A class implementing a base likelihood for the ttbar+gamma events (semileptonic channel) + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a base likelihood for ttbar+gamma (semileptonic) + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA +#define LIKELIHOODTTGAMMA + +// --------------------------------------------------------- + +#include "KLFitter/LikelihoodTopLeptonJets.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma : public KLFitter::LikelihoodTopLeptonJets + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma(); + + /** + * Update 4-vectors of model particles. + * @return An error flag. + */ + virtual int CalculateLorentzVectors(std::vector <double> const& parameters); + + /** + * 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); + + + /** + * 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. + */ + std::vector<double> GetInitialParametersWoNeutrinoPz(); + + protected: + + /** + * Adjust parameter ranges + */ + int AdjustParameterRanges(); + + /** + * Define the parameters of the fit. + */ + // this is protected, because of implicit calls from base class constructor + // -> has become just a helper for the constructor + void DefineParameters(); + + /** + * Define the model particles + * @return An error code. + */ + // this is protected, because of implicit calls from base class constructor + // -> has become just a helper for the constructor + int DefineModelParticles(); + + /** + * Calculates 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() { return KLFitter::LikelihoodTopLeptonJets::GetNeutrinoPzSolutions(); }; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadTopRadDecay.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadTopRadDecay.h new file mode 100644 index 0000000000000000000000000000000000000000..d10d4ebe3c7127c477ce5666ae2c9b8929418391 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadTopRadDecay.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_RadTopProd + * \brief A class implementing a likelihood for radiative decay of the hadronic top + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a likelihood for radiative decay of the hadronic top + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA_HADTOPRADDECAY +#define LIKELIHOODTTGAMMA_HADTOPRADDECAY + +// --------------------------------------------------------- + +#include "KLFitterExtras/LikelihoodTTGamma.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma_HadTopRadDecay : public KLFitter::LikelihoodTTGamma + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma_HadTopRadDecay(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma_HadTopRadDecay(); + + protected: + + /** + * Update 4-vectors of model particles. + * @return An error flag. + */ + virtual int CalculateLorentzVectors(std::vector <double> const& parameters); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadWRadDecay.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadWRadDecay.h new file mode 100644 index 0000000000000000000000000000000000000000..b7c31bf8ad20f54ece35080deb4c40c49b4f9eb5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_HadWRadDecay.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_HadWRadDecay + * \brief A class implementing a likelihood for radiative decay of the hadronic W + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a likelihood for radiative decay of the hadronic W + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA_HADWRADDECAY +#define LIKELIHOODTTGAMMA_HADWRADDECAY + +// --------------------------------------------------------- + +#include "LikelihoodTTGamma.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma_HadWRadDecay : public KLFitter::LikelihoodTTGamma + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma_HadWRadDecay(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma_HadWRadDecay(); + + protected: + + /** + * Update 4-vectors of model particles. + * @return An error flag. + */ + virtual int CalculateLorentzVectors(std::vector <double> const& parameters); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepTopRadDecay.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepTopRadDecay.h new file mode 100644 index 0000000000000000000000000000000000000000..6138b7c771bb57a34d1d9c773344d3229009e4d9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepTopRadDecay.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_LepTopRadDecay + * \brief A class implementing a likelihood for radiative decay of the leptonic top + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a likelihood for radiative decay of the leptonic top + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA_LEPTOPRADDECAY +#define LIKELIHOODTTGAMMA_LEPTOPRADDECAY + +// --------------------------------------------------------- + +#include "LikelihoodTTGamma.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma_LepTopRadDecay : public KLFitter::LikelihoodTTGamma + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma_LepTopRadDecay(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma_LepTopRadDecay(); + + protected: + + /** + * Update 4-vectors of model particles. + * @return An error flag. + */ + virtual int CalculateLorentzVectors(std::vector <double> const& parameters); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepWRadDecay.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepWRadDecay.h new file mode 100644 index 0000000000000000000000000000000000000000..8e97cfa0bcac962e8714fd52552c9daa00937ef1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_LepWRadDecay.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_LepWRadDecay + * \brief A class implementing a likelihood for radiative decay of the leptonic W + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a likelihood for radiative decay of the leptonic W + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA_LEPWRADDECAY +#define LIKELIHOODTTGAMMA_LEPWRADDECAY + +// --------------------------------------------------------- + +#include "LikelihoodTTGamma.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma_LepWRadDecay : public KLFitter::LikelihoodTTGamma + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma_LepWRadDecay(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma_LepWRadDecay(); + + protected: + + /** + * Update 4-vectors of model particles. + * @return An error flag. + */ + virtual int CalculateLorentzVectors(std::vector <double> const& parameters); + + /** + * Calculates 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(); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_RadTopProd.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_RadTopProd.h new file mode 100644 index 0000000000000000000000000000000000000000..ff6d8340685c5b8065b330c29eaf85e1bd7d3d9f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/LikelihoodTTGamma_RadTopProd.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::LikelihoodTTGamma_RadTopProd + * \brief A class implementing a likelihood for radiative top production + * \author Johannes Erdmann + * \version 1.3 + * \date 26.02.2010 + * + * This class represents a likelihood for radiative top production + */ + +// --------------------------------------------------------- + +#ifndef LIKELIHOODTTGAMMA_RADTOPPROD +#define LIKELIHOODTTGAMMA_RADTOPPROD + +// --------------------------------------------------------- + +#include "LikelihoodTTGamma.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class LikelihoodTTGamma_RadTopProd : public KLFitter::LikelihoodTTGamma + { + + public: + + /** + * The default constructor. + */ + LikelihoodTTGamma_RadTopProd(); + + /** + * The default destructor. + */ + virtual ~LikelihoodTTGamma_RadTopProd(); + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/MatchingTool.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/MatchingTool.h new file mode 100644 index 0000000000000000000000000000000000000000..cec9e3d8915a5d3868a143570d0952c6aae6f203 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/MatchingTool.h @@ -0,0 +1,243 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + * \class KLFitter::MatchingTool + * \brief A class for matching truth to measured Quantities. + * \author Stefan Guindon + * \version 1.3 + * \date 03.12.2009 + * + * This class matches truth to measured sets of particles. + * + */ + + +// --------------------------------------------------------- + +#ifndef MATCHINGTOOL +#define MATCHINGTOOL + +// --------------------------------------------------------- + +#include "KLFitter/Particles.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class MatchingTool + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + * @param particles A pointer to a set of particles + * @param particlestruth A pointer to a set of truth particles + */ + MatchingTool(KLFitter::Particles ** particles, KLFitter::Particles ** particlestruth); + + /** + * The default destructor. + */ + virtual ~MatchingTool(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the matching status of a truth and a reco particle. + * @param indextruth The index of the truth particle. + * @param indexreco The index of the reco particle + * @param ptype The type of the particle. + * @return The matching status of a truth and a reec particle. + */ + int MatchingStatus(int indextruth, int indexreco, KLFitter::Particles::ParticleType ptype); + + /** + * Return the number of matches of a truth particle. + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return The number of matches of a truth particle. + */ + int NMatchedTruth(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Return the number of matches of a truth particle. + * @param name The name of the particle. + * @return The number of matches of a truth particle. + */ + int NMatchedTruth(const char * name); + + /** + * Return the list of matches of a truth particle. The length of + * the vector equals the number of reco objects of that type. The + * entries are the matching status (-1: unknown, 0: no match; 1: + * match). + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return The list of matches of a truth particle. + */ + std::vector<int> ListMatchedTruth(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Return the list of matches of a truth particle. The length of + * the vector equals the number of reco objects of that type. The + * entries are the matching status (-1: unknown, 0: no match; 1: + * match). + * @param name The name of the particle. + * @return The list of matches of a truth particle. + */ + std::vector<int> ListMatchedTruth(const char * name); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set delta R matching criterion for partons. + * @param deltaR The maximum deltaR to match two particles. + */ + void SetDeltaRPartons(double deltaR); + + /** + * Set delta R matching criterion for electrons. + * @param deltaR The maximum deltaR to match two particles. + */ + void SetDeltaRElectrons(double deltaR); + + /** + * Set delta R matching criterion for muons. + * @param deltaR The maximum deltaR to match two particles. + */ + void SetDeltaRMuons(double deltaR); + + /** + * Set delta R matching criterion for photons. + * @param deltaR The maximum deltaR to match two particles. + */ + void SetDeltaRPhotons(double deltaR); + + /** + * Set the matching status. + * @param indextruth The truth particle. + * @param indexreco The reco particle. + * @param ptype The type of the particle. + * @param stat The status. + */ + int SetMatchingStatus(int indextruth, int indexreco, KLFitter::Particles::ParticleType ptype, int stat); + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Initialize vectors of a certain type. + * @param ptype The type of the particle. + * @return An error code. + */ + int Initialize(KLFitter::Particles::ParticleType ptype); + + /** + * Match all truth particles of a certain type to reco particles. + * @param ptype The particle type. + * @return An error code. + */ + int MatchTruthAll(KLFitter::Particles::ParticleType ptype); + + /** + * Match a truth particle of a certain type to all reco particles. + * @param index The index of the particle. + * @param ptype The type of the particle. + * @return Matching status flag (1: at least one match, 0: no matches). + */ + int MatchTruth(int index, KLFitter::Particles::ParticleType ptype); + + /** + * Check if two objects of a certain type are matched. + * @param index1 Index of measured particle. + * @param index2 Index for truth particle. + * @param ptype The particle type. + * @return Matching status flag (1: matched, 0: not matched). + */ + virtual int MatchVectors(int index1, int index2, KLFitter::Particles::ParticleType ptype); + + /** + * Perform matching of two Lorentz vectors based on a deltaR + * criterion. + * @param vect1 A pointer to a particle. + * @param vect2 A pointer to a particle. + * @param dR The delteR criterion. + * @return Matching status flag (1: matched, 0: not matched). + */ + int MatchDeltaR(TLorentzVector * vect1, TLorentzVector * vect2, double dR); + + /* @} */ + + protected: + + /** + * A pointer to the original particles. + */ + KLFitter::Particles ** fParticles; + + /** + * A pointer to the original truth particles. + */ + KLFitter::Particles ** fParticlesTruth; + + /** + * DeltaR criterion for partons. + */ + double fDeltaRPartons; + + /** + * DeltaR criterion for electrons. + */ + double fDeltaRElectrons; + + /** + * DeltaR criterion for muons. + */ + double fDeltaRMuons; + + /** + * DeltaR criterion for photons. + */ + double fDeltaRPhotons; + + /** + * A pointer to the vector of vectors matching truth partons + */ + std::vector< std::vector<int> > * fMatchedPartons; + + /** + * A pointer to the vector of vectors matching truth electrons + */ + std::vector< std::vector<int> > * fMatchedElectrons; + + /** + * A pointer to the vector of vectors matching truth muons + */ + std::vector< std::vector<int> > * fMatchedMuons; + + /** + * A pointer to the vector of vectors matching truth photons + */ + std::vector< std::vector<int> > * fMatchedPhotons; + }; + +}// namespace KLFitter + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/PhotonType.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/PhotonType.h new file mode 100644 index 0000000000000000000000000000000000000000..f6930528645a6d2acb96b345e36d1222c6d61cce --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/PhotonType.h @@ -0,0 +1,231 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::PhotonType + * \brief A class describing truth photon classification by invariant mass cuts + * \author Johannes Erdmann + * \version 1.3 + * \date 01.03.2010 + * + * This class implements a possibility to classify truth photons by cutting on + * the invariant masses of the final state particles of hadronic and leptonic + * top quarks and W bosons including the photon or not in the 4-vector sum. + */ + +// --------------------------------------------------------- + +#ifndef PHOTONTYPE +#define PHOTONTYPE + +#include "KLFitter/PhysicsConstants.h" +#include <cmath> +#include <TLorentzVector.h> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class Particles; + + class PhotonType + { + + public: + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + PhotonType(); + + /** + * The default destructor. + */ + ~PhotonType() { ; }; + + /* @} */ + /** \name Member function (Classification) */ + /* @{ */ + + /** + * Classify truth photons + * @return An error flag + */ + int Classify(); + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Set the top mass acceptance + */ + void SetDeltaTopMass(double dM) { deltaTopMass = dM; }; + + /** + * Set the W mass acceptance + */ + void SetDeltaWMass(double dM) { deltaWMass = dM; }; + + /** + * Set the truth particles. + * @param particles A pointer to a set of particles. + * @return An error flag. + */ + int SetTruthParticles(KLFitter::Particles ** particles) { fTruthParticles = particles; return 1; }; + + /** + * Set the table of physics constants. + * @return A pointer to the physics constants. + */ + void SetPhysicsConstants(KLFitter::PhysicsConstants * physicsConstants) + { fPhysicsConstants = physicsConstants; }; + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Is not classified + * @return A boolean + */ + bool IsNotClassified() { return isNotClassified; }; + + /** + * Is radiative top production + * @return A boolean + */ + bool IsRadTopProd() { return isRadTopProd; }; + + /** + * Is radiative decay of hadronic top + * @return A boolean + */ + bool IsHadTopRadDecay() { return isHadTopRadDecay; }; + + /** + * Is radiative decay of lepronic top + * @return A boolean + */ + bool IsLepTopRadDecay() { return isLepTopRadDecay; }; + + /** + * Is radiative decay of hadronic w + * @return A boolean + */ + bool IsHadWRadDecay() { return isHadWRadDecay; }; + + /** + * Is radiative decay of lepronic w + * @return A boolean + */ + bool IsLepWRadDecay() { return isLepWRadDecay; }; + + /* @} */ + + private: + + /** + * Make composite particles out of the decay particles + */ + void MakeCompositeParticles(); + + /** + * The composite particles + */ + TLorentzVector htop; + TLorentzVector htop_g; + TLorentzVector ltop; + TLorentzVector ltop_g; + TLorentzVector hadW; + TLorentzVector hadW_g; + TLorentzVector lepW; + TLorentzVector lepW_g; + + /** + * Methods for the actual classification + * @return A boolean + */ + bool ClassifyRadTopProd(); + bool ClassifyHadTopRadDecay(); + bool ClassifyLepTopRadDecay(); + bool ClassifyHadWRadDecay(); + bool ClassifyLepWRadDecay(); + /** + * The top mass acceptance. + */ + double deltaTopMass; + + /** + * The W mass acceptance. + */ + double deltaWMass; + + /** + * Flag for non-classified events + */ + bool isNotClassified; + + /** + * Flag for radiative top production + */ + bool isRadTopProd; + + /** + * Flag for radiative decay of hadronic top + */ + bool isHadTopRadDecay; + + /** + * Flag for radiative decay of lepronic top + */ + bool isLepTopRadDecay; + + /** + * Flag for radiative decay of hadronic w + */ + bool isHadWRadDecay; + + /** + * Flag for radiative decay of lepronic w + */ + bool isLepWRadDecay; + + /** + * The truth particles + */ + KLFitter::Particles ** fTruthParticles; + + /** + * The pointer to the table with the physics constants. + */ + KLFitter::PhysicsConstants * fPhysicsConstants; + + /** + * Helper methods for "equal", "lower" and "bigger" + * w.r.t. to the true particle mass and the delta(M) + * acceptance. + */ + bool eqTopM(double m, double acceptance) { return fabs(m - fPhysicsConstants->MassTop()) < acceptance; } + bool btTopM(double m, double acceptance) { return m - fPhysicsConstants->MassTop() > acceptance; } + bool ltTopM(double m, double acceptance) { return m - fPhysicsConstants->MassTop() < -acceptance; } + bool eqWM(double m, double acceptance) { return fabs(m - fPhysicsConstants->MassW()) < acceptance; } + bool btWM(double m, double acceptance) { return m - fPhysicsConstants->MassW() > acceptance; } + bool ltWM(double m, double acceptance) { return m - fPhysicsConstants->MassW() < -acceptance; } + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/ReadConfigFile.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/ReadConfigFile.h new file mode 100644 index 0000000000000000000000000000000000000000..e8db7aa84707294723db739d3b4349ef5480c8e6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/ReadConfigFile.h @@ -0,0 +1,271 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class KLFitter::ReadConfigFile + * \brief A class for reading a config file for runKLFitter files + * \author Sven Ebert + * \author Johannes Erdmann + * \version 1.3 + * \date 23.04.2010 + * + * This class reads a config file with running settings. + */ + +// --------------------------------------------------------- + +#ifndef READCONFIGFILE +#define READCONFIGFILE + +// --------------------------------------------------------- + +#include <string> +#include "KLFitter/DetectorBase.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" +#include "KLFitter/LikelihoodTopLeptonJetsUDSep.h" + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class ReadConfigFile + { + + public: + + /* @} */ + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + ReadConfigFile(std::string filename); + //Second possible constructor. + ReadConfigFile(std::string filename, bool * validconfig); + + /** + * The default destructor. + */ + virtual ~ReadConfigFile(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the LeptonType flag + * @return The flag. + */ + KLFitter::LikelihoodTopLeptonJets::LeptonType GetLeptonType() { return LeptonType; } + + /** + * Return the DO_BATCH flag + * @return The flag. + */ + bool GetDO_BATCH() { return DO_BATCH; } + + /** + * Return BTaggingMethod + * @return The flag. + */ + KLFitter::LikelihoodBase::BtaggingMethod GetBTaggingMethod() { return BTaggingMethod; } + + /** + * Return FlagIntegrate + * @return The flag. + */ + bool GetFlagIntegrate() { return FlagIntegrate; } + + /** + * Return FlagTopMassFixed + * @return The flag. + */ + bool GetFlagTopMassFixed() { return FlagTopMassFixed; } + + /** + * Return FlagHiggsMassFixed + * @return The flag. + */ + bool GetFlagHiggsMassFixed() { return FlagHiggsMassFixed; } + + /** + * Return FlagUseJetMass + * @return The flag. + */ + bool GetFlagUseJetMass() { return FlagUseJetMass; } + + /** + * Return FlagWriteSignalMCTruth + * @return The flag. + */ + bool GetFlagWriteSignalMCTruth() { return FlagWriteSignalMCTruth; } + + /** + * Return FlagIsSignalMC + * @return The flag. + */ + double GetTopMass() { return TopPoleMass; } + + /** + * Return FlagIsSignalMC + * @return The flag. + */ + double GetHiggsMass() { return HiggsMass; } + + /** + * Return Fthe BTagging cut value + * @return The value. + */ + double GetCutBTagging() { return CutBTagging; } + + /** + * Return input_path + * @return The path. + */ + std::string GetInputPath() { return input_path; } + + /** + * Return output_path + * @return The path. + */ + std::string GetOutputPath() { return output_path; } + + /** + * Return IsBkg + * @return The flag. + */ + bool GetIsBkg() { return IsBkg; } + + /** + * Return BeamCMEnergy + * @return The flag. + */ + KLFitter::DetectorBase::BeamCMEnergy GetBeamCMEnergy() { return BeamEnergy; } + + + /** + * Flag for using the truth selection. + */ + bool GetFlagTruthSel() { return FlagTruthSel; } + + /** + * Flag for using the light quark permutation. + */ + KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod GetLJetSeparationMethod() { return LJetSeparationMethod; } + + /** + * Flag for doing the comparison to TopKLFitter. + */ + bool GetFlagAthenaComp() { return FlagAthenaComp; } + + private: + + int ReadConfig(std::string filename); + int GetTrueOrFalse(std::string line, size_t found); + int GetValue(double * ret, std::string line, size_t found); + int GetPath(std::string * ret, std::string line, size_t found); + bool IsNumber(std::string::iterator a, int * number); + bool CheckIOPath(); + + /** + * The LeptonType flag. + */ + KLFitter::LikelihoodTopLeptonJets::LeptonType LeptonType; + + /** + * The DO_BATCH flag. + */ + bool DO_BATCH; + + /** + * The BTaggingMethod. + */ + KLFitter::LikelihoodBase::BtaggingMethod BTaggingMethod; + + /** + * The FlagIntegrate. + */ + bool FlagIntegrate; + + /** + * The FlagTopMassFixed. + */ + bool FlagTopMassFixed; + + /** + * The FlagHiggsMassFixed. + */ + bool FlagHiggsMassFixed; + + /** + * The FlagUseJetMass. + */ + bool FlagUseJetMass; + + /** + * The FlagWriteSignalMCTruth. + */ + bool FlagWriteSignalMCTruth; + + /** + * The top mass. + */ + double TopPoleMass; + + /** + * The Higgs mass. + */ + double HiggsMass; + + /** + * The cut value. + */ + double CutBTagging; + /** + * Path of the inputfile. + */ + std::string input_path; + + /** + * Path of the outputfile. + */ + std::string output_path; + + /** + * For background (w/o truth info!) + */ + bool IsBkg; + /** + * Flag for using 7TeV transferfunctions + */ + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy; + + /** + * Flag for using the truth selection. + */ + bool FlagTruthSel; + + /** + * Flag for using the light quark (and b Quark) reweighting. + */ + KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod LJetSeparationMethod; + + /** + * Flag for doing the comparison to TopKLFitter. + */ + bool FlagAthenaComp; + + }; + +} // namespace KLFitter + +// --------------------------------------------------------- + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/SelectionTool.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/SelectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..31594173f441f751d3ab026eb50eb81ca6910f1c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/SelectionTool.h @@ -0,0 +1,462 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + * \class KLFitter::SelectionTool + * \brief A class for object selection + * \author Kevin Kroeninger + * \version 1.3 + * \date 03.12.2009 + * + * This class reads in a set of particles and returns a subset + * together with a map. + * + */ + + +// --------------------------------------------------------- + +#ifndef SELECTIONTOOL +#define SELECTIONTOOL + +// --------------------------------------------------------- + +#include "KLFitter/Particles.h" + +#include <vector> + +// --------------------------------------------------------- + +/*! + * \namespace KLFitter + * \brief The KLFitter namespace + */ +namespace KLFitter +{ + + class SelectionTool + { + + public: + + /** + * Defines a cut.\n + * value: + */ + typedef struct { + double value; /**< the value to be cut on, e.g., jet pT. */ + int n; /**< the number of objects required to survive the cut.*/ + int dn; /**< tolerance.*/ + } Cut; + + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor. + */ + SelectionTool(); + + /** + * The default destructor. + */ + virtual ~SelectionTool(); + + /* @} */ + /** \name Member functions (Get) */ + /* @{ */ + + /** + * Return the selected particles + * @return The set of selected particles + */ + Particles * ParticlesSelected() + { return fParticlesSelected; }; + + /** + * Return the selected particles + * @return The set of selected particles + */ + Particles ** PParticlesSelected() + { return &fParticlesSelected; }; + + /** + * Return the map for jets. */ + std::vector <int> MapJets() { return fMapJets; }; + + /** + * Return the map for electrons. */ + std::vector <int> MapElectrons() { return fMapElectrons; }; + + /** + * Return the map for muons. */ + std::vector <int> MapMuons() { return fMapMuons; }; + + /** + * Return the map for photons. */ + std::vector <int> MapPhotons() { return fMapPhotons; }; + + /** + * Return the counter variables for events. */ + int CounterEvents() { return fCounterEvents; }; + + /** + * Return the counter variables for jets. */ + int CounterJets() { return fCounterJets; }; + + /** + * Return the counter variables for b-jets. */ + int CounterBJets() { return fCounterBJets; }; + + /** + * Return the counter variables for electrons. */ + int CounterElectrons() { return fCounterElectrons; }; + + /** + * Return the counter variables for muons. */ + int CounterMuons() { return fCounterMuons; }; + + /** + * Return the counter variables for photons. */ + int CounterPhotons() { return fCounterPhotons; }; + + /** + * Return the counter variables for missing ET. */ + int CounterMET() { return fCounterMET; }; + + /** + * Return the counter variables for MWT. */ + int CounterMWT() { return fCounterMWT; }; + + /** + * Return the counter variables for triangular cut. */ + int CounterTriangular() { return fCounterTriangular; }; + + /** + * Return the counter variables for the selection. */ + int CounterSelected() { return fCounterSelected; }; + + /* @} */ + /** \name Member functions (Set) */ + /* @{ */ + + /** + * Add a cut on the number of jets. + * @param pt The pt. + * @param n The number. + * @param dn Tolerance. + * @return An error flag. + */ + int RequireNJetsPt(double pt, int n, int dn = -1); + + /** + * Add a cut on the number of jets. + * @param weight The b-tag weight. + * @param n The number. + * @param dn Tolerance. + * @return An error flag. + */ + int RequireNBJets(double weight, int n, int dn = -1); + + /** + * Add a cut on the number of jets. + * @param pt The pt. + * @param n The number. + * @param dn Tolerance. + * @return An error flag. + */ + int RequireNBJetsPt(double pt, int n, int dn = -1); + + /** + * Add a cut on the number of electrons. + * @param pt The pt. + * @param n The number. + * @return An error flag. */ + int RequireNElectronsPt(double pt, int n); + + /** + * Add a cut on the number of muons. + * @param pt The pt. + * @param n The number. + * @return An error flag. */ + int RequireNMuonsPt(double pt, int n); + + + /** + * Add a cut on the number of photons. + * @param pt The pt. + * @param n The number. + * @return An error flag. */ + int RequireNPhotonsPt(double pt, int n); + + /** + * Add a cut on the missing ET. + * @param met The missing ET. + * @return An error flag. */ + int RequireMET(double met); + + /** + * Add a cut on the MWT. + * @param met The MWT. + * @return An error flag. */ + int RequireMWT(double met); + + /** + * Add a triangular cut MET+MWT + * @param met The sum of missing ET and MWT. + * @return An error flag. */ + int RequireTriangular(double met); + + /** + * Set jet eta cut. + * @param eta The eta region (|eta|<x). . + */ + void SelectJetEta(double eta) { fJetEta = eta; }; + + /** + * Set electron eta cut. + * @param eta The eta region (|eta|<x). . + */ + void SelectElectronEta(double eta) { fElectronEta = eta; }; + + /** + * Set muon eta cut. + * @param eta The eta region (|eta|<x). . + */ + void SelectMuonEta(double eta) { fMuonEta = eta; }; + + /** + * Set photon eta cut. + * @param eta The eta region (|eta|<x). . + */ + void SelectPhotonEta(double eta) { fPhotonEta = eta; }; + + /** + * Set jet jvf cut. + * @param eta The cut value + */ + void SelectJetJVF(double jvf) { fJetJVF = jvf; }; + + /* @} */ + /** \name Member functions (misc) */ + /* @{ */ + + /** + * Read in a set of particles and return only selected objects. + * @param particles A set of particles. + */ + int SelectObjects(KLFitter::Particles * particles); + + /** + * Select the events. + * @param particles The set of particles. + * @param MET The missing ET. + * @param MWT The MWT. + * @return event either passed the selection (1) or not (0) + */ + int SelectEvent(KLFitter::Particles * particles, double MET = 0., double MWT = 0.); + + /** + * Number of jets to consider in the fit. + * @param n The number of jetes. + */ + void SetMaxNJetsForFit(int n) { fMaxNJetsForFit = n; }; + + void ResetMaps(); + + void ResetCounter(); + + /* @} */ + + protected: + + /** + * A pointer to the selected particles. + */ + KLFitter::Particles * fParticlesSelected; + + /** + * The jet selection criteria: pT. + */ + double fJetPt; + + /** + * The jet selection criteria: eta. + */ + double fJetEta; + + /** + * The jet selection criteria: jvf. + */ + double fJetJVF; + + /** + * The electron selection criteria: pT. + */ + double fElectronPt; + + /** + * The electron selection criteria: eta. + */ + double fElectronEta; + + /** + * The muon selection criteria: pT. + */ + double fMuonPt; + + /** + * The muon selection criteria: eta. + */ + double fMuonEta; + + /** + * The photon selection criteria: pT. + */ + double fPhotonPt; + + /** + * The photon selection criteria: eta. + */ + double fPhotonEta; + + /** + * Event selection criteria for jets. + */ + std::vector <Cut> fNJetsPt; + + /** + * Event selection criteria for jets. + */ + std::vector <Cut> fNBJets; + + /** + * Event selection criteria for electrons. + */ + std::vector <Cut> fNElectronsPt; + + /** + * Event selection criteria for muons. + */ + std::vector <Cut> fNMuonsPt; + + /** + * Event selection criteria for photons. + */ + std::vector <Cut> fNPhotonsPt; + + /** + * Event selection criteria for missing ET. + */ + + double fMET; + + /** + * Event selection criteria for MWT. + */ + + double fMWT; + + /** + * Event selection criteria for triangular cut. + */ + + double fMET_plus_MWT; + + /** + * Counter variables: events + */ + int fCounterEvents; + + /** + * Counter variables: jets + */ + int fCounterJets; + + /** + * Counter variables: b-jets + */ + int fCounterBJets; + + /** + * Counter variables: electrons + */ + int fCounterElectrons; + + /** + * Counter variables: muons + */ + int fCounterMuons; + + /** + * Counter variables: photons + */ + int fCounterPhotons; + + /** + * Counter variables: missing ET + */ + int fCounterMET; + + /** + * Counter variables: MWT + */ + int fCounterMWT; + + /** + * Counter variables: Triangular + */ + int fCounterTriangular; + + /** + * Counter variables: all after selection + */ + int fCounterSelected; + + /** + * Maps : jets + */ + std::vector <int> fMapJets; + + /** + * Maps : electrons + */ + std::vector <int> fMapElectrons; + + /** + * Maps : muons + */ + std::vector <int> fMapMuons; + + /** + * Maps : photons + */ + std::vector <int> fMapPhotons; + + /* + * The number of jets to consider in the fit. + */ + unsigned int fMaxNJetsForFit; + + private: + + /** + * Helper for finding the object pt selection cut from the event selection cuts on the object + * @param cuts The object cuts. + * @return The minimum object pt. + */ + double ObjectPtCut(std::vector<Cut> const& cuts); + + /** + * Helper for removing additional particles not requested + * @param n Number of jets requested by the cut. + * @param type Type of the particles to be removed. + */ + void RemoveAdditionalParticles(int n, KLFitter::Particles::ParticleType type); + + }; + +}// namespace KLFitter + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/readparameters.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/readparameters.h new file mode 100755 index 0000000000000000000000000000000000000000..7b2da74ecd16e9d2af5bca27cd18e1cdc99ebce7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/KLFitterExtras/readparameters.h @@ -0,0 +1,141 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/*! + * \class readparameters + * \brief A class to read a parameter file. + * \author Jörg Meyer + * \version 0.1 + * \date 12.2008 + * \detail This class opens a parameter file and parses variable names + * and values. The required syntax of a line of parameter file is:\n + * variablename value [value]... [#comment]\n + * examples:\n + * number 42\n + * textarray "Hello World" "bye"\n + * The variable values can be read by the functions get() and get_vector()\n + * examples:\n + * int i=rp.get<int>("number");\n + * std::vector<std::string> textarray=rp.get_vector<std::string>("textarray");\n + * where rp is an instance of the class readparameters.\n + */ + +// --------------------------------------------------------- + + + +#ifndef READPARAMETERS_HPP +#define READPARAMETERS_HPP + +#include <vector> +#include <sstream> +#include <map> +#include <string> +#include <exception> + +class readparameters_exception: public std::exception { + +public: + readparameters_exception() : + what_("Unknown exception.") { + } + readparameters_exception(std::string c) : + what_(c) { + } + virtual ~readparameters_exception() throw() { + } + virtual const char* what() const throw(); +private: + std::string what_; +}; + + +class readparameters { + +private: + /** \name Constructors and destructors */ + /* @{ */ + + /** + * The default constructor is not ment to be used (yet) and therefore private. + */ + readparameters() { + } +public: + /** + * Constructor taking the name of a parameter file as argument. + */ + explicit readparameters(const char* filename); + /** + * The default destructor. + */ + ~readparameters(); + + /* @} */ + + /** \name Member functions */ + /* @{ */ + + /** + * @return Check whether 'name' exists in parameter file. + */ + bool exists(std::string name) const { + return tabular.find(name)!=tabular.end(); + } + /** + * @return Get value of variable of type T called 'name'. + */ + template <class T> + T get(std::string name) const { + T ret; + if (exists(name)) { + std::stringstream ss; + ss << tabular[name][0]; + ss >> ret; + } + else { + readparameters_exception excep(std::string("Parameter '")+name+std::string("' does not exist in ")+std::string(filename_)+std::string(".")); + throw excep; + } + return ret; + } + /** + * @return Get value of variable of type std::vector<T> called 'name'. + */ + template <class T> + std::vector<T> get_vector(std::string name) const { + std::vector<T> ret; + if (exists(name)) { + std::stringstream ss; + for (std::vector<std::string>::const_iterator it=tabular[name].begin();it!=tabular[name].end();++it) { + std::stringstream ss; + T val; + ss<<(*it); + ss>>val; + ret.push_back(val); + } + } + else { + readparameters_exception excep(std::string("Parameter '")+name+std::string("' does not exist in ")+std::string(filename_)+std::string(".")); + throw excep; + } + return ret; + } + + /** + * @return Print content of private member tabular. Only for debugging purposes. + */ + void print_tabular(); + + /* @} */ + +private: + mutable std::map<std::string,std::vector<std::string> > tabular; + const char* filename_; +}; + + +std::string int2string(int i); + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorAtlas_10TeV.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorAtlas_10TeV.cxx new file mode 100644 index 0000000000000000000000000000000000000000..59fb1e9a9534222ec4fedb47147ee5dea46a1875 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorAtlas_10TeV.cxx @@ -0,0 +1,361 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/ResDoubleGaussPt.h" +#include "KLFitter/ResDoubleGaussE_1.h" +#include "KLFitter/ResDoubleGaussE_2.h" +#include "KLFitter/ResDoubleGaussE_3.h" +#include "KLFitter/ResGauss.h" + +#include "TString.h" + +#include <cmath> +#include <iostream> + +// --------------------------------------------------------- +KLFitter::DetectorAtlas_10TeV::DetectorAtlas_10TeV(std::string folder) : DetectorBase() +{ + // energy resolution + fResEnergyLightJet_eta1 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_lJets_eta1.txt", folder.c_str())); + fResEnergyBJet_eta1 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_bJets_eta1.txt", folder.c_str())); + fResEnergyGluonJet_eta1 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_gluon_eta1.txt", folder.c_str())); + fResEnergyElectron_eta1 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_Electrons_eta1.txt", folder.c_str())); + fResEnergyMuon_eta1 = new KLFitter::ResGauss(Form("%s/par_energy_Muons_eta1.txt", folder.c_str())); + fResEnergyPhoton_eta1 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta1.txt", folder.c_str())); + + fResEnergyLightJet_eta2 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_lJets_eta2.txt", folder.c_str())); + fResEnergyBJet_eta2 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta2.txt", folder.c_str())); + fResEnergyGluonJet_eta2 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_gluon_eta2.txt", folder.c_str())); + fResEnergyElectron_eta2 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_Electrons_eta2.txt", folder.c_str())); + fResEnergyMuon_eta2 = new KLFitter::ResGauss(Form("%s/par_energy_Muons_eta2.txt", folder.c_str())); + fResEnergyPhoton_eta2 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta2.txt", folder.c_str())); + + fResEnergyLightJet_eta3 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_lJets_eta3.txt", folder.c_str())); + fResEnergyBJet_eta3 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta3.txt", folder.c_str())); + fResEnergyGluonJet_eta3 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_gluon_eta3.txt", folder.c_str())); + fResEnergyElectron_eta3 = new KLFitter::ResDoubleGaussE_3(Form("%s/par_energy_Electrons_eta3.txt", folder.c_str())); + fResEnergyMuon_eta3 = new KLFitter::ResGauss(Form("%s/par_energy_Muons_eta3.txt", folder.c_str())); + fResEnergyPhoton_eta3 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta3.txt", folder.c_str())); + + // eta resolution + fResEtaLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta1.txt", folder.c_str())); + fResEtaLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta2.txt", folder.c_str())); + fResEtaLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta3.txt", folder.c_str())); + + fResEtaBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta1.txt", folder.c_str())); + fResEtaBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta2.txt", folder.c_str())); + fResEtaBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta3.txt", folder.c_str())); + + // phi resolution + fResPhiLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta1.txt", folder.c_str())); + fResPhiLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta2.txt", folder.c_str())); + fResPhiLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta3.txt", folder.c_str())); + + fResPhiBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta1.txt", folder.c_str())); + fResPhiBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta2.txt", folder.c_str())); + fResPhiBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta3.txt", folder.c_str())); + + // missing et resolution in x and y + fResMissingET = new KLFitter::ResGauss(Form("%s/par_misset.txt", folder.c_str())); + + // default settings + fResEnergyLightJet = fResEnergyLightJet_eta1; + fResEnergyBJet = fResEnergyBJet_eta1; + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + fResEnergyElectron = fResEnergyElectron_eta1; + fResEnergyMuon = fResEnergyMuon_eta1; + fResEnergyPhoton = fResEnergyPhoton_eta1; + fResEtaLightJet = fResEtaLightJet_eta1; + fResEtaBJet = fResEtaBJet_eta1; + fResPhiLightJet = fResPhiLightJet_eta1; + fResPhiBJet = fResPhiBJet_eta1; +} + +// --------------------------------------------------------- + +KLFitter::DetectorAtlas_10TeV::~DetectorAtlas_10TeV() +{ + if (fResEnergyLightJet_eta1) + delete fResEnergyLightJet_eta1; + + if (fResEnergyLightJet_eta2) + delete fResEnergyLightJet_eta2; + + if (fResEnergyLightJet_eta3) + delete fResEnergyLightJet_eta3; + + if (fResEnergyBJet_eta1) + delete fResEnergyBJet_eta1; + + if (fResEnergyBJet_eta2) + delete fResEnergyBJet_eta2; + + if (fResEnergyBJet_eta3) + delete fResEnergyBJet_eta3; + + if (fResEnergyGluonJet_eta1) + delete fResEnergyGluonJet_eta1; + + if (fResEnergyGluonJet_eta2) + delete fResEnergyGluonJet_eta2; + + if (fResEnergyGluonJet_eta3) + delete fResEnergyGluonJet_eta3; + + if (fResEnergyElectron_eta1) + delete fResEnergyElectron_eta1; + + if (fResEnergyElectron_eta2) + delete fResEnergyElectron_eta2; + + if (fResEnergyElectron_eta3) + delete fResEnergyElectron_eta3; + + if (fResEnergyMuon_eta1) + delete fResEnergyMuon_eta1; + + if (fResEnergyMuon_eta2) + delete fResEnergyMuon_eta2; + + if (fResEnergyMuon_eta3) + delete fResEnergyMuon_eta3; + + if (fResEnergyPhoton_eta1) + delete fResEnergyPhoton_eta1; + + if (fResEnergyPhoton_eta2) + delete fResEnergyPhoton_eta2; + + if (fResEnergyPhoton_eta3) + delete fResEnergyPhoton_eta3; + + if (fResEtaLightJet_eta1) + delete fResEtaLightJet_eta1; + + if (fResEtaLightJet_eta2) + delete fResEtaLightJet_eta2; + + if (fResEtaLightJet_eta3) + delete fResEtaLightJet_eta3; + + if (fResEtaBJet_eta1) + delete fResEtaBJet_eta1; + + if (fResEtaBJet_eta2) + delete fResEtaBJet_eta2; + + if (fResEtaBJet_eta3) + delete fResEtaBJet_eta3; + + if (fResPhiLightJet_eta1) + delete fResPhiLightJet_eta1; + + if (fResPhiLightJet_eta2) + delete fResPhiLightJet_eta2; + + if (fResPhiLightJet_eta3) + delete fResPhiLightJet_eta3; + + if (fResPhiBJet_eta1) + delete fResPhiBJet_eta1; + + if (fResPhiBJet_eta2) + delete fResPhiBJet_eta2; + + if (fResPhiBJet_eta3) + delete fResPhiBJet_eta3; + + if (fResMissingET) + delete fResMissingET; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyLightJet(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyLightJet = fResEnergyLightJet_eta1; + else if (fabs(eta) < 1.7) + fResEnergyLightJet = fResEnergyLightJet_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyLightJet = fResEnergyLightJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyBJet(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyBJet = fResEnergyBJet_eta1; + else if (fabs(eta) < 1.7) + fResEnergyBJet = fResEnergyBJet_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyBJet = fResEnergyBJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyGluonJet(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + else if (fabs(eta) < 1.7) + fResEnergyGluonJet = fResEnergyGluonJet_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyGluonJet = fResEnergyGluonJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyGluonJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyGluonJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyElectron(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyElectron = fResEnergyElectron_eta1; + else if (fabs(eta) < 1.7) + fResEnergyElectron = fResEnergyElectron_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyElectron = fResEnergyElectron_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyElectron(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyElectron; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyMuon(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyMuon = fResEnergyMuon_eta1; + else if (fabs(eta) < 1.7) + fResEnergyMuon = fResEnergyMuon_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyMuon = fResEnergyMuon_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyMuon(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyMuon; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEnergyPhoton(double eta) +{ + if (fabs(eta) < 1.0) + fResEnergyPhoton = fResEnergyPhoton_eta1; + else if (fabs(eta) < 1.7) + fResEnergyPhoton = fResEnergyPhoton_eta2; + else if (fabs(eta) <= 2.5) + fResEnergyPhoton = fResEnergyPhoton_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEnergyPhoton(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyPhoton; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEtaLightJet(double eta) +{ + if (fabs(eta) < 1.0) + fResEtaLightJet = fResEtaLightJet_eta1; + else if (fabs(eta) < 1.7) + fResEtaLightJet = fResEtaLightJet_eta2; + else if (fabs(eta) <= 2.5) + fResEtaLightJet = fResEtaLightJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEtaLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResEtaBJet(double eta) +{ + if (fabs(eta) < 1.0) + fResEtaBJet = fResEtaBJet_eta1; + else if (fabs(eta) < 1.7) + fResEtaBJet = fResEtaBJet_eta2; + else if (fabs(eta) <= 2.5) + fResEtaBJet = fResEtaBJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResEtaBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResPhiLightJet(double eta) +{ + if (fabs(eta) < 1.0) + fResPhiLightJet = fResPhiLightJet_eta1; + else if (fabs(eta) < 1.7) + fResPhiLightJet = fResPhiLightJet_eta2; + else if (fabs(eta) <= 2.5) + fResPhiLightJet = fResPhiLightJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResPhiLightJet(). Phi range exceeded." << std::endl; + return 0; + } + + return fResPhiLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResPhiBJet(double eta) +{ + if (fabs(eta) < 1.0) + fResPhiBJet = fResPhiBJet_eta1; + else if (fabs(eta) < 1.7) + fResPhiBJet = fResPhiBJet_eta2; + else if (fabs(eta) <= 2.5) + fResPhiBJet = fResPhiBJet_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_10TeV::ResPhiBJet(). Phi range exceeded." << std::endl; + return 0; + } + + return fResPhiBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_10TeV::ResMissingET() +{ + return fResMissingET; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorDummy.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorDummy.cxx new file mode 100644 index 0000000000000000000000000000000000000000..be51274b239d20f517118be7fe37456e0bb2865f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/DetectorDummy.cxx @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/ResGauss.h" + +// --------------------------------------------------------- + +KLFitter::DetectorDummy::DetectorDummy(std::string /*folder*/) : DetectorBase() +{ + fResEnergyLightJet = new KLFitter::ResGauss(1.0); + fResEnergyBJet = new KLFitter::ResGauss(1.0); + fResEnergyGluonJet = new KLFitter::ResGauss(1.0); + fResEnergyElectron = new KLFitter::ResGauss(0.1); + fResEnergyMuon = new KLFitter::ResGauss(0.1); + fResEnergyPhoton = new KLFitter::ResGauss(0.1); + fResMissingET = new KLFitter::ResGauss(1.0); + fResEtaLightJet = new KLFitter::ResGauss(0.01); + fResEtaBJet = new KLFitter::ResGauss(0.01); + fResPhiLightJet = new KLFitter::ResGauss(0.01); + fResPhiBJet = new KLFitter::ResGauss(0.01); +} + +// --------------------------------------------------------- + +KLFitter::DetectorDummy::~DetectorDummy() +{ +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceBase.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ee646218ab0a75cafe81c99b0c34cdcaae5f912a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceBase.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceBase.h" +#include "KLFitter/Particles.h" + +// --------------------------------------------------------- +KLFitter::InterfaceBase::InterfaceBase() : + fParticles(0), + fParticlesTruth(0), + fWeight(0) +{ +} + +// --------------------------------------------------------- +KLFitter::InterfaceBase::~InterfaceBase() +{ + if (fParticles) + delete fParticles; + + if (fParticlesTruth) + delete fParticlesTruth; +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD.cxx new file mode 100644 index 0000000000000000000000000000000000000000..23f7e03796e58aeeb289c188162b9a0a23ebb74c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD.cxx @@ -0,0 +1,792 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD::InterfaceD3PD() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + EventNumber = 0; + if(mcevt_weight) + mcevt_weight = 0; + + fBtagCut = 5.85; + fBtagEff = 0.5; + fBtagRej = 271.; + + mu_n = 0; + mu_E = 0; + mu_px = 0; + mu_py = 0; + mu_pz = 0; + mu_eta = 0; + + el_n = 0; + el_E = 0; + el_eta = 0; + el_deteta = 0; + el_phi = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_deteta = 0; + jet_phi = 0; + jet_flavor_weight_SV0 = 0; + + MET_RefFinal_em_tight_et = 0; + MET_RefFinal_em_tight_etx = 0; + MET_RefFinal_em_tight_ety = 0; + MET_RefFinal_em_tight_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD::~InterfaceD3PD() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("physics"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("physics"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("EventNumber", &EventNumber); + fTree->SetBranchAddress("mcevt_weight", &mcevt_weight); + + fTree->SetBranchAddress("mu_n", &mu_n); + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_px", &mu_px); + fTree->SetBranchAddress("mu_py", &mu_py); + fTree->SetBranchAddress("mu_pz", &mu_pz); + fTree->SetBranchAddress("mu_eta", &mu_eta); + + fTree->SetBranchAddress("el_n", &el_n); + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_tracketa", &el_eta); + fTree->SetBranchAddress("el_cl_eta", &el_deteta); + fTree->SetBranchAddress("el_trackphi", &el_phi); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_emscale_eta", &jet_deteta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_flavor_weight_SV0", &jet_flavor_weight_SV0); + + fTree->SetBranchAddress("MET_RefFinal_em_tight_et", &MET_RefFinal_em_tight_et); + fTree->SetBranchAddress("MET_RefFinal_em_tight_etx", &MET_RefFinal_em_tight_etx); + fTree->SetBranchAddress("MET_RefFinal_em_tight_ety", &MET_RefFinal_em_tight_ety); + fTree->SetBranchAddress("MET_RefFinal_em_tight_sumet", &MET_RefFinal_em_tight_sumet); + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("mcevt_weight", &mcevt_weight ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"EventNumber", "mcevt_weight","mu_n", "mu_E","mu_px","mu_py","mu_pz","mu_eta","el_n","el_cl_E","el_tracketa","el_cl_eta", "el_trackphi", "jet_n", "jet_E", "jet_pt","jet_eta", "jet_emscale_eta", "jet_phi", "jet_flavor_weight_SV0", "MET_RefFinal_em_tight_et", "MET_RefFinal_em_tight_etx", "MET_RefFinal_em_tight_ety", "MET_RefFinal_em_tight_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","mcevt_weight", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("EventNumber", &EventNumber); + fChain->SetBranchAddress("mcevt_weight", &mcevt_weight); + + fChain->SetBranchAddress("mu_n", &mu_n); + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_px", &mu_px); + fChain->SetBranchAddress("mu_py", &mu_py); + fChain->SetBranchAddress("mu_pz", &mu_pz); + fChain->SetBranchAddress("mu_eta", &mu_eta); + + fChain->SetBranchAddress("el_n", &el_n); + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_tracketa", &el_eta); + fChain->SetBranchAddress("el_cl_eta", &el_deteta); + fChain->SetBranchAddress("el_trackphi", &el_phi); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_emscale_eta", &jet_deteta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_flavor_weight_SV0", &jet_flavor_weight_SV0); + + fChain->SetBranchAddress("MET_RefFinal_em_tight_et", &MET_RefFinal_em_tight_et); + fChain->SetBranchAddress("MET_RefFinal_em_tight_etx", &MET_RefFinal_em_tight_etx); + fChain->SetBranchAddress("MET_RefFinal_em_tight_ety", &MET_RefFinal_em_tight_ety); + fChain->SetBranchAddress("MET_RefFinal_em_tight_sumet", &MET_RefFinal_em_tight_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("mcevt_weight", &mcevt_weight ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (mcevt_weight){ + fWeight = mcevt_weight->at(0).at(0); + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_flavor_weight_SV0->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i)/1000., jet_eta->at(i), jet_phi->at(i), jet_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_deteta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej); + delete tlv_tmp; + } + + //fill electrons + for (int i = 0; i < el_n; ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)/1000.) / cosh(el_eta->at(i)), el_eta->at(i), el_phi->at(i), el_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_deteta->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + + // fill muons + for (int i = 0; i < mu_n; ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(mu_px->at(i)/1000., mu_py->at(i)/1000., mu_pz->at(i)/1000., mu_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + // do not fill mc information if di-leptonic + if ( (Truth_WplusHad == false) && (Truth_WminusHad == false) ) + return 1; + + int index_Whad = -1; + int index_Wlep = -1; + int index_tophad = -1; + int index_toplep = -1; + int index_bhad = -1; + int index_blep = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_l = -1; + int index_nu = -1; + + if (Truth_WplusHad) + { + index_Whad = TruthIdx_Wplus; + index_tophad = TruthIdx_t; + index_bhad = TruthIdx_b; + + index_Wlep = TruthIdx_Wminus; + index_toplep = TruthIdx_tbar; + index_blep = TruthIdx_bbar; + index_l = TruthIdx_lminus; + index_nu = TruthIdx_nbar; + index_q1 = TruthIdx_QfromWplus; + index_q2 = TruthIdx_QbarfromWplus; + + } + else + { + index_Wlep = TruthIdx_Wplus; + index_toplep = TruthIdx_t; + index_blep = TruthIdx_b; + index_l = TruthIdx_lplus; + index_nu = TruthIdx_n; + index_q1 = TruthIdx_QfromWminus; + index_q2 = TruthIdx_QbarfromWminus; + + index_Whad = TruthIdx_Wminus; + index_tophad = TruthIdx_tbar; + index_bhad = TruthIdx_bbar; + + } + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad) / 1000., + mc_eta->at(index_bhad), + mc_phi->at(index_bhad), + mc_m->at(index_bhad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_blep) / 1000., + mc_eta->at(index_blep), + mc_phi->at(index_blep), + mc_m->at(index_blep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q1) / 1000., + mc_eta->at(index_q1), + mc_phi->at(index_q1), + mc_m->at(index_q1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 1"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q2) / 1000., + mc_eta->at(index_q2), + mc_phi->at(index_q2), + mc_m->at(index_q2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 2"); + + if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "electron"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "muon"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "tau"); + } + + if (index_nu!=-1){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_nu) / 1000., + mc_eta->at(index_nu), + mc_phi->at(index_nu), + mc_m->at(index_nu) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + if (index_tophad >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad) / 1000., + mc_eta->at(index_tophad), + mc_phi->at(index_tophad), + mc_m->at(index_tophad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top quark"); + } + + if (index_toplep >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_toplep) / 1000., + mc_eta->at(index_toplep), + mc_phi->at(index_toplep), + mc_m->at(index_toplep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic top quark"); + } + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + +// --------------------------------------------------------- + +int KLFitter::InterfaceD3PD::TruthMapper(){ + + //Init: No particles found yet + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_lplus = -1; + TruthIdx_lminus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int Nt = 0; + int Ntbar = 0; + int Nb = 0; + int Nbbar = 0; + int NWplus = 0; + int NWminus = 0; + int NQfromWminus = 0; + int NQbarfromWminus = 0; + int NQfromWplus = 0; + int NQbarfromWplus = 0; + int Nlplus = 0; + int Nlminus = 0; + int Nn = 0; + int Nnbar = 0; + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + for (unsigned int i=0;i!=mc_pt->size();++i) { + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_in_itself=false; + if (mc_child_index->at(i).size()==1) { + decays_in_itself = (pdg==mc_pdgId->at(mc_child_index->at(i).at(0))); + } + + // according to Un-ki Yang <ukyang@hep.manchester.ac.uk> the particles with status code 123 or 124 are the ones to be used + + if ((TruthHERWIGFlag && (mc_status->at(i)==123 || mc_status->at(i)==124)) || (!TruthHERWIGFlag && !decays_in_itself)) { + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if (pdg==5 && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c < mc_child_index->at(i).size();++c) { + int WpChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WpChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W+ decays in leptons + Truth_WplusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24) ) { //lplus (!HERWIG) + TruthIdx_lplus=i; + ++Nlplus; + } + else if (TruthHERWIGFlag && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0) { //lplus (HERWIG) + TruthIdx_lplus=i; + Truth_WplusHad=false; + ++Nlplus; + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (!HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (TruthHERWIGFlag && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (Truth_WplusHad && NWplus==1 && NQfromWplus==0 && (pdg==2 || pdg==4) && OriginatesFromPDG(i,24)) { // up/charm from W+ + TruthIdx_QfromWplus=i; + ++NQfromWplus; + } + else if (Truth_WplusHad && NWplus==1 && NQbarfromWplus==0 && (pdg==-1 || pdg==-3) && OriginatesFromPDG(i,24)) { // antidown/antistrange from W+ + TruthIdx_QbarfromWplus=i; + ++NQbarfromWplus; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if (pdg==-5 && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c<mc_child_index->at(i).size();++c) { + int WmChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WmChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W- decays in leptons + Truth_WminusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (!HERWIG) + TruthIdx_lminus=i; + ++Nlminus; + } + else if (TruthHERWIGFlag && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0) { //lminus (HERWIG) + Truth_WminusHad=false; + TruthIdx_lminus=i; + ++Nlminus; + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (!HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (TruthHERWIGFlag && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0) { //anti neutrino (HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (Truth_WminusHad && NWminus==1 && NQfromWminus==0 && (pdg==1 || pdg==3) && OriginatesFromPDG(i,-24)) { // down/strange from W- + TruthIdx_QfromWminus=i; + ++NQfromWminus; + } + else if (Truth_WminusHad && NWminus==1 && NQbarfromWminus==0 && (pdg==-2 || pdg==-4) && OriginatesFromPDG(i,-24)) { // antiup/anticharm from W- + TruthIdx_QbarfromWminus=i; + ++NQbarfromWminus; + } + } + } //loop over all particles + + //no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD::IsProperMCEvent(){ +//some sanity checks, most of them commented out: +/* +std::cout<< "=======================" << std::endl; +std::cout<< "TruthIdx_t " <<TruthIdx_t << std::endl; +std::cout<< "TruthIdx_tbar "<< TruthIdx_tbar << std::endl; +std::cout<< "TruthIdx_b "<< TruthIdx_b<<std::endl; +std::cout<< "TruthIdx_bbar " <<TruthIdx_bbar <<std::endl; +std::cout<< "TruthIdx_Wplus " <<TruthIdx_Wplus <<std::endl; +std::cout<< "TruthIdx_Wminus " <<TruthIdx_Wminus<< std::endl; +std::cout<< "TruthIdx_QfromWplus " <<TruthIdx_QfromWplus <<std::endl; +std::cout<< "TruthIdx_QbarfromWplus " <<TruthIdx_QbarfromWplus <<std::endl; +std::cout<< "TruthIdx_QfromWminus " << TruthIdx_QfromWminus<<std::endl; +std::cout<< "TruthIdx_QbarfromWminus " <<TruthIdx_QbarfromWminus <<std::endl; +std::cout<< "TruthIdx_lplus " << TruthIdx_lplus<<std::endl; +std::cout<< "TruthIdx_lminus " <<TruthIdx_lminus<< std::endl; +std::cout<< "TruthIdx_n " << TruthIdx_n<<std::endl; +std::cout<< "TruthIdx_nbar " << TruthIdx_nbar<<std::endl; +std::cout<< "Truth_WplusHad " << Truth_WplusHad<<std::endl; +std::cout<< "Truth_WminusHad " << Truth_WminusHad<<std::endl; +*/ + +bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_b!=-1 && TruthIdx_bbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && //ttbar->W+W-bbbar + ( (Truth_WplusHad && Truth_WminusHad && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //alljets + (Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) || //(l^+)+jets + (Truth_WminusHad && !Truth_WplusHad && TruthIdx_lplus!=-1 && TruthIdx_n!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //(l^-)+jets + (!Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_lplus!=-1 && TruthIdx_n!=-1))); + +//std::cout<< "Sanity check: " << sane << std::endl; + + +/* +if (TruthIdx_t!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking top: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_t)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_t)<<std::endl; +} + +if (TruthIdx_tbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking antitop: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_tbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_tbar)<<std::endl; +} + +if (TruthIdx_b!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking b: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_b)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_b)<<std::endl; +} + +if (TruthIdx_bbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking bbar: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_bbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_bbar)<<std::endl; +} + +if (TruthIdx_Wplus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wplus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wplus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wplus)<<std::endl; +} + +if (TruthIdx_Wminus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wminus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wminus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wminus)<<std::endl; +} +*/ +/* +if (TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWplus]/1000, (*mc_eta)[TruthIdx_QfromWplus], (*mc_phi)[TruthIdx_QfromWplus], (*mc_m)[TruthIdx_QfromWplus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWplus]/1000, (*mc_eta)[TruthIdx_QbarfromWplus], (*mc_phi)[TruthIdx_QbarfromWplus], (*mc_m)[TruthIdx_QbarfromWplus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wplus reco possible! Mass: "<< truffiW.M() <<std::endl; +} + +if (TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWminus]/1000, (*mc_eta)[TruthIdx_QfromWminus], (*mc_phi)[TruthIdx_QfromWminus], (*mc_m)[TruthIdx_QfromWminus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWminus]/1000, (*mc_eta)[TruthIdx_QbarfromWminus], (*mc_phi)[TruthIdx_QbarfromWminus], (*mc_m)[TruthIdx_QbarfromWminus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wminus reco possible! Mass: "<< truffiW.M() <<std::endl; +} +*/ +return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_Allhadronic.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_Allhadronic.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4780d627195fd23ca6e2f302306da0ef52737977 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_Allhadronic.cxx @@ -0,0 +1,641 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD_Allhadronic.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_Allhadronic::InterfaceD3PD_Allhadronic() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + EventNumber = 0; + if(mcevt_weight) + mcevt_weight = 0; + + fBtagCut = 2.20; + fBtagEff = 0.564; + fBtagRej = 624.; + + mu_n = 0; + mu_E = 0; + mu_px = 0; + mu_py = 0; + mu_pz = 0; + mu_eta = 0; + + el_n = 0; + el_E = 0; + el_eta = 0; + el_deteta = 0; + el_phi = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_deteta = 0; + jet_phi = 0; + jet_flavor_weight_JetFitterCOMBNN = 0; + + MET_RefFinal_em_tightpp_et = 0; + MET_RefFinal_em_tightpp_etx = 0; + MET_RefFinal_em_tightpp_ety = 0; + MET_RefFinal_em_tightpp_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_Allhadronic::~InterfaceD3PD_Allhadronic() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("physics"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("physics"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("EventNumber", &EventNumber); + fTree->SetBranchAddress("mcevt_weight", &mcevt_weight); + + fTree->SetBranchAddress("mu_n", &mu_n); + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_px", &mu_px); + fTree->SetBranchAddress("mu_py", &mu_py); + fTree->SetBranchAddress("mu_pz", &mu_pz); + fTree->SetBranchAddress("mu_eta", &mu_eta); + + fTree->SetBranchAddress("el_n", &el_n); + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_tracketa", &el_eta); + fTree->SetBranchAddress("el_cl_eta", &el_deteta); + fTree->SetBranchAddress("el_trackphi", &el_phi); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_emscale_eta", &jet_deteta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_flavor_weight_JetFitterCOMBNN", &jet_flavor_weight_JetFitterCOMBNN); + + fTree->SetBranchAddress("MET_RefFinal_em_tightpp_et", &MET_RefFinal_em_tightpp_et); + fTree->SetBranchAddress("MET_RefFinal_em_tightpp_etx", &MET_RefFinal_em_tightpp_etx); + fTree->SetBranchAddress("MET_RefFinal_em_tightpp_ety", &MET_RefFinal_em_tightpp_ety); + fTree->SetBranchAddress("MET_RefFinal_em_tightpp_sumet", &MET_RefFinal_em_tightpp_sumet); + + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("mcevt_weight", &mcevt_weight ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"EventNumber", "mcevt_weight","mu_n", "mu_E","mu_px","mu_py","mu_pz","mu_eta","el_n","el_cl_E","el_tracketa","el_cl_eta", "el_trackphi", "jet_n", "jet_E", "jet_pt","jet_eta", "jet_emscale_eta", "jet_phi", "jet_flavor_weight_JetFitterCOMBNN", "MET_RefFinal_em_tightpp_et", "MET_RefFinal_em_tightpp_etx", "MET_RefFinal_em_tightpp_ety", "MET_RefFinal_em_tightpp_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","mcevt_weight", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("EventNumber", &EventNumber); + fChain->SetBranchAddress("mcevt_weight", &mcevt_weight); + + fChain->SetBranchAddress("mu_n", &mu_n); + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_px", &mu_px); + fChain->SetBranchAddress("mu_py", &mu_py); + fChain->SetBranchAddress("mu_pz", &mu_pz); + fChain->SetBranchAddress("mu_eta", &mu_eta); + + fChain->SetBranchAddress("el_n", &el_n); + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_tracketa", &el_eta); + fChain->SetBranchAddress("el_cl_eta", &el_deteta); + fChain->SetBranchAddress("el_trackphi", &el_phi); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_emscale_eta", &jet_deteta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_flavor_weight_JetFitterCOMBNN", &jet_flavor_weight_JetFitterCOMBNN); + + fChain->SetBranchAddress("MET_RefFinal_em_tightpp_et", &MET_RefFinal_em_tightpp_et); + fChain->SetBranchAddress("MET_RefFinal_em_tightpp_etx", &MET_RefFinal_em_tightpp_etx); + fChain->SetBranchAddress("MET_RefFinal_em_tightpp_ety", &MET_RefFinal_em_tightpp_ety); + fChain->SetBranchAddress("MET_RefFinal_em_tightpp_sumet", &MET_RefFinal_em_tightpp_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("mcevt_weight", &mcevt_weight ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_Allhadronic::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (mcevt_weight){ + fWeight = mcevt_weight->at(0).at(0); + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_flavor_weight_JetFitterCOMBNN->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i)/1000., jet_eta->at(i), jet_phi->at(i), jet_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_deteta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej, KLFitter::Particles::kNone, jet_flavor_weight_JetFitterCOMBNN->at(i)); + delete tlv_tmp; + } + + + //fill electrons + for (int i = 0; i < el_n; ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)/1000.) / cosh(el_eta->at(i)), el_eta->at(i), el_phi->at(i), el_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_deteta->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + + // fill muons + for (int i = 0; i < mu_n; ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(mu_px->at(i)/1000., mu_py->at(i)/1000., mu_pz->at(i)/1000., mu_E->at(i)/1000.); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_Allhadronic::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + // do not fill mc information if not fully hadronic + if ( (Truth_WplusHad == false) || (Truth_WminusHad == false) ) + return false; + + + int index_Whad1 = -1; + int index_Whad2 = -1; + int index_tophad1 = -1; + int index_tophad2 = -1; + int index_bhad1 = -1; + int index_bhad2 = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_q3 = -1; + int index_q4 = -1; + + + index_Whad1 = TruthIdx_Wplus; + index_tophad1 = TruthIdx_t; + index_bhad1 = TruthIdx_b; + index_q1 = TruthIdx_QfromWplus; + index_q2 = TruthIdx_QbarfromWplus; + + + index_Whad2 = TruthIdx_Wminus; + index_tophad2 = TruthIdx_tbar; + index_bhad2 = TruthIdx_bbar; + index_q3 = TruthIdx_QfromWminus; + index_q4 = TruthIdx_QbarfromWminus; + + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad1) / 1000., + mc_eta->at(index_bhad1), + mc_phi->at(index_bhad1), + mc_m->at(index_bhad1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark 1"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad2) / 1000., + mc_eta->at(index_bhad2), + mc_phi->at(index_bhad2), + mc_m->at(index_bhad2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark 2"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q1) / 1000., + mc_eta->at(index_q1), + mc_phi->at(index_q1), + mc_m->at(index_q1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 1"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q2) / 1000., + mc_eta->at(index_q2), + mc_phi->at(index_q2), + mc_m->at(index_q2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 2"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q3) / 1000., + mc_eta->at(index_q3), + mc_phi->at(index_q3), + mc_m->at(index_q3) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 3"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q4) / 1000., + mc_eta->at(index_q4), + mc_phi->at(index_q4), + mc_m->at(index_q4) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 4"); + + + if (index_tophad1 >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad1) / 1000., + mc_eta->at(index_tophad1), + mc_phi->at(index_tophad1), + mc_m->at(index_tophad1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top 1"); + } + + if (index_tophad2 >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad2) / 1000., + mc_eta->at(index_tophad2), + mc_phi->at(index_tophad2), + mc_m->at(index_tophad2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top 2"); + } + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_Allhadronic::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + +// --------------------------------------------------------- + +int KLFitter::InterfaceD3PD_Allhadronic::TruthMapper(){ + + + //Init: No particles found yet + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int Nt = 0; + int Ntbar = 0; + int Nb = 0; + int Nbbar = 0; + int NWplus = 0; + int NWminus = 0; + int NQfromWminus = 0; + int NQbarfromWminus = 0; + int NQfromWplus = 0; + int NQbarfromWplus = 0; + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + + for (unsigned int i=0;i!=mc_pt->size();++i) { + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_in_itself=false; + if (mc_child_index->at(i).size()==1) { + decays_in_itself = (pdg==mc_pdgId->at(mc_child_index->at(i).at(0))); + } + + // according to Un-ki Yang <ukyang@hep.manchester.ac.uk> the particles with status code 123 or 124 are the ones to be used + + if ((TruthHERWIGFlag && (mc_status->at(i)==123 || mc_status->at(i)==124)) || (!TruthHERWIGFlag && !decays_in_itself)) { + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if (pdg==5 && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c < mc_child_index->at(i).size();++c) { + int WpChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WpChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W+ decays in leptons + Truth_WplusHad=false; + break; + } + } + } + } + else if (TruthHERWIGFlag && (pdg==-11 || pdg==-13 || pdg==-15)) { //lplus (HERWIG) + Truth_WplusHad=false; + } + else if (TruthHERWIGFlag && (pdg==12 || pdg==14 || pdg==16) && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + Truth_WplusHad=false; + } + else if (Truth_WplusHad && NWplus==1 && NQfromWplus==0 && (pdg==2 || pdg==4) && OriginatesFromPDG(i,24)) { // up/charm from W+ + TruthIdx_QfromWplus=i; + ++NQfromWplus; + } + else if (Truth_WplusHad && NWplus==1 && NQbarfromWplus==0 && (pdg==-1 || pdg==-3) && OriginatesFromPDG(i,24)) { // antidown/antistrange from W+ + TruthIdx_QbarfromWplus=i; + ++NQbarfromWplus; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if (pdg==-5 && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c<mc_child_index->at(i).size();++c) { + int WmChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WmChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W- decays in leptons + Truth_WminusHad=false; + break; + } + } + } + } + else if (TruthHERWIGFlag && (pdg==11 || pdg==13 || pdg==15)) { //lminus (HERWIG) + Truth_WminusHad=false; + } + else if (TruthHERWIGFlag && (pdg==-12 || pdg==-14 || pdg==-16)) { //anti neutrino (HERWIG) + Truth_WminusHad=false; + } + else if (Truth_WminusHad && NWminus==1 && NQfromWminus==0 && (pdg==1 || pdg==3) && OriginatesFromPDG(i,-24)) { // down/strange from W- + TruthIdx_QfromWminus=i; + ++NQfromWminus; + } + else if (Truth_WminusHad && NWminus==1 && NQbarfromWminus==0 && (pdg==-2 || pdg==-4) && OriginatesFromPDG(i,-24)) { // antiup/anticharm from W- + TruthIdx_QbarfromWminus=i; + ++NQbarfromWminus; + } + } + } //loop over all particles + + + //no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_Allhadronic::IsProperMCEvent(){ + + bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_b!=-1 && TruthIdx_bbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && //ttbar->W+W-bbbar + ((Truth_WplusHad && Truth_WminusHad && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1))); + + return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_dilepton.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_dilepton.cxx new file mode 100644 index 0000000000000000000000000000000000000000..97a12d1c4e20f30c14f7c8bdfafc4180b3f335e3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_dilepton.cxx @@ -0,0 +1,775 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD_dilepton.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_dilepton::InterfaceD3PD_dilepton() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + eventNumber = 0; + if(eventWeight) + eventWeight = 0; + + fBtagCut = 0.601713; + fBtagEff = 0.696; + fBtagRej = 134; + + mu_E = 0; + mu_pt = 0; + mu_eta = 0; + mu_phi = 0; + mu_charge = 0; + + el_E = 0; + el_eta = 0; + el_deteta = 0; + el_phi = 0; + el_charge = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_det_eta = 0; + jet_phi = 0; + jet_MV1 = 0; + + met_et = 0; + met_x = 0; + met_y = 0; + met_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_dilepton::~InterfaceD3PD_dilepton() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("GoeTree"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("GoeTree"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("eventNumber", &eventNumber); + fTree->SetBranchAddress("eventWeight", &eventWeight); + + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_pt", &mu_pt); + fTree->SetBranchAddress("mu_eta", &mu_eta); + fTree->SetBranchAddress("mu_phi", &mu_phi); + fTree->SetBranchAddress("mu_charge", &mu_charge); + + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_eta", &el_eta); + fTree->SetBranchAddress("el_cl_eta", &el_deteta); + fTree->SetBranchAddress("el_phi", &el_phi); + fTree->SetBranchAddress("el_charge", &el_charge); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_det_eta", &jet_det_eta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_MV1", &jet_MV1); + + fTree->SetBranchAddress("met_et", &met_et); + fTree->SetBranchAddress("met_x", &met_x); + fTree->SetBranchAddress("met_y", &met_y); + fTree->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("eventWeight", &eventWeight ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"eventNumber", "eventWeight", "mu_E","mu_pt","mu_eta","mu_phi","mu_charge","el_cl_E","el_eta","el_cl_eta", "el_phi","el_charge","jet_n", "jet_E", "jet_pt","jet_eta", "jet_det_eta", "jet_phi", "jet_MV1", "met_et", "met_x", "met_y", "met_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","eventWeight", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("eventNumber", &eventNumber); + fChain->SetBranchAddress("eventWeight", &eventWeight); + + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_pt", &mu_pt); + fChain->SetBranchAddress("mu_phi", &mu_phi); + fChain->SetBranchAddress("mu_eta", &mu_eta); + fChain->SetBranchAddress("mu_charge", &mu_charge); + + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_eta", &el_eta); + fChain->SetBranchAddress("el_cl_eta", &el_deteta); + fChain->SetBranchAddress("el_phi", &el_phi); + fChain->SetBranchAddress("el_charge", &el_charge); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_det_eta", &jet_det_eta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_MV1", &jet_MV1); + + fChain->SetBranchAddress("met_et", &met_et); + fChain->SetBranchAddress("met_x", &met_x); + fChain->SetBranchAddress("met_y", &met_y); + fChain->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("eventWeight", &eventWeight ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_dilepton::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_dilepton::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (eventWeight){ + fWeight = eventWeight; + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_MV1->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i), jet_eta->at(i), jet_phi->at(i), jet_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_dilepton::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_det_eta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej, KLFitter::Particles::kNone, jet_MV1->at(i)); + delete tlv_tmp; + } + + //fill electrons + for (unsigned int i = 0; i < el_E->size(); ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)) / cosh(el_eta->at(i)), el_eta->at(i), el_phi->at(i), el_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_dilepton::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_deteta->at(i), el_charge->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + + // fill muons + for (unsigned int i = 0; i < mu_E->size(); ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(mu_pt->at(i), mu_eta->at(i), mu_phi->at(i), mu_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_dilepton::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), mu_charge->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_b) / 1000., + mc_eta->at(TruthIdx_b), + mc_phi->at(TruthIdx_b), + mc_m->at(TruthIdx_b) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_bbar) / 1000., + mc_eta->at(TruthIdx_bbar), + mc_phi->at(TruthIdx_bbar), + mc_m->at(TruthIdx_bbar) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "bbar quark"); + + if (abs(mc_pdgId->at(TruthIdx_lminus)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lminus) / 1000., + mc_eta->at(TruthIdx_lminus), + mc_phi->at(TruthIdx_lminus), + mc_m->at(TruthIdx_lminus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "lepton minus"); + } + else if (abs(mc_pdgId->at(TruthIdx_lminus)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lminus) / 1000., + mc_eta->at(TruthIdx_lminus), + mc_phi->at(TruthIdx_lminus), + mc_m->at(TruthIdx_lminus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "lepton minus"); + } + else if (abs(mc_pdgId->at(TruthIdx_lminus)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lminus) / 1000., + mc_eta->at(TruthIdx_lminus), + mc_phi->at(TruthIdx_lminus), + mc_m->at(TruthIdx_lminus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "lepton minus"); + } + + if (abs(mc_pdgId->at(TruthIdx_lplus)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lplus) / 1000., + mc_eta->at(TruthIdx_lplus), + mc_phi->at(TruthIdx_lplus), + mc_m->at(TruthIdx_lplus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "lepton plus"); + } + + else if (abs(mc_pdgId->at(TruthIdx_lplus)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lplus) / 1000., + mc_eta->at(TruthIdx_lplus), + mc_phi->at(TruthIdx_lplus), + mc_m->at(TruthIdx_lplus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "lepton plus"); + } + else if (abs(mc_pdgId->at(TruthIdx_lplus)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_lplus) / 1000., + mc_eta->at(TruthIdx_lplus), + mc_phi->at(TruthIdx_lplus), + mc_m->at(TruthIdx_lplus) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "lepton plus"); + } + + + if (TruthIdx_t >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_t) / 1000., + mc_eta->at(TruthIdx_t), + mc_phi->at(TruthIdx_t), + mc_m->at(TruthIdx_t) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "top quark"); + } + + if (TruthIdx_tbar >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_tbar) / 1000., + mc_eta->at(TruthIdx_tbar), + mc_phi->at(TruthIdx_tbar), + mc_m->at(TruthIdx_tbar) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "antitop quark"); + } + + if (TruthIdx_n >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_n) / 1000., + mc_eta->at(TruthIdx_n), + mc_phi->at(TruthIdx_n), + mc_m->at(TruthIdx_n) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + + if (TruthIdx_nbar >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(TruthIdx_nbar) / 1000., + mc_eta->at(TruthIdx_nbar), + mc_phi->at(TruthIdx_nbar), + mc_m->at(TruthIdx_nbar) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "antineutrino"); + } + + + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_dilepton::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + +// --------------------------------------------------------- + +int KLFitter::InterfaceD3PD_dilepton::TruthMapper(){ + + //Init: No particles found yet + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_lplus = -1; + TruthIdx_lminus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int Nt = 0; + int Ntbar = 0; + int Nb = 0; + int Nbbar = 0; + int NWplus = 0; + int NWminus = 0; + int Nlplus = 0; + int Nlminus = 0; + int Nn = 0; + int Nnbar = 0; + + + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + for(unsigned int i = 0; i != mc_pdgId -> size(); ++i){ + + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_in_itself=false; + if (mc_child_index->at(i).size()==1) { + decays_in_itself = (pdg==mc_pdgId->at(mc_child_index->at(i).at(0))); + } + + // if sample is showered with Herwig + if ((TruthHERWIGFlag && ((mc_status->at(i)==123) || (mc_status->at(i)==124))) || (!TruthHERWIGFlag && !decays_in_itself)){ + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if ((pdg==5 || pdg==3 || pdg==1) && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + } + else if ((pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24)) { //lplus (HERWIG) + + TruthIdx_lplus=i; + // Truth_WplusHad=false; + ++Nlplus; + } + else if ((pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + TruthIdx_n=i; + ++Nn; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if ((pdg==-5 || pdg==-3 || pdg==-1) && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + } + else if ((pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (HERWIG) + + // Truth_WminusHad=false; + TruthIdx_lminus=i; + ++Nlminus; + } + else if ((pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + } // end status 123 and 124 + else if(!TruthHERWIGFlag && mc_status->at(i) == 3){ + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if ((pdg==5 || pdg==3 || pdg==1) && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + + } + else if ((pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24) ) { //lplus (!HERWIG) + + TruthIdx_lplus=i; + ++Nlplus; + } + else if ((pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (!HERWIG) + TruthIdx_n=i; + ++Nn; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if ((pdg==-5 || pdg==-3 || pdg==-1) && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + + } + else if ((pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (!HERWIG) + TruthIdx_lminus=i; + + ++Nlminus; + } + else if ((pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (!HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + } + + + } //loop over all particles + + + Truth_WplusHad = false; + Truth_WminusHad = false; + + + //no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_dilepton::IsProperMCEvent(){ +//some sanity checks, most of them commented out: +/* +std::cout<< "=======================" << std::endl; +std::cout<< "TruthIdx_t " <<TruthIdx_t << std::endl; +std::cout<< "TruthIdx_tbar "<< TruthIdx_tbar << std::endl; +std::cout<< "TruthIdx_b "<< TruthIdx_b<<std::endl; +std::cout<< "TruthIdx_bbar " <<TruthIdx_bbar <<std::endl; +std::cout<< "TruthIdx_Wplus " <<TruthIdx_Wplus <<std::endl; +std::cout<< "TruthIdx_Wminus " <<TruthIdx_Wminus<< std::endl; +std::cout<< "TruthIdx_QfromWplus " <<TruthIdx_QfromWplus <<std::endl; +std::cout<< "TruthIdx_QbarfromWplus " <<TruthIdx_QbarfromWplus <<std::endl; +std::cout<< "TruthIdx_QfromWminus " << TruthIdx_QfromWminus<<std::endl; +std::cout<< "TruthIdx_QbarfromWminus " <<TruthIdx_QbarfromWminus <<std::endl; +std::cout<< "TruthIdx_lplus " << TruthIdx_lplus<<std::endl; +std::cout<< "TruthIdx_lminus " <<TruthIdx_lminus<< std::endl; +std::cout<< "TruthIdx_n " << TruthIdx_n<<std::endl; +std::cout<< "TruthIdx_nbar " << TruthIdx_nbar<<std::endl; +std::cout<< "Truth_WplusHad " << Truth_WplusHad<<std::endl; +std::cout<< "Truth_WminusHad " << Truth_WminusHad<<std::endl; +*/ + + bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_b!=-1 && TruthIdx_bbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && TruthIdx_lminus != -1 && TruthIdx_nbar != -1 && TruthIdx_lplus != -1 && TruthIdx_n != -1); + + //std::cout<< "Sanity check: " << sane << std::endl; + + +/* +if (TruthIdx_t!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking top: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_t)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_t)<<std::endl; +} + +if (TruthIdx_tbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking antitop: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_tbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_tbar)<<std::endl; +} + +if (TruthIdx_b!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking b: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_b)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_b)<<std::endl; +} + +if (TruthIdx_bbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking bbar: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_bbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_bbar)<<std::endl; +} + +if (TruthIdx_Wplus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wplus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wplus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wplus)<<std::endl; +} + +if (TruthIdx_Wminus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wminus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wminus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wminus)<<std::endl; +} +*/ +/* +if (TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWplus]/1000, (*mc_eta)[TruthIdx_QfromWplus], (*mc_phi)[TruthIdx_QfromWplus], (*mc_m)[TruthIdx_QfromWplus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWplus]/1000, (*mc_eta)[TruthIdx_QbarfromWplus], (*mc_phi)[TruthIdx_QbarfromWplus], (*mc_m)[TruthIdx_QbarfromWplus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wplus reco possible! Mass: "<< truffiW.M() <<std::endl; +} + +if (TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWminus]/1000, (*mc_eta)[TruthIdx_QfromWminus], (*mc_phi)[TruthIdx_QfromWminus], (*mc_m)[TruthIdx_QfromWminus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWminus]/1000, (*mc_eta)[TruthIdx_QbarfromWminus], (*mc_phi)[TruthIdx_QbarfromWminus], (*mc_m)[TruthIdx_QbarfromWminus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wminus reco possible! Mass: "<< truffiW.M() <<std::endl; +} +*/ +return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ljets.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ljets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..47f0032e324b4fe016eec74df16ee6864f62f5ec --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ljets.cxx @@ -0,0 +1,783 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD_ljets.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_ljets::InterfaceD3PD_ljets() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + eventNumber = 0; + if(eventWeight) + eventWeight = 0; + + fBtagCut = 0.601713; + fBtagEff = 0.696; + fBtagRej = 134; + + mu_E = 0; + mu_pt = 0; + mu_eta = 0; + mu_phi = 0; + + el_E = 0; + el_eta = 0; + el_deteta = 0; + el_phi = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_det_eta = 0; + jet_phi = 0; + jet_MV1 = 0; + + met_et = 0; + met_x = 0; + met_y = 0; + met_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_ljets::~InterfaceD3PD_ljets() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("GoeTree"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("GoeTree"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("eventNumber", &eventNumber); + fTree->SetBranchAddress("eventWeight", &eventWeight); + + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_pt", &mu_pt); + fTree->SetBranchAddress("mu_eta", &mu_eta); + fTree->SetBranchAddress("mu_phi", &mu_phi); + + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_eta", &el_eta); + fTree->SetBranchAddress("el_cl_eta", &el_deteta); + fTree->SetBranchAddress("el_phi", &el_phi); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_det_eta", &jet_det_eta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_MV1", &jet_MV1); + + fTree->SetBranchAddress("met_et", &met_et); + fTree->SetBranchAddress("met_x", &met_x); + fTree->SetBranchAddress("met_y", &met_y); + fTree->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("eventWeight", &eventWeight ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"eventNumber", "eventWeight", "mu_E","mu_pt","mu_eta","mu_phi","el_cl_E","el_eta","el_cl_eta", "el_phi", "jet_n", "jet_E", "jet_pt","jet_eta", "jet_det_eta", "jet_phi", "jet_MV1", "met_et", "met_x", "met_y", "met_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","eventWeight", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("eventNumber", &eventNumber); + fChain->SetBranchAddress("eventWeight", &eventWeight); + + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_pt", &mu_pt); + fChain->SetBranchAddress("mu_phi", &mu_phi); + fChain->SetBranchAddress("mu_eta", &mu_eta); + + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_eta", &el_eta); + fChain->SetBranchAddress("el_cl_eta", &el_deteta); + fChain->SetBranchAddress("el_phi", &el_phi); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_det_eta", &jet_det_eta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_MV1", &jet_MV1); + + fChain->SetBranchAddress("met_et", &met_et); + fChain->SetBranchAddress("met_x", &met_x); + fChain->SetBranchAddress("met_y", &met_y); + fChain->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("eventWeight", &eventWeight ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_ljets::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ljets::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (eventWeight){ + fWeight = eventWeight; + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_MV1->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i), jet_eta->at(i), jet_phi->at(i), jet_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_ljets::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_det_eta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej, KLFitter::Particles::kNone, jet_MV1->at(i)); + delete tlv_tmp; + } + + //fill electrons + for (unsigned int i = 0; i < el_E->size(); ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)) / cosh(el_eta->at(i)), el_eta->at(i), el_phi->at(i), el_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_ljets::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_deteta->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + + // fill muons + for (unsigned int i = 0; i < mu_E->size(); ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(mu_pt->at(i), mu_eta->at(i), mu_phi->at(i), mu_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_ljets::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + // do not fill mc information if di-leptonic + if ( (Truth_WplusHad == false) && (Truth_WminusHad == false) ) + return 1; + + int index_Whad = -1; + int index_Wlep = -1; + int index_tophad = -1; + int index_toplep = -1; + int index_bhad = -1; + int index_blep = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_l = -1; + int index_nu = -1; + + if (Truth_WplusHad) + { + index_Whad = TruthIdx_Wplus; + index_tophad = TruthIdx_t; + index_bhad = TruthIdx_b; + + index_Wlep = TruthIdx_Wminus; + index_toplep = TruthIdx_tbar; + index_blep = TruthIdx_bbar; + index_l = TruthIdx_lminus; + index_nu = TruthIdx_nbar; + index_q1 = TruthIdx_QfromWplus; + index_q2 = TruthIdx_QbarfromWplus; + + } + else + { + index_Wlep = TruthIdx_Wplus; + index_toplep = TruthIdx_t; + index_blep = TruthIdx_b; + index_l = TruthIdx_lplus; + index_nu = TruthIdx_n; + index_q1 = TruthIdx_QfromWminus; + index_q2 = TruthIdx_QbarfromWminus; + + index_Whad = TruthIdx_Wminus; + index_tophad = TruthIdx_tbar; + index_bhad = TruthIdx_bbar; + + } + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad) / 1000., + mc_eta->at(index_bhad), + mc_phi->at(index_bhad), + mc_m->at(index_bhad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_blep) / 1000., + mc_eta->at(index_blep), + mc_phi->at(index_blep), + mc_m->at(index_blep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q1) / 1000., + mc_eta->at(index_q1), + mc_phi->at(index_q1), + mc_m->at(index_q1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 1"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q2) / 1000., + mc_eta->at(index_q2), + mc_phi->at(index_q2), + mc_m->at(index_q2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 2"); + + if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "electron"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "muon"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "tau"); + } + + if (index_nu!=-1){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_nu) / 1000., + mc_eta->at(index_nu), + mc_phi->at(index_nu), + mc_m->at(index_nu) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + if (index_tophad >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad) / 1000., + mc_eta->at(index_tophad), + mc_phi->at(index_tophad), + mc_m->at(index_tophad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top quark"); + } + + if (index_toplep >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_toplep) / 1000., + mc_eta->at(index_toplep), + mc_phi->at(index_toplep), + mc_m->at(index_toplep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic top quark"); + } + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_ljets::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + +// --------------------------------------------------------- + +int KLFitter::InterfaceD3PD_ljets::TruthMapper(){ + + //Init: No particles found yet + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_lplus = -1; + TruthIdx_lminus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int Nt = 0; + int Ntbar = 0; + int Nb = 0; + int Nbbar = 0; + int NWplus = 0; + int NWminus = 0; + int NQfromWminus = 0; + int NQbarfromWminus = 0; + int NQfromWplus = 0; + int NQbarfromWplus = 0; + int Nlplus = 0; + int Nlminus = 0; + int Nn = 0; + int Nnbar = 0; + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + for (unsigned int i=0;i!=mc_pt->size();++i) { + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_in_itself=false; + if (mc_child_index->at(i).size()==1) { + decays_in_itself = (pdg==mc_pdgId->at(mc_child_index->at(i).at(0))); + } + + // according to Un-ki Yang <ukyang@hep.manchester.ac.uk> the particles with status code 123 or 124 are the ones to be used + + if ((TruthHERWIGFlag && (mc_status->at(i)==123 || mc_status->at(i)==124)) || (!TruthHERWIGFlag && !decays_in_itself)) { + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if (pdg==5 && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c < mc_child_index->at(i).size();++c) { + int WpChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WpChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W+ decays in leptons + Truth_WplusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24) ) { //lplus (!HERWIG) + TruthIdx_lplus=i; + ++Nlplus; + } + else if (TruthHERWIGFlag && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0) { //lplus (HERWIG) + TruthIdx_lplus=i; + Truth_WplusHad=false; + ++Nlplus; + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (!HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (TruthHERWIGFlag && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (Truth_WplusHad && NWplus==1 && NQfromWplus==0 && (pdg==2 || pdg==4) && OriginatesFromPDG(i,24)) { // up/charm from W+ + TruthIdx_QfromWplus=i; + ++NQfromWplus; + } + else if (Truth_WplusHad && NWplus==1 && NQbarfromWplus==0 && (pdg==-1 || pdg==-3) && OriginatesFromPDG(i,24)) { // antidown/antistrange from W+ + TruthIdx_QbarfromWplus=i; + ++NQbarfromWplus; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if (pdg==-5 && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c<mc_child_index->at(i).size();++c) { + int WmChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WmChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W- decays in leptons + Truth_WminusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (!HERWIG) + TruthIdx_lminus=i; + ++Nlminus; + } + else if (TruthHERWIGFlag && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0) { //lminus (HERWIG) + Truth_WminusHad=false; + TruthIdx_lminus=i; + ++Nlminus; + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (!HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (TruthHERWIGFlag && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0) { //anti neutrino (HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (Truth_WminusHad && NWminus==1 && NQfromWminus==0 && (pdg==1 || pdg==3) && OriginatesFromPDG(i,-24)) { // down/strange from W- + TruthIdx_QfromWminus=i; + ++NQfromWminus; + } + else if (Truth_WminusHad && NWminus==1 && NQbarfromWminus==0 && (pdg==-2 || pdg==-4) && OriginatesFromPDG(i,-24)) { // antiup/anticharm from W- + TruthIdx_QbarfromWminus=i; + ++NQbarfromWminus; + } + } + } //loop over all particles + + //no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_ljets::IsProperMCEvent(){ +//some sanity checks, most of them commented out: +/* +std::cout<< "=======================" << std::endl; +std::cout<< "TruthIdx_t " <<TruthIdx_t << std::endl; +std::cout<< "TruthIdx_tbar "<< TruthIdx_tbar << std::endl; +std::cout<< "TruthIdx_b "<< TruthIdx_b<<std::endl; +std::cout<< "TruthIdx_bbar " <<TruthIdx_bbar <<std::endl; +std::cout<< "TruthIdx_Wplus " <<TruthIdx_Wplus <<std::endl; +std::cout<< "TruthIdx_Wminus " <<TruthIdx_Wminus<< std::endl; +std::cout<< "TruthIdx_QfromWplus " <<TruthIdx_QfromWplus <<std::endl; +std::cout<< "TruthIdx_QbarfromWplus " <<TruthIdx_QbarfromWplus <<std::endl; +std::cout<< "TruthIdx_QfromWminus " << TruthIdx_QfromWminus<<std::endl; +std::cout<< "TruthIdx_QbarfromWminus " <<TruthIdx_QbarfromWminus <<std::endl; +std::cout<< "TruthIdx_lplus " << TruthIdx_lplus<<std::endl; +std::cout<< "TruthIdx_lminus " <<TruthIdx_lminus<< std::endl; +std::cout<< "TruthIdx_n " << TruthIdx_n<<std::endl; +std::cout<< "TruthIdx_nbar " << TruthIdx_nbar<<std::endl; +std::cout<< "Truth_WplusHad " << Truth_WplusHad<<std::endl; +std::cout<< "Truth_WminusHad " << Truth_WminusHad<<std::endl; +*/ + +bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_b!=-1 && TruthIdx_bbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && //ttbar->W+W-bbbar + ( (Truth_WplusHad && Truth_WminusHad && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //alljets + (Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) || //(l^+)+jets + (Truth_WminusHad && !Truth_WplusHad && TruthIdx_lplus!=-1 && TruthIdx_n!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //(l^-)+jets + (!Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_lplus!=-1 && TruthIdx_n!=-1))); + +//std::cout<< "Sanity check: " << sane << std::endl; + + +/* +if (TruthIdx_t!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking top: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_t)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_t)<<std::endl; +} + +if (TruthIdx_tbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking antitop: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_tbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_tbar)<<std::endl; +} + +if (TruthIdx_b!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking b: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_b)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_b)<<std::endl; +} + +if (TruthIdx_bbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking bbar: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_bbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_bbar)<<std::endl; +} + +if (TruthIdx_Wplus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wplus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wplus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wplus)<<std::endl; +} + +if (TruthIdx_Wminus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wminus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wminus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wminus)<<std::endl; +} +*/ +/* +if (TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWplus]/1000, (*mc_eta)[TruthIdx_QfromWplus], (*mc_phi)[TruthIdx_QfromWplus], (*mc_m)[TruthIdx_QfromWplus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWplus]/1000, (*mc_eta)[TruthIdx_QbarfromWplus], (*mc_phi)[TruthIdx_QbarfromWplus], (*mc_m)[TruthIdx_QbarfromWplus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wplus reco possible! Mass: "<< truffiW.M() <<std::endl; +} + +if (TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWminus]/1000, (*mc_eta)[TruthIdx_QfromWminus], (*mc_phi)[TruthIdx_QfromWminus], (*mc_m)[TruthIdx_QfromWminus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWminus]/1000, (*mc_eta)[TruthIdx_QbarfromWminus], (*mc_phi)[TruthIdx_QbarfromWminus], (*mc_m)[TruthIdx_QbarfromWminus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wminus reco possible! Mass: "<< truffiW.M() <<std::endl; +} +*/ +return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ttH.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ttH.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a28a673929efc9b4bf1a1ab4967f9882ca8cb4be --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_ttH.cxx @@ -0,0 +1,940 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD_ttH.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_ttH::InterfaceD3PD_ttH() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + EventNumber = 0; + if(eventWeight_SF) + eventWeight_SF = 0; + + fBtagCut = 0.601713; + fBtagEff = 0.696; + fBtagRej = 134.; + + mu_n = 0; + mu_E = 0; + mu_pt = 0; + mu_phi = 0; + mu_eta = 0; + + el_n = 0; + el_E = 0; + el_track_eta = 0; + el_phi = 0; + el_cl_eta = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_deteta = 0; + jet_phi = 0; + jet_MV1 = 0; + jet_jvf = 0; + + mwt = 0; + met_et = 0; + met_x = 0; + met_y = 0; + met_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_ttH::~InterfaceD3PD_ttH() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + // debugKK + // err *= this ->ConnectTree("physics"); + err *= this ->ConnectTree("GoeTree"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + // debugKK + // fChain = new TChain("physics"); + fChain = new TChain("GoeTree"); + + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("eventNumber", &EventNumber); + fTree->SetBranchAddress("eventWeight_SF", &eventWeight_SF); + + // fTree->SetBranchAddress("mu_n", &mu_n); + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_pt", &mu_pt); + fTree->SetBranchAddress("mu_phi", &mu_phi); + fTree->SetBranchAddress("mu_eta", &mu_eta); + + // fTree->SetBranchAddress("el_n", &el_n); + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_pt", &el_pt); + fTree->SetBranchAddress("el_track_eta", &el_track_eta); + fTree->SetBranchAddress("el_phi", &el_phi); + fTree->SetBranchAddress("el_cl_eta", &el_cl_eta); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_det_eta", &jet_deteta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_MV1", &jet_MV1); + fTree->SetBranchAddress("jet_jvf", &jet_jvf); + + fTree->SetBranchAddress("mwt", &mwt); + fTree->SetBranchAddress("met_et", &met_et); + fTree->SetBranchAddress("met_x", &met_x); + fTree->SetBranchAddress("met_y", &met_y); + fTree->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("eventWeight_SF", &eventWeight_SF ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"eventNumber", "eventWeight_SF", "mu_E","mu_pt", "mu_phi", "mu_eta","el_cl_E","el_pt","el_track_eta","el_cl_eta","el_cl_eta", "el_phi", "jet_n", "jet_E", "jet_pt","jet_eta", "jet_det_eta", "jet_phi", "jet_MV1", "jet_jvf", "mwt", "met_et", "met_x", "met_y", "met_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","eventWeight_SF", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("eventNumber", &EventNumber); + fChain->SetBranchAddress("eventWeight_SF", &eventWeight_SF); + + // fChain->SetBranchAddress("mu_n", &mu_n); + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_pt", &mu_pt); + fChain->SetBranchAddress("mu_phi", &mu_phi); + fChain->SetBranchAddress("mu_eta", &mu_eta); + + // fChain->SetBranchAddress("el_n", &el_n); + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_pt", &el_pt); + fChain->SetBranchAddress("el_track_eta", &el_track_eta); + fChain->SetBranchAddress("el_phi", &el_phi); + fChain->SetBranchAddress("el_cl_eta", &el_cl_eta); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_det_eta", &jet_deteta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_MV1", &jet_MV1); + fChain->SetBranchAddress("jet_jvf", &jet_jvf); + + fChain->SetBranchAddress("mwt", &mwt); + fChain->SetBranchAddress("met_et", &met_et); + fChain->SetBranchAddress("met_x", &met_x); + fChain->SetBranchAddress("met_y", &met_y); + fChain->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("eventWeight_SF", &eventWeight_SF ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_ttH::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (eventWeight_SF){ + + fWeight = eventWeight_SF; + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_MV1->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i), jet_eta->at(i), jet_phi->at(i), jet_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_ttH::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_deteta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej, KLFitter::Particles::kNone, jet_MV1->at(i)); + delete tlv_tmp; + } + + //fill electrons + if (el_track_eta) { + el_n = el_track_eta->size(); + for (int i = 0; i < el_n; ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)) / cosh(el_track_eta->at(i)), el_track_eta->at(i), el_phi->at(i), el_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + //std::cout << "KLFitter::InterfaceD3PD_ttH::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_cl_eta->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + } + + // fill muons + if (mu_eta) { + mu_n = mu_eta->size(); + for (int i = 0; i < mu_n; ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + // tlv_tmp->SetPxPyPzE(mu_px->at(i)/1000., mu_py->at(i)/1000., mu_pz->at(i)/1000., mu_E->at(i)/1000.); + tlv_tmp->SetPtEtaPhiE(mu_pt->at(i), mu_eta->at(i), mu_phi->at(i), mu_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_ttH::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + // do not fill mc information if di-leptonic + if ( (Truth_WplusHad == false) && (Truth_WminusHad == false) ) + return 1; + + int index_H = -1; + int index_bfromH = -1; + int index_bbarfromH = -1; + int index_Whad = -1; + int index_Wlep = -1; + int index_tophad = -1; + int index_toplep = -1; + int index_bhad = -1; + int index_blep = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_l = -1; + int index_nu = -1; + + index_H = TruthIdx_H; + index_bfromH = TruthIdx_bfromH; + index_bbarfromH = TruthIdx_bbarfromH; + + if (Truth_WplusHad) + { + index_Whad = TruthIdx_Wplus; + index_tophad = TruthIdx_t; + index_bhad = TruthIdx_bfromt; + + index_Wlep = TruthIdx_Wminus; + index_toplep = TruthIdx_tbar; + index_blep = TruthIdx_bbarfromtbar; + index_l = TruthIdx_lminus; + index_nu = TruthIdx_nbar; + index_q1 = TruthIdx_QfromWplus; + index_q2 = TruthIdx_QbarfromWplus; + + } + else + { + index_Wlep = TruthIdx_Wplus; + index_toplep = TruthIdx_t; + index_blep = TruthIdx_bfromt; + index_l = TruthIdx_lplus; + index_nu = TruthIdx_n; + index_q1 = TruthIdx_QfromWminus; + index_q2 = TruthIdx_QbarfromWminus; + + index_Whad = TruthIdx_Wminus; + index_tophad = TruthIdx_tbar; + index_bhad = TruthIdx_bbarfromtbar; + + } + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bfromH), + mc_eta->at(index_bfromH), + mc_phi->at(index_bfromH), + mc_m->at(index_bfromH)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "b from H"); + + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bbarfromH), + mc_eta->at(index_bbarfromH), + mc_phi->at(index_bbarfromH), + mc_m->at(index_bbarfromH)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "bbar from H"); + + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad), + mc_eta->at(index_bhad), + mc_phi->at(index_bhad), + mc_m->at(index_bhad)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_blep), + mc_eta->at(index_blep), + mc_phi->at(index_blep), + mc_m->at(index_blep)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q1), + mc_eta->at(index_q1), + mc_phi->at(index_q1), + mc_m->at(index_q1)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 1"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q2), + mc_eta->at(index_q2), + mc_phi->at(index_q2), + mc_m->at(index_q2)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 2"); + + if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l), + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "electron"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l), + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "muon"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l), + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "tau"); + } + + if (index_nu!=-1){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_nu), + mc_eta->at(index_nu), + mc_phi->at(index_nu), + mc_m->at(index_nu)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + if (index_tophad >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad), + mc_eta->at(index_tophad), + mc_phi->at(index_tophad), + mc_m->at(index_tophad)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top quark"); + } + + if (index_toplep >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_toplep), + mc_eta->at(index_toplep), + mc_phi->at(index_toplep), + mc_m->at(index_toplep)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic top quark"); + } + + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_H), + mc_eta->at(index_H), + mc_phi->at(index_H), + mc_m->at(index_H)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "Higgs"); + + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_ttH::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + + +// --------------------------------------------------------- +bool KLFitter::InterfaceD3PD_ttH::DecaysIntoItself(int iEntry) +{ + + if ((mc_child_index)->at(iEntry).size()==1){ + if(mc_pdgId->at(iEntry) == mc_pdgId->at((mc_child_index)->at(iEntry).at(0))) + return true; + } + + return false; + +} + +// --------------------------------------------------------- +void KLFitter::InterfaceD3PD_ttH::CheckTauChildren(int truthIdx) +{ + + bool TauHasHadronicChild = false; + + long ppdg=mc_pdgId->at(truthIdx); + + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + if(TruthHERWIGFlag){ + + int NChildren = (mc_child_index)->at(truthIdx).size(); + + for(int fChild = 0; fChild < NChildren; ++fChild){ + int truthChildrenIdx = (mc_child_index) -> at(truthIdx).at(fChild); + long ChildPDG = mc_pdgId -> at(truthChildrenIdx); + + if (fabs(ChildPDG) < 5) TauHasHadronicChild = true; + + } + } + else{ + + for(unsigned int i = 0; i != mc_pdgId -> size(); ++i){ + + // check if you find another tau which decays + if(mc_status->at(i) != 3 && ppdg == mc_pdgId->at(i)){ + + int NParents=(mc_parent_index)->at(truthIdx).size(); + + long ParentPDG = -1; + + if (NParents>0) { + int truthMotherIdx = (mc_parent_index) -> at(truthIdx).at(0); + ParentPDG = mc_pdgId -> at(truthMotherIdx); + } + + // check if this tau has a W mother + if (fabs(ParentPDG) != 24) continue; + + int NChildren = (mc_child_index)->at(truthIdx).size(); + + for(int fChild = 0; fChild < NChildren; ++fChild){ + int truthChildrenIdx = (mc_child_index) -> at(truthIdx).at(fChild); + long ChildPDG = mc_pdgId -> at(truthChildrenIdx); + + if (fabs(ChildPDG) < 5) TauHasHadronicChild = true; + + } + } + + } + + } + + HadronicTauDecay = TauHasHadronicChild; + +} + + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_ttH::TruthMapper(){ + + //Init: No particles found yet + TruthIdx_H = -1; + TruthIdx_bfromH = -1; + TruthIdx_bbarfromH = -1; + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_bfromt = -1; + TruthIdx_bbarfromtbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_lplus = -1; + TruthIdx_lminus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int NH = 0; + int NbfromH = 0; + int NbbarfromH = 0; + int Nt = 0; + int Ntbar = 0; + int Nbfromt = 0; + int Nbbarfromtbar= 0; + int NWplus = 0; + int NWminus = 0; + int NQfromWminus = 0; + int NQbarfromWminus = 0; + int NQfromWplus = 0; + int NQbarfromWplus = 0; + int Nlplus = 0; + int Nlminus = 0; + int Nn = 0; + int Nnbar = 0; + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + for (unsigned int i=0;i!=mc_pt->size();++i) { + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_into_itself= DecaysIntoItself(i); + + // according to Un-ki Yang <ukyang@hep.manchester.ac.uk> the particles with status code 123 or 124 are the ones to be used + + // if sample is showered with Herwig or Pythia + if ( (TruthHERWIGFlag && ((mc_status->at(i)==123) || (mc_status->at(i)==124) || (fabs(pdg) == 6 && mc_status->at(i) == 155))) || (!TruthHERWIGFlag && mc_status->at(i)==3 ) ) { + + //------------- + // Higgs branch + //------------- + + if (pdg==25 && NH==0) { // Higgs (ok) + TruthIdx_H=i; + ++NH; + } + else if (pdg==5 && NbfromH==0 && TruthIdx_H!=-1 && OriginatesFromPDG(i,25)) { //b from Higgs (ok) + TruthIdx_bfromH=i; + ++NbfromH; + } + else if (pdg==-5 && NbbarfromH==0 && TruthIdx_H!=-1 && OriginatesFromPDG(i,25)) { //bbar from Higgs (ok) + TruthIdx_bbarfromH=i; + ++NbbarfromH; + } + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0 && ( (TruthHERWIGFlag && mc_status->at(i) == 155) || (!TruthHERWIGFlag && mc_status->at(i) == 3) ) ) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if ((pdg==5 || pdg==3 || pdg == 1) && Nbfromt==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_bfromt=i; + ++Nbfromt; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + } + else if ((pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24)) { //lplus (HERWIG) + + if(pdg == -15 && decays_into_itself){ + + int ChildIndex = (mc_child_index -> at(i)).at(0); + + CheckTauChildren(ChildIndex); + + } + + TruthIdx_lplus=i; + Truth_WplusHad=false; + ++Nlplus; + TruthIdx_blep = TruthIdx_bfromt; + } + else if ((pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (Truth_WplusHad && NWplus==1 && NQfromWplus==0 && (pdg==2 || pdg==4) && OriginatesFromPDG(i,24)) { // up/charm from W+ + TruthIdx_QfromWplus=i; + ++NQfromWplus; + TruthIdx_bhad = TruthIdx_bfromt; + } + else if (Truth_WplusHad && NWplus==1 && NQbarfromWplus==0 && (pdg==-1 || pdg==-3 || pdg == -5) && OriginatesFromPDG(i,24)) { // antidown/antistrange from W+ + TruthIdx_QbarfromWplus=i; + ++NQbarfromWplus; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 && ( (TruthHERWIGFlag && mc_status->at(i) == 155) || (!TruthHERWIGFlag && mc_status->at(i) == 3) ) ) { //antitop (ok) + + TruthIdx_tbar=i; + ++Ntbar; + } + else if ((pdg==-5 || pdg==-3 || pdg==-1) && Nbbarfromtbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbarfromtbar=i; + ++Nbbarfromtbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + } + else if ((pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (HERWIG) + + if(pdg == 15 && decays_into_itself){ + + int ChildIndex = (mc_child_index -> at(i)).at(0); + + CheckTauChildren(ChildIndex); + + } + + Truth_WminusHad=false; + TruthIdx_lminus=i; + ++Nlminus; + TruthIdx_blep = TruthIdx_bbarfromtbar; + } + else if ((pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (Truth_WminusHad && NWminus==1 && NQfromWminus==0 && (pdg==1 || pdg==3 || pdg==5) && OriginatesFromPDG(i,-24)) { // down/strange from W- + TruthIdx_QfromWminus=i; + ++NQfromWminus; + TruthIdx_bhad = TruthIdx_bbarfromtbar; + } + else if (Truth_WminusHad && NWminus==1 && NQbarfromWminus==0 && (pdg==-2 || pdg==-4) && OriginatesFromPDG(i,-24)) { // antiup/anticharm from W- + TruthIdx_QbarfromWminus=i; + ++NQbarfromWminus; + } + + + } + } //loop over all particles + + //no error + return 1; +} + +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_ttH::IsProperMCEvent(){ +//some sanity checks, most of them commented out: + +// std::cout<< "=======================" << std::endl; +// std::cout<< "TruthIdx_H " <<TruthIdx_H << std::endl; +// std::cout<< "TruthIdx_bfromH "<< TruthIdx_bfromH<<std::endl; +// std::cout<< "TruthIdx_bbarfromH "<< TruthIdx_bbarfromH<<std::endl; + +// std::cout<< "TruthIdx_t " <<TruthIdx_t << std::endl; +// std::cout<< "TruthIdx_tbar "<< TruthIdx_tbar << std::endl; +// std::cout<< "TruthIdx_bfromt "<< TruthIdx_bfromt<<std::endl; +// std::cout<< "TruthIdx_bbarfromtbar " <<TruthIdx_bbarfromtbar <<std::endl; + +// std::cout<< "TruthIdx_Wplus " <<TruthIdx_Wplus <<std::endl; +// std::cout<< "TruthIdx_Wminus " <<TruthIdx_Wminus<< std::endl; +// std::cout<< "TruthIdx_QfromWplus " <<TruthIdx_QfromWplus <<std::endl; +// std::cout<< "TruthIdx_QbarfromWplus " <<TruthIdx_QbarfromWplus <<std::endl; +// std::cout<< "TruthIdx_QfromWminus " << TruthIdx_QfromWminus<<std::endl; +// std::cout<< "TruthIdx_QbarfromWminus " <<TruthIdx_QbarfromWminus <<std::endl; + +// std::cout<< "TruthIdx_lplus " << TruthIdx_lplus<<std::endl; +// std::cout<< "TruthIdx_lminus " <<TruthIdx_lminus<< std::endl; + +// std::cout<< "TruthIdx_n " << TruthIdx_n<<std::endl; +// std::cout<< "TruthIdx_nbar " << TruthIdx_nbar<<std::endl; + +// std::cout<< "Truth_WplusHad " << Truth_WplusHad<<std::endl; +// std::cout<< "Truth_WminusHad " << Truth_WminusHad<<std::endl; + + + bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_bfromt!=-1 && TruthIdx_bbarfromtbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && TruthIdx_H!=-1 && TruthIdx_bfromH!=-1 && TruthIdx_bbarfromH!=-1//ttbarH->W+W-bbbarbbbar + && ( (Truth_WplusHad && Truth_WminusHad && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //alljets + (Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) || //(l^+)+jets + (Truth_WminusHad && !Truth_WplusHad && TruthIdx_lplus!=-1 && TruthIdx_n!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //(l^-)+jets + (!Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_lplus!=-1 && TruthIdx_n!=-1))); + + //std::cout<< "Sanity check: " << sane << std::endl; + +/* +if (TruthIdx_H!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking H: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_H)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_H)<<std::endl; +} +*/ +/* +if (TruthIdx_t!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking top: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_t)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_t)<<std::endl; +} + +if (TruthIdx_tbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking antitop: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_tbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_tbar)<<std::endl; +} + +if (TruthIdx_b!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking b: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_b)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_b)<<std::endl; +} + +if (TruthIdx_bbarfromtbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking bbar: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_bbarfromtbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_bbarfromtbar)<<std::endl; +} + +if (TruthIdx_Wplus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wplus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wplus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wplus)<<std::endl; +} + +if (TruthIdx_Wminus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wminus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wminus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wminus)<<std::endl; +} +*/ +/* +if (TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWplus]/1000, (*mc_eta)[TruthIdx_QfromWplus], (*mc_phi)[TruthIdx_QfromWplus], (*mc_m)[TruthIdx_QfromWplus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWplus]/1000, (*mc_eta)[TruthIdx_QbarfromWplus], (*mc_phi)[TruthIdx_QbarfromWplus], (*mc_m)[TruthIdx_QbarfromWplus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wplus reco possible! Mass: "<< truffiW.M() <<std::endl; +} + +if (TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWminus]/1000, (*mc_eta)[TruthIdx_QfromWminus], (*mc_phi)[TruthIdx_QfromWminus], (*mc_m)[TruthIdx_QfromWminus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWminus]/1000, (*mc_eta)[TruthIdx_QbarfromWminus], (*mc_phi)[TruthIdx_QbarfromWminus], (*mc_m)[TruthIdx_QbarfromWminus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wminus reco possible! Mass: "<< truffiW.M() <<std::endl; +} +*/ +return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_udsep.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_udsep.cxx new file mode 100644 index 0000000000000000000000000000000000000000..37a81aa7ea5f7b08eb0ec1e1c1aa832fac7875ec --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceD3PD_udsep.cxx @@ -0,0 +1,783 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceD3PD_udsep.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TChain.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_udsep::InterfaceD3PD_udsep() +{ + fFlagWriteSignalMCTruth = false; + fSignalMCGen = KLFitter::InterfaceRoot::kHerwig; + + fTree = 0; + + eventNumber = 0; + if(eventWeight) + eventWeight = 0; + + fBtagCut = 0.601713; + fBtagEff = 0.696; + fBtagRej = 134; + + mu_E = 0; + mu_pt = 0; + mu_eta = 0; + mu_phi = 0; + + el_E = 0; + el_eta = 0; + el_deteta = 0; + el_phi = 0; + + jet_n = 0; + jet_E = 0; + jet_pt = 0; + jet_eta = 0; + jet_det_eta = 0; + jet_phi = 0; + jet_MV1 = 0; + + met_et = 0; + met_x = 0; + met_y = 0; + met_sumet = 0; + + mc_eta = 0; + mc_phi = 0; + mc_pt = 0; + mc_pdgId = 0; + mc_m = 0; + mc_status = 0; + mc_parent_index = 0; + mc_child_index = 0; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceD3PD_udsep::~InterfaceD3PD_udsep() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("GoeTree"); + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("GoeTree"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + return ConnectTree(fTree); +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::ConnectTree(TTree * fTree) +{ + if (!this->fTree) this->fTree = fTree; + // set branch adresses + fTree->SetBranchAddress("eventNumber", &eventNumber); + fTree->SetBranchAddress("eventWeight", &eventWeight); + + fTree->SetBranchAddress("mu_E", &mu_E); + fTree->SetBranchAddress("mu_pt", &mu_pt); + fTree->SetBranchAddress("mu_eta", &mu_eta); + fTree->SetBranchAddress("mu_phi", &mu_phi); + + fTree->SetBranchAddress("el_cl_E", &el_E); + fTree->SetBranchAddress("el_eta", &el_eta); + fTree->SetBranchAddress("el_cl_eta", &el_deteta); + fTree->SetBranchAddress("el_phi", &el_phi); + + fTree->SetBranchAddress("jet_n", &jet_n); + fTree->SetBranchAddress("jet_E", &jet_E); + fTree->SetBranchAddress("jet_pt", &jet_pt); + fTree->SetBranchAddress("jet_eta", &jet_eta); + fTree->SetBranchAddress("jet_det_eta", &jet_det_eta); + fTree->SetBranchAddress("jet_phi", &jet_phi); + fTree->SetBranchAddress("jet_MV1", &jet_MV1); + + fTree->SetBranchAddress("met_et", &met_et); + fTree->SetBranchAddress("met_x", &met_x); + fTree->SetBranchAddress("met_y", &met_y); + fTree->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fTree->SetBranchAddress("mc_eta", &mc_eta ); + fTree->SetBranchAddress("mc_phi", &mc_phi ); + fTree->SetBranchAddress("mc_pt", &mc_pt ); + fTree->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fTree->SetBranchAddress("eventWeight", &eventWeight ); + fTree->SetBranchAddress("mc_m", &mc_m ); + fTree->SetBranchAddress("mc_status", &mc_status ); + fTree->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fTree->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + fChain->SetBranchStatus("*", 0); + + const char* branches[] = + {"eventNumber", "eventWeight", "mu_E","mu_pt","mu_eta","mu_phi","el_cl_E","el_eta","el_cl_eta", "el_phi", "jet_n", "jet_E", "jet_pt","jet_eta", "jet_det_eta", "jet_phi", "jet_MV1", "met_et", "met_x", "met_y", "met_sumet", "mc_eta", "mc_phi", "mc_pt", "mc_pdgId","eventWeight", "mc_m", "mc_status", "mc_parent_index","mc_child_index"}; + + for (unsigned int b = 0; b < sizeof(branches) / sizeof(const char*); b++) + fChain->SetBranchStatus(branches[b], 1); + + // set branch adresses + fChain->SetBranchAddress("eventNumber", &eventNumber); + fChain->SetBranchAddress("eventWeight", &eventWeight); + + fChain->SetBranchAddress("mu_E", &mu_E); + fChain->SetBranchAddress("mu_pt", &mu_pt); + fChain->SetBranchAddress("mu_phi", &mu_phi); + fChain->SetBranchAddress("mu_eta", &mu_eta); + + fChain->SetBranchAddress("el_cl_E", &el_E); + fChain->SetBranchAddress("el_eta", &el_eta); + fChain->SetBranchAddress("el_cl_eta", &el_deteta); + fChain->SetBranchAddress("el_phi", &el_phi); + + fChain->SetBranchAddress("jet_n", &jet_n); + fChain->SetBranchAddress("jet_E", &jet_E); + fChain->SetBranchAddress("jet_pt", &jet_pt); + fChain->SetBranchAddress("jet_eta", &jet_eta); + fChain->SetBranchAddress("jet_det_eta", &jet_det_eta); + fChain->SetBranchAddress("jet_phi", &jet_phi); + fChain->SetBranchAddress("jet_MV1", &jet_MV1); + + fChain->SetBranchAddress("met_et", &met_et); + fChain->SetBranchAddress("met_x", &met_x); + fChain->SetBranchAddress("met_y", &met_y); + fChain->SetBranchAddress("met_sumet", &met_sumet); + + //Truth Variables + fChain->SetBranchAddress("mc_eta", &mc_eta ); + fChain->SetBranchAddress("mc_phi", &mc_phi ); + fChain->SetBranchAddress("mc_pt", &mc_pt ); + fChain->SetBranchAddress("mc_pdgId", &mc_pdgId ); + fChain->SetBranchAddress("eventWeight", &eventWeight ); + fChain->SetBranchAddress("mc_m", &mc_m ); + fChain->SetBranchAddress("mc_status", &mc_status ); + fChain->SetBranchAddress("mc_parent_index", &mc_parent_index ); + fChain->SetBranchAddress("mc_child_index", &mc_child_index ); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::GetEvent(). Tree or Chain not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceD3PD_udsep::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceD3PD_udsep::FillParticles() +{ + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + //set weight + if (eventWeight){ + fWeight = eventWeight; + } else { + fWeight=1.0; + } + + // fill jets + for (int i = 0; i < jet_n; ++i){ + if (jet_E->at(i) <= 0.) + continue; + + bool isTagged = jet_MV1->at(i) > fBtagCut; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(jet_pt->at(i), jet_eta->at(i), jet_phi->at(i), jet_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_udsep::FillParticles(). Jet mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, jet_det_eta->at(i), KLFitter::Particles::kParton, "", i, isTagged, fBtagEff, fBtagRej, KLFitter::Particles::kNone, jet_MV1->at(i)); + delete tlv_tmp; + } + + //fill electrons + for (unsigned int i = 0; i < el_E->size(); ++i){ + if (el_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE((el_E->at(i)) / cosh(el_eta->at(i)), el_eta->at(i), el_phi->at(i), el_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_udsep::FillParticles(). Electron mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, el_deteta->at(i), KLFitter::Particles::kElectron, "", i); + delete tlv_tmp; + } + + // fill muons + for (unsigned int i = 0; i < mu_E->size(); ++i){ + if (mu_E->at(i) <= 0.) + continue; + + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(mu_pt->at(i), mu_eta->at(i), mu_phi->at(i), mu_E->at(i)); + //If mass is negative, manually correct it to 0. + if (tlv_tmp->M() < 0){ + std::cout << "KLFitter::InterfaceD3PD_udsep::FillParticles(). Muon mass was negative and corrected to 0." << std::endl; + tlv_tmp->SetPtEtaPhiM(tlv_tmp->Pt(), tlv_tmp->Eta(), tlv_tmp->Phi(), 0); + } + fParticles->AddParticle(tlv_tmp, mu_eta->at(i), KLFitter::Particles::kMuon, "", i); + delete tlv_tmp; + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + //Find the correct truth particle indices + this->TruthMapper(); + + + // check if event is proper ttbar event + if (!this->IsProperMCEvent()) + return 1; + + // do not fill mc information if di-leptonic + if ( (Truth_WplusHad == false) && (Truth_WminusHad == false) ) + return 1; + + int index_Whad = -1; + int index_Wlep = -1; + int index_tophad = -1; + int index_toplep = -1; + int index_bhad = -1; + int index_blep = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_l = -1; + int index_nu = -1; + + if (Truth_WplusHad) + { + index_Whad = TruthIdx_Wplus; + index_tophad = TruthIdx_t; + index_bhad = TruthIdx_b; + + index_Wlep = TruthIdx_Wminus; + index_toplep = TruthIdx_tbar; + index_blep = TruthIdx_bbar; + index_l = TruthIdx_lminus; + index_nu = TruthIdx_nbar; + index_q1 = TruthIdx_QfromWplus; //q1: up type quark + index_q2 = TruthIdx_QbarfromWplus; //q2: down type quark + + } + else + { + index_Wlep = TruthIdx_Wplus; + index_toplep = TruthIdx_t; + index_blep = TruthIdx_b; + index_l = TruthIdx_lplus; + index_nu = TruthIdx_n; + index_q1 = TruthIdx_QbarfromWminus; //q1: up type quark + index_q2 = TruthIdx_QfromWminus; //q2: down type quark + + index_Whad = TruthIdx_Wminus; + index_tophad = TruthIdx_tbar; + index_bhad = TruthIdx_bbar; + + } + //Create new temp TLorentzVector + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_bhad) / 1000., + mc_eta->at(index_bhad), + mc_phi->at(index_bhad), + mc_m->at(index_bhad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_blep) / 1000., + mc_eta->at(index_blep), + mc_phi->at(index_blep), + mc_m->at(index_blep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic b quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q1) / 1000., + mc_eta->at(index_q1), + mc_phi->at(index_q1), + mc_m->at(index_q1) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light up type quark"); + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_q2) / 1000., + mc_eta->at(index_q2), + mc_phi->at(index_q2), + mc_m->at(index_q2) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light down type quark"); + + if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 11){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "electron"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 13){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "muon"); + } + else if (index_l!=-1 && abs(mc_pdgId->at(index_l)) == 15){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_l) / 1000., + mc_eta->at(index_l), + mc_phi->at(index_l), + mc_m->at(index_l) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "tau"); + } + + if (index_nu!=-1){ + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_nu) / 1000., + mc_eta->at(index_nu), + mc_phi->at(index_nu), + mc_m->at(index_nu) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + if (index_tophad >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_tophad) / 1000., + mc_eta->at(index_tophad), + mc_phi->at(index_tophad), + mc_m->at(index_tophad) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top quark"); + } + + if (index_toplep >= 0) { + tlv_tmp->SetPtEtaPhiM(mc_pt->at(index_toplep) / 1000., + mc_eta->at(index_toplep), + mc_phi->at(index_toplep), + mc_m->at(index_toplep) / 1000.); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic top quark"); + } + //free memory + delete tlv_tmp; + + // no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_udsep::OriginatesFromPDG(int truthIdx,long pdg) +{ + // a helper function needed for the TruthMapper + //returns true if particle with index truthIdx originates directly from a particle with pgdid 'pdg' + //=========================================================================== + long ppdg=mc_pdgId->at(truthIdx); + for (int i=0;i!=6;++i) { //check to most 6 generations + int NParents=mc_parent_index->at(truthIdx).size(); + if (NParents>0) { + int truthMotherIdx=mc_parent_index->at(truthIdx).at(0); + long ParentPDG=mc_pdgId->at(truthMotherIdx); + if (ParentPDG==pdg) return true; //found pdg + else if (ParentPDG==ppdg) truthIdx=truthMotherIdx; //particle decayed from itself, keep looking upwards + else return false; //other parent + } + else return false; //no parent + } + return false; +} + +// --------------------------------------------------------- + +int KLFitter::InterfaceD3PD_udsep::TruthMapper(){ + + //Init: No particles found yet + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wplus = -1; + TruthIdx_Wminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_lplus = -1; + TruthIdx_lminus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + Truth_WplusHad = true; + Truth_WminusHad = true; + + //counters for cross checks + int Nt = 0; + int Ntbar = 0; + int Nb = 0; + int Nbbar = 0; + int NWplus = 0; + int NWminus = 0; + int NQfromWminus = 0; + int NQbarfromWminus = 0; + int NQfromWplus = 0; + int NQbarfromWplus = 0; + int Nlplus = 0; + int Nlminus = 0; + int Nn = 0; + int Nnbar = 0; + + // !!! Define this parameter in your config file/job option. Its crucial for a correct MC truth particle identification! + bool TruthHERWIGFlag = true; + if (fSignalMCGen == KLFitter::InterfaceRoot::kAcer) + TruthHERWIGFlag = false; + + for (unsigned int i=0;i!=mc_pt->size();++i) { + int pdg = (*mc_pdgId)[i]; + + //TruthIdx + bool decays_in_itself=false; + if (mc_child_index->at(i).size()==1) { + decays_in_itself = (pdg==mc_pdgId->at(mc_child_index->at(i).at(0))); + } + + // according to Un-ki Yang <ukyang@hep.manchester.ac.uk> the particles with status code 123 or 124 are the ones to be used + + if ((TruthHERWIGFlag && (mc_status->at(i)==123 || mc_status->at(i)==124)) || (!TruthHERWIGFlag && !decays_in_itself)) { + + //----------- + // top branch + //----------- + if (pdg==6 && Nt==0) { //top (ok) + TruthIdx_t=i; + ++Nt; + } + else if (pdg==5 && Nb==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //bottom (ok) + TruthIdx_b=i; + ++Nb; + } + else if (pdg==24 && NWplus==0 && TruthIdx_t!=-1 && OriginatesFromPDG(i,6)) { //W+ + TruthIdx_Wplus=i; + ++NWplus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c < mc_child_index->at(i).size();++c) { + int WpChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WpChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W+ decays in leptons + Truth_WplusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0 && OriginatesFromPDG(i,24) ) { //lplus (!HERWIG) + TruthIdx_lplus=i; + ++Nlplus; + } + else if (TruthHERWIGFlag && (pdg==-11 || pdg==-13 || pdg==-15) && Nlplus==0) { //lplus (HERWIG) + TruthIdx_lplus=i; + Truth_WplusHad=false; + ++Nlplus; + } + else if (!TruthHERWIGFlag && !Truth_WplusHad && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (!HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (TruthHERWIGFlag && (pdg==12 || pdg==14 || pdg==16) && Nn==0 && OriginatesFromPDG(i,24)) { //neutrino (HERWIG) + TruthIdx_n=i; + ++Nn; + } + else if (Truth_WplusHad && NWplus==1 && NQfromWplus==0 && (pdg==2 || pdg==4) && OriginatesFromPDG(i,24)) { // up/charm from W+ + TruthIdx_QfromWplus=i; + ++NQfromWplus; + } + else if (Truth_WplusHad && NWplus==1 && NQbarfromWplus==0 && (pdg==-1 || pdg==-3) && OriginatesFromPDG(i,24)) { // antidown/antistrange from W+ + TruthIdx_QbarfromWplus=i; + ++NQbarfromWplus; + } + //---------------- + // anti-top branch + //---------------- + if (pdg==-6 && Ntbar==0 ) { //anti top (ok) + TruthIdx_tbar=i; + ++Ntbar; + } + else if (pdg==-5 && Nbbar==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //anti bottom (ok) + TruthIdx_bbar=i; + ++Nbbar; + } + else if (pdg==-24 && NWminus==0 && TruthIdx_tbar!=-1 && OriginatesFromPDG(i,-6)) { //W- + TruthIdx_Wminus=i; + ++NWminus; + if (!TruthHERWIGFlag) { + for (unsigned int c=0;c<mc_child_index->at(i).size();++c) { + int WmChildIdx=mc_child_index->at(i).at(c); + long Wc_pdg=mc_pdgId->at(WmChildIdx); + if (abs(Wc_pdg)>10 && abs(Wc_pdg)<17) { //W- decays in leptons + Truth_WminusHad=false; + break; + } + } + } + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0 && OriginatesFromPDG(i,-24)) { //lminus (!HERWIG) + TruthIdx_lminus=i; + ++Nlminus; + } + else if (TruthHERWIGFlag && (pdg==11 || pdg==13 || pdg==15) && Nlminus==0) { //lminus (HERWIG) + Truth_WminusHad=false; + TruthIdx_lminus=i; + ++Nlminus; + } + else if (!TruthHERWIGFlag && !Truth_WminusHad && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0 && OriginatesFromPDG(i,-24)) { //anti neutrino (!HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (TruthHERWIGFlag && (pdg==-12 || pdg==-14 || pdg==-16) && Nnbar==0) { //anti neutrino (HERWIG) + TruthIdx_nbar=i; + ++Nnbar; + } + else if (Truth_WminusHad && NWminus==1 && NQfromWminus==0 && (pdg==1 || pdg==3) && OriginatesFromPDG(i,-24)) { // down/strange from W- + TruthIdx_QfromWminus=i; + ++NQfromWminus; + } + else if (Truth_WminusHad && NWminus==1 && NQbarfromWminus==0 && (pdg==-2 || pdg==-4) && OriginatesFromPDG(i,-24)) { // antiup/anticharm from W- + TruthIdx_QbarfromWminus=i; + ++NQbarfromWminus; + } + } + } //loop over all particles + + //no error + return 1; +} +// --------------------------------------------------------- + +bool KLFitter::InterfaceD3PD_udsep::IsProperMCEvent(){ +//some sanity checks, most of them commented out: +/* +std::cout<< "=======================" << std::endl; +std::cout<< "TruthIdx_t " <<TruthIdx_t << std::endl; +std::cout<< "TruthIdx_tbar "<< TruthIdx_tbar << std::endl; +std::cout<< "TruthIdx_b "<< TruthIdx_b<<std::endl; +std::cout<< "TruthIdx_bbar " <<TruthIdx_bbar <<std::endl; +std::cout<< "TruthIdx_Wplus " <<TruthIdx_Wplus <<std::endl; +std::cout<< "TruthIdx_Wminus " <<TruthIdx_Wminus<< std::endl; +std::cout<< "TruthIdx_QfromWplus " <<TruthIdx_QfromWplus <<std::endl; +std::cout<< "TruthIdx_QbarfromWplus " <<TruthIdx_QbarfromWplus <<std::endl; +std::cout<< "TruthIdx_QfromWminus " << TruthIdx_QfromWminus<<std::endl; +std::cout<< "TruthIdx_QbarfromWminus " <<TruthIdx_QbarfromWminus <<std::endl; +std::cout<< "TruthIdx_lplus " << TruthIdx_lplus<<std::endl; +std::cout<< "TruthIdx_lminus " <<TruthIdx_lminus<< std::endl; +std::cout<< "TruthIdx_n " << TruthIdx_n<<std::endl; +std::cout<< "TruthIdx_nbar " << TruthIdx_nbar<<std::endl; +std::cout<< "Truth_WplusHad " << Truth_WplusHad<<std::endl; +std::cout<< "Truth_WminusHad " << Truth_WminusHad<<std::endl; +*/ + +bool sane = (TruthIdx_t!=-1 && TruthIdx_tbar!=-1 && TruthIdx_b!=-1 && TruthIdx_bbar!=-1 && TruthIdx_Wplus!=-1 && TruthIdx_Wminus!=-1 && //ttbar->W+W-bbbar + ( (Truth_WplusHad && Truth_WminusHad && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //alljets + (Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) || //(l^+)+jets + (Truth_WminusHad && !Truth_WplusHad && TruthIdx_lplus!=-1 && TruthIdx_n!=-1 && TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) || //(l^-)+jets + (!Truth_WplusHad && !Truth_WminusHad && TruthIdx_lminus!=-1 && TruthIdx_nbar!=-1 && TruthIdx_lplus!=-1 && TruthIdx_n!=-1))); + +//std::cout<< "Sanity check: " << sane << std::endl; + + +/* +if (TruthIdx_t!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking top: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_t)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_t)<<std::endl; +} + +if (TruthIdx_tbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking antitop: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_tbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_tbar)<<std::endl; +} + +if (TruthIdx_b!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking b: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_b)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_b)<<std::endl; +} + +if (TruthIdx_bbar!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking bbar: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_bbar)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_bbar)<<std::endl; +} + +if (TruthIdx_Wplus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wplus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wplus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wplus)<<std::endl; +} + +if (TruthIdx_Wminus!=-1) { + std::cout << "-------------"<< std::endl; + std::cout << "Checking Wminus: "<< std::endl; + std::cout << "mass: "<< mc_m->at(TruthIdx_Wminus)<<std::endl; + std::cout << "PDGid: "<< mc_pdgId->at(TruthIdx_Wminus)<<std::endl; +} +*/ +/* +if (TruthIdx_QfromWplus!=-1 && TruthIdx_QbarfromWplus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWplus]/1000, (*mc_eta)[TruthIdx_QfromWplus], (*mc_phi)[TruthIdx_QfromWplus], (*mc_m)[TruthIdx_QfromWplus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWplus]/1000, (*mc_eta)[TruthIdx_QbarfromWplus], (*mc_phi)[TruthIdx_QbarfromWplus], (*mc_m)[TruthIdx_QbarfromWplus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wplus reco possible! Mass: "<< truffiW.M() <<std::endl; +} + +if (TruthIdx_QfromWminus!=-1 && TruthIdx_QbarfromWminus!=-1) { + TLorentzVector truffiQ, truffiQbar, truffiW; + truffiQ.SetPtEtaPhiM((*mc_pt)[TruthIdx_QfromWminus]/1000, (*mc_eta)[TruthIdx_QfromWminus], (*mc_phi)[TruthIdx_QfromWminus], (*mc_m)[TruthIdx_QfromWminus]/1000); + + truffiQbar.SetPtEtaPhiM((*mc_pt)[TruthIdx_QbarfromWminus]/1000, (*mc_eta)[TruthIdx_QbarfromWminus], (*mc_phi)[TruthIdx_QbarfromWminus], (*mc_m)[TruthIdx_QbarfromWminus]/1000); + + truffiW = truffiQ + truffiQbar; + + std::cout << "-------------"<< std::endl; + std::cout << "Wminus reco possible! Mass: "<< truffiW.M() <<std::endl; +} +*/ +return sane; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceDummy.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceDummy.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0f3a86486a96929fff17ae4ca9a0061d4e91072c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceDummy.cxx @@ -0,0 +1,287 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceDummy.h" +#include <iostream> + +// --------------------------------------------------------- +KLFitter::InterfaceDummy::InterfaceDummy() +{ + fTree = 0; + + fBhad_E = 0; + fBhad_px = 0; + fBhad_py = 0; + fBhad_pz = 0; + + fQup_E = 0; + fQup_px = 0; + fQup_py = 0; + fQup_pz = 0; + + fQdown_E = 0; + fQdown_px = 0; + fQdown_py = 0; + fQdown_pz = 0; + + fBlep_E = 0; + fBlep_px = 0; + fBlep_py = 0; + fBlep_pz = 0; + + fLepton_E = 0; + fLepton_px = 0; + fLepton_py = 0; + fLepton_pz = 0; + + fPhoton_E = 0; + fPhoton_px = 0; + fPhoton_py = 0; + fPhoton_pz = 0; + + MET_Et = 0; + MET_Etx = 0; + MET_Ety = 0; + MET_Phi = 0; + + fTrue_Bhad_E = 0; + fTrue_Bhad_px = 0; + fTrue_Bhad_py = 0; + fTrue_Bhad_pz = 0; + + fTrue_Qup_E = 0; + fTrue_Qup_px = 0; + fTrue_Qup_py = 0; + fTrue_Qup_pz = 0; + + fTrue_Qdown_E = 0; + fTrue_Qdown_px = 0; + fTrue_Qdown_py = 0; + fTrue_Qdown_pz = 0; + + fTrue_Blep_E = 0; + fTrue_Blep_px = 0; + fTrue_Blep_py = 0; + fTrue_Blep_pz = 0; + + fTrue_Lepton_E = 0; + fTrue_Lepton_px = 0; + fTrue_Lepton_py = 0; + fTrue_Lepton_pz = 0; + + fTrue_Photon_E = 0; + fTrue_Photon_px = 0; + fTrue_Photon_py = 0; + fTrue_Photon_pz = 0; + + fTrue_Neutrino_E = 0; + fTrue_Neutrino_px = 0; + fTrue_Neutrino_py = 0; + fTrue_Neutrino_pz = 0; + +} + +// --------------------------------------------------------- +KLFitter::InterfaceDummy::~InterfaceDummy() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceDummy::NEvents() +{ + if (!fTree) + return 0; + + else + return fTree -> GetEntries(); +} + + +// --------------------------------------------------------- +int KLFitter::InterfaceDummy::OpenRootFile(const char * filename, Option_t * opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this -> ConnectTree("fTree"); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceDummy::ConnectTree(const char * treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceDummy::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile -> IsOpen()) + { + std::cout << "KLFitter::InterfaceDummy::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile -> Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceDummy::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + // set branch addresses + fTree -> SetBranchAddress("bhad_E", &fBhad_E); + fTree -> SetBranchAddress("bhad_px", &fBhad_px); + fTree -> SetBranchAddress("bhad_py", &fBhad_py); + fTree -> SetBranchAddress("bhad_pz", &fBhad_pz); + + fTree -> SetBranchAddress("blep_E", &fBlep_E); + fTree -> SetBranchAddress("blep_px", &fBlep_px); + fTree -> SetBranchAddress("blep_py", &fBlep_py); + fTree -> SetBranchAddress("blep_pz", &fBlep_pz); + + fTree -> SetBranchAddress("qup_E", &fQup_E); + fTree -> SetBranchAddress("qup_px", &fQup_px); + fTree -> SetBranchAddress("qup_py", &fQup_py); + fTree -> SetBranchAddress("qup_pz", &fQup_pz); + + fTree -> SetBranchAddress("qdown_E", &fQdown_E); + fTree -> SetBranchAddress("qdown_px", &fQdown_px); + fTree -> SetBranchAddress("qdown_py", &fQdown_py); + fTree -> SetBranchAddress("qdown_pz", &fQdown_pz); + + fTree -> SetBranchAddress("lcharged_E", &fLepton_E); + fTree -> SetBranchAddress("lcharged_px", &fLepton_px); + fTree -> SetBranchAddress("lcharged_py", &fLepton_py); + fTree -> SetBranchAddress("lcharged_pz", &fLepton_pz); + + fTree -> SetBranchAddress("photon_E", &fPhoton_E); + fTree -> SetBranchAddress("photon_px", &fPhoton_px); + fTree -> SetBranchAddress("photon_py", &fPhoton_py); + fTree -> SetBranchAddress("photon_pz", &fPhoton_pz); + + fTree -> SetBranchAddress("MET_Et", &MET_Et); + fTree -> SetBranchAddress("MET_Phi", &MET_Phi); + fTree -> SetBranchAddress("MET_Etx", &MET_Etx); + fTree -> SetBranchAddress("MET_Ety", &MET_Ety); + + fTree -> SetBranchAddress("true_bhad_E", &fTrue_Bhad_E); + fTree -> SetBranchAddress("true_bhad_px", &fTrue_Bhad_px); + fTree -> SetBranchAddress("true_bhad_py", &fTrue_Bhad_py); + fTree -> SetBranchAddress("true_bhad_pz", &fTrue_Bhad_pz); + + fTree -> SetBranchAddress("true_blep_E", &fTrue_Blep_E); + fTree -> SetBranchAddress("true_blep_px", &fTrue_Blep_px); + fTree -> SetBranchAddress("true_blep_py", &fTrue_Blep_py); + fTree -> SetBranchAddress("true_blep_pz", &fTrue_Blep_pz); + + fTree -> SetBranchAddress("true_qup_E", &fTrue_Qup_E); + fTree -> SetBranchAddress("true_qup_px", &fTrue_Qup_px); + fTree -> SetBranchAddress("true_qup_py", &fTrue_Qup_py); + fTree -> SetBranchAddress("true_qup_pz", &fTrue_Qup_pz); + + fTree -> SetBranchAddress("true_qdown_E", &fTrue_Qdown_E); + fTree -> SetBranchAddress("true_qdown_px", &fTrue_Qdown_px); + fTree -> SetBranchAddress("true_qdown_py", &fTrue_Qdown_py); + fTree -> SetBranchAddress("true_qdown_pz", &fTrue_Qdown_pz); + + fTree -> SetBranchAddress("true_lcharged_E", &fTrue_Lepton_E); + fTree -> SetBranchAddress("true_lcharged_px", &fTrue_Lepton_px); + fTree -> SetBranchAddress("true_lcharged_py", &fTrue_Lepton_py); + fTree -> SetBranchAddress("true_lcharged_pz", &fTrue_Lepton_pz); + + fTree -> SetBranchAddress("true_photon_E", &fTrue_Photon_E); + fTree -> SetBranchAddress("true_photon_px", &fTrue_Photon_px); + fTree -> SetBranchAddress("true_photon_py", &fTrue_Photon_py); + fTree -> SetBranchAddress("true_photon_pz", &fTrue_Photon_pz); + + fTree -> SetBranchAddress("true_lneutral_E", &fTrue_Neutrino_E); + fTree -> SetBranchAddress("true_lneutral_px", &fTrue_Neutrino_px); + fTree -> SetBranchAddress("true_lneutral_py", &fTrue_Neutrino_py); + fTree -> SetBranchAddress("true_lneutral_pz", &fTrue_Neutrino_pz); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceDummy::Event(int index) +{ + // check tree + if (!fTree) + { + std::cout << "KLFitter::InterfaceDummy::GetEvent(). Tree not defined." << std::endl; + return 0; + } + + // check event number + if (index < 0 || index >= fTree -> GetEntries()) + { + std::cout << "KLFitter::InterfaceDummy::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + + // get event + fTree -> GetEntry(index); + + // fill particles + if (!this -> FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceDummy::FillParticles() +{ + // delete old particles + if (fParticles) + delete fParticles; + + // delete old truth particles + if (fParticlesTruth) + delete fParticlesTruth; + + TLorentzVector * lv = 0; + + // create new particle container + fParticles = new KLFitter::Particles(); + + // create Lorentz-vectors and add to list of particles + fParticles -> AddParticle(lv = new TLorentzVector(fBhad_px, fBhad_py, fBhad_pz, fBhad_E), KLFitter::Particles::kParton, "jet 1"); + fParticles -> AddParticle(lv = new TLorentzVector(fBlep_px, fBlep_py, fBlep_pz, fBlep_E), KLFitter::Particles::kParton, "jet 2"); + fParticles -> AddParticle(lv = new TLorentzVector(fQup_px, fQup_py, fQup_pz, fQup_E), KLFitter::Particles::kParton, "jet 3"); + fParticles -> AddParticle(lv = new TLorentzVector(fQdown_px, fQdown_py, fQdown_pz, fQdown_E), KLFitter::Particles::kParton, "jet 4"); + fParticles -> AddParticle(lv = new TLorentzVector(fLepton_px, fLepton_py, fLepton_pz, fLepton_E), KLFitter::Particles::kElectron, "electron"); + fParticles -> AddParticle(lv = new TLorentzVector(fPhoton_px, fPhoton_py, fPhoton_pz, fPhoton_E), KLFitter::Particles::kPhoton, "photon"); + + // create new truth particles container + fParticlesTruth = new KLFitter::Particles(); + + // create Lorentz-vectors and add to list of particles + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Bhad_px, fTrue_Bhad_py, fTrue_Bhad_pz, fTrue_Bhad_E), KLFitter::Particles::kParton, "hadronic b quark"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Blep_px, fTrue_Blep_py, fTrue_Blep_pz, fTrue_Blep_E), KLFitter::Particles::kParton, "leptonic b quark"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Qup_px, fTrue_Qup_py, fTrue_Qup_pz, fTrue_Qup_E), KLFitter::Particles::kParton, "up-type quark"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Qdown_px, fTrue_Qdown_py, fTrue_Qdown_pz, fTrue_Qdown_E), KLFitter::Particles::kParton, "down-type quark"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Lepton_px, fTrue_Lepton_py, fTrue_Lepton_pz, fTrue_Lepton_E), KLFitter::Particles::kElectron, "electron"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Photon_px, fTrue_Photon_py, fTrue_Photon_pz, fTrue_Photon_E), KLFitter::Particles::kPhoton, "photon"); + fParticlesTruth -> AddParticle(lv = new TLorentzVector(fTrue_Neutrino_px, fTrue_Neutrino_py, fTrue_Neutrino_pz, fTrue_Neutrino_E), KLFitter::Particles::kNeutrino, "neutrino"); + + // no error + return 1; +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceGoTopTree.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceGoTopTree.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d7a190d8a1b991c7a470b1932ded133106dc71f0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceGoTopTree.cxx @@ -0,0 +1,639 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceGoTopTree.h" +#include "KLFitter/Particles.h" + +#include <TLorentzVector.h> + +#include <TROOT.h> +#include <TTree.h> +#include <TFile.h> + +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::InterfaceGoTopTree::InterfaceGoTopTree() +{ + fTree = 0; + + Event_EventNumber = 0; + + Muon_N = 0; + Muon_E = 0; + Muon_Px = 0; + Muon_Py = 0; + Muon_Pz = 0; + Muon_Pt = 0; + Muon_Eta = 0; + Muon_Phi = 0; + Muon_IsTopInputs = 0; + + Electron_N = 0; + Electron_E = 0; + Electron_Px = 0; + Electron_Py = 0; + Electron_Pz = 0; + Electron_Pt = 0; + Electron_Eta = 0; + Electron_DetEta = 0; + Electron_Phi = 0; + Electron_IsTopInputs = 0; + + Jet_N = 0; + Jet_E = 0; + Jet_Px = 0; + Jet_Py = 0; + Jet_Pz = 0; + Jet_Pt = 0; + Jet_Eta = 0; + Jet_DetEta = 0; + Jet_Phi = 0; + Jet_IsTopInputs = 0; + + Jet_SV0_Weight = 0; + + Photon_N = 0; + Photon_E = 0; + Photon_Px = 0; + Photon_Py = 0; + Photon_Pz = 0; + Photon_Pt = 0; + Photon_Eta = 0; + Photon_Phi = 0; + Photon_IsTopInputs = 0; + + MET_Et = 0; + MET_Phi = 0; + MET_Etx = 0; + MET_Ety = 0; + + Truth_IsProperMCEvent = false; + + TruthPart_N = 0; + TruthPart_PDG = 0x0; + TruthPart_NParents = 0x0; + TruthPart_ParentIdx = 0x0; + TruthPart_NChildren = 0x0; + TruthPart_ChildIdx = 0x0; + TruthPart_E = 0x0; + TruthPart_Px = 0x0; + TruthPart_Py = 0x0; + TruthPart_Pz = 0x0; + TruthPart_Eta = 0x0; + TruthPart_Phi = 0x0; + TruthPart_Pt = 0x0; + + Truth_WplusHad = false; + Truth_WminusHad = false; + + TruthIdx_b = -1; + TruthIdx_bbar = -1; + TruthIdx_Wminus = -1; + TruthIdx_Wplus = -1; + TruthIdx_lminus = -1; + TruthIdx_lplus = -1; + TruthIdx_n = -1; + TruthIdx_nbar = -1; + TruthIdx_t = -1; + TruthIdx_tbar = -1; + TruthIdx_QfromWminus = -1; + TruthIdx_QfromWplus = -1; + TruthIdx_QbarfromWminus = -1; + TruthIdx_QbarfromWplus = -1; + TruthIdx_photon = -1; + + // needed due to incomplete dictionaries in ROOT (reading vector<bool> from TTree won't work without) + gROOT->ProcessLine("#include <vector>"); + gROOT->ProcessLine(".L loader.C+"); +} + +// --------------------------------------------------------- +KLFitter::InterfaceGoTopTree::~InterfaceGoTopTree() +{ +} + +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::NEvents() +{ + if(fTree) + return fTree->GetEntries(); + if(fChain) + return fChain->GetEntries(); + else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // connect Root tree + err *= this ->ConnectTree("GoTopTree"); + + // return error code + return err; +} + +//--------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::OpenRootFiles(std::vector<std::string> filenames, Option_t* opt) +{ + // define error code + int err = 1; + + fChain = new TChain("GoTopTree"); + // open files + for(unsigned int i=0; i<filenames.size(); i++){ + err *= KLFitter::InterfaceRoot::OpenRootFile(filenames.at(i).c_str(), opt); + fChain->Add(filenames.at(i).c_str()); + } + + // connect Root tree + err *= this ->ConnectChain(fChain); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::ConnectTree(const char* treename) +{ + // check if file exists + if (!fRootFile) + { + std::cout << "KLFitter::InterfaceGoTopTree::ConnectTree(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) + { + std::cout << "KLFitter::InterfaceGoTopTree::ConnectTree(). Root file not open."<< std::endl; + return 0; + } + + // get tree from file + fTree = (TTree *) fRootFile->Get(treename); + + if (!fTree) + { + std::cout << "KLFitter::InterfaceGoTopTree::ConnectTree(). Tree not found." << std::endl; + return 0; + } + + // set branch addresses + fTree->SetBranchAddress("Event_EventNumber", &Event_EventNumber); + fTree->SetBranchAddress("Event_Weight", &fWeight); + + fTree->SetBranchAddress("Muon_N", &Muon_N); + fTree->SetBranchAddress("Muon_E", &Muon_E); + fTree->SetBranchAddress("Muon_Px", &Muon_Px); + fTree->SetBranchAddress("Muon_Py", &Muon_Py); + fTree->SetBranchAddress("Muon_Pz", &Muon_Pz); + fTree->SetBranchAddress("Muon_Pt", &Muon_Pt); + fTree->SetBranchAddress("Muon_Eta", &Muon_Eta); + fTree->SetBranchAddress("Muon_Phi", &Muon_Phi); + fTree->SetBranchAddress("Muon_IsTopInputs", &Muon_IsTopInputs); + + fTree->SetBranchAddress("Electron_N", &Electron_N); + fTree->SetBranchAddress("Electron_EgE", &Electron_E); + fTree->SetBranchAddress("Electron_Px", &Electron_Px); + fTree->SetBranchAddress("Electron_Py", &Electron_Py); + fTree->SetBranchAddress("Electron_Pz", &Electron_Pz); + fTree->SetBranchAddress("Electron_EgPt", &Electron_Pt); + fTree->SetBranchAddress("Electron_EgEta", &Electron_Eta); + fTree->SetBranchAddress("Electron_DetEta", &Electron_DetEta); + fTree->SetBranchAddress("Electron_EgPhi", &Electron_Phi); + fTree->SetBranchAddress("Electron_IsTopInputs", &Electron_IsTopInputs); + + fTree->SetBranchAddress("Jet_N", &Jet_N); + fTree->SetBranchAddress("Jet_E", &Jet_E); + fTree->SetBranchAddress("Jet_Px", &Jet_Px); + fTree->SetBranchAddress("Jet_Py", &Jet_Py); + fTree->SetBranchAddress("Jet_Pz", &Jet_Pz); + fTree->SetBranchAddress("Jet_Pt", &Jet_Pt); + fTree->SetBranchAddress("Jet_Eta", &Jet_Eta); + fTree->SetBranchAddress("Jet_EMscaleDetEta", &Jet_DetEta); + fTree->SetBranchAddress("Jet_Phi", &Jet_Phi); + fTree->SetBranchAddress("Jet_IsTopInputs", &Jet_IsTopInputs); + + fTree->SetBranchAddress("Jet_SV0_Weight", &Jet_SV0_Weight); + + if (fTree->FindBranch("Photon_N")) + fTree->SetBranchAddress("Photon_N", &Photon_N); + if (fTree->FindBranch("Photon_E")) + fTree->SetBranchAddress("Photon_E", &Photon_E); + if (fTree->FindBranch("Photon_Px")) + fTree->SetBranchAddress("Photon_Px", &Photon_Px); + if (fTree->FindBranch("Photon_Py")) + fTree->SetBranchAddress("Photon_Py", &Photon_Py); + if (fTree->FindBranch("Photon_Pz")) + fTree->SetBranchAddress("Photon_Pz", &Photon_Pz); + if (fTree->FindBranch("Photon_Pt")) + fTree->SetBranchAddress("Photon_Pt", &Photon_Pt); + if (fTree->FindBranch("Photon_Eta")) + fTree->SetBranchAddress("Photon_Eta", &Photon_Eta); + if (fTree->FindBranch("Photon_Phi")) + fTree->SetBranchAddress("Photon_Phi", &Photon_Phi); + if (fTree->FindBranch("Photon_IsTopInputs")) + fTree->SetBranchAddress("Photon_IsTopInputs", &Photon_IsTopInputs); + + fTree->SetBranchAddress("MET_Et", &MET_Et); + fTree->SetBranchAddress("MET_Phi", &MET_Phi); + fTree->SetBranchAddress("MET_Etx", &MET_Etx); + fTree->SetBranchAddress("MET_Ety", &MET_Ety); + + fTree->SetBranchAddress("Truth_IsProperMCEvent", &Truth_IsProperMCEvent); + fTree->SetBranchAddress("TruthPart_N", &TruthPart_N); + fTree->SetBranchAddress("TruthPart_PDG", &TruthPart_PDG); + + + fTree->SetBranchAddress("TruthPart_NParents", &TruthPart_NParents); + fTree->SetBranchAddress("TruthPart_ParentIdx", &TruthPart_ParentIdx); + fTree->SetBranchAddress("TruthPart_NChildren", &TruthPart_NChildren); + fTree->SetBranchAddress("TruthPart_ChildIdx", &TruthPart_ChildIdx); + fTree->SetBranchAddress("TruthPart_E", &TruthPart_E); + fTree->SetBranchAddress("TruthPart_Px", &TruthPart_Px); + fTree->SetBranchAddress("TruthPart_Py", &TruthPart_Py); + fTree->SetBranchAddress("TruthPart_Pz", &TruthPart_Pz); + fTree->SetBranchAddress("TruthPart_Eta", &TruthPart_Eta); + fTree->SetBranchAddress("TruthPart_Phi", &TruthPart_Phi); + fTree->SetBranchAddress("TruthPart_Pt", &TruthPart_Pt); + + fTree->SetBranchAddress("Truth_WplusHad", &Truth_WplusHad); + fTree->SetBranchAddress("Truth_WminusHad", &Truth_WminusHad); + + fTree->SetBranchAddress("TruthIdx_Wplus", &TruthIdx_Wplus); + fTree->SetBranchAddress("TruthIdx_b", &TruthIdx_b); + fTree->SetBranchAddress("TruthIdx_bbar", &TruthIdx_bbar); + fTree->SetBranchAddress("TruthIdx_lminus", &TruthIdx_lminus); + fTree->SetBranchAddress("TruthIdx_lplus", &TruthIdx_lplus); + fTree->SetBranchAddress("TruthIdx_n", &TruthIdx_n); + fTree->SetBranchAddress("TruthIdx_nbar", &TruthIdx_nbar); + fTree->SetBranchAddress("TruthIdx_t", &TruthIdx_t); + fTree->SetBranchAddress("TruthIdx_Wminus", &TruthIdx_Wminus); + fTree->SetBranchAddress("TruthIdx_tbar", &TruthIdx_tbar); + + if (fTree->FindBranch("TruthIdx_photon")) + fTree->SetBranchAddress("TruthIdx_photon", &TruthIdx_photon); + fTree->SetBranchAddress("TruthIdx_QfromWminus", &TruthIdx_QfromWminus); + fTree->SetBranchAddress("TruthIdx_QfromWplus", &TruthIdx_QfromWplus); + fTree->SetBranchAddress("TruthIdx_QbarfromWminus", &TruthIdx_QbarfromWminus); + fTree->SetBranchAddress("TruthIdx_QbarfromWplus", &TruthIdx_QbarfromWplus); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::ConnectChain(TChain * fChain) +{ + if (!this->fChain) this->fChain = fChain; + + // set branch addresses + fChain->SetBranchAddress("Event_EventNumber", &Event_EventNumber); + fChain->SetBranchAddress("Event_Weight", &fWeight); + + fChain->SetBranchAddress("Muon_N", &Muon_N); + fChain->SetBranchAddress("Muon_E", &Muon_E); + fChain->SetBranchAddress("Muon_Px", &Muon_Px); + fChain->SetBranchAddress("Muon_Py", &Muon_Py); + fChain->SetBranchAddress("Muon_Pz", &Muon_Pz); + fChain->SetBranchAddress("Muon_Pt", &Muon_Pt); + fChain->SetBranchAddress("Muon_Eta", &Muon_Eta); + fChain->SetBranchAddress("Muon_Phi", &Muon_Phi); + fChain->SetBranchAddress("Muon_IsTopInputs", &Muon_IsTopInputs); + + fChain->SetBranchAddress("Electron_N", &Electron_N); + fChain->SetBranchAddress("Electron_EgE", &Electron_E); + fChain->SetBranchAddress("Electron_Px", &Electron_Px); + fChain->SetBranchAddress("Electron_Py", &Electron_Py); + fChain->SetBranchAddress("Electron_Pz", &Electron_Pz); + fChain->SetBranchAddress("Electron_EgPt", &Electron_Pt); + fChain->SetBranchAddress("Electron_EgEta", &Electron_Eta); + fChain->SetBranchAddress("Electron_DetEta", &Electron_DetEta); + fChain->SetBranchAddress("Electron_EgPhi", &Electron_Phi); + fChain->SetBranchAddress("Electron_IsTopInputs", &Electron_IsTopInputs); + + fChain->SetBranchAddress("Jet_N", &Jet_N); + fChain->SetBranchAddress("Jet_E", &Jet_E); + fChain->SetBranchAddress("Jet_Px", &Jet_Px); + fChain->SetBranchAddress("Jet_Py", &Jet_Py); + fChain->SetBranchAddress("Jet_Pz", &Jet_Pz); + fChain->SetBranchAddress("Jet_Pt", &Jet_Pt); + fChain->SetBranchAddress("Jet_Eta", &Jet_Eta); + fChain->SetBranchAddress("Jet_EMscaleDetEta", &Jet_DetEta); + fChain->SetBranchAddress("Jet_Phi", &Jet_Phi); + fChain->SetBranchAddress("Jet_IsTopInputs", &Jet_IsTopInputs); + + fChain->SetBranchAddress("Jet_SV0_Weight", &Jet_SV0_Weight); + + if (fChain->FindBranch("Photon_N")) + fChain->SetBranchAddress("Photon_N", &Photon_N); + if (fChain->FindBranch("Photon_E")) + fChain->SetBranchAddress("Photon_E", &Photon_E); + if (fChain->FindBranch("Photon_Px")) + fChain->SetBranchAddress("Photon_Px", &Photon_Px); + if (fChain->FindBranch("Photon_Py")) + fChain->SetBranchAddress("Photon_Py", &Photon_Py); + if (fChain->FindBranch("Photon_Pz")) + fChain->SetBranchAddress("Photon_Pz", &Photon_Pz); + if (fChain->FindBranch("Photon_Pt")) + fChain->SetBranchAddress("Photon_Pt", &Photon_Pt); + if (fChain->FindBranch("Photon_Eta")) + fChain->SetBranchAddress("Photon_Eta", &Photon_Eta); + if (fChain->FindBranch("Photon_Phi")) + fChain->SetBranchAddress("Photon_Phi", &Photon_Phi); + if (fChain->FindBranch("Photon_IsTopInputs")) + fChain->SetBranchAddress("Photon_IsTopInputs", &Photon_IsTopInputs); + + fChain->SetBranchAddress("MET_Et", &MET_Et); + fChain->SetBranchAddress("MET_Phi", &MET_Phi); + fChain->SetBranchAddress("MET_Etx", &MET_Etx); + fChain->SetBranchAddress("MET_Ety", &MET_Ety); + + fChain->SetBranchAddress("Truth_IsProperMCEvent", &Truth_IsProperMCEvent); + fChain->SetBranchAddress("TruthPart_N", &TruthPart_N); + fChain->SetBranchAddress("TruthPart_PDG", &TruthPart_PDG); + + + fChain->SetBranchAddress("TruthPart_NParents", &TruthPart_NParents); + fChain->SetBranchAddress("TruthPart_ParentIdx", &TruthPart_ParentIdx); + fChain->SetBranchAddress("TruthPart_NChildren", &TruthPart_NChildren); + fChain->SetBranchAddress("TruthPart_ChildIdx", &TruthPart_ChildIdx); + fChain->SetBranchAddress("TruthPart_E", &TruthPart_E); + fChain->SetBranchAddress("TruthPart_Px", &TruthPart_Px); + fChain->SetBranchAddress("TruthPart_Py", &TruthPart_Py); + fChain->SetBranchAddress("TruthPart_Pz", &TruthPart_Pz); + fChain->SetBranchAddress("TruthPart_Eta", &TruthPart_Eta); + fChain->SetBranchAddress("TruthPart_Phi", &TruthPart_Phi); + fChain->SetBranchAddress("TruthPart_Pt", &TruthPart_Pt); + + fChain->SetBranchAddress("Truth_WplusHad", &Truth_WplusHad); + fChain->SetBranchAddress("Truth_WminusHad", &Truth_WminusHad); + + fChain->SetBranchAddress("TruthIdx_Wplus", &TruthIdx_Wplus); + fChain->SetBranchAddress("TruthIdx_b", &TruthIdx_b); + fChain->SetBranchAddress("TruthIdx_bbar", &TruthIdx_bbar); + fChain->SetBranchAddress("TruthIdx_lminus", &TruthIdx_lminus); + fChain->SetBranchAddress("TruthIdx_lplus", &TruthIdx_lplus); + fChain->SetBranchAddress("TruthIdx_n", &TruthIdx_n); + fChain->SetBranchAddress("TruthIdx_nbar", &TruthIdx_nbar); + fChain->SetBranchAddress("TruthIdx_t", &TruthIdx_t); + fChain->SetBranchAddress("TruthIdx_Wminus", &TruthIdx_Wminus); + fChain->SetBranchAddress("TruthIdx_tbar", &TruthIdx_tbar); + + if (fChain->FindBranch("TruthIdx_photon")) + fChain->SetBranchAddress("TruthIdx_photon", &TruthIdx_photon); + fChain->SetBranchAddress("TruthIdx_QfromWminus", &TruthIdx_QfromWminus); + fChain->SetBranchAddress("TruthIdx_QfromWplus", &TruthIdx_QfromWplus); + fChain->SetBranchAddress("TruthIdx_QbarfromWminus", &TruthIdx_QbarfromWminus); + fChain->SetBranchAddress("TruthIdx_QbarfromWplus", &TruthIdx_QbarfromWplus); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::Event(int index) +{ + + // check tree + if (!fTree && !fChain) + { + std::cout << "KLFitter::InterfaceGoTopTree::GetEvent(). Tree not defined." << std::endl; + return 0; + } + + if(fTree){ + // check event number + if (index < 0 || index >= fTree->GetEntries()) + { + std::cout << "KLFitter::InterfaceGoTopTree::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fTree->GetEntry(index); + } + + if(fChain){ + // check event number + if (index < 0 || index >= fChain->GetEntries()) + { + std::cout << "KLFitter::InterfaceGoTopTree::GetEvent(). Event number negative or too large." << std::endl; + return 0; + } + // get event + fChain->GetEntry(index); + } + + // fill particles + if (!this->FillParticles()) + return 0; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceGoTopTree::FillParticles() +{ + + // delete old particle container + if (fParticles) + delete fParticles; + + // delete old truth particles container + if (fParticlesTruth) + delete fParticlesTruth; + + // create new particle container + fParticles = new KLFitter::Particles(); + + // fill jets + for (int i = 0; i < Jet_N; ++i) + { + if ((*Jet_IsTopInputs)[i]){ + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(Jet_Px->at(i), Jet_Py->at(i), Jet_Pz->at(i), Jet_E->at(i)); + fParticles->AddParticle(tlv_tmp, Jet_DetEta->at(i), KLFitter::Particles::kParton,"",Jet_SV0_Weight->at(i)); + delete tlv_tmp; + } + } + // fill electrons + for (int i = 0; i < Electron_N; ++i) + { + if ((*Electron_IsTopInputs)[i]){ + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPtEtaPhiE(Electron_Pt->at(i), Electron_Eta->at(i), Electron_Phi->at(i), Electron_E->at(i)); + fParticles->AddParticle(tlv_tmp, Electron_DetEta->at(i), KLFitter::Particles::kElectron); + delete tlv_tmp; + } + } + + // fill muons + for (int i = 0; i < Muon_N; ++i) + { + if ((*Muon_IsTopInputs)[i]){ + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(Muon_Px->at(i), Muon_Py->at(i), Muon_Pz->at(i), Muon_E->at(i)); + fParticles->AddParticle(tlv_tmp, Muon_Eta->at(i), KLFitter::Particles::kMuon); + delete tlv_tmp; + } + } + + // fill photons + for (int i = 0; i < Photon_N; ++i) + { + if ((*Photon_IsTopInputs)[i]){ + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(Photon_Px->at(i), Photon_Py->at(i), Photon_Pz->at(i), Photon_E->at(i)); + fParticles->AddParticle(tlv_tmp, Photon_Eta->at(i), KLFitter::Particles::kPhoton); + } + } + + // check if input is Signal MC + if (!fFlagWriteSignalMCTruth) + return 1; + + // create truth particle container + fParticlesTruth = new KLFitter::Particles(); + + // check if event is proper ttbar event + if (!Truth_IsProperMCEvent) + return 1; + + // do not fill mc information if di-leptonic + if ( (Truth_WplusHad == false) && (Truth_WminusHad == false) ) + return 1; + + int index_Whad = -1; + int index_Wlep = -1; + int index_tophad = -1; + int index_toplep = -1; + int index_bhad = -1; + int index_blep = -1; + int index_q1 = -1; + int index_q2 = -1; + int index_l = -1; + int index_nu = -1; + int index_photon = -1; + + if (Truth_WplusHad) + { + index_Whad = TruthIdx_Wplus; + index_tophad = TruthIdx_t; + index_bhad = TruthIdx_b; + + index_Wlep = TruthIdx_Wminus; + index_toplep = TruthIdx_tbar; + index_blep = TruthIdx_bbar; + index_l = TruthIdx_lminus; + index_nu = TruthIdx_nbar; + index_q1 = TruthIdx_QfromWplus; + index_q2 = TruthIdx_QbarfromWplus; + + index_photon = TruthIdx_photon; + } + else + { + index_Wlep = TruthIdx_Wplus; + index_toplep = TruthIdx_t; + index_blep = TruthIdx_b; + index_l = TruthIdx_lplus; + index_nu = TruthIdx_n; + index_q1 = TruthIdx_QfromWminus; + index_q2 = TruthIdx_QbarfromWminus; + + index_Whad = TruthIdx_Wminus; + index_tophad = TruthIdx_tbar; + index_bhad = TruthIdx_bbar; + + index_photon = TruthIdx_photon; + } + TLorentzVector * tlv_tmp = new TLorentzVector(0,0,0,0); + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_bhad), + TruthPart_Py->at(index_bhad), + TruthPart_Pz->at(index_bhad), + TruthPart_E->at(index_bhad)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic b quark"); + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_blep), + TruthPart_Py->at(index_blep), + TruthPart_Pz->at(index_blep), + TruthPart_E->at(index_blep)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic b quark"); + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_q1), + TruthPart_Py->at(index_q1), + TruthPart_Pz->at(index_q1), + TruthPart_E->at(index_q1)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 1"); + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_q2), + TruthPart_Py->at(index_q2), + TruthPart_Pz->at(index_q2), + TruthPart_E->at(index_q2)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "light quark 2"); + + if (index_l!=-1 && abs(TruthPart_PDG->at(index_l)) == 11){ + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_l), + TruthPart_Py->at(index_l), + TruthPart_Pz->at(index_l), + TruthPart_E->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kElectron, "electron"); + } + else if (index_l!=-1 && abs(TruthPart_PDG->at(index_l)) == 13){ + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_l), TruthPart_Py->at(index_l), + TruthPart_Pz->at(index_l), + TruthPart_E->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kMuon, "muon"); + } + else if (index_l!=-1 && abs(TruthPart_PDG->at(index_l)) == 15){ + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_l), + TruthPart_Py->at(index_l), + TruthPart_Pz->at(index_l), + TruthPart_E->at(index_l)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kTau, "tau"); + } + if (index_photon >= 0) { + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_photon), + TruthPart_Py->at(index_photon), + TruthPart_Pz->at(index_photon), + TruthPart_E->at(index_photon)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kPhoton, "photon"); + } + if (index_nu!=-1){ + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_nu), + TruthPart_Py->at(index_nu), + TruthPart_Pz->at(index_nu), + TruthPart_E->at(index_nu)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kNeutrino, "neutrino"); + } + if (index_tophad >= 0) { + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_tophad), + TruthPart_Py->at(index_tophad), + TruthPart_Pz->at(index_tophad), + TruthPart_E->at(index_tophad)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "hadronic top quark"); + } + + if (index_toplep >= 0) { + tlv_tmp->SetPxPyPzE(TruthPart_Px->at(index_toplep), + TruthPart_Py->at(index_toplep), + TruthPart_Pz->at(index_toplep), + TruthPart_E->at(index_toplep)); + fParticlesTruth->AddParticle(tlv_tmp, KLFitter::Particles::kParton, "leptonic top quark"); + } + //free memory + delete tlv_tmp; + + // no error + return 1; + +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f463e0a1d3709156862d6b35a6031671ac228495 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput.cxx @@ -0,0 +1,1776 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/Fitter.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "KLFitter/Permutations.h" + +#include <TFile.h> +#include <TTree.h> + +#include <iostream> +#include <map> + +// --------------------------------------------------------- +KLFitter::InterfaceOutput::InterfaceOutput() +{ + fFitter = 0; + fMatchingTool = 0; + fSelectionTool = 0; + fParticlesTruth = 0; + fParticlesModel = 0; + fParticlesMeasured = 0; + fParticlesSelected = 0; + fTreeTruth = 0; + fTreeModel = 0; + fTreeMeasured = 0; + fTreeSelected = 0; + fTreeMatching = 0; + fTreeMap = 0; + fTreeVarBestPermutation = 0; + fTreeVarLogLikelihood = 0; + fTreeVarLogLikelihoodComp_TF_bhad = 0; + fTreeVarLogLikelihoodComp_TF_blep = 0; + fTreeVarLogLikelihoodComp_TF_lq1 = 0; + fTreeVarLogLikelihoodComp_TF_lq2 = 0; + fTreeVarLogLikelihoodComp_TF_lep = 0; + fTreeVarLogLikelihoodComp_TF_METx = 0; + fTreeVarLogLikelihoodComp_TF_METy = 0; + fTreeVarLogLikelihoodComp_BW_Whad = 0; + fTreeVarLogLikelihoodComp_BW_Wlep = 0; + fTreeVarLogLikelihoodComp_BW_Thad = 0; + fTreeVarLogLikelihoodComp_BW_Tlep = 0; +// fTreeVarLogLikelihoodComponents = 0; + fTreeVarIntegral = 0; + fTreeVarEventProbability = 0; + fTreeVarMinuitStatus = 0; + fTreeVarConvergenceStatus = 0; + fTreeVarEventNumber = 0; + fTreeVarParameters = new std::vector<std::vector<double> *>(0); + fTreeVarParameterErrors = new std::vector<std::vector<double> *>(0); + fTreeVarModel = new std::vector<std::vector<double> *>(0); + fTreeIntVarModel = new std::vector<std::vector<int> *>(0); + fTreeVarTruth = new std::vector<std::vector<double> *>(0); + fTreeVarMeasured = new std::vector<std::vector<double> *>(0); + fTreeVarSelected = new std::vector<std::vector<double> *>(0); + fTreeVarNMatchedPartons = new std::vector<int *>(0); + fTreeVarNMatchedElectrons = new std::vector<int *>(0); + fTreeVarNMatchedMuons = new std::vector<int *>(0); + fTreeVarNMatchedPhotons = new std::vector<int *>(0); + fTreeVarMatchedPartons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedElectrons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedMuons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedPhotons = new std::vector <std::vector<int> *>(0); + fTreeVarMapJets = 0; + fTreeVarMapElectrons = 0; + fTreeVarMapMuons = 0; + fTreeVarMapPhotons = 0; + fEventWeight = 0.; + fIsNotClassified = false; + fIsRadTopProd = false; + fIsHadTopRadDecay = false; + fIsLepTopRadDecay = false; + fIsHadWRadDecay = false; + fIsLepWRadDecay = false; +} + +// --------------------------------------------------------- +KLFitter::InterfaceOutput::~InterfaceOutput() +{ + if (fTreeVarBestPermutation) + delete fTreeVarBestPermutation; + + if (fTreeVarLogLikelihood) + delete fTreeVarLogLikelihood; + + if(fTreeVarLogLikelihoodComp_TF_bhad) + delete fTreeVarLogLikelihoodComp_TF_bhad; + + if(fTreeVarLogLikelihoodComp_TF_blep) + delete fTreeVarLogLikelihoodComp_TF_blep; + + if(fTreeVarLogLikelihoodComp_TF_lq1) + delete fTreeVarLogLikelihoodComp_TF_lq1; + + if(fTreeVarLogLikelihoodComp_TF_lq2) + delete fTreeVarLogLikelihoodComp_TF_lq2; + + if(fTreeVarLogLikelihoodComp_TF_lep) + delete fTreeVarLogLikelihoodComp_TF_lep; + + if(fTreeVarLogLikelihoodComp_TF_METx) + delete fTreeVarLogLikelihoodComp_TF_METx; + + if(fTreeVarLogLikelihoodComp_TF_METy) + delete fTreeVarLogLikelihoodComp_TF_METy; + + if(fTreeVarLogLikelihoodComp_BW_Whad) + delete fTreeVarLogLikelihoodComp_BW_Whad; + + if(fTreeVarLogLikelihoodComp_BW_Wlep) + delete fTreeVarLogLikelihoodComp_BW_Wlep; + + if(fTreeVarLogLikelihoodComp_BW_Thad) + delete fTreeVarLogLikelihoodComp_BW_Thad; + + if(fTreeVarLogLikelihoodComp_BW_Tlep) + delete fTreeVarLogLikelihoodComp_BW_Tlep; + +// if (fTreeVarLogLikelihoodComponents) +// delete fTreeVarLogLikelihoodComponents; + + if (fTreeVarIntegral) + delete fTreeVarIntegral; + + if (fTreeVarEventProbability) + delete fTreeVarEventProbability; + + if (fTreeVarMinuitStatus) + delete fTreeVarMinuitStatus; + + if (fTreeVarConvergenceStatus) + delete fTreeVarConvergenceStatus; + + while (!fTreeVarParameters->empty()) + { + std::vector<double>* d = fTreeVarParameters->front(); + fTreeVarParameters->erase(fTreeVarParameters->begin()); + delete d; + } + delete fTreeVarParameters; + + while (!fTreeVarParameterErrors->empty()) + { + std::vector<double>* d = fTreeVarParameterErrors->front(); + fTreeVarParameterErrors->erase(fTreeVarParameterErrors->begin()); + delete d; + } + delete fTreeVarParameterErrors; + + while (!fTreeVarModel->empty()) + { + std::vector<double>* d = fTreeVarModel->front(); + fTreeVarModel->erase(fTreeVarModel->begin()); + delete d; + } + delete fTreeVarModel; + + while (!fTreeIntVarModel->empty()) + { + std::vector<int>* d = fTreeIntVarModel->front(); + fTreeIntVarModel->erase(fTreeIntVarModel->begin()); + delete d; + } + delete fTreeIntVarModel; + + while (!fTreeVarTruth->empty()) + { + std::vector<double>* d = fTreeVarTruth->front(); + fTreeVarTruth->erase(fTreeVarTruth->begin()); + delete d; + } + delete fTreeVarTruth; + + while (!fTreeVarMeasured->empty()) + { + std::vector<double>* d = fTreeVarMeasured-> front(); + fTreeVarMeasured->erase(fTreeVarMeasured->begin()); + delete d; + } + delete fTreeVarMeasured; + + while (!fTreeVarSelected->empty()) + { + std::vector<double>* d = fTreeVarSelected->front(); + fTreeVarSelected->erase(fTreeVarSelected->begin()); + delete d; + } + delete fTreeVarSelected; + + while (!fTreeVarNMatchedPartons->empty()) + { + int* i = fTreeVarNMatchedPartons->front(); + fTreeVarNMatchedPartons->erase(fTreeVarNMatchedPartons->begin()); + delete i; + } + delete fTreeVarNMatchedPartons; + + while (!fTreeVarNMatchedElectrons->empty()) + { + int* i = fTreeVarNMatchedElectrons->front(); + fTreeVarNMatchedElectrons->erase(fTreeVarNMatchedElectrons->begin()); + delete i; + } + delete fTreeVarNMatchedElectrons; + + while (!fTreeVarNMatchedMuons->empty()) + { + int* i = fTreeVarNMatchedMuons->front(); + fTreeVarNMatchedMuons->erase(fTreeVarNMatchedMuons->begin()); + delete i; + } + delete fTreeVarNMatchedMuons; + + while (!fTreeVarNMatchedPhotons->empty()) + { + int* i = fTreeVarNMatchedPhotons->front(); + fTreeVarNMatchedPhotons->erase(fTreeVarNMatchedPhotons->begin()); + delete i; + } + delete fTreeVarNMatchedPhotons; + + while (!fTreeVarMatchedPartons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPartons->front(); + fTreeVarMatchedPartons->erase(fTreeVarMatchedPartons->begin()); + delete i; + } + delete fTreeVarMatchedPartons; + + while (!fTreeVarMatchedElectrons->empty()) + { + std::vector<int>* i = fTreeVarMatchedElectrons->front(); + fTreeVarMatchedElectrons->erase(fTreeVarMatchedElectrons->begin()); + delete i; + } + delete fTreeVarMatchedElectrons; + + while (!fTreeVarMatchedMuons->empty()) + { + std::vector<int>* i = fTreeVarMatchedMuons->front(); + fTreeVarMatchedMuons->erase(fTreeVarMatchedMuons->begin()); + delete i; + } + delete fTreeVarMatchedMuons; + + while (!fTreeVarMatchedPhotons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPhotons->front(); + fTreeVarMatchedPhotons->erase(fTreeVarMatchedPhotons->begin()); + delete i; + } + delete fTreeVarMatchedPhotons; + + if (fTreeVarMapJets) + delete fTreeVarMapJets; + + if (fTreeVarMapElectrons) + delete fTreeVarMapElectrons; + + if (fTreeVarMapMuons) + delete fTreeVarMapMuons; + + if (fTreeVarMapPhotons) + delete fTreeVarMapPhotons; + + if (fTreeTruth) + delete fTreeTruth; + + if (fTreeModel) + delete fTreeModel; + + if (fTreeMeasured) + delete fTreeMeasured; + + if (fTreeSelected) + delete fTreeSelected; + + if (fTreeMatching) + delete fTreeMatching; + + if (fTreeMap) + delete fTreeMap; + +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::SetFitter(KLFitter::Fitter* fitter) +{ + // check if fitter exists + if (!fitter) + { + std::cout << "KLFitter::InterfaceOutput::SetFitter(). Fitter does not exist." << std::endl; + return 0; + } + + // set pointers to pointer + fParticlesModel = fitter->Likelihood()->PParticlesModel(); + fParticlesSelected = fitter->PParticles(); + + // set fitter + fFitter = fitter; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::SetMatchingTool(KLFitter::MatchingTool* matchingtool) +{ + // check if fitter exists + if (!matchingtool) + { + std::cout << "KLFitter::InterfaceOutput::SetMatchingTool(). Matching tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fMatchingTool = matchingtool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::SetSelectionTool(KLFitter::SelectionTool* selectiontool) +{ + // check if fitter exists + if (!selectiontool) + { + std::cout << "KLFitter::InterfaceOutput::SetSelectionTool(). Selection tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fSelectionTool = selectiontool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CloseRootFile() +{ + // define error code + int err = 1; + + // check if file exists + if (!fRootFile) + return 0; + + // check if file is open + if (!fRootFile->IsOpen()) + return 0; + + if (fTreeTruth) + fRootFile->WriteTObject(fTreeTruth); + + if (fTreeModel) + fRootFile->WriteTObject(fTreeModel); + + if (fTreeMeasured) + fRootFile->WriteTObject(fTreeMeasured); + + if (fTreeSelected) + fRootFile->WriteTObject(fTreeSelected); + + if (fTreeMatching) + fRootFile->WriteTObject(fTreeMatching); + + if (fTreeMap) + fRootFile->WriteTObject(fTreeMap); + + // close file + KLFitter::InterfaceRoot::CloseRootFile(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeModel() +{ + // check if particles exist + if (!fParticlesModel) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeModel(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeModel) + delete fTreeModel; + + // get number of permutations + int nperm = fFitter->Permutations()->NPermutations(); + + // create new tree + fTreeModel = new TTree("TreeModel", "TreeModel"); + + // reset variables + fTreeVarNPermutations = nperm; + fTreeVarNBTags=0; + fTreeVarBestPermutation = new std::vector<int>(0); + fTreeVarLogLikelihood = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_bhad = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_blep = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lep = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_METx = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_METy = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Whad = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Wlep = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Thad = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Tlep = new std::vector<double>(0); +// fTreeVarLogLikelihoodComponents = new std::vector<std::vector<double> >(0); + fTreeVarIntegral = new std::vector<double>(0); + fTreeVarEventProbability = new std::vector<double>(0); + fTreeVarMinuitStatus = new std::vector<double>(0); + fTreeVarConvergenceStatus = new std::vector<unsigned int>(0); + + // set branches for event variables + fTreeModel->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeModel->Branch("N_permutations", &fTreeVarNPermutations, "N_permutations/I"); + fTreeModel->Branch("N_btags", &fTreeVarNBTags, "N_btags/I"); + fTreeModel->Branch("best_permutation", fTreeVarBestPermutation); + fTreeModel->Branch("LogLikelihood", fTreeVarLogLikelihood); + fTreeModel->Branch("LogLikelihoodComp_TF_bhad", fTreeVarLogLikelihoodComp_TF_bhad); + fTreeModel->Branch("LogLikelihoodComp_TF_blep", fTreeVarLogLikelihoodComp_TF_blep); + fTreeModel->Branch("LogLikelihoodComp_TF_lq1", fTreeVarLogLikelihoodComp_TF_lq1); + fTreeModel->Branch("LogLikelihoodComp_TF_lq2", fTreeVarLogLikelihoodComp_TF_lq2); + fTreeModel->Branch("LogLikelihoodComp_TF_lep", fTreeVarLogLikelihoodComp_TF_lep); + fTreeModel->Branch("LogLikelihoodComp_TF_METx", fTreeVarLogLikelihoodComp_TF_METx); + fTreeModel->Branch("LogLikelihoodComp_TF_METy", fTreeVarLogLikelihoodComp_TF_METy); + fTreeModel->Branch("LogLikelihoodComp_BW_Whad", fTreeVarLogLikelihoodComp_BW_Whad); + fTreeModel->Branch("LogLikelihoodComp_BW_Wlep", fTreeVarLogLikelihoodComp_BW_Wlep); + fTreeModel->Branch("LogLikelihoodComp_BW_Thad", fTreeVarLogLikelihoodComp_BW_Thad); + fTreeModel->Branch("LogLikelihoodComp_BW_Tlep", fTreeVarLogLikelihoodComp_BW_Tlep); +// fTreeModel->Branch("LogLikelihoodComponents", fTreeVarLogLikelihoodComponents); + fTreeModel->Branch("Integral", fTreeVarIntegral); + fTreeModel->Branch("EventProbability", fTreeVarEventProbability); + fTreeModel->Branch("MinuitStatus", fTreeVarMinuitStatus); + fTreeModel->Branch("ConvergenceStatusBit", fTreeVarConvergenceStatus); + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + std::vector<double>* par = new std::vector<double>(0); + std::vector<double>* parerr = new std::vector<double>(0); + fTreeVarParameters->push_back(par); + fTreeVarParameterErrors->push_back(parerr); + + fTreeModel->Branch( this->ModifyString( "par_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), par); + fTreeModel->Branch( this->ModifyString( "parerr_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), parerr); + } + + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesModel)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + std::vector<double>* btag = new std::vector<double>(0); + std::vector<int>* index = new std::vector<int>(0); + + // add variables to vector + fTreeVarModel->push_back(E); + fTreeVarModel->push_back(px); + fTreeVarModel->push_back(py); + fTreeVarModel->push_back(pz); + fTreeVarModel->push_back(m); + fTreeVarModel->push_back(pt); + fTreeVarModel->push_back(eta); + fTreeVarModel->push_back(phi); + fTreeVarModel->push_back(btag); + fTreeIntVarModel->push_back(index); + + // create new branches + fTreeModel->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeModel->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeModel->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeModel->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeModel->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeModel->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeModel->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeModel->Branch(this->ModifyString((name+"_phi")).data(), phi); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + fTreeModel->Branch(this->ModifyString((name+"_btag")).data(), btag); + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + if (itype == KLFitter::Particles::kElectron && (*fParticlesModel)->ElectronIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kMuon && (*fParticlesModel)->MuonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kPhoton && (*fParticlesModel)->PhotonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeMeasured() +{ + // check if particles exist + if (!fParticlesMeasured) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMeasured(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMeasured) + delete fTreeMeasured; + + // create new tree + fTreeMeasured = new TTree("TreeMeasured", "TreeMeasured"); + + // event weight branch + fTreeMeasured->Branch("Weight", &fEventWeight, "Weight/D"); + + fTreeMeasured->Branch("N_jets", &fTreeVarNPartonsMeasured, "N_jets/I"); + fTreeMeasured->Branch("N_electrons", &fTreeVarNElectronsMeasured, "N_electrons/I"); + fTreeMeasured->Branch("N_muons", &fTreeVarNMuonsMeasured, "N_muons/I"); + fTreeMeasured->Branch("N_photons", &fTreeVarNPhotonsMeasured, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarMeasured->push_back(vec_E); + fTreeVarMeasured->push_back(vec_px); + fTreeVarMeasured->push_back(vec_py); + fTreeVarMeasured->push_back(vec_pz); + fTreeVarMeasured->push_back(vec_m); + fTreeVarMeasured->push_back(vec_pt); + fTreeVarMeasured->push_back(vec_eta); + fTreeVarMeasured->push_back(vec_phi); + + // create new branches + fTreeMeasured->Branch((name+"_E").data(), vec_E ); + fTreeMeasured->Branch((name+"_px").data(), vec_px ); + fTreeMeasured->Branch((name+"_py").data(), vec_py ); + fTreeMeasured->Branch((name+"_pz").data(), vec_pz ); + fTreeMeasured->Branch((name+"_m").data(), vec_m ); + fTreeMeasured->Branch((name+"_pt").data(), vec_pt ); + fTreeMeasured->Branch((name+"_eta").data(), vec_eta); + fTreeMeasured->Branch((name+"_phi").data(), vec_phi); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeSelected() +{ + // check if particles exist + if (!fParticlesSelected) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeSelected(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeSelected) + delete fTreeSelected; + + // create new tree + fTreeSelected = new TTree("TreeSelected", "TreeSelected"); + + fTreeSelected->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeSelected->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeSelected->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeSelected->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + std::vector<double>* vec_btag = new std::vector<double>(0); + + // add variables to vector + fTreeVarSelected->push_back(vec_E); + fTreeVarSelected->push_back(vec_px); + fTreeVarSelected->push_back(vec_py); + fTreeVarSelected->push_back(vec_pz); + fTreeVarSelected->push_back(vec_m); + fTreeVarSelected->push_back(vec_pt); + fTreeVarSelected->push_back(vec_eta); + fTreeVarSelected->push_back(vec_phi); + fTreeVarSelected->push_back(vec_btag); + + // create new branches + fTreeSelected->Branch((name+"_E").data(), vec_E ); + fTreeSelected->Branch((name+"_px").data(), vec_px ); + fTreeSelected->Branch((name+"_py").data(), vec_py ); + fTreeSelected->Branch((name+"_pz").data(), vec_pz ); + fTreeSelected->Branch((name+"_m").data(), vec_m ); + fTreeSelected->Branch((name+"_pt").data(), vec_pt ); + fTreeSelected->Branch((name+"_eta").data(), vec_eta); + fTreeSelected->Branch((name+"_phi").data(), vec_phi); + if (itype == KLFitter::Particles::kParton) + fTreeSelected->Branch((name+"_btag").data(), vec_btag); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeTruth() +{ + // check if particles exist + if (!fParticlesTruth) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeTruth(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeTruth) + delete fTreeTruth; + + // create new tree + fTreeTruth = new TTree("TreeTruth", "TreeTruth"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarTruth->push_back(E); + fTreeVarTruth->push_back(px); + fTreeVarTruth->push_back(py); + fTreeVarTruth->push_back(pz); + fTreeVarTruth->push_back(m); + fTreeVarTruth->push_back(pt); + fTreeVarTruth->push_back(eta); + fTreeVarTruth->push_back(phi); + + // create new branches + fTreeTruth->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeTruth->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeTruth->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeTruth->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeTruth->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeTruth->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeTruth->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeTruth->Branch(this->ModifyString((name+"_phi")).data(), phi); + } + } + + fTreeTruth->Branch("IsNotClassified", &fIsNotClassified, "IsNotClassified/B"); + fTreeTruth->Branch("IsRadTopProd", &fIsRadTopProd, "IsRadTopProd/B"); + fTreeTruth->Branch("IsHadTopRadDecay", &fIsHadTopRadDecay, "IsHadTopRadDecay/B"); + fTreeTruth->Branch("IsLepTopRadDecay", &fIsLepTopRadDecay, "IsLepTopRadDecay/B"); + fTreeTruth->Branch("IsHadWRadDecay", &fIsHadWRadDecay, "IsHadWRadDecay/B"); + fTreeTruth->Branch("IsLepWRadDecay", &fIsLepWRadDecay, "IsLepWRadDecay/B"); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeMatching() +{ + // check if particles exist + if (!fMatchingTool) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMatching(). Matching tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMatching) + delete fTreeMatching; + + // create new tree + fTreeMatching = new TTree("TreeMatching", "TreeMatching"); + + fTreeMatching->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMatching->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMatching->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMatching->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // get parton container + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kParton); + + // get number of particles in container + int ntruth = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < ntruth; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPartons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_partons_max = fParticlesSelected ? (*fParticlesSelected)->NPartons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_partons_max, -1); + fTreeVarMatchedPartons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get electron container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kElectron); + + // get number of particles in container + int n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedElectrons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_electrons_max = fParticlesSelected ? (*fParticlesSelected)->NElectrons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_electrons_max, -1); + fTreeVarMatchedElectrons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get muon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kMuon); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedMuons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_muons_max = fParticlesSelected ? (*fParticlesSelected)->NMuons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_muons_max, -1); + fTreeVarMatchedMuons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get photon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kPhoton); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPhotons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_photons_max = fParticlesSelected ? (*fParticlesSelected)->NPhotons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_photons_max, -1); + fTreeVarMatchedPhotons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTreeMap() +{ + // check if particles exist + if (!fSelectionTool) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMap(). Selection tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMap) + delete fTreeMap; + + // reset variables + fTreeVarMapJets = new std::vector<int>(0); + fTreeVarMapElectrons = new std::vector<int>(0); + fTreeVarMapMuons = new std::vector<int>(0); + fTreeVarMapPhotons = new std::vector<int>(0); + + // create new tree + fTreeMap = new TTree("TreeMap", "TreeMap"); + + fTreeMap->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMap->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMap->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMap->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // set branches for event variables + fTreeMap->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeMap->Branch("Index_jet", fTreeVarMapJets); + fTreeMap->Branch("Index_electron", fTreeVarMapElectrons); + fTreeMap->Branch("Index_muon", fTreeVarMapMuons); + fTreeMap->Branch("Index_photon", fTreeVarMapPhotons); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::CreateTrees() +{ + // error code + int err = 1; + + // create tree for truth particles + if (fParticlesTruth) + err *= this->CreateTreeTruth(); + + // create tree for measured particles + err *= this->CreateTreeMeasured(); + + // create tree for selected particles + err *= this->CreateTreeSelected(); + + // create tree for model particles + err *= this->CreateTreeModel(); + + // create tree for matching informations + if (fMatchingTool && fParticlesTruth) + err *= this->CreateTreeMatching(); + + if (fSelectionTool) + err *= this->CreateTreeMap(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeModelPermutation() +{ + // check tree + if (!fTreeModel) + this->CreateTreeModel(); + + // make sure that the model particles are being built in the likelihood + fParticlesModel = fFitter->Likelihood()->PParticlesModel(); + + // initialize counter + int counter = 0; + + // create new permutation table for writing out the index + // int npartons = (*fParticlesSelected)->NPartons(); + // std::vector < std::vector<int>* >* table_partons = new std::vector < std::vector<int>* >(0); + // fFitter->Permutations()-> CreateSubTable(npartons, table_partons); + + // get permutation index + int pindex = fFitter->Permutations()->PermutationIndex(); + + // fill event variables + fTreeVarNBTags = (*fParticlesModel)->NBTags(); + + // resize and reset branches only in first permutation + if (pindex == 0) + { + // - get number of permutations + fTreeVarNPermutations = fFitter->Permutations()->NPermutations(); + + // reset tree variables + fTreeVarLogLikelihood->clear(); + fTreeVarLogLikelihood->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_bhad->clear(); + fTreeVarLogLikelihoodComp_TF_bhad->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_blep->clear(); + fTreeVarLogLikelihoodComp_TF_blep->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq1->clear(); + fTreeVarLogLikelihoodComp_TF_lq1->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq2->clear(); + fTreeVarLogLikelihoodComp_TF_lq2->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lep->clear(); + fTreeVarLogLikelihoodComp_TF_lep->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_METx->clear(); + fTreeVarLogLikelihoodComp_TF_METx->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_METy->clear(); + fTreeVarLogLikelihoodComp_TF_METy->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Whad->clear(); + fTreeVarLogLikelihoodComp_BW_Whad->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Wlep->clear(); + fTreeVarLogLikelihoodComp_BW_Wlep->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Thad->clear(); + fTreeVarLogLikelihoodComp_BW_Thad->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Tlep->clear(); + fTreeVarLogLikelihoodComp_BW_Tlep->assign(fTreeVarNPermutations, 1.e99); + +// fTreeVarLogLikelihoodComponents->clear(); +// std::vector<double> tempvec(3, 0.0); +// fTreeVarLogLikelihoodComponents->assign(fTreeVarNPermutations, tempvec); + + fTreeVarIntegral->clear(); + fTreeVarIntegral->assign(fTreeVarNPermutations, -1.); + + fTreeVarEventProbability->clear(); + fTreeVarEventProbability->assign(fTreeVarNPermutations, 0.); + + fTreeVarMinuitStatus->clear(); + fTreeVarMinuitStatus->assign(fTreeVarNPermutations, 0); + + fTreeVarConvergenceStatus->clear(); + fTreeVarConvergenceStatus->assign(fTreeVarNPermutations, 0); + + fTreeVarBestPermutation->clear(); + fTreeVarBestPermutation->assign(fTreeVarNPermutations, -1); + + unsigned int n = fTreeVarParameters->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarParameters->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + + d = fTreeVarParameterErrors->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeIntVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<int>* d = fTreeIntVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1); + } + + } + + (*fTreeVarLogLikelihood)[pindex] = fFitter->Likelihood()->LogLikelihood( fFitter->Likelihood()->GetBestFitParameters() ); + +// (*fTreeVarLogLikelihoodComponents)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ); + + (*fTreeVarLogLikelihoodComp_TF_bhad)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(0); + (*fTreeVarLogLikelihoodComp_TF_blep)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(1); + (*fTreeVarLogLikelihoodComp_TF_lq1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(2); + (*fTreeVarLogLikelihoodComp_TF_lq2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(3); + (*fTreeVarLogLikelihoodComp_TF_lep)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(4); + (*fTreeVarLogLikelihoodComp_TF_METx)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(5); + (*fTreeVarLogLikelihoodComp_TF_METy)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(6); + (*fTreeVarLogLikelihoodComp_BW_Whad)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(7); + (*fTreeVarLogLikelihoodComp_BW_Wlep)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(8); + (*fTreeVarLogLikelihoodComp_BW_Thad)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(9); + (*fTreeVarLogLikelihoodComp_BW_Tlep)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(10); + + + (*fTreeVarMinuitStatus)[pindex] = fFitter->MinuitStatus(); + (*fTreeVarConvergenceStatus)[pindex] = fFitter->ConvergenceStatus(); + (*fTreeVarIntegral)[pindex] = fFitter->Likelihood()->GetIntegral(); + (*fTreeVarEventProbability)[pindex] = exp( fFitter->Likelihood()->LogEventProbability() ); + + // check event probability for NaN + if ((*fTreeVarLogLikelihood)[pindex] != (*fTreeVarLogLikelihood)[pindex]) + (*fTreeVarLogLikelihood)[pindex] = double(pindex)* (-1e10); + + if ((*fTreeVarEventProbability)[pindex] != (*fTreeVarEventProbability)[pindex]) + (*fTreeVarEventProbability)[pindex] = 0.; + + // normalize event probability + double sum = 0; + bool flagall = true; + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + if ((*fTreeVarLogLikelihood)[i] < 1e99) + sum += (*fTreeVarEventProbability)[i]; + else + flagall = false; + } + + if (flagall) + { + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + (*fTreeVarEventProbability)[i] = (*fTreeVarEventProbability)[i] / sum; + } + } + + // sort for best permutation + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + int counter = 0; + for (int j = 0; j < fTreeVarNPermutations; ++j) + if ((*fTreeVarEventProbability)[i] < (*fTreeVarEventProbability)[j]) + counter++; + (*fTreeVarBestPermutation)[counter] = i; + } + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + (*fTreeVarParameters->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameter(i); + (*fTreeVarParameterErrors->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameterError(i); + } + + int IntVarcounter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<int>* index = fTreeIntVarModel->at(IntVarcounter); + std::vector<double>* E = fTreeVarModel->at(counter); + std::vector<double>* px = fTreeVarModel->at(++counter); + std::vector<double>* py = fTreeVarModel->at(++counter); + std::vector<double>* pz = fTreeVarModel->at(++counter); + std::vector<double>* m = fTreeVarModel->at(++counter); + std::vector<double>* pt = fTreeVarModel->at(++counter); + std::vector<double>* eta = fTreeVarModel->at(++counter); + std::vector<double>* phi = fTreeVarModel->at(++counter); + std::vector<double>* btag = fTreeVarModel->at(++counter); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + (*E)[pindex] = lv->E(); + (*px)[pindex] = lv->Px(); + (*py)[pindex] = lv->Py(); + (*pz)[pindex] = lv->Pz(); + (*m)[pindex] = lv->M(); + (*pt)[pindex] = lv->Pt(); + (*eta)[pindex] = lv->Eta(); + (*phi)[pindex] = lv->Phi(); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + (*btag)[pindex] = (*fParticlesModel)->IsBTagged(i); +// //std::cout << pindex << " : " << (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i) << std::endl; +// +// //std::cout <<fParticles->NameParticle(0, KLFitter::Particles::kParton) << std::endl; + (*index)[pindex] = (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i); //(*fParticlesModel)->JetIndex(i); + + IntVarcounter++; + } + + if (itype == KLFitter::Particles::kElectron) { + (*index)[pindex] = (*fParticlesModel)->ElectronIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kMuon) { + (*index)[pindex] = (*fParticlesModel)->MuonIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kPhoton) { + (*index)[pindex] = (*fParticlesModel)->PhotonIndex(i); + IntVarcounter++; + } + + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::TreeModelDeleteAllButNBestPermutations(unsigned int n) +{ + //Sanity check: + if(n>unsigned(fTreeVarNPermutations)){ + std::cout<< "KLFitter::InterfaceOutput::TreeModelDeleteAllButNBestPermutations(). Number of permutations to be kept larger than total number of permutations!" << std::endl; + return 0; + } + + //Define tmp vectors for int, double + std::vector<int> vi_tmp; + std::vector<double> vd_tmp; + + //Copy every single vector to tmp and refill the vector in the order of the best permutation from temp and resize to n + // fTreeVarEventNumber and fTreeVarBTags remain untouched + //LogLikelihood + vd_tmp.resize(fTreeVarLogLikelihood->size()); + copy(fTreeVarLogLikelihood->begin(), fTreeVarLogLikelihood->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarLogLikelihood)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarLogLikelihood->resize(n); + //Integral + vd_tmp.resize(fTreeVarIntegral->size()); + copy(fTreeVarIntegral->begin(), fTreeVarIntegral->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarIntegral)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarIntegral->resize(n); + //EventProbability + vd_tmp.resize(fTreeVarEventProbability->size()); + copy(fTreeVarEventProbability->begin(), fTreeVarEventProbability->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarEventProbability)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarEventProbability->resize(n); + //MinuitStatus + vd_tmp.resize(fTreeVarMinuitStatus->size()); + copy(fTreeVarMinuitStatus->begin(), fTreeVarMinuitStatus->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarMinuitStatus)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarMinuitStatus->resize(n); + //ConvergenceStatus + vi_tmp.resize(fTreeVarConvergenceStatus->size()); + copy(fTreeVarConvergenceStatus->begin(), fTreeVarConvergenceStatus->end(), vi_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarConvergenceStatus)[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarConvergenceStatus->resize(n); + + //Parameters Vector + for (unsigned int iPar(0), nPar(fTreeVarParameters->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarParameters)[iPar]->size()); + copy((*fTreeVarParameters)[iPar]->begin(), (*fTreeVarParameters)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarParameters)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarParameters)[iPar]->resize(n); + } + //ParameterErrors Vector + for (unsigned int iPar(0), nPar(fTreeVarParameterErrors->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarParameterErrors)[iPar]->size()); + copy((*fTreeVarParameterErrors)[iPar]->begin(), (*fTreeVarParameterErrors)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarParameterErrors)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarParameterErrors)[iPar]->resize(n); + } + //VarModel Vector + for (unsigned int iPar(0), nPar(fTreeVarModel->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarModel)[iPar]->size()); + copy((*fTreeVarModel)[iPar]->begin(), (*fTreeVarModel)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarModel)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarModel)[iPar]->resize(n); + } + //IntVarModel Vector + for (unsigned int iPar(0), nPar(fTreeIntVarModel->size()); iPar < nPar; ++iPar) { + vi_tmp.resize((*fTreeIntVarModel)[iPar]->size()); + copy((*fTreeIntVarModel)[iPar]->begin(), (*fTreeIntVarModel)[iPar]->end(), vi_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeIntVarModel)[iPar])[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeIntVarModel)[iPar]->resize(n); + } + + //BestPermutation -- NEEDS TO BE DONE LAST! + for (unsigned int i=0; i<n; i++) + (*fTreeVarBestPermutation)[i] = i; + fTreeVarBestPermutation->resize(n); + //NPermutations + fTreeVarNPermutations = n; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeMeasured() +{ + // check tree + if (!fTreeMeasured) + this->CreateTreeMeasured(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsMeasured = (*fParticlesMeasured)->NPartons(); + fTreeVarNElectronsMeasured = (*fParticlesMeasured)->NElectrons(); + fTreeVarNMuonsMeasured = (*fParticlesMeasured)->NMuons(); + fTreeVarNPhotonsMeasured = (*fParticlesMeasured)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesMeasured)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarMeasured->at(counter); + std::vector<double>* vec_px = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_py = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pz = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_m = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pt = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_eta = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_phi = fTreeVarMeasured->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeSelected() +{ + // check tree + if (!fTreeSelected) + this->CreateTreeSelected(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesSelected)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarSelected->at(counter); + std::vector<double>* vec_px = fTreeVarSelected->at(++counter); + std::vector<double>* vec_py = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pz = fTreeVarSelected->at(++counter); + std::vector<double>* vec_m = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pt = fTreeVarSelected->at(++counter); + std::vector<double>* vec_eta = fTreeVarSelected->at(++counter); + std::vector<double>* vec_phi = fTreeVarSelected->at(++counter); + std::vector<double>* vec_btag = fTreeVarSelected->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta ->clear(); + vec_phi ->clear(); + vec_btag->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + vec_btag->push_back( (*fParticlesSelected)->IsBTagged(i) ); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeTruth() +{ + // check tree + if (!fTreeTruth) + { + // error code + int err = 1; + + // create tree + if (fParticlesTruth) + err = this->CreateTreeTruth(); + + else + return 0; + } + + // initialize counter + int counter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<double>* vec_E = fTreeVarTruth->at(counter); + std::vector<double>* vec_px = fTreeVarTruth->at(++counter); + std::vector<double>* vec_py = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pz = fTreeVarTruth->at(++counter); + std::vector<double>* vec_m = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pt = fTreeVarTruth->at(++counter); + std::vector<double>* vec_eta = fTreeVarTruth->at(++counter); + std::vector<double>* vec_phi = fTreeVarTruth->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E->push_back(lv->E()); + vec_px->push_back(lv->Px()); + vec_py->push_back(lv->Py()); + vec_pz->push_back(lv->Pz()); + vec_m->push_back(lv->M()); + vec_pt->push_back(lv->Pt()); + vec_eta->push_back(lv->Eta()); + vec_phi->push_back(lv->Phi()); + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeMatching() +{ + // check tree + if (!fTreeMatching) + { + // error code + int err = 1; + + // create tree + if (fMatchingTool) + err = this->CreateTreeMatching(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // set matching vector for all partons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPartons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPartons->at(k); + d->clear(); + d->assign(fTreeVarNPartonsSelected, -1); + // set number of matched partons to -1 + *fTreeVarNMatchedPartons->at(k) = -1; + } + + // loop over partons + for (int i = 0; i < (*fParticlesTruth)->NPartons(); ++i) + { + // get number of matched partons + *(fTreeVarNMatchedPartons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kParton); + + // loop over reconstructed partons + for (int j = 0; j < fTreeVarNPartonsSelected; ++j) + { + (*(fTreeVarMatchedPartons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kParton)).at(j); + } + } + + // set matching vector for all electrons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedElectrons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedElectrons->at(k); + d->clear(); + d->assign(fTreeVarNElectronsSelected, -1); + // set number of matched electrons to -1 + *fTreeVarNMatchedElectrons->at(k) = -1; + } + // loop over electrons + for (int i = 0; i < (*fParticlesTruth)->NElectrons(); ++i) + { + // get number of matched electrons + *(fTreeVarNMatchedElectrons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kElectron); + + // loop over reconstructed electrons + for (int j = 0; j < fTreeVarNElectronsSelected; ++j) + { + (*(fTreeVarMatchedElectrons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kElectron)).at(j); + } + } + + // set matching vector for all muons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedMuons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedMuons->at(k); + d->clear(); + d->assign(fTreeVarNMuonsSelected, -1); + // set number of matched muons to -1 + *fTreeVarNMatchedMuons->at(k) = -1; + } + // loop over muons + for (int i = 0; i < (*fParticlesTruth)->NMuons(); ++i) + { + // get number of matched muons + *(fTreeVarNMatchedMuons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kMuon); + + // loop over reconstructed muons + for (int j = 0; j < fTreeVarNMuonsSelected; ++j) + { + (*(fTreeVarMatchedMuons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kMuon)).at(j); + } + } + + // set matching vector for all photons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPhotons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPhotons->at(k); + d->clear(); + d->assign(fTreeVarNPhotonsSelected, -1); + // set number of matched photons to -1 + *fTreeVarNMatchedPhotons->at(k) = -1; + } + // loop over photons + for (int i = 0; i < (*fParticlesTruth)->NPhotons(); ++i) + { + + // get number of matched photons + *(fTreeVarNMatchedPhotons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kPhoton); + + // loop over reconstructed photons + for (int j = 0; j < fTreeVarNPhotonsSelected; ++j) + { + (*(fTreeVarMatchedPhotons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kPhoton)).at(j); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTreeMap() +{ + // check tree + if (!fTreeMap) + { + // error code + int err = 1; + + // create tree + if (fSelectionTool) + err = this->CreateTreeMap(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapElectrons->clear(); + fTreeVarMapElectrons->assign(fTreeVarNElectronsSelected, -1); + + fTreeVarMapMuons->clear(); + fTreeVarMapMuons->assign(fTreeVarNMuonsSelected, -1); + + fTreeVarMapPhotons->clear(); + fTreeVarMapPhotons->assign(fTreeVarNPhotonsSelected, -1); + + // get maps + for (int i = 0; i < fTreeVarNPartonsSelected; ++i) + (*fTreeVarMapJets)[i] = (fSelectionTool->MapJets()).at(i); + for (int i = 0; i < fTreeVarNElectronsSelected; ++i) + (*fTreeVarMapElectrons)[i] = (fSelectionTool->MapElectrons()).at(i); + for (int i = 0; i < fTreeVarNMuonsSelected; ++i) + (*fTreeVarMapMuons)[i] = (fSelectionTool->MapMuons()).at(i); + for (int i = 0; i < fTreeVarNPhotonsSelected; ++i) + (*fTreeVarMapPhotons)[i] = (fSelectionTool->MapPhotons()).at(i); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::FillTrees() +{ + // fill tree with truth particles + if (fParticlesTruth && fTreeTruth) + fTreeTruth->Fill(); + + // fill tree with measured particles + if (fParticlesMeasured && fTreeMeasured) + fTreeMeasured->Fill(); + + // fill tree with selected particles + if (fParticlesSelected && fTreeSelected) + fTreeSelected->Fill(); + + // fill tree with model particles + if (fParticlesModel && fTreeModel) + fTreeModel->Fill(); + + if (fMatchingTool) + fTreeMatching->Fill(); + + if (fSelectionTool) + fTreeMap->Fill(); + + fTreeVarEventNumber++; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::SetEventWeight(double weight) +{ + fEventWeight = weight; + + // no error + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput::SetPhotonType(bool isNotClassified, bool isRadTopProd, bool isHadTopRadDecay, bool isLepTopRadDecay, bool isHadWRadDecay, bool isLepWRadDecay) +{ + fIsNotClassified = isNotClassified; + fIsRadTopProd = isRadTopProd; + fIsHadTopRadDecay = isHadTopRadDecay; + fIsLepTopRadDecay = isLepTopRadDecay; + fIsHadWRadDecay = isHadWRadDecay; + fIsLepWRadDecay = isLepWRadDecay; + + // no error + return 0; +} + +// --------------------------------------------------------- +std::string KLFitter::InterfaceOutput::ModifyString(std::string str) +{ + int idx; + + while( (idx=str.find_first_of(' ')) >= 0 ) + str.replace(idx, 1, "_" ); + + while( (idx=str.find_first_of('-')) >= 0 ) + str.replace(idx, 1, "_" ); + + return str; +} + +// --------------------------------------------------------- + +std::string KLFitter::InterfaceOutput::TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType) +{ + std::string name = ""; + switch(pType) + { + case KLFitter::Particles::kParton: name = "jet"; break; + case KLFitter::Particles::kElectron: name = "electron"; break; + case KLFitter::Particles::kMuon: name = "muon"; break; + case KLFitter::Particles::kPhoton: name = "photon"; break; + case KLFitter::Particles::kTau: name = ""; break; // there is no measured tau + case KLFitter::Particles::kNeutrino: name = ""; break; // there is no measured neutrino + case KLFitter::Particles::kBoson: name = ""; break; // there is no measured (W) boson + default: name = ""; break; + } + + return name; +} + +// --------------------------------------------------------- + +template<class type> void KLFitter::InterfaceOutput::Resize(std::vector<std::vector<type>* >* v, unsigned int length) +{ + for (unsigned int i = 0; i < v->size(); i++) + { + v->at(i)->resize(length); + } +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_Allhadronic.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_Allhadronic.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f224f12f4e5939621f1e569f34f981221c244435 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_Allhadronic.cxx @@ -0,0 +1,1775 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceOutput_Allhadronic.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/Fitter.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "KLFitter/Permutations.h" + +#include <TFile.h> +#include <TTree.h> + +#include <iostream> +#include <map> + +// --------------------------------------------------------- +KLFitter::InterfaceOutput_Allhadronic::InterfaceOutput_Allhadronic() +{ + fFitter = 0; + fMatchingTool = 0; + fSelectionTool = 0; + fParticlesTruth = 0; + fParticlesModel = 0; + fParticlesMeasured = 0; + fParticlesSelected = 0; + fTreeTruth = 0; + fTreeModel = 0; + fTreeMeasured = 0; + fTreeSelected = 0; + fTreeMatching = 0; + fTreeMap = 0; + fTreeVarBestPermutation = 0; + fTreeVarLogLikelihood = 0; + fTreeVarLogLikelihoodComp_TF_bhad1 = 0; + fTreeVarLogLikelihoodComp_TF_bhad2 = 0; + fTreeVarLogLikelihoodComp_TF_lq1 = 0; + fTreeVarLogLikelihoodComp_TF_lq2 = 0; + fTreeVarLogLikelihoodComp_TF_lq3 = 0; + fTreeVarLogLikelihoodComp_TF_lq4 = 0; + fTreeVarLogLikelihoodComp_BW_Whad1 = 0; + fTreeVarLogLikelihoodComp_BW_Whad2 = 0; + fTreeVarLogLikelihoodComp_BW_Thad1 = 0; + fTreeVarLogLikelihoodComp_BW_Thad2 = 0; +// fTreeVarLogLikelihoodComponents = 0; + fTreeVarIntegral = 0; + fTreeVarEventProbability = 0; + fTreeVarMinuitStatus = 0; + fTreeVarConvergenceStatus = 0; + fTreeVarEventNumber = 0; + fTreeVarParameters = new std::vector<std::vector<double> *>(0); + fTreeVarParameterErrors = new std::vector<std::vector<double> *>(0); + fTreeVarModel = new std::vector<std::vector<double> *>(0); + fTreeIntVarModel = new std::vector<std::vector<int> *>(0); + fTreeVarTruth = new std::vector<std::vector<double> *>(0); + fTreeVarMeasured = new std::vector<std::vector<double> *>(0); + fTreeVarSelected = new std::vector<std::vector<double> *>(0); + fTreeVarNMatchedPartons = new std::vector<int *>(0); + fTreeVarNMatchedElectrons = new std::vector<int *>(0); + fTreeVarNMatchedMuons = new std::vector<int *>(0); + fTreeVarNMatchedPhotons = new std::vector<int *>(0); + fTreeVarMatchedPartons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedElectrons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedMuons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedPhotons = new std::vector <std::vector<int> *>(0); + fTreeVarMapJets = 0; + fTreeVarMapElectrons = 0; + fTreeVarMapMuons = 0; + fTreeVarMapPhotons = 0; + fEventWeight = 0.; + fPileupWeight = 0.; + fIsNotClassified = false; + fIsRadTopProd = false; + fIsHadTopRadDecay = false; + fIsLepTopRadDecay = false; + fIsHadWRadDecay = false; + fIsLepWRadDecay = false; +} + +// --------------------------------------------------------- +KLFitter::InterfaceOutput_Allhadronic::~InterfaceOutput_Allhadronic() +{ + if (fTreeVarBestPermutation) + delete fTreeVarBestPermutation; + + if (fTreeVarLogLikelihood) + delete fTreeVarLogLikelihood; + + if(fTreeVarLogLikelihoodComp_TF_bhad1) + delete fTreeVarLogLikelihoodComp_TF_bhad1; + + if(fTreeVarLogLikelihoodComp_TF_bhad2) + delete fTreeVarLogLikelihoodComp_TF_bhad2; + + if(fTreeVarLogLikelihoodComp_TF_lq1) + delete fTreeVarLogLikelihoodComp_TF_lq1; + + if(fTreeVarLogLikelihoodComp_TF_lq2) + delete fTreeVarLogLikelihoodComp_TF_lq2; + + if(fTreeVarLogLikelihoodComp_TF_lq3) + delete fTreeVarLogLikelihoodComp_TF_lq3; + + if(fTreeVarLogLikelihoodComp_TF_lq4) + delete fTreeVarLogLikelihoodComp_TF_lq4; + + if(fTreeVarLogLikelihoodComp_BW_Whad1) + delete fTreeVarLogLikelihoodComp_BW_Whad1; + + if(fTreeVarLogLikelihoodComp_BW_Whad2) + delete fTreeVarLogLikelihoodComp_BW_Whad2; + + if(fTreeVarLogLikelihoodComp_BW_Thad1) + delete fTreeVarLogLikelihoodComp_BW_Thad1; + + if(fTreeVarLogLikelihoodComp_BW_Thad2) + delete fTreeVarLogLikelihoodComp_BW_Thad2; + +// if (fTreeVarLogLikelihoodComponents) +// delete fTreeVarLogLikelihoodComponents; + + if (fTreeVarIntegral) + delete fTreeVarIntegral; + + if (fTreeVarEventProbability) + delete fTreeVarEventProbability; + + if (fTreeVarMinuitStatus) + delete fTreeVarMinuitStatus; + + if (fTreeVarConvergenceStatus) + delete fTreeVarConvergenceStatus; + + while (!fTreeVarParameters->empty()) + { + std::vector<double>* d = fTreeVarParameters->front(); + fTreeVarParameters->erase(fTreeVarParameters->begin()); + delete d; + } + delete fTreeVarParameters; + + while (!fTreeVarParameterErrors->empty()) + { + std::vector<double>* d = fTreeVarParameterErrors->front(); + fTreeVarParameterErrors->erase(fTreeVarParameterErrors->begin()); + delete d; + } + delete fTreeVarParameterErrors; + + while (!fTreeVarModel->empty()) + { + std::vector<double>* d = fTreeVarModel->front(); + fTreeVarModel->erase(fTreeVarModel->begin()); + delete d; + } + delete fTreeVarModel; + + while (!fTreeIntVarModel->empty()) + { + std::vector<int>* d = fTreeIntVarModel->front(); + fTreeIntVarModel->erase(fTreeIntVarModel->begin()); + delete d; + } + delete fTreeIntVarModel; + + while (!fTreeVarTruth->empty()) + { + std::vector<double>* d = fTreeVarTruth->front(); + fTreeVarTruth->erase(fTreeVarTruth->begin()); + delete d; + } + delete fTreeVarTruth; + + while (!fTreeVarMeasured->empty()) + { + std::vector<double>* d = fTreeVarMeasured-> front(); + fTreeVarMeasured->erase(fTreeVarMeasured->begin()); + delete d; + } + delete fTreeVarMeasured; + + while (!fTreeVarSelected->empty()) + { + std::vector<double>* d = fTreeVarSelected->front(); + fTreeVarSelected->erase(fTreeVarSelected->begin()); + delete d; + } + delete fTreeVarSelected; + + while (!fTreeVarNMatchedPartons->empty()) + { + int* i = fTreeVarNMatchedPartons->front(); + fTreeVarNMatchedPartons->erase(fTreeVarNMatchedPartons->begin()); + delete i; + } + delete fTreeVarNMatchedPartons; + + while (!fTreeVarNMatchedElectrons->empty()) + { + int* i = fTreeVarNMatchedElectrons->front(); + fTreeVarNMatchedElectrons->erase(fTreeVarNMatchedElectrons->begin()); + delete i; + } + delete fTreeVarNMatchedElectrons; + + while (!fTreeVarNMatchedMuons->empty()) + { + int* i = fTreeVarNMatchedMuons->front(); + fTreeVarNMatchedMuons->erase(fTreeVarNMatchedMuons->begin()); + delete i; + } + delete fTreeVarNMatchedMuons; + + while (!fTreeVarNMatchedPhotons->empty()) + { + int* i = fTreeVarNMatchedPhotons->front(); + fTreeVarNMatchedPhotons->erase(fTreeVarNMatchedPhotons->begin()); + delete i; + } + delete fTreeVarNMatchedPhotons; + + while (!fTreeVarMatchedPartons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPartons->front(); + fTreeVarMatchedPartons->erase(fTreeVarMatchedPartons->begin()); + delete i; + } + delete fTreeVarMatchedPartons; + + while (!fTreeVarMatchedElectrons->empty()) + { + std::vector<int>* i = fTreeVarMatchedElectrons->front(); + fTreeVarMatchedElectrons->erase(fTreeVarMatchedElectrons->begin()); + delete i; + } + delete fTreeVarMatchedElectrons; + + while (!fTreeVarMatchedMuons->empty()) + { + std::vector<int>* i = fTreeVarMatchedMuons->front(); + fTreeVarMatchedMuons->erase(fTreeVarMatchedMuons->begin()); + delete i; + } + delete fTreeVarMatchedMuons; + + while (!fTreeVarMatchedPhotons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPhotons->front(); + fTreeVarMatchedPhotons->erase(fTreeVarMatchedPhotons->begin()); + delete i; + } + delete fTreeVarMatchedPhotons; + + if (fTreeVarMapJets) + delete fTreeVarMapJets; + + if (fTreeVarMapElectrons) + delete fTreeVarMapElectrons; + + if (fTreeVarMapMuons) + delete fTreeVarMapMuons; + + if (fTreeVarMapPhotons) + delete fTreeVarMapPhotons; + + if (fTreeTruth) + delete fTreeTruth; + + if (fTreeModel) + delete fTreeModel; + + if (fTreeMeasured) + delete fTreeMeasured; + + if (fTreeSelected) + delete fTreeSelected; + + if (fTreeMatching) + delete fTreeMatching; + + if (fTreeMap) + delete fTreeMap; + +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::SetFitter(KLFitter::Fitter* fitter) +{ + // check if fitter exists + if (!fitter) + { + std::cout << "KLFitter::InterfaceOutput::SetFitter(). Fitter does not exist." << std::endl; + return 0; + } + + // set pointers to pointer + fParticlesModel = fitter->Likelihood()->PParticlesModel(); + fParticlesSelected = fitter->PParticles(); + + // set fitter + fFitter = fitter; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::SetMatchingTool(KLFitter::MatchingTool* matchingtool) +{ + // check if fitter exists + if (!matchingtool) + { + std::cout << "KLFitter::InterfaceOutput::SetMatchingTool(). Matching tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fMatchingTool = matchingtool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::SetSelectionTool(KLFitter::SelectionTool* selectiontool) +{ + // check if fitter exists + if (!selectiontool) + { + std::cout << "KLFitter::InterfaceOutput::SetSelectionTool(). Selection tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fSelectionTool = selectiontool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CloseRootFile() +{ + // define error code + int err = 1; + + // check if file exists + if (!fRootFile) + return 0; + + // check if file is open + if (!fRootFile->IsOpen()) + return 0; + + if (fTreeTruth) + fRootFile->WriteTObject(fTreeTruth); + + if (fTreeModel) + fRootFile->WriteTObject(fTreeModel); + + if (fTreeMeasured) + fRootFile->WriteTObject(fTreeMeasured); + + if (fTreeSelected) + fRootFile->WriteTObject(fTreeSelected); + + if (fTreeMatching) + fRootFile->WriteTObject(fTreeMatching); + + if (fTreeMap) + fRootFile->WriteTObject(fTreeMap); + + // close file + KLFitter::InterfaceRoot::CloseRootFile(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeModel() +{ + // check if particles exist + if (!fParticlesModel) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeModel(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeModel) + delete fTreeModel; + + // get number of permutations + int nperm = fFitter->Permutations()->NPermutations(); + + // create new tree + fTreeModel = new TTree("TreeModel", "TreeModel"); + + // reset variables + fTreeVarNPermutations = nperm; + fTreeVarNBTags=0; + fTreeVarBestPermutation = new std::vector<int>(0); + fTreeVarLogLikelihood = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_bhad1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_bhad2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq3 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lq4 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Whad1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Whad2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Thad1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_BW_Thad2 = new std::vector<double>(0); +// fTreeVarLogLikelihoodComponents = new std::vector<std::vector<double> >(0); + fTreeVarIntegral = new std::vector<double>(0); + fTreeVarEventProbability = new std::vector<double>(0); + fTreeVarMinuitStatus = new std::vector<double>(0); + fTreeVarConvergenceStatus = new std::vector<unsigned int>(0); + + // set branches for event variables + fTreeModel->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeModel->Branch("N_permutations", &fTreeVarNPermutations, "N_permutations/I"); + fTreeModel->Branch("N_btags", &fTreeVarNBTags, "N_btags/I"); + fTreeModel->Branch("best_permutation", fTreeVarBestPermutation); + fTreeModel->Branch("LogLikelihood", fTreeVarLogLikelihood); + fTreeModel->Branch("LogLikelihoodComp_TF_bhad1", fTreeVarLogLikelihoodComp_TF_bhad1); + fTreeModel->Branch("LogLikelihoodComp_TF_bhad2", fTreeVarLogLikelihoodComp_TF_bhad2); + fTreeModel->Branch("LogLikelihoodComp_TF_lq1", fTreeVarLogLikelihoodComp_TF_lq1); + fTreeModel->Branch("LogLikelihoodComp_TF_lq2", fTreeVarLogLikelihoodComp_TF_lq2); + fTreeModel->Branch("LogLikelihoodComp_TF_lq3", fTreeVarLogLikelihoodComp_TF_lq3); + fTreeModel->Branch("LogLikelihoodComp_TF_lq4", fTreeVarLogLikelihoodComp_TF_lq4); + fTreeModel->Branch("LogLikelihoodComp_BW_Whad1", fTreeVarLogLikelihoodComp_BW_Whad1); + fTreeModel->Branch("LogLikelihoodComp_BW_Whad2", fTreeVarLogLikelihoodComp_BW_Whad2); + fTreeModel->Branch("LogLikelihoodComp_BW_Thad1", fTreeVarLogLikelihoodComp_BW_Thad1); + fTreeModel->Branch("LogLikelihoodComp_BW_Thad2", fTreeVarLogLikelihoodComp_BW_Thad2); +// fTreeModel->Branch("LogLikelihoodComponents", fTreeVarLogLikelihoodComponents); + fTreeModel->Branch("Integral", fTreeVarIntegral); + fTreeModel->Branch("EventProbability", fTreeVarEventProbability); + fTreeModel->Branch("MinuitStatus", fTreeVarMinuitStatus); + fTreeModel->Branch("ConvergenceStatusBit", fTreeVarConvergenceStatus); + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + std::vector<double>* par = new std::vector<double>(0); + std::vector<double>* parerr = new std::vector<double>(0); + fTreeVarParameters->push_back(par); + fTreeVarParameterErrors->push_back(parerr); + + fTreeModel->Branch( this->ModifyString( "par_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), par); + fTreeModel->Branch( this->ModifyString( "parerr_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), parerr); + } + + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesModel)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + std::vector<double>* btag = new std::vector<double>(0); + std::vector<int>* index = new std::vector<int>(0); + + // add variables to vector + fTreeVarModel->push_back(E); + fTreeVarModel->push_back(px); + fTreeVarModel->push_back(py); + fTreeVarModel->push_back(pz); + fTreeVarModel->push_back(m); + fTreeVarModel->push_back(pt); + fTreeVarModel->push_back(eta); + fTreeVarModel->push_back(phi); + fTreeVarModel->push_back(btag); + fTreeIntVarModel->push_back(index); + + // create new branches + fTreeModel->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeModel->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeModel->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeModel->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeModel->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeModel->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeModel->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeModel->Branch(this->ModifyString((name+"_phi")).data(), phi); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + fTreeModel->Branch(this->ModifyString((name+"_btag")).data(), btag); + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + if (itype == KLFitter::Particles::kElectron && (*fParticlesModel)->ElectronIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kMuon && (*fParticlesModel)->MuonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kPhoton && (*fParticlesModel)->PhotonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeMeasured() +{ + // check if particles exist + if (!fParticlesMeasured) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMeasured(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMeasured) + delete fTreeMeasured; + + // create new tree + fTreeMeasured = new TTree("TreeMeasured", "TreeMeasured"); + + // event weight branch + fTreeMeasured->Branch("Weight", &fEventWeight, "Weight/D"); + fTreeMeasured->Branch("PileupWeight", &fPileupWeight, "PileupWeight/D"); + fTreeMeasured->Branch("N_jets", &fTreeVarNPartonsMeasured, "N_jets/I"); + fTreeMeasured->Branch("N_electrons", &fTreeVarNElectronsMeasured, "N_electrons/I"); + fTreeMeasured->Branch("N_muons", &fTreeVarNMuonsMeasured, "N_muons/I"); + fTreeMeasured->Branch("N_photons", &fTreeVarNPhotonsMeasured, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarMeasured->push_back(vec_E); + fTreeVarMeasured->push_back(vec_px); + fTreeVarMeasured->push_back(vec_py); + fTreeVarMeasured->push_back(vec_pz); + fTreeVarMeasured->push_back(vec_m); + fTreeVarMeasured->push_back(vec_pt); + fTreeVarMeasured->push_back(vec_eta); + fTreeVarMeasured->push_back(vec_phi); + + // create new branches + fTreeMeasured->Branch((name+"_E").data(), vec_E ); + fTreeMeasured->Branch((name+"_px").data(), vec_px ); + fTreeMeasured->Branch((name+"_py").data(), vec_py ); + fTreeMeasured->Branch((name+"_pz").data(), vec_pz ); + fTreeMeasured->Branch((name+"_m").data(), vec_m ); + fTreeMeasured->Branch((name+"_pt").data(), vec_pt ); + fTreeMeasured->Branch((name+"_eta").data(), vec_eta); + fTreeMeasured->Branch((name+"_phi").data(), vec_phi); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeSelected() +{ + // check if particles exist + if (!fParticlesSelected) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeSelected(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeSelected) + delete fTreeSelected; + + // create new tree + fTreeSelected = new TTree("TreeSelected", "TreeSelected"); + + fTreeSelected->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeSelected->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeSelected->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeSelected->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + std::vector<double>* vec_btag = new std::vector<double>(0); + + // add variables to vector + fTreeVarSelected->push_back(vec_E); + fTreeVarSelected->push_back(vec_px); + fTreeVarSelected->push_back(vec_py); + fTreeVarSelected->push_back(vec_pz); + fTreeVarSelected->push_back(vec_m); + fTreeVarSelected->push_back(vec_pt); + fTreeVarSelected->push_back(vec_eta); + fTreeVarSelected->push_back(vec_phi); + fTreeVarSelected->push_back(vec_btag); + + // create new branches + fTreeSelected->Branch((name+"_E").data(), vec_E ); + fTreeSelected->Branch((name+"_px").data(), vec_px ); + fTreeSelected->Branch((name+"_py").data(), vec_py ); + fTreeSelected->Branch((name+"_pz").data(), vec_pz ); + fTreeSelected->Branch((name+"_m").data(), vec_m ); + fTreeSelected->Branch((name+"_pt").data(), vec_pt ); + fTreeSelected->Branch((name+"_eta").data(), vec_eta); + fTreeSelected->Branch((name+"_phi").data(), vec_phi); + if (itype == KLFitter::Particles::kParton) + fTreeSelected->Branch((name+"_btag").data(), vec_btag); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeTruth() +{ + // check if particles exist + if (!fParticlesTruth) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeTruth(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeTruth) + delete fTreeTruth; + + // create new tree + fTreeTruth = new TTree("TreeTruth", "TreeTruth"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarTruth->push_back(E); + fTreeVarTruth->push_back(px); + fTreeVarTruth->push_back(py); + fTreeVarTruth->push_back(pz); + fTreeVarTruth->push_back(m); + fTreeVarTruth->push_back(pt); + fTreeVarTruth->push_back(eta); + fTreeVarTruth->push_back(phi); + + // create new branches + fTreeTruth->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeTruth->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeTruth->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeTruth->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeTruth->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeTruth->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeTruth->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeTruth->Branch(this->ModifyString((name+"_phi")).data(), phi); + } + } + + fTreeTruth->Branch("IsNotClassified", &fIsNotClassified, "IsNotClassified/B"); + fTreeTruth->Branch("IsRadTopProd", &fIsRadTopProd, "IsRadTopProd/B"); + fTreeTruth->Branch("IsHadTopRadDecay", &fIsHadTopRadDecay, "IsHadTopRadDecay/B"); + fTreeTruth->Branch("IsLepTopRadDecay", &fIsLepTopRadDecay, "IsLepTopRadDecay/B"); + fTreeTruth->Branch("IsHadWRadDecay", &fIsHadWRadDecay, "IsHadWRadDecay/B"); + fTreeTruth->Branch("IsLepWRadDecay", &fIsLepWRadDecay, "IsLepWRadDecay/B"); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeMatching() +{ + // check if particles exist + if (!fMatchingTool) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMatching(). Matching tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMatching) + delete fTreeMatching; + + // create new tree + fTreeMatching = new TTree("TreeMatching", "TreeMatching"); + + fTreeMatching->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMatching->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMatching->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMatching->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // get parton container + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kParton); + + // get number of particles in container + int ntruth = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < ntruth; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPartons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_partons_max = fParticlesSelected ? (*fParticlesSelected)->NPartons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_partons_max, -1); + fTreeVarMatchedPartons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get electron container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kElectron); + + // get number of particles in container + int n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedElectrons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_electrons_max = fParticlesSelected ? (*fParticlesSelected)->NElectrons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_electrons_max, -1); + fTreeVarMatchedElectrons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get muon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kMuon); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedMuons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_muons_max = fParticlesSelected ? (*fParticlesSelected)->NMuons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_muons_max, -1); + fTreeVarMatchedMuons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get photon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kPhoton); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPhotons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_photons_max = fParticlesSelected ? (*fParticlesSelected)->NPhotons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_photons_max, -1); + fTreeVarMatchedPhotons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTreeMap() +{ + // check if particles exist + if (!fSelectionTool) + { + std::cout << "KLFitter::InterfaceOutput::CreateTreeMap(). Selection tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMap) + delete fTreeMap; + + // reset variables + fTreeVarMapJets = new std::vector<int>(0); + fTreeVarMapElectrons = new std::vector<int>(0); + fTreeVarMapMuons = new std::vector<int>(0); + fTreeVarMapPhotons = new std::vector<int>(0); + + // create new tree + fTreeMap = new TTree("TreeMap", "TreeMap"); + + fTreeMap->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMap->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMap->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMap->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // set branches for event variables + fTreeMap->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeMap->Branch("Index_jet", fTreeVarMapJets); + fTreeMap->Branch("Index_electron", fTreeVarMapElectrons); + fTreeMap->Branch("Index_muon", fTreeVarMapMuons); + fTreeMap->Branch("Index_photon", fTreeVarMapPhotons); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::CreateTrees() +{ + // error code + int err = 1; + + // create tree for truth particles + if (fParticlesTruth) + err *= this->CreateTreeTruth(); + + // create tree for measured particles + err *= this->CreateTreeMeasured(); + + // create tree for selected particles + err *= this->CreateTreeSelected(); + + // create tree for model particles + err *= this->CreateTreeModel(); + + // create tree for matching informations + if (fMatchingTool && fParticlesTruth) + err *= this->CreateTreeMatching(); + + if (fSelectionTool) + err *= this->CreateTreeMap(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeModelPermutation() +{ + // check tree + if (!fTreeModel) + this->CreateTreeModel(); + + // make sure that the model particles are being built in the likelihood + fParticlesModel = fFitter->Likelihood()->PParticlesModel(); + + // initialize counter + int counter = 0; + + // create new permutation table for writing out the index + // int npartons = (*fParticlesSelected)->NPartons(); + // std::vector < std::vector<int>* >* table_partons = new std::vector < std::vector<int>* >(0); + // fFitter->Permutations()-> CreateSubTable(npartons, table_partons); + + // get permutation index + int pindex = fFitter->Permutations()->PermutationIndex(); + + // fill event variables + fTreeVarNBTags = (*fParticlesModel)->NBTags(); + + // resize and reset branches only in first permutation + if (pindex == 0) + { + // - get number of permutations + fTreeVarNPermutations = fFitter->Permutations()->NPermutations(); + + // reset tree variables + fTreeVarLogLikelihood->clear(); + fTreeVarLogLikelihood->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_bhad1->clear(); + fTreeVarLogLikelihoodComp_TF_bhad1->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_bhad2->clear(); + fTreeVarLogLikelihoodComp_TF_bhad2->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq1->clear(); + fTreeVarLogLikelihoodComp_TF_lq1->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq2->clear(); + fTreeVarLogLikelihoodComp_TF_lq2->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq3->clear(); + fTreeVarLogLikelihoodComp_TF_lq3->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_TF_lq4->clear(); + fTreeVarLogLikelihoodComp_TF_lq4->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Whad1->clear(); + fTreeVarLogLikelihoodComp_BW_Whad1->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Whad2->clear(); + fTreeVarLogLikelihoodComp_BW_Whad2->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Thad1->clear(); + fTreeVarLogLikelihoodComp_BW_Thad1->assign(fTreeVarNPermutations, 1.e99); + + fTreeVarLogLikelihoodComp_BW_Thad2->clear(); + fTreeVarLogLikelihoodComp_BW_Thad2->assign(fTreeVarNPermutations, 1.e99); + +// fTreeVarLogLikelihoodComponents->clear(); +// std::vector<double> tempvec(3, 0.0); +// fTreeVarLogLikelihoodComponents->assign(fTreeVarNPermutations, tempvec); + + fTreeVarIntegral->clear(); + fTreeVarIntegral->assign(fTreeVarNPermutations, -1.); + + fTreeVarEventProbability->clear(); + fTreeVarEventProbability->assign(fTreeVarNPermutations, 0.); + + fTreeVarMinuitStatus->clear(); + fTreeVarMinuitStatus->assign(fTreeVarNPermutations, 0); + + fTreeVarConvergenceStatus->clear(); + fTreeVarConvergenceStatus->assign(fTreeVarNPermutations, 0); + + fTreeVarBestPermutation->clear(); + fTreeVarBestPermutation->assign(fTreeVarNPermutations, -1); + + unsigned int n = fTreeVarParameters->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarParameters->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + + d = fTreeVarParameterErrors->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeIntVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<int>* d = fTreeIntVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1); + } + + } + + (*fTreeVarLogLikelihood)[pindex] = fFitter->Likelihood()->LogLikelihood( fFitter->Likelihood()->GetBestFitParameters() ); + +// (*fTreeVarLogLikelihoodComponents)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ); + + (*fTreeVarLogLikelihoodComp_TF_bhad1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(0); + (*fTreeVarLogLikelihoodComp_TF_bhad2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(1); + (*fTreeVarLogLikelihoodComp_TF_lq1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(2); + (*fTreeVarLogLikelihoodComp_TF_lq2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(3); + (*fTreeVarLogLikelihoodComp_TF_lq3)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(4); + (*fTreeVarLogLikelihoodComp_TF_lq4)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(5); + (*fTreeVarLogLikelihoodComp_BW_Whad1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(6); + (*fTreeVarLogLikelihoodComp_BW_Whad2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(7); + (*fTreeVarLogLikelihoodComp_BW_Thad1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(8); + (*fTreeVarLogLikelihoodComp_BW_Thad2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(9); + + + (*fTreeVarMinuitStatus)[pindex] = fFitter->MinuitStatus(); + (*fTreeVarConvergenceStatus)[pindex] = fFitter->ConvergenceStatus(); + (*fTreeVarIntegral)[pindex] = fFitter->Likelihood()->GetIntegral(); + (*fTreeVarEventProbability)[pindex] = exp( fFitter->Likelihood()->LogEventProbability() ); + + // check event probability for NaN + if ((*fTreeVarLogLikelihood)[pindex] != (*fTreeVarLogLikelihood)[pindex]) + (*fTreeVarLogLikelihood)[pindex] = double(pindex)* (-1e10); + + if ((*fTreeVarEventProbability)[pindex] != (*fTreeVarEventProbability)[pindex]) + (*fTreeVarEventProbability)[pindex] = 0.; + + // normalize event probability + double sum = 0; + bool flagall = true; + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + if ((*fTreeVarLogLikelihood)[i] < 1e99) + sum += (*fTreeVarEventProbability)[i]; + else + flagall = false; + } + + if (flagall) + { + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + (*fTreeVarEventProbability)[i] = (*fTreeVarEventProbability)[i] / sum; + } + } + + // sort for best permutation + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + int counter = 0; + for (int j = 0; j < fTreeVarNPermutations; ++j) + if ((*fTreeVarEventProbability)[i] < (*fTreeVarEventProbability)[j]) + counter++; + (*fTreeVarBestPermutation)[counter] = i; + } + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + (*fTreeVarParameters->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameter(i); + (*fTreeVarParameterErrors->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameterError(i); + } + + int IntVarcounter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<int>* index = fTreeIntVarModel->at(IntVarcounter); + std::vector<double>* E = fTreeVarModel->at(counter); + std::vector<double>* px = fTreeVarModel->at(++counter); + std::vector<double>* py = fTreeVarModel->at(++counter); + std::vector<double>* pz = fTreeVarModel->at(++counter); + std::vector<double>* m = fTreeVarModel->at(++counter); + std::vector<double>* pt = fTreeVarModel->at(++counter); + std::vector<double>* eta = fTreeVarModel->at(++counter); + std::vector<double>* phi = fTreeVarModel->at(++counter); + std::vector<double>* btag = fTreeVarModel->at(++counter); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + (*E)[pindex] = lv->E(); + (*px)[pindex] = lv->Px(); + (*py)[pindex] = lv->Py(); + (*pz)[pindex] = lv->Pz(); + (*m)[pindex] = lv->M(); + (*pt)[pindex] = lv->Pt(); + (*eta)[pindex] = lv->Eta(); + (*phi)[pindex] = lv->Phi(); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + (*btag)[pindex] = (*fParticlesModel)->IsBTagged(i); +// //std::cout << pindex << " : " << (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i) << std::endl; +// +// //std::cout <<fParticles->NameParticle(0, KLFitter::Particles::kParton) << std::endl; + (*index)[pindex] = (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i); //(*fParticlesModel)->JetIndex(i); + + IntVarcounter++; + } + + if (itype == KLFitter::Particles::kElectron) { + (*index)[pindex] = (*fParticlesModel)->ElectronIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kMuon) { + (*index)[pindex] = (*fParticlesModel)->MuonIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kPhoton) { + (*index)[pindex] = (*fParticlesModel)->PhotonIndex(i); + IntVarcounter++; + } + + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::TreeModelDeleteAllButNBestPermutations(unsigned int n) +{ + //Sanity check: + if(n>unsigned(fTreeVarNPermutations)){ + std::cout<< "KLFitter::InterfaceOutput::TreeModelDeleteAllButNBestPermutations(). Number of permutations to be kept larger than total number of permutations!" << std::endl; + return 0; + } + + //Define tmp vectors for int, double + std::vector<int> vi_tmp; + std::vector<double> vd_tmp; + + //Copy every single vector to tmp and refill the vector in the order of the best permutation from temp and resize to n + // fTreeVarEventNumber and fTreeVarBTags remain untouched + //LogLikelihood + vd_tmp.resize(fTreeVarLogLikelihood->size()); + copy(fTreeVarLogLikelihood->begin(), fTreeVarLogLikelihood->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarLogLikelihood)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarLogLikelihood->resize(n); + //Integral + vd_tmp.resize(fTreeVarIntegral->size()); + copy(fTreeVarIntegral->begin(), fTreeVarIntegral->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarIntegral)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarIntegral->resize(n); + //EventProbability + vd_tmp.resize(fTreeVarEventProbability->size()); + copy(fTreeVarEventProbability->begin(), fTreeVarEventProbability->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarEventProbability)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarEventProbability->resize(n); + //MinuitStatus + vd_tmp.resize(fTreeVarMinuitStatus->size()); + copy(fTreeVarMinuitStatus->begin(), fTreeVarMinuitStatus->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarMinuitStatus)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarMinuitStatus->resize(n); + //ConvergenceStatus + vi_tmp.resize(fTreeVarConvergenceStatus->size()); + copy(fTreeVarConvergenceStatus->begin(), fTreeVarConvergenceStatus->end(), vi_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarConvergenceStatus)[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarConvergenceStatus->resize(n); + + //Parameters Vector + for (unsigned int iPar(0), nPar(fTreeVarParameters->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarParameters)[iPar]->size()); + copy((*fTreeVarParameters)[iPar]->begin(), (*fTreeVarParameters)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarParameters)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarParameters)[iPar]->resize(n); + } + //ParameterErrors Vector + for (unsigned int iPar(0), nPar(fTreeVarParameterErrors->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarParameterErrors)[iPar]->size()); + copy((*fTreeVarParameterErrors)[iPar]->begin(), (*fTreeVarParameterErrors)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarParameterErrors)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarParameterErrors)[iPar]->resize(n); + } + //VarModel Vector + for (unsigned int iPar(0), nPar(fTreeVarModel->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarModel)[iPar]->size()); + copy((*fTreeVarModel)[iPar]->begin(), (*fTreeVarModel)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarModel)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarModel)[iPar]->resize(n); + } + //IntVarModel Vector + for (unsigned int iPar(0), nPar(fTreeIntVarModel->size()); iPar < nPar; ++iPar) { + vi_tmp.resize((*fTreeIntVarModel)[iPar]->size()); + copy((*fTreeIntVarModel)[iPar]->begin(), (*fTreeIntVarModel)[iPar]->end(), vi_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeIntVarModel)[iPar])[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeIntVarModel)[iPar]->resize(n); + } + + //BestPermutation -- NEEDS TO BE DONE LAST! + for (unsigned int i=0; i<n; i++) + (*fTreeVarBestPermutation)[i] = i; + fTreeVarBestPermutation->resize(n); + //NPermutations + fTreeVarNPermutations = n; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeMeasured() +{ + // check tree + if (!fTreeMeasured) + this->CreateTreeMeasured(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsMeasured = (*fParticlesMeasured)->NPartons(); + fTreeVarNElectronsMeasured = (*fParticlesMeasured)->NElectrons(); + fTreeVarNMuonsMeasured = (*fParticlesMeasured)->NMuons(); + fTreeVarNPhotonsMeasured = (*fParticlesMeasured)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesMeasured)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarMeasured->at(counter); + std::vector<double>* vec_px = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_py = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pz = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_m = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pt = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_eta = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_phi = fTreeVarMeasured->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeSelected() +{ + // check tree + if (!fTreeSelected) + this->CreateTreeSelected(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesSelected)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarSelected->at(counter); + std::vector<double>* vec_px = fTreeVarSelected->at(++counter); + std::vector<double>* vec_py = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pz = fTreeVarSelected->at(++counter); + std::vector<double>* vec_m = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pt = fTreeVarSelected->at(++counter); + std::vector<double>* vec_eta = fTreeVarSelected->at(++counter); + std::vector<double>* vec_phi = fTreeVarSelected->at(++counter); + std::vector<double>* vec_btag = fTreeVarSelected->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta ->clear(); + vec_phi ->clear(); + vec_btag->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + vec_btag->push_back( (*fParticlesSelected)->IsBTagged(i) ); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeTruth() +{ + // check tree + if (!fTreeTruth) + { + // error code + int err = 1; + + // create tree + if (fParticlesTruth) + err = this->CreateTreeTruth(); + + else + return 0; + } + + // initialize counter + int counter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<double>* vec_E = fTreeVarTruth->at(counter); + std::vector<double>* vec_px = fTreeVarTruth->at(++counter); + std::vector<double>* vec_py = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pz = fTreeVarTruth->at(++counter); + std::vector<double>* vec_m = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pt = fTreeVarTruth->at(++counter); + std::vector<double>* vec_eta = fTreeVarTruth->at(++counter); + std::vector<double>* vec_phi = fTreeVarTruth->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E->push_back(lv->E()); + vec_px->push_back(lv->Px()); + vec_py->push_back(lv->Py()); + vec_pz->push_back(lv->Pz()); + vec_m->push_back(lv->M()); + vec_pt->push_back(lv->Pt()); + vec_eta->push_back(lv->Eta()); + vec_phi->push_back(lv->Phi()); + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeMatching() +{ + // check tree + if (!fTreeMatching) + { + // error code + int err = 1; + + // create tree + if (fMatchingTool) + err = this->CreateTreeMatching(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // set matching vector for all partons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPartons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPartons->at(k); + d->clear(); + d->assign(fTreeVarNPartonsSelected, -1); + // set number of matched partons to -1 + *fTreeVarNMatchedPartons->at(k) = -1; + } + + // loop over partons + for (int i = 0; i < (*fParticlesTruth)->NPartons(); ++i) + { + // get number of matched partons + *(fTreeVarNMatchedPartons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kParton); + + // loop over reconstructed partons + for (int j = 0; j < fTreeVarNPartonsSelected; ++j) + { + (*(fTreeVarMatchedPartons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kParton)).at(j); + } + } + + // set matching vector for all electrons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedElectrons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedElectrons->at(k); + d->clear(); + d->assign(fTreeVarNElectronsSelected, -1); + // set number of matched electrons to -1 + *fTreeVarNMatchedElectrons->at(k) = -1; + } + // loop over electrons + for (int i = 0; i < (*fParticlesTruth)->NElectrons(); ++i) + { + // get number of matched electrons + *(fTreeVarNMatchedElectrons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kElectron); + + // loop over reconstructed electrons + for (int j = 0; j < fTreeVarNElectronsSelected; ++j) + { + (*(fTreeVarMatchedElectrons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kElectron)).at(j); + } + } + + // set matching vector for all muons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedMuons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedMuons->at(k); + d->clear(); + d->assign(fTreeVarNMuonsSelected, -1); + // set number of matched muons to -1 + *fTreeVarNMatchedMuons->at(k) = -1; + } + // loop over muons + for (int i = 0; i < (*fParticlesTruth)->NMuons(); ++i) + { + // get number of matched muons + *(fTreeVarNMatchedMuons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kMuon); + + // loop over reconstructed muons + for (int j = 0; j < fTreeVarNMuonsSelected; ++j) + { + (*(fTreeVarMatchedMuons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kMuon)).at(j); + } + } + + // set matching vector for all photons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPhotons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPhotons->at(k); + d->clear(); + d->assign(fTreeVarNPhotonsSelected, -1); + // set number of matched photons to -1 + *fTreeVarNMatchedPhotons->at(k) = -1; + } + // loop over photons + for (int i = 0; i < (*fParticlesTruth)->NPhotons(); ++i) + { + + // get number of matched photons + *(fTreeVarNMatchedPhotons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kPhoton); + + // loop over reconstructed photons + for (int j = 0; j < fTreeVarNPhotonsSelected; ++j) + { + (*(fTreeVarMatchedPhotons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kPhoton)).at(j); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTreeMap() +{ + // check tree + if (!fTreeMap) + { + // error code + int err = 1; + + // create tree + if (fSelectionTool) + err = this->CreateTreeMap(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapElectrons->clear(); + fTreeVarMapElectrons->assign(fTreeVarNElectronsSelected, -1); + + fTreeVarMapMuons->clear(); + fTreeVarMapMuons->assign(fTreeVarNMuonsSelected, -1); + + fTreeVarMapPhotons->clear(); + fTreeVarMapPhotons->assign(fTreeVarNPhotonsSelected, -1); + + // get maps + for (int i = 0; i < fTreeVarNPartonsSelected; ++i) + (*fTreeVarMapJets)[i] = (fSelectionTool->MapJets()).at(i); + for (int i = 0; i < fTreeVarNElectronsSelected; ++i) + (*fTreeVarMapElectrons)[i] = (fSelectionTool->MapElectrons()).at(i); + for (int i = 0; i < fTreeVarNMuonsSelected; ++i) + (*fTreeVarMapMuons)[i] = (fSelectionTool->MapMuons()).at(i); + for (int i = 0; i < fTreeVarNPhotonsSelected; ++i) + (*fTreeVarMapPhotons)[i] = (fSelectionTool->MapPhotons()).at(i); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::FillTrees() +{ + // fill tree with truth particles + if (fParticlesTruth && fTreeTruth) + fTreeTruth->Fill(); + + // fill tree with measured particles + if (fParticlesMeasured && fTreeMeasured) + fTreeMeasured->Fill(); + + // fill tree with selected particles + if (fParticlesSelected && fTreeSelected) + fTreeSelected->Fill(); + + // fill tree with model particles + if (fParticlesModel && fTreeModel) + fTreeModel->Fill(); + + if (fMatchingTool) + fTreeMatching->Fill(); + + if (fSelectionTool) + fTreeMap->Fill(); + + fTreeVarEventNumber++; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::SetEventWeight(double weight) +{ + fEventWeight = weight; + + // no error + return 0; +} +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_Allhadronic::SetPileupWeight(double weight) +{ + fPileupWeight = weight; + + // no error + return 0; +} +// --------------------------------------------------------- + +int KLFitter::InterfaceOutput_Allhadronic::SetPhotonType(bool isNotClassified, bool isRadTopProd, bool isHadTopRadDecay, bool isLepTopRadDecay, bool isHadWRadDecay, bool isLepWRadDecay) +{ + fIsNotClassified = isNotClassified; + fIsRadTopProd = isRadTopProd; + fIsHadTopRadDecay = isHadTopRadDecay; + fIsLepTopRadDecay = isLepTopRadDecay; + fIsHadWRadDecay = isHadWRadDecay; + fIsLepWRadDecay = isLepWRadDecay; + + // no error + return 0; +} + +// --------------------------------------------------------- +std::string KLFitter::InterfaceOutput_Allhadronic::ModifyString(std::string str) +{ + int idx; + + while( (idx=str.find_first_of(' ')) >= 0 ) + str.replace(idx, 1, "_" ); + + while( (idx=str.find_first_of('-')) >= 0 ) + str.replace(idx, 1, "_" ); + + return str; +} + +// --------------------------------------------------------- + +std::string KLFitter::InterfaceOutput_Allhadronic::TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType) +{ + std::string name = ""; + switch(pType) + { + case KLFitter::Particles::kParton: name = "jet"; break; + case KLFitter::Particles::kElectron: name = "electron"; break; + case KLFitter::Particles::kMuon: name = "muon"; break; + case KLFitter::Particles::kPhoton: name = "photon"; break; + case KLFitter::Particles::kTau: name = ""; break; // there is no measured tau + case KLFitter::Particles::kNeutrino: name = ""; break; // there is no measured neutrino + case KLFitter::Particles::kBoson: name = ""; break; // there is no measured (W) boson + default: name = ""; break; + } + + return name; +} + +// --------------------------------------------------------- + +template<class type> void KLFitter::InterfaceOutput_Allhadronic::Resize(std::vector<std::vector<type>* >* v, unsigned int length) +{ + for (unsigned int i = 0; i < v->size(); i++) + { + v->at(i)->resize(length); + } +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_dilepton.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_dilepton.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b118781a45d63243134657bae74aaf876b756dc4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceOutput_dilepton.cxx @@ -0,0 +1,1708 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceOutput_dilepton.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/Fitter.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "KLFitter/Permutations.h" + +#include <TFile.h> +#include <TTree.h> + +#include <iostream> +#include <map> + +// --------------------------------------------------------- +KLFitter::InterfaceOutput_dilepton::InterfaceOutput_dilepton() +{ + fFitter = 0; + fMatchingTool = 0; + fSelectionTool = 0; + fParticlesTruth = 0; + fParticlesModel = 0; + fParticlesMeasured = 0; + fParticlesSelected = 0; + fTreeTruth = 0; + fTreeModel = 0; + fTreeMeasured = 0; + fTreeSelected = 0; + fTreeMatching = 0; + fTreeMap = 0; + fTreeVarBestPermutation = 0; + fTreeVarLogLikelihood = 0; + fTreeVarLogLikelihoodComp_TF_NuWT = 0; + fTreeVarLogLikelihoodComp_TF_b1 = 0; + fTreeVarLogLikelihoodComp_TF_b2 = 0; + fTreeVarLogLikelihoodComp_TF_lep1 = 0; + fTreeVarLogLikelihoodComp_TF_lep2 = 0; + fTreeVarLogLikelihoodComp_TF_antinueta = 0; + fTreeVarLogLikelihoodComp_TF_nueta = 0; + fTreeVarLogLikelihoodComp_TF_minv = 0; +// fTreeVarLogLikelihoodComponents = 0; + fTreeVarIntegral = 0; + fTreeVarEventProbability = 0; +// fTreeVarMinuitStatus = 0; +// fTreeVarConvergenceStatus = 0; + fTreeVarEventNumber = 0; + fTreeVarParameters = new std::vector<std::vector<double> *>(0); + //fTreeVarParameterErrors = new std::vector<std::vector<double> *>(0); + fTreeVarModel = new std::vector<std::vector<double> *>(0); + fTreeIntVarModel = new std::vector<std::vector<int> *>(0); + fTreeVarTruth = new std::vector<std::vector<double> *>(0); + fTreeVarMeasured = new std::vector<std::vector<double> *>(0); + fTreeVarSelected = new std::vector<std::vector<double> *>(0); + fTreeVarNMatchedPartons = new std::vector<int *>(0); + fTreeVarNMatchedElectrons = new std::vector<int *>(0); + fTreeVarNMatchedMuons = new std::vector<int *>(0); + fTreeVarNMatchedPhotons = new std::vector<int *>(0); + fTreeVarMatchedPartons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedElectrons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedMuons = new std::vector <std::vector<int> *>(0); + fTreeVarMatchedPhotons = new std::vector <std::vector<int> *>(0); + fTreeVarMapJets = 0; + fTreeVarMapElectrons = 0; + fTreeVarMapMuons = 0; + fTreeVarMapPhotons = 0; + fEventWeight = 0.; + fIsNotClassified = false; + +} + +// --------------------------------------------------------- +KLFitter::InterfaceOutput_dilepton::~InterfaceOutput_dilepton() +{ + if (fTreeVarBestPermutation) + delete fTreeVarBestPermutation; + + if (fTreeVarLogLikelihood) + delete fTreeVarLogLikelihood; + + if(fTreeVarLogLikelihoodComp_TF_NuWT) + delete fTreeVarLogLikelihoodComp_TF_NuWT; + if(fTreeVarLogLikelihoodComp_TF_b1) + delete fTreeVarLogLikelihoodComp_TF_b1; + if(fTreeVarLogLikelihoodComp_TF_b2) + delete fTreeVarLogLikelihoodComp_TF_b2; + if(fTreeVarLogLikelihoodComp_TF_lep1) + delete fTreeVarLogLikelihoodComp_TF_lep1; + if(fTreeVarLogLikelihoodComp_TF_lep2) + delete fTreeVarLogLikelihoodComp_TF_lep2; + if(fTreeVarLogLikelihoodComp_TF_antinueta) + delete fTreeVarLogLikelihoodComp_TF_antinueta; + if(fTreeVarLogLikelihoodComp_TF_nueta) + delete fTreeVarLogLikelihoodComp_TF_nueta; + if(fTreeVarLogLikelihoodComp_TF_minv) + delete fTreeVarLogLikelihoodComp_TF_minv; + // if (fTreeVarLogLikelihoodComponents) + // delete fTreeVarLogLikelihoodComponents; + + if (fTreeVarIntegral) + delete fTreeVarIntegral; + + if (fTreeVarEventProbability) + delete fTreeVarEventProbability; + + // if (fTreeVarMinuitStatus) +// delete fTreeVarMinuitStatus; + +// if (fTreeVarConvergenceStatus) +// delete fTreeVarConvergenceStatus; + + while (!fTreeVarParameters->empty()) + { + std::vector<double>* d = fTreeVarParameters->front(); + fTreeVarParameters->erase(fTreeVarParameters->begin()); + delete d; + } + delete fTreeVarParameters; + + // while (!fTreeVarParameterErrors->empty()) +// { +// std::vector<double>* d = fTreeVarParameterErrors->front(); +// fTreeVarParameterErrors->erase(fTreeVarParameterErrors->begin()); +// delete d; +// } +// delete fTreeVarParameterErrors; + + while (!fTreeVarModel->empty()) + { + std::vector<double>* d = fTreeVarModel->front(); + fTreeVarModel->erase(fTreeVarModel->begin()); + delete d; + } + delete fTreeVarModel; + + while (!fTreeIntVarModel->empty()) + { + std::vector<int>* d = fTreeIntVarModel->front(); + fTreeIntVarModel->erase(fTreeIntVarModel->begin()); + delete d; + } + delete fTreeIntVarModel; + + while (!fTreeVarTruth->empty()) + { + std::vector<double>* d = fTreeVarTruth->front(); + fTreeVarTruth->erase(fTreeVarTruth->begin()); + delete d; + } + delete fTreeVarTruth; + + while (!fTreeVarMeasured->empty()) + { + std::vector<double>* d = fTreeVarMeasured-> front(); + fTreeVarMeasured->erase(fTreeVarMeasured->begin()); + delete d; + } + delete fTreeVarMeasured; + + while (!fTreeVarSelected->empty()) + { + std::vector<double>* d = fTreeVarSelected->front(); + fTreeVarSelected->erase(fTreeVarSelected->begin()); + delete d; + } + delete fTreeVarSelected; + + while (!fTreeVarNMatchedPartons->empty()) + { + int* i = fTreeVarNMatchedPartons->front(); + fTreeVarNMatchedPartons->erase(fTreeVarNMatchedPartons->begin()); + delete i; + } + delete fTreeVarNMatchedPartons; + + while (!fTreeVarNMatchedElectrons->empty()) + { + int* i = fTreeVarNMatchedElectrons->front(); + fTreeVarNMatchedElectrons->erase(fTreeVarNMatchedElectrons->begin()); + delete i; + } + delete fTreeVarNMatchedElectrons; + + while (!fTreeVarNMatchedMuons->empty()) + { + int* i = fTreeVarNMatchedMuons->front(); + fTreeVarNMatchedMuons->erase(fTreeVarNMatchedMuons->begin()); + delete i; + } + delete fTreeVarNMatchedMuons; + + while (!fTreeVarNMatchedPhotons->empty()) + { + int* i = fTreeVarNMatchedPhotons->front(); + fTreeVarNMatchedPhotons->erase(fTreeVarNMatchedPhotons->begin()); + delete i; + } + delete fTreeVarNMatchedPhotons; + + while (!fTreeVarMatchedPartons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPartons->front(); + fTreeVarMatchedPartons->erase(fTreeVarMatchedPartons->begin()); + delete i; + } + delete fTreeVarMatchedPartons; + + while (!fTreeVarMatchedElectrons->empty()) + { + std::vector<int>* i = fTreeVarMatchedElectrons->front(); + fTreeVarMatchedElectrons->erase(fTreeVarMatchedElectrons->begin()); + delete i; + } + delete fTreeVarMatchedElectrons; + + while (!fTreeVarMatchedMuons->empty()) + { + std::vector<int>* i = fTreeVarMatchedMuons->front(); + fTreeVarMatchedMuons->erase(fTreeVarMatchedMuons->begin()); + delete i; + } + delete fTreeVarMatchedMuons; + + while (!fTreeVarMatchedPhotons->empty()) + { + std::vector<int>* i = fTreeVarMatchedPhotons->front(); + fTreeVarMatchedPhotons->erase(fTreeVarMatchedPhotons->begin()); + delete i; + } + delete fTreeVarMatchedPhotons; + + if (fTreeVarMapJets) + delete fTreeVarMapJets; + + if (fTreeVarMapElectrons) + delete fTreeVarMapElectrons; + + if (fTreeVarMapMuons) + delete fTreeVarMapMuons; + + if (fTreeVarMapPhotons) + delete fTreeVarMapPhotons; + + if (fTreeTruth) + delete fTreeTruth; + + if (fTreeModel) + delete fTreeModel; + + if (fTreeMeasured) + delete fTreeMeasured; + + if (fTreeSelected) + delete fTreeSelected; + + if (fTreeMatching) + delete fTreeMatching; + + if (fTreeMap) + delete fTreeMap; + +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::SetFitter(KLFitter::Fitter* fitter) +{ + // check if fitter exists + if (!fitter) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::SetFitter(). Fitter does not exist." << std::endl; + return 0; + } + + // set pointers to pointer + fParticlesModel = fitter->Likelihood()->PParticlesModel(); + fParticlesSelected = fitter->PParticles(); + + // set fitter + fFitter = fitter; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::SetMatchingTool(KLFitter::MatchingTool* matchingtool) +{ + // check if fitter exists + if (!matchingtool) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::SetMatchingTool(). Matching tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fMatchingTool = matchingtool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::SetSelectionTool(KLFitter::SelectionTool* selectiontool) +{ + // check if fitter exists + if (!selectiontool) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::SetSelectionTool(). Selection tool does not exist." << std::endl; + return 0; + } + + // set pointer to matching tool + fSelectionTool = selectiontool; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::OpenRootFile(const char* filename, Option_t* opt) +{ + // define error code + int err = 1; + + // open file + err *= KLFitter::InterfaceRoot::OpenRootFile(filename, opt); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CloseRootFile() +{ + // define error code + int err = 1; + + // check if file exists + if (!fRootFile) + return 0; + + // check if file is open + if (!fRootFile->IsOpen()) + return 0; + + if (fTreeTruth) + fRootFile->WriteTObject(fTreeTruth); + + if (fTreeModel) + fRootFile->WriteTObject(fTreeModel); + + if (fTreeMeasured) + fRootFile->WriteTObject(fTreeMeasured); + + if (fTreeSelected) + fRootFile->WriteTObject(fTreeSelected); + + if (fTreeMatching) + fRootFile->WriteTObject(fTreeMatching); + + if (fTreeMap) + fRootFile->WriteTObject(fTreeMap); + + // close file + KLFitter::InterfaceRoot::CloseRootFile(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeModel() +{ + // check if particles exist + if (!fParticlesModel) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeModel(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeModel) + delete fTreeModel; + + // get number of permutations + int nperm = fFitter->Permutations()->NPermutations(); + + // create new tree + fTreeModel = new TTree("TreeModel", "TreeModel"); + + // reset variables + fTreeVarNPermutations = nperm; + fTreeVarNBTags=0; + fTreeVarBestPermutation = new std::vector<int>(0); + fTreeVarLogLikelihood = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_NuWT = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_b1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_b2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lep1 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_lep2 = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_antinueta = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_nueta = new std::vector<double>(0); + fTreeVarLogLikelihoodComp_TF_minv = new std::vector<double>(0); +// fTreeVarLogLikelihoodComponents = new std::vector<std::vector<double> >(0); + fTreeVarIntegral = new std::vector<double>(0); + fTreeVarEventProbability = new std::vector<double>(0); +// fTreeVarMinuitStatus = new std::vector<double>(0); +// fTreeVarConvergenceStatus = new std::vector<unsigned int>(0); + + // set branches for event variables + fTreeModel->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeModel->Branch("N_permutations", &fTreeVarNPermutations, "N_permutations/I"); + fTreeModel->Branch("N_btags", &fTreeVarNBTags, "N_btags/I"); + fTreeModel->Branch("best_permutation", fTreeVarBestPermutation); + fTreeModel->Branch("LogLikelihood", fTreeVarLogLikelihood); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_NuWT", fTreeVarLogLikelihoodComp_TF_NuWT); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_b1", fTreeVarLogLikelihoodComp_TF_b1); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_b2", fTreeVarLogLikelihoodComp_TF_b2); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_lep1", fTreeVarLogLikelihoodComp_TF_lep1); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_lep2", fTreeVarLogLikelihoodComp_TF_lep2); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_antinueta", fTreeVarLogLikelihoodComp_TF_antinueta); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_nueta", fTreeVarLogLikelihoodComp_TF_nueta); + fTreeModel->Branch("fTreeVarLogLikelihoodComp_TF_minv", fTreeVarLogLikelihoodComp_TF_minv); +// fTreeModel->Branch("LogLikelihoodComponents", fTreeVarLogLikelihoodComponents); + fTreeModel->Branch("Integral", fTreeVarIntegral); + fTreeModel->Branch("EventProbability", fTreeVarEventProbability); + // fTreeModel->Branch("MinuitStatus", fTreeVarMinuitStatus); +// fTreeModel->Branch("ConvergenceStatusBit", fTreeVarConvergenceStatus); + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + std::vector<double>* par = new std::vector<double>(0); + //std::vector<double>* parerr = new std::vector<double>(0); + fTreeVarParameters->push_back(par); + //fTreeVarParameterErrors->push_back(parerr); + + fTreeModel->Branch( this->ModifyString( "par_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), par); + //fTreeModel->Branch( this->ModifyString( "parerr_" + fFitter->Likelihood()->GetParameter(i)->GetName() ).data(), parerr); + } + + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesModel)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + std::vector<double>* btag = new std::vector<double>(0); + std::vector<int>* index = new std::vector<int>(0); + + // add variables to vector + fTreeVarModel->push_back(E); + fTreeVarModel->push_back(px); + fTreeVarModel->push_back(py); + fTreeVarModel->push_back(pz); + fTreeVarModel->push_back(m); + fTreeVarModel->push_back(pt); + fTreeVarModel->push_back(eta); + fTreeVarModel->push_back(phi); + fTreeVarModel->push_back(btag); + fTreeIntVarModel->push_back(index); + + // create new branches + fTreeModel->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeModel->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeModel->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeModel->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeModel->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeModel->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeModel->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeModel->Branch(this->ModifyString((name+"_phi")).data(), phi); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + fTreeModel->Branch(this->ModifyString((name+"_btag")).data(), btag); + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + if (itype == KLFitter::Particles::kElectron && (*fParticlesModel)->ElectronIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kMuon && (*fParticlesModel)->MuonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + if (itype == KLFitter::Particles::kPhoton && (*fParticlesModel)->PhotonIndex(i)>=0) + fTreeModel->Branch(this->ModifyString((name+"_index")).data(), index); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeMeasured() +{ + // check if particles exist + if (!fParticlesMeasured) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeMeasured(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMeasured) + delete fTreeMeasured; + + // create new tree + fTreeMeasured = new TTree("TreeMeasured", "TreeMeasured"); + + // event weight branch + fTreeMeasured->Branch("Weight", &fEventWeight, "Weight/D"); + + fTreeMeasured->Branch("N_jets", &fTreeVarNPartonsMeasured, "N_jets/I"); + fTreeMeasured->Branch("N_electrons", &fTreeVarNElectronsMeasured, "N_electrons/I"); + fTreeMeasured->Branch("N_muons", &fTreeVarNMuonsMeasured, "N_muons/I"); + fTreeMeasured->Branch("N_photons", &fTreeVarNPhotonsMeasured, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarMeasured->push_back(vec_E); + fTreeVarMeasured->push_back(vec_px); + fTreeVarMeasured->push_back(vec_py); + fTreeVarMeasured->push_back(vec_pz); + fTreeVarMeasured->push_back(vec_m); + fTreeVarMeasured->push_back(vec_pt); + fTreeVarMeasured->push_back(vec_eta); + fTreeVarMeasured->push_back(vec_phi); + + // create new branches + fTreeMeasured->Branch((name+"_E").data(), vec_E ); + fTreeMeasured->Branch((name+"_px").data(), vec_px ); + fTreeMeasured->Branch((name+"_py").data(), vec_py ); + fTreeMeasured->Branch((name+"_pz").data(), vec_pz ); + fTreeMeasured->Branch((name+"_m").data(), vec_m ); + fTreeMeasured->Branch((name+"_pt").data(), vec_pt ); + fTreeMeasured->Branch((name+"_eta").data(), vec_eta); + fTreeMeasured->Branch((name+"_phi").data(), vec_phi); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeSelected() +{ + // check if particles exist + if (!fParticlesSelected) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeSelected(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeSelected) + delete fTreeSelected; + + // create new tree + fTreeSelected = new TTree("TreeSelected", "TreeSelected"); + + fTreeSelected->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeSelected->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeSelected->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeSelected->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get the name of the branch + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // create new pointer to variables + std::vector<double>* vec_E = new std::vector<double>(0); + std::vector<double>* vec_px = new std::vector<double>(0); + std::vector<double>* vec_py = new std::vector<double>(0); + std::vector<double>* vec_pz = new std::vector<double>(0); + std::vector<double>* vec_m = new std::vector<double>(0); + std::vector<double>* vec_pt = new std::vector<double>(0); + std::vector<double>* vec_eta = new std::vector<double>(0); + std::vector<double>* vec_phi = new std::vector<double>(0); + std::vector<double>* vec_btag = new std::vector<double>(0); + + // add variables to vector + fTreeVarSelected->push_back(vec_E); + fTreeVarSelected->push_back(vec_px); + fTreeVarSelected->push_back(vec_py); + fTreeVarSelected->push_back(vec_pz); + fTreeVarSelected->push_back(vec_m); + fTreeVarSelected->push_back(vec_pt); + fTreeVarSelected->push_back(vec_eta); + fTreeVarSelected->push_back(vec_phi); + fTreeVarSelected->push_back(vec_btag); + + // create new branches + fTreeSelected->Branch((name+"_E").data(), vec_E ); + fTreeSelected->Branch((name+"_px").data(), vec_px ); + fTreeSelected->Branch((name+"_py").data(), vec_py ); + fTreeSelected->Branch((name+"_pz").data(), vec_pz ); + fTreeSelected->Branch((name+"_m").data(), vec_m ); + fTreeSelected->Branch((name+"_pt").data(), vec_pt ); + fTreeSelected->Branch((name+"_eta").data(), vec_eta); + fTreeSelected->Branch((name+"_phi").data(), vec_phi); + if (itype == KLFitter::Particles::kParton) + fTreeSelected->Branch((name+"_btag").data(), vec_btag); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeTruth() +{ + // check if particles exist + if (!fParticlesTruth) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeTruth(). Particles do not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeTruth) + delete fTreeTruth; + + // create new tree + fTreeTruth = new TTree("TreeTruth", "TreeTruth"); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + // create new pointer to variables + std::vector<double>* E = new std::vector<double>(0); + std::vector<double>* px = new std::vector<double>(0); + std::vector<double>* py = new std::vector<double>(0); + std::vector<double>* pz = new std::vector<double>(0); + std::vector<double>* m = new std::vector<double>(0); + std::vector<double>* pt = new std::vector<double>(0); + std::vector<double>* eta = new std::vector<double>(0); + std::vector<double>* phi = new std::vector<double>(0); + + // add variables to vector + fTreeVarTruth->push_back(E); + fTreeVarTruth->push_back(px); + fTreeVarTruth->push_back(py); + fTreeVarTruth->push_back(pz); + fTreeVarTruth->push_back(m); + fTreeVarTruth->push_back(pt); + fTreeVarTruth->push_back(eta); + fTreeVarTruth->push_back(phi); + + // create new branches + fTreeTruth->Branch(this->ModifyString((name+"_E")).data(), E); + fTreeTruth->Branch(this->ModifyString((name+"_px")).data(), px); + fTreeTruth->Branch(this->ModifyString((name+"_py")).data(), py); + fTreeTruth->Branch(this->ModifyString((name+"_pz")).data(), pz); + fTreeTruth->Branch(this->ModifyString((name+"_m")).data(), m); + fTreeTruth->Branch(this->ModifyString((name+"_pt")).data(), pt); + fTreeTruth->Branch(this->ModifyString((name+"_eta")).data(), eta); + fTreeTruth->Branch(this->ModifyString((name+"_phi")).data(), phi); + } + } + + fTreeTruth->Branch("IsNotClassified", &fIsNotClassified, "IsNotClassified/B"); + + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeMatching() +{ + // check if particles exist + if (!fMatchingTool) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeMatching(). Matching tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMatching) + delete fTreeMatching; + + // create new tree + fTreeMatching = new TTree("TreeMatching", "TreeMatching"); + + fTreeMatching->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMatching->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMatching->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMatching->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // get parton container + std::vector <std::string>* namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kParton); + + // get number of particles in container + int ntruth = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < ntruth; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPartons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_partons_max = fParticlesSelected ? (*fParticlesSelected)->NPartons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_partons_max, -1); + fTreeVarMatchedPartons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get electron container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kElectron); + + // get number of particles in container + int n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedElectrons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_electrons_max = fParticlesSelected ? (*fParticlesSelected)->NElectrons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_electrons_max, -1); + fTreeVarMatchedElectrons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get muon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kMuon); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedMuons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_muons_max = fParticlesSelected ? (*fParticlesSelected)->NMuons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_muons_max, -1); + fTreeVarMatchedMuons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // get photon container + namecontainer = (*fParticlesTruth)->ParticleNameContainer(KLFitter::Particles::kPhoton); + + // get number of particles in container + n = int(namecontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get name + std::string name(namecontainer->at(i)); + + int* pi = new int(-1); + fTreeVarNMatchedPhotons->push_back(pi); + + // if fParticlesSelected are not yet defined, set the maximum value to 10 + int nreco_photons_max = fParticlesSelected ? (*fParticlesSelected)->NPhotons() : 10; + std::vector<int>* indices = new std::vector<int>(nreco_photons_max, -1); + fTreeVarMatchedPhotons->push_back(indices); + + // create new branches + fTreeMatching->Branch( this->ModifyString("Nmatches_"+name).data(), pi); + fTreeMatching->Branch( this->ModifyString("Matches_"+name).data(), indices); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTreeMap() +{ + // check if particles exist + if (!fSelectionTool) + { + std::cout << "KLFitter::InterfaceOutput_dilepton::CreateTreeMap(). Selection tool does not exist." << std::endl; + return 0; + } + + // delete old tree if necessary + if (fTreeMap) + delete fTreeMap; + + // reset variables + fTreeVarMapJets = new std::vector<int>(0); + fTreeVarMapElectrons = new std::vector<int>(0); + fTreeVarMapMuons = new std::vector<int>(0); + fTreeVarMapPhotons = new std::vector<int>(0); + + // create new tree + fTreeMap = new TTree("TreeMap", "TreeMap"); + + fTreeMap->Branch("N_jets", &fTreeVarNPartonsSelected, "N_jets/I"); + fTreeMap->Branch("N_electrons", &fTreeVarNElectronsSelected, "N_electrons/I"); + fTreeMap->Branch("N_muons", &fTreeVarNMuonsSelected, "N_muons/I"); + fTreeMap->Branch("N_photons", &fTreeVarNPhotonsSelected, "N_photons/I"); + + // set branches for event variables + fTreeMap->Branch("EventNumber", &fTreeVarEventNumber, "EventNumber/I"); + fTreeMap->Branch("Index_jet", fTreeVarMapJets); + fTreeMap->Branch("Index_electron", fTreeVarMapElectrons); + fTreeMap->Branch("Index_muon", fTreeVarMapMuons); + fTreeMap->Branch("Index_photon", fTreeVarMapPhotons); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::CreateTrees() +{ + // error code + int err = 1; + + // create tree for truth particles + if (fParticlesTruth) + err *= this->CreateTreeTruth(); + + // create tree for measured particles + err *= this->CreateTreeMeasured(); + + // create tree for selected particles + err *= this->CreateTreeSelected(); + + // create tree for model particles + err *= this->CreateTreeModel(); + + // create tree for matching informations + if (fMatchingTool && fParticlesTruth) + err *= this->CreateTreeMatching(); + + if (fSelectionTool) + err *= this->CreateTreeMap(); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeModelPermutation() +{ + // check tree + if (!fTreeModel) + this->CreateTreeModel(); + + // make sure that the model particles are being built in the likelihood + fParticlesModel = fFitter->Likelihood()->PParticlesModel(); + + // initialize counter + int counter = 0; + + // create new permutation table for writing out the index + // int npartons = (*fParticlesSelected)->NPartons(); + // std::vector < std::vector<int>* >* table_partons = new std::vector < std::vector<int>* >(0); + // fFitter->Permutations()-> CreateSubTable(npartons, table_partons); + + // get permutation index + int pindex = fFitter->Permutations()->PermutationIndex(); + + // fill event variables + fTreeVarNBTags = (*fParticlesModel)->NBTags(); + + // resize and reset branches only in first permutation + if (pindex == 0) + { + // - get number of permutations + fTreeVarNPermutations = fFitter->Permutations()->NPermutations(); + + // reset tree variables + fTreeVarLogLikelihood->clear(); + fTreeVarLogLikelihood->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_NuWT ->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_b1 ->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_b2 ->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_lep1->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_lep2->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_antinueta ->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_nueta ->assign(fTreeVarNPermutations, 1.e99); + fTreeVarLogLikelihoodComp_TF_minv ->assign(fTreeVarNPermutations, 1.e99); + +// fTreeVarLogLikelihoodComponents->clear(); +// std::vector<double> tempvec(3, 0.0); +// fTreeVarLogLikelihoodComponents->assign(fTreeVarNPermutations, tempvec); + + fTreeVarIntegral->clear(); + fTreeVarIntegral->assign(fTreeVarNPermutations, -1.); + + fTreeVarEventProbability->clear(); + fTreeVarEventProbability->assign(fTreeVarNPermutations, 0.); + + // fTreeVarMinuitStatus->clear(); +// fTreeVarMinuitStatus->assign(fTreeVarNPermutations, 0); + +// fTreeVarConvergenceStatus->clear(); +// fTreeVarConvergenceStatus->assign(fTreeVarNPermutations, 0); + + fTreeVarBestPermutation->clear(); + fTreeVarBestPermutation->assign(fTreeVarNPermutations, -1); + + unsigned int n = fTreeVarParameters->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarParameters->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + + // d = fTreeVarParameterErrors->at(i); +// d->clear(); +// d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<double>* d = fTreeVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1.); + } + + n = fTreeIntVarModel->size(); + for (unsigned int i = 0; i < n; ++i) { + std::vector<int>* d = fTreeIntVarModel->at(i); + d->clear(); + d->assign(fTreeVarNPermutations, -1); + } + + } + + (*fTreeVarLogLikelihood)[pindex] = fFitter->Likelihood()->LogLikelihood( fFitter->Likelihood()->GetBestFitParameters() ); + +// (*fTreeVarLogLikelihoodComponents)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ); + + (*fTreeVarLogLikelihoodComp_TF_NuWT)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(0); + (*fTreeVarLogLikelihoodComp_TF_b1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(1); + (*fTreeVarLogLikelihoodComp_TF_b2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(2); + (*fTreeVarLogLikelihoodComp_TF_lep1)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(3); + (*fTreeVarLogLikelihoodComp_TF_lep2)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(4); + (*fTreeVarLogLikelihoodComp_TF_antinueta)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(5); + (*fTreeVarLogLikelihoodComp_TF_nueta)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(6); + (*fTreeVarLogLikelihoodComp_TF_minv)[pindex] = fFitter->Likelihood()->LogLikelihoodComponents( fFitter->Likelihood()->GetBestFitParameters() ).at(7); + + //(*fTreeVarMinuitStatus)[pindex] = fFitter->MinuitStatus(); + //(*fTreeVarConvergenceStatus)[pindex] = fFitter->ConvergenceStatus(); + (*fTreeVarIntegral)[pindex] = fFitter->Likelihood()->GetIntegral(); + (*fTreeVarEventProbability)[pindex] = exp( fFitter->Likelihood()->LogEventProbability() ); + + // check event probability for NaN + if ((*fTreeVarLogLikelihood)[pindex] != (*fTreeVarLogLikelihood)[pindex]) + (*fTreeVarLogLikelihood)[pindex] = double(pindex)* (-1e10); + + if ((*fTreeVarEventProbability)[pindex] != (*fTreeVarEventProbability)[pindex]) + (*fTreeVarEventProbability)[pindex] = 0.; + + // normalize event probability + double sum = 0; + bool flagall = true; + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + if ((*fTreeVarLogLikelihood)[i] < 1e99) + sum += (*fTreeVarEventProbability)[i]; + else + flagall = false; + } + + if (flagall) + { + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + (*fTreeVarEventProbability)[i] = (*fTreeVarEventProbability)[i] / sum; + } + } + + // sort for best permutation + for (int i = 0; i < fTreeVarNPermutations; ++i) + { + int counter = 0; + for (int j = 0; j < fTreeVarNPermutations; ++j) + if ((*fTreeVarEventProbability)[i] < (*fTreeVarEventProbability)[j]) + counter++; + (*fTreeVarBestPermutation)[counter] = i; + } + + // loop over all parameters + for (int i = 0; i < fFitter->Likelihood()->NParameters(); ++i) + { + (*fTreeVarParameters->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameter(i); + //(*fTreeVarParameterErrors->at(i))[pindex] = fFitter->Likelihood()->GetBestFitParameterError(i); + } + + int IntVarcounter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesModel)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<int>* index = fTreeIntVarModel->at(IntVarcounter); + std::vector<double>* E = fTreeVarModel->at(counter); + std::vector<double>* px = fTreeVarModel->at(++counter); + std::vector<double>* py = fTreeVarModel->at(++counter); + std::vector<double>* pz = fTreeVarModel->at(++counter); + std::vector<double>* m = fTreeVarModel->at(++counter); + std::vector<double>* pt = fTreeVarModel->at(++counter); + std::vector<double>* eta = fTreeVarModel->at(++counter); + std::vector<double>* phi = fTreeVarModel->at(++counter); + std::vector<double>* btag = fTreeVarModel->at(++counter); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + (*E)[pindex] = lv->E(); + (*px)[pindex] = lv->Px(); + (*py)[pindex] = lv->Py(); + (*pz)[pindex] = lv->Pz(); + (*m)[pindex] = lv->M(); + (*pt)[pindex] = lv->Pt(); + (*eta)[pindex] = lv->Eta(); + (*phi)[pindex] = lv->Phi(); + if (itype == KLFitter::Particles::kParton && (*fParticlesModel)->JetIndex(i)>=0) { + (*btag)[pindex] = (*fParticlesModel)->IsBTagged(i); +// //std::cout << pindex << " : " << (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i) << std::endl; +// +// //std::cout <<fParticles->NameParticle(0, KLFitter::Particles::kParton) << std::endl; + (*index)[pindex] = (fFitter->Permutations()->PermutationTable())->at(pindex)->at(i); //(*fParticlesModel)->JetIndex(i); + + IntVarcounter++; + } + + if (itype == KLFitter::Particles::kElectron) { + (*index)[pindex] = (*fParticlesModel)->ElectronIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kMuon) { + (*index)[pindex] = (*fParticlesModel)->MuonIndex(i); + IntVarcounter++; + } + if (itype == KLFitter::Particles::kPhoton) { + (*index)[pindex] = (*fParticlesModel)->PhotonIndex(i); + IntVarcounter++; + } + + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::TreeModelDeleteAllButNBestPermutations(unsigned int n) +{ + //Sanity check: + if(n>unsigned(fTreeVarNPermutations)){ + std::cout<< "KLFitter::InterfaceOutput_dilepton::TreeModelDeleteAllButNBestPermutations(). Number of permutations to be kept larger than total number of permutations!" << std::endl; + return 0; + } + + //Define tmp vectors for int, double + std::vector<int> vi_tmp; + std::vector<double> vd_tmp; + + //Copy every single vector to tmp and refill the vector in the order of the best permutation from temp and resize to n + // fTreeVarEventNumber and fTreeVarBTags remain untouched + //LogLikelihood + vd_tmp.resize(fTreeVarLogLikelihood->size()); + copy(fTreeVarLogLikelihood->begin(), fTreeVarLogLikelihood->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarLogLikelihood)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarLogLikelihood->resize(n); + //Integral + vd_tmp.resize(fTreeVarIntegral->size()); + copy(fTreeVarIntegral->begin(), fTreeVarIntegral->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarIntegral)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarIntegral->resize(n); + //EventProbability + vd_tmp.resize(fTreeVarEventProbability->size()); + copy(fTreeVarEventProbability->begin(), fTreeVarEventProbability->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*fTreeVarEventProbability)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + fTreeVarEventProbability->resize(n); + // //MinuitStatus +// vd_tmp.resize(fTreeVarMinuitStatus->size()); +// copy(fTreeVarMinuitStatus->begin(), fTreeVarMinuitStatus->end(), vd_tmp.begin()); +// for (unsigned int i=0; i<n; i++) +// (*fTreeVarMinuitStatus)[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; +// fTreeVarMinuitStatus->resize(n); +// //ConvergenceStatus +// vi_tmp.resize(fTreeVarConvergenceStatus->size()); +// copy(fTreeVarConvergenceStatus->begin(), fTreeVarConvergenceStatus->end(), vi_tmp.begin()); +// for (unsigned int i=0; i<n; i++) +// (*fTreeVarConvergenceStatus)[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; +// fTreeVarConvergenceStatus->resize(n); + + //Parameters Vector + for (unsigned int iPar(0), nPar(fTreeVarParameters->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarParameters)[iPar]->size()); + copy((*fTreeVarParameters)[iPar]->begin(), (*fTreeVarParameters)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarParameters)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarParameters)[iPar]->resize(n); + } + //ParameterErrors Vector + // for (unsigned int iPar(0), nPar(fTreeVarParameterErrors->size()); iPar < nPar; ++iPar) { +// vd_tmp.resize((*fTreeVarParameterErrors)[iPar]->size()); +// copy((*fTreeVarParameterErrors)[iPar]->begin(), (*fTreeVarParameterErrors)[iPar]->end(), vd_tmp.begin()); +// for (unsigned int i=0; i<n; i++) +// (*(*fTreeVarParameterErrors)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; +// (*fTreeVarParameterErrors)[iPar]->resize(n); +// } + //VarModel Vector + for (unsigned int iPar(0), nPar(fTreeVarModel->size()); iPar < nPar; ++iPar) { + vd_tmp.resize((*fTreeVarModel)[iPar]->size()); + copy((*fTreeVarModel)[iPar]->begin(), (*fTreeVarModel)[iPar]->end(), vd_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeVarModel)[iPar])[i] = vd_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeVarModel)[iPar]->resize(n); + } + //IntVarModel Vector + for (unsigned int iPar(0), nPar(fTreeIntVarModel->size()); iPar < nPar; ++iPar) { + vi_tmp.resize((*fTreeIntVarModel)[iPar]->size()); + copy((*fTreeIntVarModel)[iPar]->begin(), (*fTreeIntVarModel)[iPar]->end(), vi_tmp.begin()); + for (unsigned int i=0; i<n; i++) + (*(*fTreeIntVarModel)[iPar])[i] = vi_tmp[(*fTreeVarBestPermutation)[i]]; + (*fTreeIntVarModel)[iPar]->resize(n); + } + + //BestPermutation -- NEEDS TO BE DONE LAST! + for (unsigned int i=0; i<n; i++) + (*fTreeVarBestPermutation)[i] = i; + fTreeVarBestPermutation->resize(n); + //NPermutations + fTreeVarNPermutations = n; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeMeasured() +{ + // check tree + if (!fTreeMeasured) + this->CreateTreeMeasured(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsMeasured = (*fParticlesMeasured)->NPartons(); + fTreeVarNElectronsMeasured = (*fParticlesMeasured)->NElectrons(); + fTreeVarNMuonsMeasured = (*fParticlesMeasured)->NMuons(); + fTreeVarNPhotonsMeasured = (*fParticlesMeasured)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesMeasured)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarMeasured->at(counter); + std::vector<double>* vec_px = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_py = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pz = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_m = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_pt = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_eta = fTreeVarMeasured->at(++counter); + std::vector<double>* vec_phi = fTreeVarMeasured->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeSelected() +{ + // check tree + if (!fTreeSelected) + this->CreateTreeSelected(); + + // initialize counter + int counter = 0; + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // check if the branch should exist + std::string name = TreeMeasuredBranchName(itype); + if (name == "") + continue; + + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesSelected)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // get variables + std::vector<double>* vec_E = fTreeVarSelected->at(counter); + std::vector<double>* vec_px = fTreeVarSelected->at(++counter); + std::vector<double>* vec_py = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pz = fTreeVarSelected->at(++counter); + std::vector<double>* vec_m = fTreeVarSelected->at(++counter); + std::vector<double>* vec_pt = fTreeVarSelected->at(++counter); + std::vector<double>* vec_eta = fTreeVarSelected->at(++counter); + std::vector<double>* vec_phi = fTreeVarSelected->at(++counter); + std::vector<double>* vec_btag = fTreeVarSelected->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta ->clear(); + vec_phi ->clear(); + vec_btag->clear(); + + // increase counter + counter++; + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E ->push_back( lv->E() ); + vec_px ->push_back( lv->Px() ); + vec_py ->push_back( lv->Py() ); + vec_pz ->push_back( lv->Pz() ); + vec_m ->push_back( lv->M() ); + vec_pt ->push_back( lv->Pt() ); + vec_eta->push_back( lv->Eta() ); + vec_phi->push_back( lv->Phi() ); + vec_btag->push_back( (*fParticlesSelected)->IsBTagged(i) ); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeTruth() +{ + // check tree + if (!fTreeTruth) + { + // error code + int err = 1; + + // create tree + if (fParticlesTruth) + err = this->CreateTreeTruth(); + + else + return 0; + } + + // initialize counter + int counter = 0; + + // loop over all particle type + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype <= KLFitter::Particles::kPhoton; ++itype) + { + // get particle container + std::vector <TLorentzVector *>* momcontainer = (*fParticlesTruth)->ParticleContainer(itype); + + // get number of particles in container + int n = int(momcontainer->size()); + + // loop over particles + for (int i = 0; i < n; ++i) + { + // get variables + std::vector<double>* vec_E = fTreeVarTruth->at(counter); + std::vector<double>* vec_px = fTreeVarTruth->at(++counter); + std::vector<double>* vec_py = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pz = fTreeVarTruth->at(++counter); + std::vector<double>* vec_m = fTreeVarTruth->at(++counter); + std::vector<double>* vec_pt = fTreeVarTruth->at(++counter); + std::vector<double>* vec_eta = fTreeVarTruth->at(++counter); + std::vector<double>* vec_phi = fTreeVarTruth->at(++counter); + + // clear the particle vectors + vec_E ->clear(); + vec_px ->clear(); + vec_py ->clear(); + vec_pz ->clear(); + vec_m ->clear(); + vec_pt ->clear(); + vec_eta->clear(); + vec_phi->clear(); + + // get four vector + TLorentzVector* lv = momcontainer->at(i); + + // fill variables + vec_E->push_back(lv->E()); + vec_px->push_back(lv->Px()); + vec_py->push_back(lv->Py()); + vec_pz->push_back(lv->Pz()); + vec_m->push_back(lv->M()); + vec_pt->push_back(lv->Pt()); + vec_eta->push_back(lv->Eta()); + vec_phi->push_back(lv->Phi()); + // increase counter + counter++; + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeMatching() +{ + // check tree + if (!fTreeMatching) + { + // error code + int err = 1; + + // create tree + if (fMatchingTool) + err = this->CreateTreeMatching(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + // set matching vector for all partons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPartons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPartons->at(k); + d->clear(); + d->assign(fTreeVarNPartonsSelected, -1); + // set number of matched partons to -1 + *fTreeVarNMatchedPartons->at(k) = -1; + } + + // loop over partons + for (int i = 0; i < (*fParticlesTruth)->NPartons(); ++i) + { + // get number of matched partons + *(fTreeVarNMatchedPartons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kParton); + + // loop over reconstructed partons + for (int j = 0; j < fTreeVarNPartonsSelected; ++j) + { + (*(fTreeVarMatchedPartons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kParton)).at(j); + } + } + + // set matching vector for all electrons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedElectrons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedElectrons->at(k); + d->clear(); + d->assign(fTreeVarNElectronsSelected, -1); + // set number of matched electrons to -1 + *fTreeVarNMatchedElectrons->at(k) = -1; + } + // loop over electrons + for (int i = 0; i < (*fParticlesTruth)->NElectrons(); ++i) + { + // get number of matched electrons + *(fTreeVarNMatchedElectrons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kElectron); + + // loop over reconstructed electrons + for (int j = 0; j < fTreeVarNElectronsSelected; ++j) + { + (*(fTreeVarMatchedElectrons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kElectron)).at(j); + } + } + + // set matching vector for all muons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedMuons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedMuons->at(k); + d->clear(); + d->assign(fTreeVarNMuonsSelected, -1); + // set number of matched muons to -1 + *fTreeVarNMatchedMuons->at(k) = -1; + } + // loop over muons + for (int i = 0; i < (*fParticlesTruth)->NMuons(); ++i) + { + // get number of matched muons + *(fTreeVarNMatchedMuons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kMuon); + + // loop over reconstructed muons + for (int j = 0; j < fTreeVarNMuonsSelected; ++j) + { + (*(fTreeVarMatchedMuons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kMuon)).at(j); + } + } + + // set matching vector for all photons to [-1,-1,-1,-1] + for (unsigned int k = 0; k < fTreeVarMatchedPhotons->size(); ++k) { + std::vector<int>* d = fTreeVarMatchedPhotons->at(k); + d->clear(); + d->assign(fTreeVarNPhotonsSelected, -1); + // set number of matched photons to -1 + *fTreeVarNMatchedPhotons->at(k) = -1; + } + // loop over photons + for (int i = 0; i < (*fParticlesTruth)->NPhotons(); ++i) + { + + // get number of matched photons + *(fTreeVarNMatchedPhotons->at(i)) = fMatchingTool->NMatchedTruth(i, KLFitter::Particles::kPhoton); + + // loop over reconstructed photons + for (int j = 0; j < fTreeVarNPhotonsSelected; ++j) + { + (*(fTreeVarMatchedPhotons->at(i)))[j] = (fMatchingTool->ListMatchedTruth(i, KLFitter::Particles::kPhoton)).at(j); + } + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTreeMap() +{ + // check tree + if (!fTreeMap) + { + // error code + int err = 1; + + // create tree + if (fSelectionTool) + err = this->CreateTreeMap(); + + else + return 0; + } + + // fill number of reconstructed objects + fTreeVarNPartonsSelected = (*fParticlesSelected)->NPartons(); + fTreeVarNElectronsSelected = (*fParticlesSelected)->NElectrons(); + fTreeVarNMuonsSelected = (*fParticlesSelected)->NMuons(); + fTreeVarNPhotonsSelected = (*fParticlesSelected)->NPhotons(); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapJets->clear(); + fTreeVarMapJets->assign(fTreeVarNPartonsSelected, -1); + + fTreeVarMapElectrons->clear(); + fTreeVarMapElectrons->assign(fTreeVarNElectronsSelected, -1); + + fTreeVarMapMuons->clear(); + fTreeVarMapMuons->assign(fTreeVarNMuonsSelected, -1); + + fTreeVarMapPhotons->clear(); + fTreeVarMapPhotons->assign(fTreeVarNPhotonsSelected, -1); + + // get maps + for (int i = 0; i < fTreeVarNPartonsSelected; ++i) + (*fTreeVarMapJets)[i] = (fSelectionTool->MapJets()).at(i); + for (int i = 0; i < fTreeVarNElectronsSelected; ++i) + (*fTreeVarMapElectrons)[i] = (fSelectionTool->MapElectrons()).at(i); + for (int i = 0; i < fTreeVarNMuonsSelected; ++i) + (*fTreeVarMapMuons)[i] = (fSelectionTool->MapMuons()).at(i); + for (int i = 0; i < fTreeVarNPhotonsSelected; ++i) + (*fTreeVarMapPhotons)[i] = (fSelectionTool->MapPhotons()).at(i); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::FillTrees() +{ + // fill tree with truth particles + if (fParticlesTruth && fTreeTruth) + fTreeTruth->Fill(); + + // fill tree with measured particles + if (fParticlesMeasured && fTreeMeasured) + fTreeMeasured->Fill(); + + // fill tree with selected particles + if (fParticlesSelected && fTreeSelected) + fTreeSelected->Fill(); + + // fill tree with model particles + if (fParticlesModel && fTreeModel) + fTreeModel->Fill(); + + if (fMatchingTool) + fTreeMatching->Fill(); + + if (fSelectionTool) + fTreeMap->Fill(); + + fTreeVarEventNumber++; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::SetEventWeight(double weight) +{ + fEventWeight = weight; + + // no error + return 0; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceOutput_dilepton::SetPhotonType(bool isNotClassified, bool /*isRadTopProd*/, bool /*isHadTopRadDecay*/, bool /*isLepTopRadDecay*/, bool /*isHadWRadDecay*/, bool /*isLepWRadDecay*/) +{ + fIsNotClassified = isNotClassified; + + // no error + return 0; +} + +// --------------------------------------------------------- +std::string KLFitter::InterfaceOutput_dilepton::ModifyString(std::string str) +{ + int idx; + + while( (idx=str.find_first_of(' ')) >= 0 ) + str.replace(idx, 1, "_" ); + + while( (idx=str.find_first_of('-')) >= 0 ) + str.replace(idx, 1, "_" ); + + return str; +} + +// --------------------------------------------------------- + +std::string KLFitter::InterfaceOutput_dilepton::TreeMeasuredBranchName(KLFitter::Particles::ParticleType pType) +{ + std::string name = ""; + switch(pType) + { + case KLFitter::Particles::kParton: name = "jet"; break; + case KLFitter::Particles::kElectron: name = "electron"; break; + case KLFitter::Particles::kMuon: name = "muon"; break; + case KLFitter::Particles::kPhoton: name = "photon"; break; + case KLFitter::Particles::kTau: name = ""; break; // there is no measured tau + case KLFitter::Particles::kNeutrino: name = ""; break; // there is no measured neutrino + case KLFitter::Particles::kBoson: name = ""; break; // there is no measured (W) boson + default: name = ""; break; + } + + return name; +} + +// --------------------------------------------------------- + +template<class type> void KLFitter::InterfaceOutput_dilepton::Resize(std::vector<std::vector<type>* >* v, unsigned int length) +{ + for (unsigned int i = 0; i < v->size(); i++) + { + v->at(i)->resize(length); + } +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceRoot.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceRoot.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07a0cbaccc2415ff8a0382a13004d42198417385 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/InterfaceRoot.cxx @@ -0,0 +1,131 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/InterfaceRoot.h" + +#include <TDirectory.h> +#include <TFile.h> + +#include <iostream> + +// --------------------------------------------------------- +KLFitter::InterfaceRoot::InterfaceRoot() : fRootFile(0) +{ +} + +// --------------------------------------------------------- +KLFitter::InterfaceRoot::~InterfaceRoot() +{ + if (fRootFile) + delete fRootFile; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceRoot::OpenRootFile(const char * filename, Option_t * opt) +{ + // delete old file + if (fRootFile) + delete fRootFile; + + // get current directory + TDirectory * dir = gDirectory; + + // create new file + fRootFile = new TFile(filename, opt); + + // check if file is open + if (!fRootFile->IsOpen()) { + std::cout << "KLFitter::InterfaceRoot::OpenFile(). Could not open Root file." << std::endl; + delete fRootFile; + return 0; + } + + // change directory + gDirectory = dir; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::InterfaceRoot::CloseRootFile() +{ + // check if file exists + if (!fRootFile) { + std::cout << "KLFitter::InterfaceRoot::CloseRootFile(). No Root file defined." << std::endl; + return 0; + } + + // check if file is open + if (!fRootFile->IsOpen()) { + std::cout << "KLFitter::InterfaceRoot::CloseRootFile(). Root file not open."<< std::endl; + return 0; + } + + // close file + fRootFile->Close(); + + // no error + return 1; +} + +// --------------------------------------------------------- + +std::vector<std::string> KLFitter::InterfaceRoot::ReadInputFiles(const char * filename) +{ + // define input file + std::ifstream inputfile; + + // open file + inputfile.open(filename); + + // check if file is open + if (!inputfile.is_open()) + { + std::cout << "KLFitter::InterfaceRoot::ReadInputFiles(). File \"" << filename << "\" not found." << std::endl; + } + + // reset parameters + std::vector<std::string> filenameVec; + std::string name = "empty"; + + // Read in, in case input files are separeted with "," + // read a string via file since long string causes memory error in CINT when it is read via stdin + std::string argStr; + std::ifstream ifs(filename); + std::getline(ifs,argStr); + + // split by ',' + for (size_t i=0,n; i <= argStr.length(); i=n+1) + { + n = argStr.find_first_of(',',i); + if (n == std::string::npos && filenameVec.size()!=0) //end of file + n = argStr.length(); + else if(n == std::string::npos) //either only one entry or separated by line + break; + std::string tmp = argStr.substr(i,n-i); + filenameVec.push_back(tmp); + } + + //If there are no "," read in line by line + if(filenameVec.size() ==0){ + while(!inputfile.eof()) + { + name = ""; + inputfile >> name; + if(name.size()==0) + break; + filenameVec.push_back(name); + } + } + // close file + inputfile.close(); + + // no error + return filenameVec; +} + +// ----------------------------------------------------------------------------------------------------------- + + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fff964d6f970c0eee7ba01a54a6bf8bcb401caea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma.cxx @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma.h" +#include "KLFitter/DetectorBase.h" +#include "KLFitter/ResolutionBase.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma::LikelihoodTTGamma() : KLFitter::LikelihoodTopLeptonJets::LikelihoodTopLeptonJets() +{ + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); + + // reset flag from base class constructor + fFlagTopMassFixed = true; +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma::~LikelihoodTTGamma() +{ + // calls base class destructor +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma::DefineModelParticles() +{ + // call base class constructor + KLFitter::LikelihoodTopLeptonJets::DefineModelParticles(); + + // add the photon + TLorentzVector * lv = 0; + fParticlesModel->AddParticle(lv = new TLorentzVector(), + KLFitter::Particles::kPhoton, + "photon"); + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTGamma::DefineParameters() +{ + // check if base class constructor has already been called + if (this->NParameters() != 17) + KLFitter::LikelihoodTopLeptonJets::DefineParameters(); + + // add photon energy + this->AddParameter("energy photon", 0.0, 1000.0); // par 17 (the 18th parameter - counting starts well at 0) +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma::AdjustParameterRanges() +{ + // call base class method + KLFitter::LikelihoodTopLeptonJets::AdjustParameterRanges(); + + // add parameter 17: energy of photon + double nsigmas_photon = 2.0; + double E = (*fParticlesPermuted)->Photon(0)->E(); + double Emin = TMath::Max(0.001, E - nsigmas_photon * sqrt(E)); + double Emax = E + nsigmas_photon * sqrt(E); + this->SetParameterRange(17, Emin, Emax); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + KLFitter::LikelihoodTopLeptonJets::CalculateLorentzVectors(parameters); + + // photon + TLorentzVector * vect = (*fParticlesPermuted)->Photon(0); + double E = parameters.at(17); + double px = vect->Px(); + double py = vect->Py(); + double pz = vect->Pz(); + double scale = E / vect->E(); + fParticlesModel->Photon(0)->SetPxPyPzE(scale * px, scale * py, scale * pz, E); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTTGamma::LogLikelihood(const std::vector <double> ¶meters) +{ + // calculate 4-vectors + this->CalculateLorentzVectors(parameters); + + // get base likelihood from base class + // this works also with one additional parameter, because the first + // parameters are well preserved + double logprob = KLFitter::LikelihoodTopLeptonJets::LogLikelihood(parameters); + + // add photon transfer function + bool TFgood(true); + logprob += log((*fDetector)->ResEnergyPhoton((*fParticlesPermuted)->Photon(0)->Eta())->p(parameters.at(17), (*fParticlesPermuted)->Photon(0)->E(), TFgood) ); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTGamma::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(KLFitter::LikelihoodTopLeptonJets::GetInitialParametersWoNeutrinoPz()); + + // add initial value for the photon energy + values.push_back((*fParticlesPermuted)->Photon(0)->E()); + + // return the vector + return values; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadTopRadDecay.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadTopRadDecay.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1e11490175f51acc41b606fd10adba329f3295d8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadTopRadDecay.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma_HadTopRadDecay.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_HadTopRadDecay::LikelihoodTTGamma_HadTopRadDecay() +{ + // calls base class constructor +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_HadTopRadDecay::~LikelihoodTTGamma_HadTopRadDecay() +{ + // calls base class destructor +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma_HadTopRadDecay::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + KLFitter::LikelihoodTTGamma::CalculateLorentzVectors(parameters); + + // hadronic top + *(fParticlesModel->Parton(4)) += *(fParticlesModel->Photon(0)); + + // no error + return 1; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadWRadDecay.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadWRadDecay.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8f617ac5bab6846a6b58a909f6addd5ca2579597 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_HadWRadDecay.cxx @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma_HadWRadDecay.h" +#include <vector> + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_HadWRadDecay::LikelihoodTTGamma_HadWRadDecay() +{ + // calls base class constructor +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_HadWRadDecay::~LikelihoodTTGamma_HadWRadDecay() +{ + // calls base class destructor +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma_HadWRadDecay::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + KLFitter::LikelihoodTTGamma::CalculateLorentzVectors(parameters); + + // the hadronic W + *(fParticlesModel->Boson(0)) += *(fParticlesModel->Photon(0)); + + // the hadronic top + *(fParticlesModel->Parton(4)) += *(fParticlesModel->Photon(0)); + + // no error + return 1; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepTopRadDecay.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepTopRadDecay.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e5fad9b396a6d9819bb176f30470782bf6789d43 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepTopRadDecay.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma_LepTopRadDecay.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_LepTopRadDecay::LikelihoodTTGamma_LepTopRadDecay() +{ + // calls base class constructor +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_LepTopRadDecay::~LikelihoodTTGamma_LepTopRadDecay() +{ + // calls base class destructor +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma_LepTopRadDecay::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + KLFitter::LikelihoodTTGamma::CalculateLorentzVectors(parameters); + + // leptonic top + *(fParticlesModel->Parton(5)) += *(fParticlesModel->Photon(0)); + + // no error + return 1; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepWRadDecay.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepWRadDecay.cxx new file mode 100644 index 0000000000000000000000000000000000000000..22c5632dfa336251cec52762b13429f278c5fd1a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_LepWRadDecay.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma_LepWRadDecay.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_LepWRadDecay::LikelihoodTTGamma_LepWRadDecay() +{ + // calls base class constructor +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_LepWRadDecay::~LikelihoodTTGamma_LepWRadDecay() +{ + // calls base class destructor +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTGamma_LepWRadDecay::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + KLFitter::LikelihoodTTGamma::CalculateLorentzVectors(parameters); + + // the leptonic W + *(fParticlesModel->Boson(1)) += *(fParticlesModel->Photon(0)); + + // leptonic top + *(fParticlesModel->Parton(5)) += *(fParticlesModel->Photon(0)); + + // no error + return 1; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTGamma_LepWRadDecay::GetNeutrinoPzSolutions() +{ + return this->CalculateNeutrinoPzSolutions((*fParticlesPermuted)->Photon(0)); +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_RadTopProd.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_RadTopProd.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d651a5b81f1f66abe19c38aacbc43d1f0880455e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LikelihoodTTGamma_RadTopProd.cxx @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/LikelihoodTTGamma_RadTopProd.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_RadTopProd::LikelihoodTTGamma_RadTopProd() +{ + // calls base class constructor +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTGamma_RadTopProd::~LikelihoodTTGamma_RadTopProd() +{ + // calls base class destructor +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..668378d93d724288ec33af89ac5827ff1aee159c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/LinkDef.h @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <vector> + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class vector<vector<double> >+; +#pragma link C++ class vector<vector<int> >+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/MatchingTool.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/MatchingTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3cf298861f9e313e04b4d8d27dd861695f43958a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/MatchingTool.cxx @@ -0,0 +1,564 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/MatchingTool.h" + +#include <iostream> + + +// --------------------------------------------------------- +KLFitter::MatchingTool::MatchingTool(KLFitter::Particles ** particles, KLFitter::Particles ** particlestruth) +{ + fParticles = particles; + fParticlesTruth = particlestruth; + fDeltaRPartons = 0.3; + fDeltaRElectrons = 0.1; + fDeltaRMuons = 0.1; + fDeltaRPhotons = 0.1; + fMatchedPartons = new std::vector< std::vector<int> >(0); + fMatchedElectrons = new std::vector< std::vector<int> >(0); + fMatchedMuons = new std::vector< std::vector<int> >(0); + fMatchedPhotons = new std::vector< std::vector<int> >(0); +} + +// --------------------------------------------------------- +KLFitter::MatchingTool::~MatchingTool() +{ + if (fMatchedPartons) + delete fMatchedPartons; + + if (fMatchedElectrons) + delete fMatchedElectrons; + + if (fMatchedMuons) + delete fMatchedMuons; + + if (fMatchedPhotons) + delete fMatchedPhotons; +} + +// --------------------------------------------------------- +void KLFitter::MatchingTool::SetDeltaRPartons(double dR) +{ + if (dR < 0) + dR = 0.3; + else + fDeltaRPartons = dR; +} + +// --------------------------------------------------------- +void KLFitter::MatchingTool::SetDeltaRElectrons(double dR) +{ + if (dR < 0) + dR = 0.1; + else + fDeltaRElectrons = dR; +} + +// --------------------------------------------------------- +void KLFitter::MatchingTool::SetDeltaRMuons(double dR) +{ + if (dR < 0) + dR = 0.1; + else + fDeltaRMuons = dR; +} + +// --------------------------------------------------------- +void KLFitter::MatchingTool::SetDeltaRPhotons(double dR) +{ + if (dR < 0) + dR = 0.1; + else + fDeltaRPhotons = dR; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::Initialize(KLFitter::Particles::ParticleType ptype) +{ + if (!fParticlesTruth) + { + std::cout << "KLFitter::MatchingTool::Initialize(). Pointer to truth particle container not defined." << std::endl; + return 0; + } + + if (!(*fParticlesTruth)) + { + std::cout << "KLFitter::MatchingTool::Initialize(). Truth particle container not defined." << std::endl; + return 0; + } + + if (!fParticles) + { + std::cout << "KLFitter::MatchingTool::Initialize(). Pointer to particle container not defined." << std::endl; + return 0; + } + + if (!(*fParticles)) + { + std::cout << "KLFitter::MatchingTool::Initialize(). Particle container not defined." << std::endl; + return 0; + } + + int n_truth = -1; + int n_reco = -1; + if (ptype == KLFitter::Particles::kParton) + { + // get number of particles + n_truth = (*fParticlesTruth) -> NPartons(); + n_reco = (*fParticles) -> NPartons(); + + // clear matrix with matching status + fMatchedPartons -> clear(); + + // initialze matrix with status of matching + for(int j=0; j<n_truth; ++j) + { + fMatchedPartons -> push_back(std::vector<int>(0)); + for(int i=0; i<n_reco; ++i) + fMatchedPartons -> at(j).push_back(-1); + } + } + + else if (ptype == KLFitter::Particles::kElectron) + { + // get number of particles + n_truth = (*fParticlesTruth) -> NElectrons(); + n_reco = (*fParticles) -> NElectrons(); + + // clear matrix with matching status + fMatchedElectrons -> clear(); + + // initialze matrix with status of matching + for(int j=0; j<n_truth; ++j) + { + fMatchedElectrons -> push_back(std::vector<int>(0)); + for(int i=0; i<n_reco; ++i) + fMatchedElectrons -> at(j).push_back(-1); + } + } + + else if (ptype == KLFitter::Particles::kMuon) + { + // get number of particles + n_truth = (*fParticlesTruth) -> NMuons(); + n_reco = (*fParticles) -> NMuons(); + + // clear matrix with matching status + fMatchedMuons -> clear(); + + // initialze matrix with status of matching + for(int j=0; j<n_truth; ++j) + { + fMatchedMuons -> push_back(std::vector<int>(0)); + for(int i=0; i<n_reco; ++i) + fMatchedMuons -> at(j).push_back(-1); + } + } + + else if (ptype == KLFitter::Particles::kPhoton) + { + // get number of particles + n_truth = (*fParticlesTruth) -> NPhotons(); + n_reco = (*fParticles) -> NPhotons(); + + // clear matrix with matching status + fMatchedPhotons -> clear(); + + // initialze matrix with status of matching + for(int j=0; j<n_truth; ++j) + { + fMatchedPhotons -> push_back(std::vector<int>(0)); + for(int i=0; i<n_reco; ++i) + fMatchedPhotons -> at(j).push_back(-1); + } + } + + else + { + std::cout << "KLFitter::MatchingTool::Initialize(). Unknown particle type." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::MatchVectors(int index1, int index2, KLFitter::Particles::ParticleType ptype) +{ + // get Lorentz vectors + TLorentzVector * vect1 = (*fParticles) -> Particle(index1, ptype); + TLorentzVector * vect2 = (*fParticlesTruth) -> Particle(index2, ptype); + + double dR = 0.; + if (ptype == KLFitter::Particles::kParton) + dR = fDeltaRPartons; + else if (ptype == KLFitter::Particles::kElectron) + dR = fDeltaRElectrons; + else if (ptype == KLFitter::Particles::kMuon) + dR = fDeltaRMuons; + else if (ptype == KLFitter::Particles::kPhoton) + dR = fDeltaRPhotons; + + // check if Lorentz vectors exist + if (vect1 == 0 || vect2 == 0) + { + std::cout << "KLFitter::MatchingTool::MatchVectors(). Could not find Lorentz vectors." << std::endl; + return -1; + } + else + return MatchDeltaR(vect1, vect2, dR); +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::MatchDeltaR(TLorentzVector * vect1, TLorentzVector * vect2, double dr) +{ + // get deltaR + double MaxDeltaR = dr; + + // get eta and phi for the objects + double recophi = 0.; + double recoeta = 0.; + recophi = vect1->Phi(); + recoeta = vect1->Eta(); + double truephi = 0.; + double trueeta = 0.; + truephi = vect2->Phi(); + trueeta = vect2->Eta(); + + // calculate deltaR and make sure about boundaries + double dEta = recoeta - trueeta; + double dPhi = recophi - truephi; + const double dPi = 3.1415926535897932384626433832795; + while (dPhi > dPi) {dPhi -= 2*dPi;} + while (dPhi < -dPi) {dPhi += 2*dPi;} + + double dR = sqrt(dEta*dEta + dPhi*dPhi); + + // check if deltaR is within our range + if (dR < MaxDeltaR) + return 1; + //else + return 0; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::MatchTruth(int index, KLFitter::Particles::ParticleType ptype) +{ + // get number of reco particles + int nreco = (*fParticles) -> NParticles(ptype); + + // loop over all reco particles + for (int i = 0; i < nreco; ++i) + { + // match truth and reco particle + int stat = this -> MatchVectors(i, index, ptype); + + // write into list of matching status + this -> SetMatchingStatus(index, i, ptype, stat); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::MatchTruthAll(KLFitter::Particles::ParticleType ptype) +{ + // initialize + this -> Initialize(ptype); + + // get number of reco particles + int ntruth = (*fParticlesTruth) -> NParticles(ptype); + + // loop over all truth particles + for (int i = 0; i < ntruth; ++i) + { + // match truth and reco particle + if (!this -> MatchTruth(i, ptype)) + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::SetMatchingStatus(int indextruth, int indexreco, KLFitter::Particles::ParticleType ptype, int stat) +{ + if (ptype == KLFitter::Particles::kParton) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NPartons() && + indexreco >= 0 && indexreco < (*fParticles) -> NPartons()) + fMatchedPartons -> at(indextruth).at(indexreco) = stat; + else + { + std::cout << "KLFitter::MatchingTool::SetMatchingStatus(). Parton index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kElectron) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NElectrons() && + indexreco >= 0 && indexreco < (*fParticles) -> NElectrons()) + fMatchedElectrons -> at(indextruth).at(indexreco) = stat; + else + { + std::cout << "KLFitter::MatchingTool::SetMatchingStatus(). Electron index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kMuon) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NMuons() && + indexreco >= 0 && indexreco < (*fParticles) -> NMuons()) + fMatchedMuons -> at(indextruth).at(indexreco) = stat; + else + { + std::cout << "KLFitter::MatchingTool::SetMatchingStatus(). Muon index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kPhoton) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NPhotons() && + indexreco >= 0 && indexreco < (*fParticles) -> NPhotons()) + fMatchedPhotons -> at(indextruth).at(indexreco) = stat; + else + { + std::cout << "KLFitter::MatchingTool::SetMatchingStatus(). Photon index out of range." << std::endl; + return 0; + } + } + else + { + std::cout << "KLFitter::MatchingTool::SetMatchingStatus(). Unknown particle type." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::MatchingStatus(int indextruth, int indexreco, KLFitter::Particles::ParticleType ptype) +{ + if (ptype == KLFitter::Particles::kParton) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NPartons() && + indexreco >= 0 && indexreco < (*fParticles) -> NPartons()) + return fMatchedPartons -> at(indextruth).at(indexreco); + else + { + std::cout << "KLFitter::MatchingTool::IsMatched(). Parton index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kElectron) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NElectrons() && + indexreco >= 0 && indexreco < (*fParticles) -> NElectrons()) + return fMatchedElectrons -> at(indextruth).at(indexreco); + else + { + std::cout << "KLFitter::MatchingTool::IsMatched(). Electron index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kMuon) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NMuons() && + indexreco >= 0 && indexreco < (*fParticles) -> NMuons()) + return fMatchedMuons -> at(indextruth).at(indexreco); + else + { + std::cout << "KLFitter::MatchingTool::IsMatched(). Muon index out of range." << std::endl; + return 0; + } + } + else if (ptype == KLFitter::Particles::kPhoton) + { + if (indextruth >= 0 && indextruth < (*fParticlesTruth) -> NPhotons() && + indexreco >= 0 && indexreco < (*fParticles) -> NPhotons()) + return fMatchedPhotons -> at(indextruth).at(indexreco); + else + { + std::cout << "KLFitter::MatchingTool::IsMatched(). Photon index out of range." << std::endl; + return 0; + } + } + else + { + std::cout << "KLFitter::MatchingTool::IsMatched(). Unknown particle type." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::MatchingTool::NMatchedTruth(int index, KLFitter::Particles::ParticleType ptype) +{ + int nmatches = 0; + int njets = (*fParticles) -> NPartons(); + int nelectrons = (*fParticles) -> NElectrons(); + int nmuons = (*fParticles) -> NMuons(); + int nphotons = (*fParticles) -> NPhotons(); + + int npartonstruth = (*fParticlesTruth) -> NPartons(); + int nelectronstruth = (*fParticlesTruth) -> NElectrons(); + int nmuonstruth = (*fParticlesTruth) -> NMuons(); + int nphotonstruth = (*fParticlesTruth) -> NPhotons(); + + // return size of our vector to check number of matches - parton + if(ptype == KLFitter::Particles::kParton) + { + if (index < 0 || index >= npartonstruth) + return -1; + + for(int i = 0; i < njets; ++i) + if ((fMatchedPartons-> at(index)).at(i) > 0) + nmatches++; + + // return number of matches + return nmatches; + } + + // return size of our vector to check number of matches - electrons + if(ptype == KLFitter::Particles::kElectron) + { + if (index < 0 || index >= nelectronstruth) + return -1; + + for(int i = 0; i < nelectrons; ++i) + if ((fMatchedElectrons-> at(index)).at(i) > 0) + nmatches++; + + // return number of matches + return nmatches; + } + + // return size of our vector to check number of matches - muons + if(ptype == KLFitter::Particles::kMuon) + { + if (index < 0 || index >= nmuonstruth) + return -1; + + for(int i = 0; i < nmuons; ++i) + if ((fMatchedMuons-> at(index)).at(i) > 0) + nmatches++; + + // return number of matches + return nmatches; + } + + // return size of our vector to check number of matches - photons + if(ptype == KLFitter::Particles::kPhoton) + { + + if (index < 0 || index >= nphotonstruth) + return -1; + + for(int i = 0; i < nphotons; ++i) { + if ((fMatchedPhotons-> at(index)).at(i) > 0) + nmatches++; + + // return number of matches + return nmatches; + } + } + else + { + std::cout << "KLFitter::MatchingTool::NMatchedTruth(): Particle type unknown." << std::endl; + return -1; + } + return -1; +} + +// --------------------------------------------------------- +// int KLFitter::MatchingTool::NMatchedTruth(const char * name) +// { +// KLFitter::Particles::ParticleType ptype; +// int index; + +// // find the particle according to the name +// fParticlesTruth -> FindParticle(name, index, ptype); + +// // run the function NMatchedTruth to find the number of matches +// int size = NMatchedTruth(index, ptype); + +// // return the number of reco particles matched to the truth particle +// return size; +// } + +// --------------------------------------------------------- +std::vector<int> KLFitter::MatchingTool::ListMatchedTruth(int index, KLFitter::Particles::ParticleType ptype) +{ + int njets = (*fParticlesTruth) -> NPartons(); + int neles = (*fParticlesTruth) -> NElectrons(); + int nmuons = (*fParticlesTruth) -> NMuons(); + int nphotons = (*fParticlesTruth) -> NPhotons(); + // check type + if(ptype == KLFitter::Particles::kParton){ + // check for out of range index + if(index > njets-1 ){ + std::vector<int> errvec[1]; + errvec->push_back(-1); + return *(errvec); + } + // return vector linking truth particle + return fMatchedPartons->at(index); + } + else if(ptype == KLFitter::Particles::kElectron){ + // check for out of range index + if(index > neles-1){ + std::vector<int> errvec[1]; + errvec->push_back(-1); + return *(errvec); + } + // return vector linking truth particle + return fMatchedElectrons->at(index); + } + else if(ptype == KLFitter::Particles::kMuon){ + // check for out of range index + if(index > nmuons-1){ + std::vector<int> errvec[1]; + errvec->push_back(-1); + return *(errvec); + } + // return vector linking truth particle + return fMatchedMuons->at(index); + } + else if(ptype == KLFitter::Particles::kPhoton){ + // check for out of range index + if(index > nphotons-1){ + std::vector<int> errvec[1]; + errvec->push_back(-1); + return *(errvec); + } + // return vector linking truth particle + return fMatchedPhotons->at(index); + } + else{ + // error - particle type incorrect - return vector with -1 + std::vector<int> errvec[1]; + errvec->push_back(-1); + return *(errvec); + } +} + +// --------------------------------------------------------- +// std::vector<int> KLFitter::MatchingTool::ListMatchedTruth(const char * name) +// { +// KLFitter::Particles::ParticleType ptype; +// int index; +// // find the particle according to the name +// fParticlesTruth -> FindParticle(name ,index, ptype); +// // run the function ListMatchedTruth to get the vector on matches +// std::vector<int> outvec = ListMatchedTruth(index,ptype); + +// return outvec; +// } diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/PhotonType.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/PhotonType.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e1ac52efbabefa815c1a38ea380ef3ef46f4cb5f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/PhotonType.cxx @@ -0,0 +1,151 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/PhotonType.h" +#include "KLFitter/Particles.h" + +#include <iostream> + +// --------------------------------------------------------- +KLFitter::PhotonType::PhotonType() +{ + deltaTopMass = 8.0; + deltaWMass = 8.0; + isNotClassified = false; + isRadTopProd = false; + isHadTopRadDecay = false; + isLepTopRadDecay = false; + isHadWRadDecay = false; + isLepWRadDecay = false; + fTruthParticles = 0x0; + fPhysicsConstants = 0x0 + ;} + +// --------------------------------------------------------- +int KLFitter::PhotonType::Classify() +{ + // clear info + isNotClassified = false; + isRadTopProd = false; + isHadTopRadDecay = false; + isLepTopRadDecay = false; + isHadWRadDecay = false; + isLepWRadDecay = false; + + // make composite particles + MakeCompositeParticles(); + + // call the classification methods + if (ClassifyRadTopProd()) + isRadTopProd = true; + + if (ClassifyHadTopRadDecay()) + isHadTopRadDecay = true; + + if (ClassifyLepTopRadDecay()) + isLepTopRadDecay = true; + + if (ClassifyHadWRadDecay()) + isHadWRadDecay = true; + + if (ClassifyLepWRadDecay()) + isLepWRadDecay = true; + + isNotClassified = !isRadTopProd && !isHadTopRadDecay && !isLepTopRadDecay && !isHadWRadDecay && !isLepWRadDecay; + + // no error + return 1; +} + +// --------------------------------------------------------- +bool KLFitter::PhotonType::ClassifyRadTopProd() { + if (eqTopM(htop.M(), deltaTopMass) && + btTopM(htop_g.M(), deltaTopMass) && + eqTopM(ltop.M(), deltaTopMass) && + btTopM(ltop_g.M(), deltaTopMass) && + eqWM(hadW.M(), deltaWMass) && + btWM(hadW_g.M(), deltaWMass) && + eqWM(lepW.M(), deltaWMass) && + btWM(lepW_g.M(), deltaWMass)) + return true; + + return false; +} + +// --------------------------------------------------------- +bool KLFitter::PhotonType::ClassifyHadTopRadDecay() { + if (ltTopM(htop.M(), deltaTopMass) && + eqTopM(htop_g.M(), deltaTopMass) && + eqTopM(ltop.M(), deltaTopMass) && + btTopM(ltop_g.M(), deltaTopMass) && + eqWM(hadW.M(), deltaWMass) && + btWM(hadW_g.M(), deltaWMass) && + eqWM(lepW.M(), deltaWMass) && + btWM(lepW_g.M(), deltaWMass)) + return true; + + return false; +} + +// --------------------------------------------------------- +bool KLFitter::PhotonType::ClassifyLepTopRadDecay() { + if (eqTopM(htop.M(), deltaTopMass) && + btTopM(htop_g.M(), deltaTopMass) && + ltTopM(ltop.M(), deltaTopMass) && + eqTopM(ltop_g.M(), deltaTopMass) && + eqWM(hadW.M(), deltaWMass) && + btWM(hadW_g.M(), deltaWMass) && + eqWM(lepW.M(), deltaWMass) && + btWM(lepW_g.M(), deltaWMass)) + return true; + + return false; +} + +// --------------------------------------------------------- +bool KLFitter::PhotonType::ClassifyHadWRadDecay() { + if (ltTopM(htop.M(), deltaTopMass) && + eqTopM(htop_g.M(), deltaTopMass) && + eqTopM(ltop.M(), deltaTopMass) && + btTopM(ltop_g.M(), deltaTopMass) && + ltWM(hadW.M(), deltaWMass) && + eqWM(hadW_g.M(), deltaWMass) && + eqWM(lepW.M(), deltaWMass) && + btWM(lepW_g.M(), deltaWMass)) + return true; + + return false; +} + +// --------------------------------------------------------- +bool KLFitter::PhotonType::ClassifyLepWRadDecay() { + if (eqTopM(htop.M(), deltaTopMass) && + btTopM(htop_g.M(), deltaTopMass) && + ltTopM(ltop.M(), deltaTopMass) && + eqTopM(ltop_g.M(), deltaTopMass) && + eqWM(hadW.M(), deltaWMass) && + btWM(hadW_g.M(), deltaWMass) && + ltWM(lepW.M(), deltaWMass) && + eqWM(lepW_g.M(), deltaWMass)) + return true; + + return false; +} + +// --------------------------------------------------------- +void KLFitter::PhotonType::MakeCompositeParticles() { + KLFitter::Particles * p = *fTruthParticles; + + hadW = *(p->Parton(2)) + *(p->Parton(3)); + hadW_g = hadW + *(p->Photon(0)); + + lepW = *(p->Electron(0)) + *(p->Neutrino(0)); + lepW_g = lepW + *(p->Photon(0)); + + htop = *(p->Parton(0)) + hadW; + htop_g = *(p->Parton(0)) + hadW_g; + + ltop = *(p->Parton(1)) + lepW; + ltop_g = *(p->Parton(1)) + lepW_g; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/ReadConfigFile.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/ReadConfigFile.cxx new file mode 100644 index 0000000000000000000000000000000000000000..27b08dbf64bf96fec94db267d5722c6be4fc66ef --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/ReadConfigFile.cxx @@ -0,0 +1,715 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/ReadConfigFile.h" +#include <iostream> +#include <cmath> +#include <fstream> +#include <TSystem.h> + +// --------------------------------------------------------- +KLFitter::ReadConfigFile::ReadConfigFile(std::string filename) +{ + LeptonType = KLFitter::LikelihoodTopLeptonJets::kElectron; + + BTaggingMethod = KLFitter::LikelihoodBase::kNotag; + CutBTagging = 1.e4; + FlagIntegrate = false; + FlagTopMassFixed = false; + FlagHiggsMassFixed = false; + FlagWriteSignalMCTruth = true; + BeamEnergy = KLFitter::DetectorBase::k7TeV; + FlagTruthSel = false; + LJetSeparationMethod = KLFitter::LikelihoodTopLeptonJetsUDSep::kNone; + TopPoleMass = 172.5; + HiggsMass = 120.0; + + input_path="input.root"; + output_path="output.root"; + + //Following variables are obsolete and not used anymore + IsBkg = false; + FlagAthenaComp = false; + DO_BATCH = false; + FlagUseJetMass = false; + + + ReadConfig(filename); +} + + +// --------------------------------------------------------- +KLFitter::ReadConfigFile::ReadConfigFile(std::string filename, bool * validconfig) +{ + LeptonType = KLFitter::LikelihoodTopLeptonJets::kElectron; + + BTaggingMethod = KLFitter::LikelihoodBase::kNotag; + CutBTagging = 1.e4; + FlagIntegrate = false; + FlagTopMassFixed = false; + FlagHiggsMassFixed = false; + FlagWriteSignalMCTruth = true; + BeamEnergy = KLFitter::DetectorBase::k7TeV; + FlagTruthSel = false; + LJetSeparationMethod = KLFitter::LikelihoodTopLeptonJetsUDSep::kNone; + + TopPoleMass = 172.5; + HiggsMass = 120.0; + + input_path="input.root"; + output_path="output.root"; + + //Following variables are obsolete and not used anymore + IsBkg = false; + FlagAthenaComp = false; + DO_BATCH = false; + FlagUseJetMass = false; + + if(ReadConfig(filename)!=-1){*validconfig=true;} + else{*validconfig=false;} +} + + +// --------------------------------------------------------- +KLFitter::ReadConfigFile::~ReadConfigFile() +{ +} + +// --------------------------------------------------------- +int KLFitter::ReadConfigFile::ReadConfig(std::string filename) +{ + ifstream configfile(filename.c_str(),std::ios::in); + std::string line; + bool is_comment=false; + bool is_whitespace=false; + bool slash=false; + int tmp; + double tmpdouble=0.0; + std::string tmpstr=""; + size_t found; + std::string::iterator k; + std::cout<<"reading "<<filename.c_str()<<"..."<<std::endl; + + if(configfile.is_open()) + { + //read config + while (! configfile.eof() ) + { + getline (configfile,line); + is_comment=false; + slash=false; + is_whitespace=false; + if(line.size()==0) //ignore any empty lines + continue; + //looking for uncommentation + for(k=line.begin();k<line.end();k++) + { + //ignore any white space, unless a slash was found before + if((*k==std::string(" ") || *k==std::string("\t") || *k==std::string("\n")) && slash==false) + { + is_whitespace=true; + continue; + } + //a line is a comment, if there is a #, % or // as first non whitespace character + if(*k==std::string("#") || *k==std::string("%") || (*k==std::string("/") && slash==true)) + { + is_comment=true; + is_whitespace=false; + break; + } + else if(*k==std::string("/")) + { + slash=true; + is_whitespace=false; + } + else + { + break; + } + } + + if(is_comment==false) + { + found=line.find("LeptonType"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetPath(&tmpstr,line,found); + if(tmp!=-1) + { + if(tmpstr == "electron") + LeptonType=KLFitter::LikelihoodTopLeptonJets::kElectron; + if(tmpstr == "muon") + LeptonType=KLFitter::LikelihoodTopLeptonJets::kMuon; + } + else + { + std::cout<<"Warning: Error while reading value of LeptonType, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("CutBTagging"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetValue(&tmpdouble,line,found); + if(tmp!=-1) + { + CutBTagging=tmpdouble; + } + else + { + std::cout<<"Warning: Error while reading value of CutBTagging, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("DO_BATCH"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + DO_BATCH=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of DO_BATCH, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("BTaggingMethod"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetPath(&tmpstr,line,found); + if(tmp!=-1) + { + if(tmpstr == "Notag") + BTaggingMethod=KLFitter::LikelihoodBase::kNotag; + if(tmpstr == "Veto") + BTaggingMethod=KLFitter::LikelihoodBase::kVeto; + if(tmpstr == "VetoLight") + BTaggingMethod=KLFitter::LikelihoodBase::kVetoLight; + if(tmpstr == "VetoBoth") + BTaggingMethod=KLFitter::LikelihoodBase::kVetoBoth; + if(tmpstr == "VetoNoFit") + BTaggingMethod=KLFitter::LikelihoodBase::kVetoNoFit; + if(tmpstr == "VetoNoFitLight") + BTaggingMethod=KLFitter::LikelihoodBase::kVetoNoFitLight; + if(tmpstr == "VetoNoFitBoth") + BTaggingMethod=KLFitter::LikelihoodBase::kVetoNoFitBoth; + if(tmpstr == "WorkingPoint") + BTaggingMethod=KLFitter::LikelihoodBase::kWorkingPoint; + } + + else + { + std::cout<<"Warning: Error while reading value of BTaggingMethod, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagTopMassFixed"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1){ + FlagTopMassFixed=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagTopMassFixed, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagHiggsMassFixed"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1){ + FlagHiggsMassFixed=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagHiggsMassFixed, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagIntegrate"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1){ + FlagIntegrate=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagIntegrate, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagUseJetMass"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + FlagUseJetMass=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagUseJetMass, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagWriteSignalMCTruth"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + FlagWriteSignalMCTruth=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagWriteSignalMCTruth, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("BeamCMEnergy"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetValue(&tmpdouble,line,found); + if(tmp!=-1) + { + if(tmpdouble==7) + BeamEnergy=KLFitter::DetectorBase::k7TeV; + if(tmpdouble==8) + BeamEnergy=KLFitter::DetectorBase::k8TeV; + if(tmpdouble==10) + BeamEnergy=KLFitter::DetectorBase::k10TeV; + } + else + { + std::cout<<"Warning: Error while reading value of BeamCMEnergy, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("TopPoleMass"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetValue(&tmpdouble,line,found); + if(tmp!=-1) + { + TopPoleMass=tmpdouble; + } + else + { + std::cout<<"Warning: Error while reading value of TopPoleMass, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("HiggsMass"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetValue(&tmpdouble,line,found); + if(tmp!=-1) + { + HiggsMass=tmpdouble; + } + else + { + std::cout<<"Warning: Error while reading value of HiggsMass, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("PathToInputFile"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetPath(&tmpstr,line,found); + if(tmp!=-1) + { + input_path=tmpstr; + } + else + { + std::cout<<"Warning: Error while reading path to input file, using standard path 'input.root'"<<std::endl; + } + } + } + else + { + found=line.find("PathToOutputFile"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetPath(&tmpstr,line,found); + if(tmp!=-1) + { + output_path=tmpstr; + } + else + { + std::cout<<"Warning: Error while reading path to output file, using standard path 'output.root'"<<std::endl; + } + } + } + else + { + found=line.find("IsBkg"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + IsBkg=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of IsBkg, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagTruthSel"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + FlagTruthSel=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagTruthSel, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("LJetSeparationMethod"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetPath(&tmpstr,line,found); + if(tmp!=-1) + { + if(tmpstr == "None") + LJetSeparationMethod=KLFitter::LikelihoodTopLeptonJetsUDSep::kNone; + if(tmpstr == "PermReweight") + LJetSeparationMethod=KLFitter::LikelihoodTopLeptonJetsUDSep::kPermReweight; + } + else + { + std::cout<<"Warning: Error while reading value of LJetSeparationMethod, using standard value"<<std::endl; + } + } + } + else + { + found=line.find("FlagAthenaComp"); + if(found!=std::string::npos) + { + found=line.find("=",found); + if(found!=std::string::npos) + { + tmp=GetTrueOrFalse(line,found); + if(tmp!=-1) + { + FlagAthenaComp=(tmp==1); + } + else + { + std::cout<<"Warning: Error while reading value of FlagAthenaComp, using standard value"<<std::endl; + } + } + } + else + { + if(is_whitespace==false) + { + std::cout<<"Warning: the line \""<<line.c_str()<<"\" does not match any variable. It is ignored."<<std::endl; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + configfile.close(); + } + else + { + std::cout<<"Couldn't open the file \""; + std::cout<<filename.c_str(); + std::cout<<"\". Will use standard values."<<std::endl; + } + //Print Flag values + std::cout<<"Flags are set as follows:"<<std::endl; + if (LeptonType==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout<<"LeptonType = Electron"<<std::endl; + if (LeptonType==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout<<"LeptonType = Muon"<<std::endl; + if(BTaggingMethod==KLFitter::LikelihoodBase::kNotag) + std::cout<< "BTaggingMethod = Notag"<<std::endl; + if(BTaggingMethod==KLFitter::LikelihoodBase::kVeto) + std::cout<< "BTaggingMethod = Veto"<<std::endl; + if(BTaggingMethod==KLFitter::LikelihoodBase::kVetoNoFit) + std::cout<< "BTaggingMethod = VetoNoFit"<<std::endl; + if(BTaggingMethod==KLFitter::LikelihoodBase::kWorkingPoint) + std::cout<< "BTaggingMethod = WorkingPoint"<<std::endl; + std::cout<< "CutBTagging = "<<CutBTagging<<std::endl; + std::cout<< "FlagIntegrate = "<<FlagIntegrate<<std::endl; + std::cout<< "FlagTopMassFixed = "<<FlagTopMassFixed<<std::endl; + std::cout<< "FlagHiggsMassFixed = "<<FlagHiggsMassFixed<<std::endl; + std::cout<< "TopPoleMass = "<<TopPoleMass<<std::endl; + std::cout<< "HiggsMass = "<<HiggsMass<<std::endl; + std::cout<< "FlagUseJetMass = "<<FlagUseJetMass<<std::endl; + std::cout<< "FlagWriteSignalMCTruth = "<<FlagWriteSignalMCTruth<<std::endl; + std::cout << "FlagTruthSel = " << FlagTruthSel << std::endl; + if(LJetSeparationMethod==KLFitter::LikelihoodTopLeptonJetsUDSep::kNone) + std::cout << "LJetSeparationMethod = None" << std::endl; + if(LJetSeparationMethod==KLFitter::LikelihoodTopLeptonJetsUDSep::kPermReweight) + std::cout << "LJetSeparationMethod = PermReweight" << std::endl; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + std::cout<< "BeamCMEnergy = 7TeV" <<std::endl; + if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + std::cout<< "BeamCMEnergy = 10TeV" <<std::endl; + std::cout<< "PathToInputFile = " << input_path<<std::endl; + std::cout<< "PathToOutputFile = " << output_path<<std::endl; + std::cout << std::endl; + + if(CheckIOPath()){return 0;} + else{std::cout<<"KLFitter::ReadConfigFile::ReadConfig(). Error: PathToInputFile==PathToOutputFile! Will not overwrite input file!!!"<<std::endl;return -1;} + +} + + + +bool KLFitter::ReadConfigFile::CheckIOPath() +{ + if(input_path==output_path) + {return false;} + else + {return true;} +} + +int KLFitter::ReadConfigFile::GetValue(double * ret, std::string line, size_t found) +{ + std::string::iterator k; + bool is_whitespace=true; + bool is_number=false; + bool found_point=false; + int a=0; + int l=0; + unsigned int i=0; + *ret=0; + if(line.size()<=found) + {return -1;} + else + { + + for(k=line.begin();k<line.end();k++) + { + //go forward to the place of "=" + if(i<=found) + {i++;continue;} + //ignore any white space unless it is within a number + if((*k==std::string(" ") || *k==std::string("\t")) && is_number==false) + {is_whitespace=true;continue;} + else + { + //Is this char a number (0 to 9) ? + if(IsNumber(k,&a)) + { + *ret+=a*pow(10,l);l--; // calculate the whole number. This result has to be corrected by a factor of some power of 10. But this correction is only known when the "." is found or the end of the number + is_number=true; + + } + else + { + if(*k==std::string(".") && found_point==false) //is this nonumber char the point? + { + *ret*=pow(10,fabs(l)-1); //if yes and there was no point before, correct the number and set the "l" this way, that it calculates the powers for the coming numbers in the right way + l=-1; + found_point=true; + } + else + { + break; + } + } + } + } + if(found_point==false){*ret*=pow(10,fabs(l)-1);} //calculate the correction, if the number ended without a point + if(is_number==true){return 1;} + else{return -1;} + } + +} + +int KLFitter::ReadConfigFile::GetPath(std::string * ret, std::string line, size_t found) +{ + std::string::iterator k; + bool is_whitespace=true; + bool path_started=false; + int l=0; + unsigned int i=0; + *ret=std::string(""); //clear ret + if(line.size()<=found) + {return -1;} + else + { + + for(k=line.begin();k<line.end();k++) + { + //go forward to the place of "=" + if(i<=found) + {i++;continue;} + //ignore any white space unless the path started + if((*k==std::string(" ") || *k==std::string("\t")) && path_started==false) + {is_whitespace=true;continue;} + else + { + if(*k==std::string(" ") || *k==std::string("\t") || *k==std::string("#")) + {break;} + *ret+=*k;l++; + path_started=true; + } + } + + if(l==0){*ret="";return -1;} //return -1 if path has length 0 + else{return 0;} + } + +} + +// --------------------------------------------------------- +bool KLFitter::ReadConfigFile::IsNumber(std::string::iterator a, int * number) +{ + + if(*a==std::string("0")){*number=0;return true;} + else if (*a==std::string("1")){*number=1;return true;} + else if (*a==std::string("2")){*number=2;return true;} + else if (*a==std::string("3")){*number=3;return true;} + else if (*a==std::string("4")){*number=4;return true;} + else if (*a==std::string("5")){*number=5;return true;} + else if (*a==std::string("6")){*number=6;return true;} + else if (*a==std::string("7")){*number=7;return true;} + else if (*a==std::string("8")){*number=8;return true;} + else if (*a==std::string("9")){*number=9;return true;} + else{return false;*number=-1;} +} + + +// --------------------------------------------------------- +int KLFitter::ReadConfigFile::GetTrueOrFalse(std::string line, size_t found) +{ + if(line.size()<=found) + {return -1;} + else + { + //string to lower case + + for (unsigned int i = 0; i < line.size(); i++) + {line[i] = tolower(line[i]);} + if(line.find("true", found)!=std::string::npos) + { + return 1; + } + else if(line.find("false", found)!=std::string::npos) + { + return 0; + } + else + {return -1;} + + } +} + +//<----------- End of reading out config.conf-----------------> diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/SelectionTool.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/SelectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..699808158ecea02f935b21be9db9f5ad559f3558 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/SelectionTool.cxx @@ -0,0 +1,725 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitterExtras/SelectionTool.h" +#include <iostream> + +// --------------------------------------------------------- +KLFitter::SelectionTool::SelectionTool() : + fParticlesSelected(0), + fJetPt(0.0), + fJetEta(2.5), + fJetJVF(0.75), + fElectronPt(0.0), + fElectronEta(2.5), + fMuonPt(0.0), + fMuonEta(2.5), + fPhotonPt(0.0), + fPhotonEta(2.5), + fMET(0), + fMWT(0), + fMET_plus_MWT(0), + fCounterEvents(0), + fCounterJets(0), + fCounterBJets(0), + fCounterElectrons(0), + fCounterMuons(0), + fCounterPhotons(0), + fCounterMET(0), + fCounterMWT(0), + fCounterTriangular(0), + fCounterSelected(0), + fMaxNJetsForFit(4) +{ +} + +// --------------------------------------------------------- +KLFitter::SelectionTool::~SelectionTool() +{ + if (fParticlesSelected) + delete fParticlesSelected; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::SelectObjects(KLFitter::Particles * particles) +{ + // check if particles exist + if (!particles) + { + std::cout << "KLFitter::SelectionTool::SelectObjects. Particles do not exist." << std::endl; + return 0; + } + + // clear events + if (fParticlesSelected) + delete fParticlesSelected; + + bool isDilepton(false); + + fParticlesSelected = new KLFitter::Particles(); + + // reset maps + this->ResetMaps(); + + // jet selection + int npartons = particles->NPartons(); + + // debugKK + // re-order such that b-tagged jets come first + + if (fNBJets.size() > 0) { + // run over b-jets first + for (int i = 0; i < npartons; ++i) { + // check b-tag + if (particles->BTagWeight(i) < fNBJets.at(0).value) + continue; + + // check eta region + if (TMath::Abs( particles->DetEta(i, KLFitter::Particles::kParton) ) > fJetEta) + continue; + + // check pT + if (particles->Parton(i)->Pt() < fJetPt) + continue; + + // add jet + TLorentzVector * tlv_tmp = new TLorentzVector(*particles->Parton(i)); + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Parton(i)), + particles->DetEta(i, KLFitter::Particles::kParton), + KLFitter::Particles::kParton, + particles->NameParticle(i, KLFitter::Particles::kParton), + particles->JetIndex(i), + particles->IsBTagged(i), + particles->BTaggingEfficiency(i), + particles->BTaggingRejection(i), + particles->TrueFlavor(i), + particles->BTagWeight(i)); + + + + // add index to map + fMapJets.push_back(i); + delete tlv_tmp; + } + } + + // run of non-b-tag jets + for (int i = 0; i < npartons; ++i) + { + if (fNBJets.size() > 0) { + // check non-b-tag + if (particles->BTagWeight(i) > fNBJets.at(0).value) + continue; + } + + // check eta region + if (TMath::Abs( particles->DetEta(i, KLFitter::Particles::kParton) ) > fJetEta) + continue; + + // check pT + if (particles->Parton(i)->Pt() < fJetPt) + continue; + + // add jet + TLorentzVector * tlv_tmp = new TLorentzVector(*particles->Parton(i)); + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Parton(i)), + particles->DetEta(i, KLFitter::Particles::kParton), + KLFitter::Particles::kParton, + particles->NameParticle(i, KLFitter::Particles::kParton), + particles->JetIndex(i), + particles->IsBTagged(i), + particles->BTaggingEfficiency(i), + particles->BTaggingRejection(i), + particles->TrueFlavor(i), + particles->BTagWeight(i)); + + // add index to map + fMapJets.push_back(i); + delete tlv_tmp; + } + + + + + // electron selection + int nelectrons = particles->NElectrons(); + + if(nelectrons!=0 && particles->LeptonCharge(0, KLFitter::Particles::kElectron)!=-9) + isDilepton=true; + + //std::cout << "isDilepton? " << isDilepton << std::endl; + + for (int i = 0; i < nelectrons; ++i) + { + // check eta region + if (TMath::Abs(particles->DetEta(i, KLFitter::Particles::kElectron)) > fElectronEta) + continue; + + // check pT + if (particles->Electron(i)->Pt() < fElectronPt) + continue; + TLorentzVector * tlv_tmp = new TLorentzVector(*particles->Electron(i)); + + if (isDilepton){ + // add electron + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Electron(i)), + particles->DetEta(i, KLFitter::Particles::kElectron), + particles->LeptonCharge(i, KLFitter::Particles::kElectron), + KLFitter::Particles::kElectron, + particles->NameParticle(i, KLFitter::Particles::kElectron), + particles->ElectronIndex(i)); + } + else { + // add electron + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Electron(i)), + particles->DetEta(i, KLFitter::Particles::kElectron), + KLFitter::Particles::kElectron, + particles->NameParticle(i, KLFitter::Particles::kElectron), + particles->ElectronIndex(i)); + } + + + // add index to map + fMapElectrons.push_back(i); + delete tlv_tmp; + } + + // muon selection + int nmuons = particles->NMuons(); + + if(nmuons!=0 && particles->LeptonCharge(0, KLFitter::Particles::kMuon)!=-9) + isDilepton=true; + + //std::cout << "isDilepton? " << isDilepton << std::endl; + + for (int i = 0; i < nmuons; ++i) + { + // check eta region + if (TMath::Abs(particles->DetEta(i, KLFitter::Particles::kMuon)) > fMuonEta) + continue; + + // check pT + if (particles->Muon(i)->Pt() < fMuonPt) + continue; + TLorentzVector * tlv_tmp = new TLorentzVector(*particles->Muon(i)); + + if (isDilepton) { + // add muon + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Muon(i)), + particles->DetEta(i, KLFitter::Particles::kMuon), + particles->LeptonCharge(i, KLFitter::Particles::kMuon), + KLFitter::Particles::kMuon, + particles->NameParticle(i, KLFitter::Particles::kMuon), + particles->MuonIndex(i)); + } + else { + // add muon + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Muon(i)), + particles->DetEta(i, KLFitter::Particles::kMuon), + KLFitter::Particles::kMuon, + particles->NameParticle(i, KLFitter::Particles::kMuon), + particles->MuonIndex(i)); + } + + + // add index to map + fMapMuons.push_back(i); + delete tlv_tmp; + } + + // photon selection + int nphotons = particles->NPhotons(); + + for (int i = 0; i < nphotons; ++i) + { + // check eta region + if (TMath::Abs(particles->DetEta(i, KLFitter::Particles::kPhoton)) > fPhotonEta) + continue; + + // check pT + if (particles->Photon(i)->Pt() < fPhotonPt) + continue; + TLorentzVector * tlv_tmp = new TLorentzVector(*particles->Photon(i)); + // add photon + fParticlesSelected->AddParticle( tlv_tmp, + // new TLorentzVector(*particles->Photon(i)), + particles->DetEta(i, KLFitter::Particles::kPhoton), + KLFitter::Particles::kPhoton, + particles->NameParticle(i, KLFitter::Particles::kPhoton), + particles->PhotonIndex(i)); + + // add index to map + fMapPhotons.push_back(i); + delete tlv_tmp; + } + + + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::SelectEvent(KLFitter::Particles * particles, double MET, double MWT) +{ + // get the object selection pt cuts from the event cuts + fElectronPt = ObjectPtCut(fNElectronsPt); + fMuonPt = ObjectPtCut(fNMuonsPt); + fJetPt = ObjectPtCut(fNJetsPt); + fPhotonPt = ObjectPtCut(fNPhotonsPt); + + + // select objects + if (!this->SelectObjects(particles)) + return 0; + + // check if particles exist + if (!fParticlesSelected) + { + std::cout << "KLFitter::SelectionTool::SelectEvent. Particles do not exist." << std::endl; + return 0; + } + + // increase coutner + fCounterEvents++; + + // ------------------ + // electron selection + // ------------------ + + if (int(fNElectronsPt.size()) > 0) { + // counting variables + int nelectrons = fParticlesSelected->NElectrons(); + unsigned int nelectroncuts = fNElectronsPt.size(); + + std::vector<int> nelectronspt; + nelectronspt.assign(nelectroncuts, 0); + + // loop over electrons + for (int i = 0; i < nelectrons; ++i) { + // get pt of electron + double pt = fParticlesSelected->Electron(i)->Pt(); + + // loop over all cuts and count + for (unsigned int j = 0; j < nelectroncuts; ++j) { + // increase counter if pt larger than cut value + if ( pt > fNElectronsPt[j].value) + nelectronspt[j]++; + } + } + + // check electron cuts + for (unsigned int i = 0; i < nelectroncuts; ++i) { + if (nelectronspt[i] != fNElectronsPt[i].n) + return 0; + } + } + + // increase counter + fCounterElectrons++; + + // -------------- + // muon selection + // -------------- + + if (int(fNMuonsPt.size()) > 0) { + // counting variables + int nmuons = fParticlesSelected->NMuons(); + int nmuoncuts = int(fNMuonsPt.size()); + + std::vector<int> nmuonspt; + nmuonspt.assign(nmuoncuts, 0); + + // loop over muons + for (int i = 0; i < nmuons; ++i) { + // get pt of muon + double pt = fParticlesSelected->Muon(i)->Pt(); + + // loop over all cuts and count + for (int j = 0; j < nmuoncuts; ++j) { + // increase counter if pt larger than cut value + if ( pt > fNMuonsPt[j].value) + nmuonspt[j]++; + } + } + + // check muon cuts + for (int i = 0; i < nmuoncuts; ++i) { + if (nmuonspt[i] != fNMuonsPt[i].n) + return 0; + } + } + + // increase counter + fCounterMuons++; + + + //------------ + // jet selection + //------------ + + int nbjets = 0; + + if (int(fNJetsPt.size()) > 0) + { + // counting variables + int njets = fParticlesSelected->NPartons(); + int njetcuts = int(fNJetsPt.size()); + std::vector<int> njetspt; + njetspt.assign(njetcuts, 0); + + // loop over jets + for (int i = 0; i < njets; ++i) + { + // get pt of jet + double pt = fParticlesSelected->Parton(i)->Pt(); + double tag = fParticlesSelected->BTagWeight(i); + // loop over all cuts and count + for (int j = 0; j < njetcuts; ++j) + { + // increase counter if pt larger than cut value + if ( pt > fNJetsPt.at(j).value) { + njetspt[j]++; + if (fNBJets.size()>0) { + if (tag > fNBJets.at(j).value) + nbjets++; + } + } + } + } + + // check jet cuts + for (int i = 0; i < njetcuts; ++i) + { + if (njetspt.at(i) < fNJetsPt.at(i).n) + return 0; + + if (fNJetsPt.at(i).dn >= 0 && njetspt.at(i) - fNJetsPt.at(i).n > fNJetsPt.at(i).dn) + return 0; + } + + RemoveAdditionalParticles(int(fMaxNJetsForFit), KLFitter::Particles::kParton); + + // increase counter + fCounterJets++; + + } + else { + // increase counter + fCounterJets++; + } + + // -------------- + // photon selection + // -------------- + + if (int(fNPhotonsPt.size()) > 0) + { + // counting variables + int nphotons = fParticlesSelected->NPhotons(); + int nphotoncuts = int(fNPhotonsPt.size()); + + std::vector<int> nphotonspt; + nphotonspt.assign(nphotoncuts, 0); + + // loop over photons + for (int i = 0; i < nphotons; ++i) + { + // get pt of photon + double pt = fParticlesSelected->Photon(i)->Pt(); + + // loop over all cuts and count + for (int j = 0; j < nphotoncuts; ++j) + { + // increase counter if pt larger than cut value + if ( pt > fNPhotonsPt.at(j).value) + nphotonspt[j]++; + } + } + + // check photon cuts + for (int i = 0; i < nphotoncuts; ++i) + { + if (nphotonspt.at(i) != fNPhotonsPt.at(i).n) + return 0; + } + } + + // increase counter + fCounterPhotons++; + + // MET selection + if (MET < fMET) + return 0; + + // increase counter + fCounterMET++; + + // MWT selection + if (MWT < fMWT) + return 0; + + // increase counter + fCounterMWT++; + + // triangular cut + if ( (MWT+MET) < fMET_plus_MWT) + return 0; + + // increase counter + fCounterTriangular++; + + // check jet cuts + if (fNBJets.size()>0) { + + if (nbjets < fNBJets.at(0).n) + return 0; + + if (fNBJets.at(0).dn >= 0 && nbjets - fNBJets.at(0).n > fNBJets.at(0).dn) + return 0; + } + + // increase counter + fCounterBJets++; + + + // increase counter + fCounterSelected++; + + // event passed + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireNBJets(double weight, int n, int dn){ + + // add cut to set of cuts + KLFitter::SelectionTool::Cut cut; + cut.value = weight; + cut.n = n; + cut.dn = dn; + fNBJets.push_back(cut); + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireNJetsPt(double pt, int n, int dn) +{ + if (pt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNJetsPt. Pt < 0 does not make sense." << std::endl; + return 0; + } + + if (n < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNJetsPt. n < 0 does not make sense." << std::endl; + return 0; + } + + // add cut to set of cuts + KLFitter::SelectionTool::Cut cut; + cut.value = pt; + cut.n = n; + cut.dn = dn; + fNJetsPt.push_back(cut); + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireNElectronsPt(double pt, int n) +{ + if (pt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNElectronsPt. Pt < 0 does not make sense." << std::endl; + return 0; + } + + if (n < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNElectronsPt. n < 0 does not make sense." << std::endl; + return 0; + } + + // add cut to set of cuts + KLFitter::SelectionTool::Cut cut; + cut.value = pt; + cut.n = n; + cut.dn = 0; + fNElectronsPt.push_back(cut); + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireNMuonsPt(double pt, int n) +{ + if (pt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNMuonsPt. Pt < 0 does not make sense." << std::endl; + return 0; + } + + if (n < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNMuonsPt. n < 0 does not make sense." << std::endl; + return 0; + } + + // add cut to set of cuts + KLFitter::SelectionTool::Cut cut; + cut.value = pt; + cut.n = n; + cut.dn = 0; + fNMuonsPt.push_back(cut); + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireNPhotonsPt(double pt, int n) +{ + if (pt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNPhotonsPt. Pt < 0 does not make sense." << std::endl; + return 0; + } + + if (n < 0) + { + std::cout << "KLFitter::SelectionTool::RequireNPhotonsPt. n < 0 does not make sense." << std::endl; + return 0; + } + + // add cut to set of cuts + KLFitter::SelectionTool::Cut cut; + cut.value = pt; + cut.n = n; + cut.dn = 0; + fNPhotonsPt.push_back(cut); + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireMET(double met) +{ + if (met < 0) + { + std::cout << "KLFitter::SelectionTool::RequireMET. Missing ET < 0 does not make sense." << std::endl; + return 0; + } + + fMET = met; + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireMWT(double mwt) +{ + if (mwt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireMWT. MWT < 0 does not make sense." << std::endl; + return 0; + } + + fMWT = mwt; + + // no errors + return 1; +} + +// --------------------------------------------------------- +int KLFitter::SelectionTool::RequireTriangular(double met_plus_mwt) +{ + if (met_plus_mwt < 0) + { + std::cout << "KLFitter::SelectionTool::RequireTriangular. MET+MWT < 0 does not make sense." << std::endl; + return 0; + } + + fMET_plus_MWT = met_plus_mwt; + + // no errors + return 1; +} + +// --------------------------------------------------------- +void KLFitter::SelectionTool::ResetMaps() +{ + fMapJets.clear(); + fMapElectrons.clear(); + fMapMuons.clear(); + fMapPhotons.clear(); +} + +// --------------------------------------------------------- +void KLFitter::SelectionTool::ResetCounter() +{ + fCounterEvents = 0; + fCounterJets = 0; + fCounterElectrons = 0; + fCounterMuons = 0; + fCounterPhotons = 0; + fCounterMET = 0; + fCounterMWT = 0; + fCounterTriangular = 0; + fCounterSelected = 0; +} + +// --------------------------------------------------------- +double KLFitter::SelectionTool::ObjectPtCut(std::vector<Cut> const& cuts) +{ + double tmp_pt = -1.0; + for (unsigned int iCut = 0; iCut < cuts.size(); iCut++) + { + if (tmp_pt > cuts.at(iCut).value || tmp_pt < 0) + { + tmp_pt = cuts.at(iCut).value; + } + } + return tmp_pt; +} + +// --------------------------------------------------------- +void KLFitter::SelectionTool::RemoveAdditionalParticles(int n, KLFitter::Particles::ParticleType type) +{ + // remove particles - starting with lowest pT ! + while (fParticlesSelected->NParticles(type) > n) + { + double pTmin = 0.; + int remove = -1; + for (int j = 0; j < fParticlesSelected->NParticles(type); ++j) + { + double pt = fParticlesSelected->Particle(j, type)->Pt(); + if (j == 0 || pt < pTmin) + { + pTmin = pt; + remove = j; + } + } + fParticlesSelected->RemoveParticle(remove, type); + std::vector<int>::iterator it = fMapJets.begin(); + for (int i = 0; i < remove; i++) + it++; + // fMapJets.erase(it); + } +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/readparameters.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/readparameters.cxx new file mode 100755 index 0000000000000000000000000000000000000000..246e40f5ca969ea65f2c37363a18337728b6240e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/Root/readparameters.cxx @@ -0,0 +1,170 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#define READPARAMETERS_CPP + +#include <iostream> +#include <fstream> +#include <string> +#include <vector> +#include <exception> + +#include "KLFitterExtras/readparameters.h" + +using namespace std; + +readparameters::readparameters(const char* filename) + :filename_(filename) { + ifstream file(filename); + if (file.fail()) { + readparameters_exception excep(string("Could not open ")+string(filename)+string(".")); + throw excep; + } + else { + + //reading and parsing of parameter file + //required syntax: + // + // [space]name value <value ... value>[#comment] + // + string line; + int linenumber=1; + typedef string::size_type string_size; + while (getline(file,line)) { + string_size i=0; + string_size size=line.size(); + //whitespace at the begining of the line + while (i!=size && isspace(line[i])) ++i; + string_size j=i; + if (j!=size && line[j]!='#') {//not end of line or a comment + + //keyname + string key; + while (j!=size && !isspace(line[j])) ++j; + if (i!=j) key=line.substr(i,j-i); + i=j; + //whitespace after keyname + while (i!=size && isspace(line[i])) ++i; + if (i!=size) { + vector<string> value; + if (line[i]=='"') { //string value + ++i; + j=i; + bool inquotes=true; + string val=""; + for (;i!=size;++i) { + if (inquotes) { + if (line[i]=='"') { //end of a string value + inquotes=false; + value.push_back(val); + val=""; + } + else if (line[i]=='\\') { //escape character + if (i+1==size) { + readparameters_exception excep((string(filename)+string(" line ")+int2string(linenumber)+string(": Unexpected end of line.")).c_str()); + throw excep; + + } + else { + if (line[i+1]=='\\') { + val+='\\'; + ++i; + } + else if (line[i+1]=='"') { + val+='"'; + ++i; + } + else val+='\\'; + } + } + else val+=line[i]; //add character or space to string + } + else {// not in quotes + if (line[i]=='#') break; //begin of a comment + else if (line[i]=='"') { //start of new string value + inquotes=true; + } + else if (!isspace(line[i])) { //syntax error + readparameters_exception excep(string(filename)+string(" line ")+int2string(linenumber)+string(": Syntax error.")); + throw excep; + } + } + + }//for + if (inquotes) { + readparameters_exception excep(string(filename)+string(" line ")+int2string(linenumber)+string(": Unexpected end of line.")); + throw excep; + } + } + else { //non-string value + while (i!=size && line[i]!='#') { + j=i; + while (i!=size && line[i]!='#' && !isspace(line[i]) ) ++i; + if (i!=j) { + value.push_back(line.substr(j,i-j)); + } + while (i!=size && isspace(line[i]) ) ++i; + } + + } + tabular[key]=value; + } + else { + //no value specified for key + readparameters_exception excep(string(filename)+string(" line ")+int2string(linenumber)+string(": No value specified for '")+key+string("'.")); + throw excep; + } + }//if not a comment + ++linenumber; + }//while getline + + }//file.fail +} + +readparameters::~readparameters() { +} + +template <> +string readparameters::get<string>(string name) const { + if (exists(name)) return tabular[name][0]; + else { + readparameters_exception excep(string("Parameter '")+name+string("' does not exist in ")+string(filename_)+string(".")); + throw excep; + } +} + +template <> +vector<string> readparameters::get_vector<string>(string name) const { + if (exists(name)) return tabular[name]; + else { + readparameters_exception excep(string("Parameter '")+name+string("' does not exist in ")+string(filename_)+string(".")); + throw excep; + } +} + +void readparameters::print_tabular() { + cout<<"\ntabular:"<<endl; + for (map<string,vector<string> >::iterator it=tabular.begin();it!=tabular.end();++it) { + cout<<"key: "<<(*it).first<<" value: "; + for (int i=0,N=(*it).second.size();i!=N;++i) cout<<(*it).second[i]<<" "; + cout<<endl; + } + return; +} + +const char* readparameters_exception::what() const throw() { + static string ret; + ret = string("readparameters exception: ")+what_; + return ret.c_str(); +} + +//useful conversion from int to a string +string int2string(int i) { + stringstream ss; + string ret; + ss << i; + ss >> ret; + return ret; +} + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..6631815647dea4ac5a7e2f1c0b0ccf6ead65dcff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/cmt/Makefile.RootCore @@ -0,0 +1,22 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + +PACKAGE = KLFitterExtras +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = KLFitter +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__config.conf b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__config.conf new file mode 100644 index 0000000000000000000000000000000000000000..d35927ca13933faa329c03a50c862feceea63333 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__config.conf @@ -0,0 +1,11 @@ +BTaggingMethod = VetoNoFit # Notag,Veto,VetoNoFit,WorkingPoint +CutBTagging = 0.601713 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input.txt +PathToOutputFile = out.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__input.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__input.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e90bd07c0c49db93c8a4fc5742388466b4a0094 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_allhadronic__input.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/a/adomeit/public/KLFitter/allhadronic.root \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__config.conf b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__config.conf new file mode 100644 index 0000000000000000000000000000000000000000..eedb0f03bcd65a0edb235f86dfa96cf8923ac205 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__config.conf @@ -0,0 +1,22 @@ +## electron or muon (dilepton) +LeptonType1 electron +LeptonType2 electron + +## Notag,Veto,VetoLight,VetoBoth,VetoNoFit,VetoNoFitLight,VetoNoFitBoth,WorkingPoint +BTaggingMethod WorkingPoint +CutBTagging 0.601713 + +FlagTopMassFixed 0 +TopPoleMass 172.5 + +## 7 or 10 +BeamCMEnergy 7 + +FlagIntegrate 0 +FlagWriteSignalMCTruth 1 +FlagTruthSel 1 +FlagSumloglik 0 + +PathToInputFile input_ee.txt +PathToOutputFile output.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_ee.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_ee.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bf649a5002a45f95be37d4e0c5311fa4e56785 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_ee.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/ee.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_em.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_em.txt new file mode 100644 index 0000000000000000000000000000000000000000..71bbb41b4b47a6f80b050b3f4389a4e593fd212b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_em.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/em.root \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_mm.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_mm.txt new file mode 100644 index 0000000000000000000000000000000000000000..405a3e5b3e499dac0f9f76081e4bb11a13c92272 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_dilepton__input_mm.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/mm.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__config.conf b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__config.conf new file mode 100644 index 0000000000000000000000000000000000000000..1830db4224c3bd86dd10693064c1e03bd080a13a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__config.conf @@ -0,0 +1,12 @@ +LeptonType = electron # electron or muon +BTaggingMethod = WorkingPoint # Notag,Veto,VetoLight,VetoBoth,VetoNoFit,VetoNoFitLight,VetoNoFitBoth,WorkingPoint +CutBTagging = 0.601713 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = false +FlagTruthSel = false +PathToInputFile = input.txt +PathToOutputFile = output.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e79d8bd7ddd23805e2946fe25bfe0553bdf3b08 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/el.root +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/mu.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input_full_el.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input_full_el.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets__input_full_el.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__config.conf b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__config.conf new file mode 100644 index 0000000000000000000000000000000000000000..4799cc91ad515d31cc4fe1233d990021e8f95cba --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__config.conf @@ -0,0 +1,13 @@ +LeptonType = electron # electron or muon +BTaggingMethod = WorkingPoint # Notag,Veto,WorkingPoint +CutBTagging = 3.00 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input.txt +PathToOutputFile = output.root +LJetSeparationMethod = PermReweight # None, PermReweight + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input_full_el.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input_full_el.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/top_ljets_udsep__input_full_el.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__config_ttH.conf b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__config_ttH.conf new file mode 100755 index 0000000000000000000000000000000000000000..8a385417633ff9702dfce859b7f114ee3b422dfd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__config_ttH.conf @@ -0,0 +1,14 @@ +LeptonType = electron # electron or muon +BTaggingMethod = Veto # Notag,Veto,WorkingPoint, kVetoBoth +CutBTagging = 0.601713 +FlagTopMassFixed = true +FlagHiggsMassFixed = false +TopPoleMass = 172.5 +HiggsMass = 125.0 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input_ttH.txt +PathToOutputFile = output_ttH.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__input_ttH.txt b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__input_ttH.txt new file mode 100755 index 0000000000000000000000000000000000000000..b9b15869fb6492de90b3a1007d4aa458ea1c7f2b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/data/ttH__input_ttH.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/l/lserkin/public/KLFitter_files/el_ttH125.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_allhadronic.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_allhadronic.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6ba0a1a67038bb38c2aee798372181c5fca0ecd7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_allhadronic.cxx @@ -0,0 +1,411 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_Allhadronic.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput_Allhadronic.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopAllHadronic.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + TString myfilename = "$ROOTCOREBIN/data/KLFitterExtras/top_allhadronic__config.conf"; + gSystem->ExpandPathName (myfilename); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile(myfilename.Data(), &valid); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_Allhadronic(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.497, 988.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/7TeV/ttbar/mc11c"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_7TeV(myfilename.Data()); + } else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/10TeV/ttbar"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_10TeV(myfilename.Data()); + } else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + + // create likelihood for ttbar->allhadronic channel + KLFitter::LikelihoodTopAllHadronic * myLikelihood = new KLFitter::LikelihoodTopAllHadronic(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput_Allhadronic * myInterfaceOutput = new KLFitter::InterfaceOutput_Allhadronic(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 6, -1); + + mySelectionTool -> SetMaxNJetsForFit(6); + mySelectionTool -> RequireNElectronsPt(20.0, 0); + mySelectionTool -> RequireNMuonsPt(20.0, 0); +// mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles)) + continue; + + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // check if there are more than two b-tagged jets if we're running in the kVetoNoFit mode + if(Btagmethod == KLFitter::LikelihoodTopAllHadronic::kVetoNoFit) + { + int nPartons = particles->NPartons(); + int nbTags = 0; + for (int iParton(0); iParton < nPartons; ++iParton) + { + if (particles->IsBTagged(iParton)) nbTags++; + } + //std::cout << nbTags << std::endl; + if (nbTags > 2 ) + continue; + } + + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + + + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + std::vector<int> v4 = myMatchingTool->ListMatchedTruth(4, KLFitter::Particles::kParton); + std::vector<int> v5 = myMatchingTool->ListMatchedTruth(5, KLFitter::Particles::kParton); + } + + + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) + { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark1| hadronic b quark2 | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | light quark 3 | light quark 4 | light quark | light quark |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E(), + InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E(), + OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | parBhad1E |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopAllHadronic::parTopM],ParErrors[KLFitter::LikelihoodTopAllHadronic::parTopM], + Par[KLFitter::LikelihoodTopAllHadronic::parBhad1E],ParErrors[KLFitter::LikelihoodTopAllHadronic::parBhad1E]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) + { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + countJMatch++; + } + } + + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + if (FlagWriteSignalMCTruth) + { + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (nTruthElectrons != 0) + return false; + if (nTruthMuons != 0) + return false; + if (nTruthTaus != 0) + return false; + + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=8) return false; + + return true; + +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_dilepton.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_dilepton.cxx new file mode 100644 index 0000000000000000000000000000000000000000..964e0ecff2f5c2db9f11107e60521b4e38d99ab9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_dilepton.cxx @@ -0,0 +1,641 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include <exception> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_dilepton.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput_dilepton.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopDilepton.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/readparameters.h" + +#include "BAT/BCModel.h" +#include "BAT/BCH1D.h" +#include "BAT/BCParameter.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopDilepton::LeptonType Lepton1, KLFitter::LikelihoodTopDilepton::LeptonType Lepton2); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + char* paramfile = argv[1]; + // parameters (1st: config_file, 2nd: 'first event', 3rd: 'last event - 1' + if (argc!=4) { // i.e. 3 parameters ... + std::cout << "number of parameters is unequal 3. Usage: ./runKLFitter.exe [config] [first-event] [last-event]" << std::endl; + return 1; + } + + ///// read configurating + + //auxiliar parameters + std::string tmp_Lepton1, tmp_Lepton2, tmp_Btagmethod; + int tmp_BeamEnergy; + + // parameters to read + KLFitter::LikelihoodTopDilepton::LeptonType Lepton1(KLFitter::LikelihoodTopDilepton::kElectron); + KLFitter::LikelihoodTopDilepton::LeptonType Lepton2(KLFitter::LikelihoodTopDilepton::kElectron); + bool FlagIntegrate; + bool FlagTopMassFixed; + bool FlagWriteSignalMCTruth; + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy; + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod; + double CutBTagging; + double MassTop; + std::string input_file; + std::string output_file; + bool FlagTruthSel; + bool FlagSumloglik; + + try { + readparameters rp(paramfile); + + tmp_Lepton1 = rp.get<std::string>("LeptonType1"); + tmp_Lepton2 = rp.get<std::string>("LeptonType2"); + FlagIntegrate = rp.get<bool>("FlagIntegrate"); + FlagTopMassFixed = rp.get<bool>("FlagTopMassFixed"); + FlagWriteSignalMCTruth = rp.get<bool>("FlagWriteSignalMCTruth"); + tmp_BeamEnergy = rp.get<int>("BeamCMEnergy"); + tmp_Btagmethod = rp.get<std::string>("BTaggingMethod"); + CutBTagging = rp.get<double>("CutBTagging"); + MassTop = rp.get<double>("TopPoleMass"); + input_file = rp.get<std::string>("PathToInputFile"); + output_file = rp.get<std::string>("PathToOutputFile"); + FlagTruthSel = rp.get<bool>("FlagTruthSel"); + FlagSumloglik = rp.get<bool>("FlagSumloglik"); + } + catch (std::exception& e) { + std::cerr<<e.what()<<std::endl; + return 0; + } + + // LeptonTypes 1 & 2 + if (tmp_Lepton1 == "electron") + Lepton1 = KLFitter::LikelihoodTopDilepton::kElectron; + else if (tmp_Lepton1 == "muon") + Lepton1 = KLFitter::LikelihoodTopDilepton::kMuon; + + if (tmp_Lepton2 == "electron") + Lepton2 = KLFitter::LikelihoodTopDilepton::kElectron; + else if (tmp_Lepton2 == "muon") + Lepton2 = KLFitter::LikelihoodTopDilepton::kMuon; + + // BeamEnergy + if(tmp_BeamEnergy==7) + BeamEnergy=KLFitter::DetectorBase::k7TeV; + if(tmp_BeamEnergy==10) + BeamEnergy=KLFitter::DetectorBase::k10TeV; + + // Btagmethod + if(tmp_Btagmethod == "Notag") + Btagmethod=KLFitter::LikelihoodBase::kNotag; + if(tmp_Btagmethod == "Veto") + Btagmethod=KLFitter::LikelihoodBase::kVeto; + if(tmp_Btagmethod == "VetoNoFit") + Btagmethod=KLFitter::LikelihoodBase::kVetoNoFit; + if(tmp_Btagmethod == "WorkingPoint") + Btagmethod=KLFitter::LikelihoodBase::kWorkingPoint; + + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // set minimization method to MCMC + myFitter->SetMinimizationMethod(KLFitter::Fitter::kSimulatedAnnealing); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_dilepton(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/7TeV/ttbar/mc11c"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_7TeV(myfilename.Data()); + } else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/10TeV/ttbar"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_10TeV(myfilename.Data()); + } else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + + /////////////////////////////////////////////////////////// + // sigma_nueta dependency on mtop (a + b*mtop) => push_back (a,b) + + std::vector<double> m_nu_params_ee; + std::vector<double> m_nu_params_emu; + std::vector<double> m_nu_params_mumu; + + m_nu_params_ee.push_back(1.207); + m_nu_params_ee.push_back(-2.4e-04); + + m_nu_params_emu.push_back(1.438); + m_nu_params_emu.push_back(-8.55e-04); + + m_nu_params_mumu.push_back(1.295); + m_nu_params_mumu.push_back(-4.00e-04); + /////////////////////////////////////////////////////////// + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopDilepton * myLikelihood = new KLFitter::LikelihoodTopDilepton(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << "in the ee channel" << std::endl; + myLikelihood -> SetLeptonType(1,1); // ee channel + myLikelihood -> SetEtaNuParams(m_nu_params_ee); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << "in the emu channel" << std::endl; + myLikelihood -> SetLeptonType(1,2); // emu channel + myLikelihood -> SetEtaNuParams(m_nu_params_emu); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << "in the mumu channel" << std::endl; + myLikelihood -> SetLeptonType(2,2); // mumu channel + myLikelihood -> SetEtaNuParams(m_nu_params_mumu); + } + else + std::cout << "Error: SetLeptonType1/2 wrong! check lepton types in config..." << std::endl; + + //if flag true, set "sumloglikelihood" option, instead of the default "bestpermutation" one + myLikelihood -> SetDoSumLogLik(FlagSumloglik); + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput_dilepton * myInterfaceOutput = new KLFitter::InterfaceOutput_dilepton(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 2, -1); // dilepton case +// mySelectionTool -> RequireNBJets(0.601713, 2, 0); // optional + + + mySelectionTool -> SetMaxNJetsForFit(2); // dilepton case (can be set to >2) + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + mySelectionTool -> RequireNElectronsPt(20.0, 2); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + mySelectionTool -> RequireNElectronsPt(20.0, 1); + mySelectionTool -> RequireNMuonsPt(20.0, 1); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + mySelectionTool -> RequireNMuonsPt(20.0, 2); + } + + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[2]).Atoi(); + int maxEv = TString(argv[3]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton1, Lepton2)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())){ + //std::cout << "*** event did not pass selection -> check! ***" << std::endl; + continue; + } + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add truth particles to fitter + if (FlagWriteSignalMCTruth) + if (!myFitter -> SetMyParticlesTruth(truthparticles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + } + + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + double inputE_lep1(0.); + double inputE_lep2(0.); + double outputE_lep1(0.); + double outputE_lep2(0.); + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + inputE_lep1 = InputParticles->Electron(0)->E(); + inputE_lep2 = InputParticles->Electron(1)->E(); + outputE_lep1 = OutputParticles->Electron(0)->E(); + outputE_lep2 = OutputParticles->Electron(1)->E(); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + inputE_lep1 = InputParticles->Electron(0)->E(); + inputE_lep2 = InputParticles->Muon(0)->E(); + outputE_lep1 = OutputParticles->Electron(0)->E(); + outputE_lep2 = OutputParticles->Muon(0)->E(); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + inputE_lep1 = InputParticles->Muon(0)->E(); + inputE_lep2 = InputParticles->Muon(1)->E(); + outputE_lep1 = OutputParticles->Muon(0)->E(); + outputE_lep2 = OutputParticles->Muon(1)->E(); + } + + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | b1 quark | b2 quark | lepton 1 | lepton 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + inputE_lep1, inputE_lep2); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + outputE_lep1, outputE_lep2); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability |\n"); + printf("Fitting Variables | %16.2f | %17.2E |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()) ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Top Pole Mass | Nu Eta | AntiNu Eta |\n"); + printf("Fitting Variables | %16.2f | %16.2f | %16.2f |\n", + Par[KLFitter::LikelihoodTopDilepton::parTopM],Par[KLFitter::LikelihoodTopDilepton::parNuEta],Par[KLFitter::LikelihoodTopDilepton::parAntiNuEta]); + printf("----------------------------------------------------------------------------------------------\n"); + + std::vector<double> LHCompVec = myFitter->Likelihood()->LogLikelihoodComponents( myFitter->Likelihood()->GetBestFitParameters() ); + + std::cout << "LHComp(0)= " << LHCompVec.at(0) << " LHComp(1)= " << LHCompVec.at(1) << " LHComp(2)= " << LHCompVec.at(2) << + " LHComp(3)= " << LHCompVec.at(3) << " LHComp(4)= " << LHCompVec.at(4) << std::endl; + std::cout << "LHComp(5)= " << LHCompVec.at(5) << " LHComp(6)= " << LHCompVec.at(6) <<" LHComp(7)= " << LHCompVec.at(7) << std::endl; + + } + + // // example: get marginalized histogram wrt Par(0)==mtop if using kMarkovChainMC!! +// BCParameter * a = myFitter->Likelihood()->GetParameter(0); + +// if(myFitter->Likelihood()->GetMarginalized(a)){ +// if(myFitter->Likelihood()->GetMarginalized(a)->GetHistogram()->Integral() > 0){ +// TH1D* h_mtop_marginalized = (TH1D *)myFitter->Likelihood()->GetMarginalized(a)->GetHistogram(); +// } +// }//get marginalized + + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { // considering tops in Partons + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + } + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << " N (e matched) : " << countLMatch << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (e&mu matched) : " << countLMatch << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (mu matched) : " << countLMatch << std::endl; + } + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopDilepton::LeptonType Lepton1, KLFitter::LikelihoodTopDilepton::LeptonType Lepton2) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + + // require exactly 2 truth electron + if (nTruthElectrons != 2) return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + // require exactly 1 truth electron + if (nTruthElectrons != 1) return false; + // require exactly 1 truth muon + if (nTruthMuons != 1) return false; + + // require no truth tau + if (nTruthTaus != 0) return false; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + // require exactly 2 truth muon + if (nTruthMuons != 2) return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 4 truth quarks (including the 2 tops) + if (nTruthPartons !=4) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchB1, int matchB2 + + // Match String to KLFitter Combinatorics + if (s == "0 1") return 0; + if (s == "1 0") return 1; + + return -1; + +} +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + + return s; +} +/////////////////////////////////////////////////////////// diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b355a8018bc566323b5d792590b20d08e765935f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets.cxx @@ -0,0 +1,492 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_ljets.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + TString myfilename = "$ROOTCOREBIN/data/KLFitterExtras/top_ljets__config.conf"; + gSystem->ExpandPathName (myfilename); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile(myfilename.Data(), &valid); + KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton = configReader->GetLeptonType(); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_ljets(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/7TeV/ttbar/mc11c"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_7TeV(myfilename.Data()); + } else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/10TeV/ttbar"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_10TeV(myfilename.Data()); + } else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopLeptonJets * myLikelihood = new KLFitter::LikelihoodTopLeptonJets(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 4, -1); +// mySelectionTool -> RequireNBJets(0.601713, 2, 0); + + + mySelectionTool -> SetMaxNJetsForFit(4); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + mySelectionTool -> RequireNElectronsPt(20.0, 1); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTopLeptonJets::parTopM], + Par[KLFitter::LikelihoodTopLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTopLeptonJets::parNuPz]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (muons ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (e matched) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (mu matched) : " << countLMatch << std::endl; + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + return s; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets_udsep.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets_udsep.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3f37843ab780e2306b0dc3867a8d7528859f7db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_top_ljets_udsep.cxx @@ -0,0 +1,523 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_udsep.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopLeptonJetsUDSep.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" +#include "TH1F.h" + + + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + + + + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1', 3rd: output file + if (argc!=4) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 3" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + TString myfilename = "$ROOTCOREBIN/data/KLFitterExtras/top_ljets_udsep__config.conf"; + gSystem->ExpandPathName (myfilename); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile(myfilename.Data(), &valid); + KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton = configReader->GetLeptonType(); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); +// std::string output_file=configReader->GetOutputPath(); + std::string output_file=argv[3]; + bool FlagTruthSel = configReader->GetFlagTruthSel(); + KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod LJetSeparationMethod = configReader->GetLJetSeparationMethod(); + std::string dir_cache; //caching current root directory. Enables to read another root file for the histos in between + + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_udsep(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/7TeV/ttbar/mc11c"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_7TeV(myfilename.Data()); + } else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/10TeV/ttbar"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_10TeV(myfilename.Data()); + } else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopLeptonJetsUDSep * myLikelihood = new KLFitter::LikelihoodTopLeptonJetsUDSep(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // next block: u/d separation histograms + myLikelihood -> SetLJetSeparationMethod(LJetSeparationMethod); + TFile *udhistos = 0x0; + if (LJetSeparationMethod != KLFitter::LikelihoodTopLeptonJetsUDSep::kNone){ + dir_cache = gDirectory->GetPath(); + udhistos = new TFile("udhistos.root"); + gDirectory->cd(dir_cache.c_str()); + gDirectory->pwd(); + myLikelihood -> SetUpJetPtHisto((TH1F*)udhistos->Get("up_pt")->Clone()); + myLikelihood -> SetDownJetPtHisto((TH1F*)udhistos->Get("down_pt")->Clone()); + myLikelihood -> SetUpJetTagWeightHisto((TH1F*)udhistos->Get("up_MV1")->Clone()); + myLikelihood -> SetDownJetTagWeightHisto((TH1F*)udhistos->Get("down_MV1")->Clone()); + myLikelihood -> SetBJetPtHisto((TH1F*)udhistos->Get("b_pt")->Clone()); + myLikelihood -> SetBJetTagWeightHisto((TH1F*)udhistos->Get("b_MV1")->Clone()); + } + + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 4, -1); + + mySelectionTool -> SetMaxNJetsForFit(4); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + mySelectionTool -> RequireNElectronsPt(20.0, 1); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + myInterfaceOutput -> FillTreeModelPermutation(); + + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTopLeptonJets::parTopM], + Par[KLFitter::LikelihoodTopLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTopLeptonJets::parNuPz]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + + + } + + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (muons ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (e matched) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (mu matched) : " << countLMatch << std::endl; + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (udhistos) + delete udhistos; + if (myMatchingTool) + delete myMatchingTool; + + + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + return s; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_ttH.cxx b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_ttH.cxx new file mode 100755 index 0000000000000000000000000000000000000000..5438c7c665d7f36950342b4e37ff0a1044976863 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/KLFitterExtras/util/runKLFitter_ttH.cxx @@ -0,0 +1,623 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_ttH.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTTHLeptonJets.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("config_ttH.conf", &valid); + KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton = (KLFitter::LikelihoodTTHLeptonJets::LeptonType) configReader->GetLeptonType(); + + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagHiggsMassFixed = configReader->GetFlagHiggsMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + double MassHiggs = configReader->GetHiggsMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + unsigned int count_bfromH = 0; + unsigned int count_bbarfromH = 0; + unsigned int count_0bsfromH = 0; + unsigned int count_1bsfromH = 0; + unsigned int count_2bsfromH = 0; + unsigned int count_b_overlap = 0; + unsigned int count_bbar_overlap = 0; + unsigned int count_both_overlap = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_ttH(); + + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/7TeV/ttbar/mc11c"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_7TeV(myfilename.Data()); + } else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + { + TString myfilename = "$ROOTCOREBIN/data/KLFitter/transferfunctions/10TeV/ttbar"; + gSystem->ExpandPathName (myfilename); + myDetector = new KLFitter::DetectorAtlas_10TeV(myfilename.Data()); + } else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbarH->e+jets channel + KLFitter::LikelihoodTTHLeptonJets * myLikelihood = new KLFitter::LikelihoodTTHLeptonJets(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + myLikelihood -> PhysicsConstants() -> SetMassHiggs(MassHiggs); + + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myLikelihood -> SetFlagHiggsMassFixed(FlagHiggsMassFixed); + + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kAcer); // hack to pick Pythia mathing + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 6, -1); + + // Require NBjets + mySelectionTool -> RequireNBJets(0.601713, 4, 0); + + // lepton selection + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + mySelectionTool -> RequireNElectronsPt(25.0, 1); + mySelectionTool -> RequireMET(30.); + mySelectionTool -> RequireMWT(30.); + } + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireTriangular(60.); + } + + // NJets to fit + mySelectionTool -> SetMaxNJetsForFit(6); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%100 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss(), myInterfaceRoot->MWT())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); // b from H + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); // bbar from H + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); // hadronic b quark + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); // leptonic b quark + std::vector<int> v4 = myMatchingTool->ListMatchedTruth(4, KLFitter::Particles::kParton); // light quark 1 + std::vector<int> v5 = myMatchingTool->ListMatchedTruth(5, KLFitter::Particles::kParton); // light quark 2 + + // std::cout << "True combination: " << GetTrueCombinationString(v0, v1, v2, v3, v4, v5) << std::endl; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 | Higgs b 1 | Higgs b 2 | \n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f | %15.2f | %15.2f | \n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), InputParticles->Parton(2)->E(), + InputParticles->Parton(3)->E(), InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E() ); + + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f | %15.2f | %15.2f | \n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), OutputParticles->Parton(2)->E(), + OutputParticles->Parton(3)->E(), OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E() ); + + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz | Higgs Mass | \n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f | %6.2f +- %5.2f | \n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTTHLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parTopM], + Par[KLFitter::LikelihoodTTHLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parNuPz], + Par[KLFitter::LikelihoodTTHLeptonJets::parHiggsM],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parHiggsM] ); + + + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + // check if b and bbar from H overlap + std::vector<int> BfromH_list = myMatchingTool -> ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> BbarfromH_list = myMatchingTool -> ListMatchedTruth(1, KLFitter::Particles::kParton); + + int ntruth = truthparticles->NPartons(); + int nmeasured = particles->NPartons(); + int nmatches_jets_bfromH = 0; + int nmatches_partons_bfromH = 0; + int nmatches_jets_bbarfromH = 0; + int nmatches_partons_bbarfromH = 0; + int index_bfromH = -1; + int index_bbarfromH = -1; + + for (int i = 0; i < nmeasured; ++i) { + int temp_b = myMatchingTool->MatchVectors(i, 0, KLFitter::Particles::kParton); + int temp_bbar = myMatchingTool->MatchVectors(i, 1, KLFitter::Particles::kParton); + nmatches_jets_bfromH += temp_b; + nmatches_jets_bbarfromH += temp_bbar; + if (temp_b > 0) + index_bfromH = i; + if (temp_bbar > 0) + index_bbarfromH = i; + } + + if (nmatches_jets_bfromH > 0) { + for (int j = 0; j < ntruth; ++j) { + int temp = myMatchingTool->MatchVectors(index_bfromH, j, KLFitter::Particles::kParton); + nmatches_partons_bfromH+=temp; + } + } + + if (nmatches_jets_bbarfromH > 0) { + for (int j = 0; j < ntruth; ++j) { + int temp = myMatchingTool->MatchVectors(index_bbarfromH, j, KLFitter::Particles::kParton); + nmatches_partons_bbarfromH+=temp; + } + } + + int nMatchedBfromH = myMatchingTool->NMatchedTruth(0, KLFitter::Particles::kParton); + int nMatchedBbarfromH = myMatchingTool->NMatchedTruth(1, KLFitter::Particles::kParton); + + // veto if overlap + if (nmatches_jets_bfromH == 1 && nmatches_partons_bfromH == 1) + nMatchedBfromH = 1; + else + nMatchedBfromH = 0; + + if (nmatches_jets_bbarfromH == 1 && nmatches_partons_bbarfromH == 1) + nMatchedBbarfromH = 1; + else + nMatchedBbarfromH = 0; + + if ( (nmatches_jets_bfromH > 1) || (nmatches_partons_bfromH > 1)) + count_b_overlap++; + if ( (nmatches_jets_bbarfromH > 1) || (nmatches_partons_bbarfromH > 1)) + count_bbar_overlap++; + if ( ((nmatches_jets_bfromH > 1) || (nmatches_partons_bfromH > 1)) + && ((nmatches_jets_bbarfromH > 1) || (nmatches_partons_bbarfromH > 1))) + count_both_overlap++; + + + // increase counter + if (nMatchedBfromH > 0) + count_bfromH++; + if (nMatchedBbarfromH > 0) + count_bbarfromH++; + + if (nMatchedBfromH == 0 && nMatchedBbarfromH == 0) + count_0bsfromH++; + else if ((nMatchedBfromH > 0 && nMatchedBbarfromH == 0) || (nMatchedBfromH == 0 && nMatchedBbarfromH > 0)) + count_1bsfromH++; + else if (nMatchedBfromH > 0 && nMatchedBbarfromH > 0) + count_2bsfromH++; + + bool leptonsMatched = false; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron > 0) + leptonsMatched = true; + } + } + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon > 0) + leptonsMatched = true; + } + } + + // if (!leptonsMatched) + // continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 2; iQuark < truthparticles -> NPartons()-3; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " Selection: " << std::endl; + std::cout << " ---------- " << std::endl; + std::cout << " N (after preselection) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + std::cout << " N (after electron cuts) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + std::cout << " N (after muon cuts ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (after jet cuts) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (after MET cuts) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (after MWT cuts) : " << mySelectionTool -> CounterMWT() << std::endl; + std::cout << " N (after triangular cuts) : " << mySelectionTool -> CounterTriangular() << std::endl; + std::cout << " N (after b-jet cuts) : " << mySelectionTool -> CounterBJets() << std::endl; + std::cout << " N (after all cuts) : " << mySelectionTool -> CounterSelected() << std::endl; + + if (FlagWriteSignalMCTruth) + { + std::cout << std::endl; + std::cout << " Matching: " << std::endl; + std::cout << " --------- " << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + std::cout << " N (with matched e ) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + std::cout << " N (with matched muon) : " << countLMatch << std::endl; + std::cout << " N (with b from H matched) : " << count_bfromH << std::endl; + std::cout << " N (with bbar from H matched) : " << count_bbarfromH << std::endl; + std::cout << " N (with 0 b's from H matched) : " << count_0bsfromH << std::endl; + std::cout << " N (with 1 b's from H matched) : " << count_1bsfromH << std::endl; + std::cout << " N (with 2 b's from H matched) : " << count_2bsfromH << std::endl; + std::cout << " N (with b overlap) : " << count_b_overlap << std::endl; + std::cout << " N (with bbar overlap) : " << count_bbar_overlap << std::endl; + std::cout << " N (with both overlap) : " << count_both_overlap << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + //int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 8 truth quarks (including the 2 tops) + // if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3, std::vector<int> v4, std::vector<int> v5) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v4.size(); i++) + if (v4.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v5.size(); i++) + if (v5.at(i) == 1) + s += i; + return s; +} + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Makefile b/PhysicsAnalysis/TopPhys/KLFitter/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8871e4698c1eb46f98aac8b8cdad31841e15b94f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Makefile @@ -0,0 +1,47 @@ +MACHINE = $(shell uname -s) +LINUX = Linux +MAC = Darwin + +INCDIR = KLFitter +SRCDIR = Root +OBJDIR = lib + +CXX = g++ +MKDIR = mkdir -p +RM = rm -f + +ROOTCFLAGS = $(shell root-config --cflags) +ROOTLIBS = $(shell root-config --libs) -lMinuit + +BATCFLAGS = -I$(BATINSTALLDIR) +BATLIBS = -L$(BATINSTALLDIR)/lib -lBAT + +SRC = $(wildcard $(SRCDIR)/*.cxx) +OBJ = $(SRC:$(SRCDIR)/%.cxx=$(OBJDIR)/%.o) +MAIN = $(wildcard *.c) +ifneq ($(MACHINE), $(MAC)) + LIBSO = libKLFitter.so + SOFLAGS = -shared +else + LIBSO = libKLFitter.dylib + SOFLAGS = -dynamiclib +endif + +GARBAGE = $(OBJ) $(LIBSO) + +CXXFLAGS = $(ROOTCFLAGS) $(BATCFLAGS) -I$/$(INCDIR) -Wall -Wno-deprecated -O2 -ggdb -g +ifneq ($(MACHINE), $(MAC)) + CXXFLAGS += -fPIC +endif +LIBS = $(ROOTLIBS) $(BATLIBS) + +# rule for shared library +$(LIBSO) : $(OBJ) + $(CXX) $(CXXFLAGS) $(LIBS) $(SOFLAGS) $+ -o $@ + +$(OBJDIR)/%.o: $(SRCDIR)/%.cxx $(INCDIR)/%.h + @if [ ! -e $(OBJDIR) ]; then $(MKDIR) $(OBJDIR); fi + $(CXX) $(CXXFLAGS) -c $< -o $@ + +clean: + $(RM) $(GARBAGE) diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/BoostedLikelihoodTopLeptonJets.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/BoostedLikelihoodTopLeptonJets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9ae7572fcb4ca3dc72feeb41457fc5ed8b089d9a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/BoostedLikelihoodTopLeptonJets.cxx @@ -0,0 +1,759 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/BoostedLikelihoodTopLeptonJets.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::BoostedLikelihoodTopLeptonJets::BoostedLikelihoodTopLeptonJets() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , fFlagGetParSigmasFromTFs(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::BoostedLikelihoodTopLeptonJets::~BoostedLikelihoodTopLeptonJets() +{ +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::BoostedLikelihoodTopLeptonJets::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::BoostedLikelihoodTopLeptonJets::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quarks", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // merged light jet (truth) + + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::BoostedLikelihoodTopLeptonJets::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // parBhadE + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // parBlepE + AddParameter("energy light quarks", fPhysicsConstants->MassW(), 1000.0); // parLQE + AddParameter("energy lepton", 0.0, 1000.0); // parLepE + AddParameter("p_x neutrino", -1000.0, 1000.0); // parNuPx + AddParameter("p_y neutrino", -1000.0, 1000.0); // parNuPy + AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz + AddParameter("top mass", 100.0, 1000.0); // parTopM +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + static double wlep_fit_e; + static double wlep_fit_px; + static double wlep_fit_py; + static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + // hadronic b quark + bhad_fit_e = parameters[parBhadE]; + scale = sqrt(bhad_fit_e*bhad_fit_e - bhad_meas_m*bhad_meas_m) / bhad_meas_p; + bhad_fit_px = scale * bhad_meas_px; + bhad_fit_py = scale * bhad_meas_py; + bhad_fit_pz = scale * bhad_meas_pz; + + // leptonic b quark + blep_fit_e = parameters[parBlepE]; + scale = sqrt(blep_fit_e*blep_fit_e - blep_meas_m*blep_meas_m) / blep_meas_p; + blep_fit_px = scale * blep_meas_px; + blep_fit_py = scale * blep_meas_py; + blep_fit_pz = scale * blep_meas_pz; + + // light quarks + lq_fit_e = parameters[parLQE]; + scale = sqrt(lq_fit_e*lq_fit_e - lq_meas_m*lq_meas_m) / lq_meas_p; + lq_fit_px = scale * lq_meas_px; + lq_fit_py = scale * lq_meas_py; + lq_fit_pz = scale * lq_meas_pz; + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = lq_fit_e+bhad_fit_e; + thad_fit_px = lq_fit_px+bhad_fit_px; + thad_fit_py = lq_fit_py+bhad_fit_py; + thad_fit_pz = lq_fit_pz+bhad_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+blep_fit_e; + tlep_fit_px = wlep_fit_px+blep_fit_px; + tlep_fit_py = wlep_fit_py+blep_fit_py; + tlep_fit_pz = wlep_fit_pz+blep_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // there are no invariant particle permutations with this likelihood + + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + // indexVector_Jets.push_back(2); + // indexVector_Jets.push_back(3); + // err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove invariant jet permutations of notevent jets + + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 3; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = fFlagGetParSigmasFromTFs ? 10 : 7; + double nsigmas_lepton = fFlagGetParSigmasFromTFs ? 10 : 2; + double nsigmas_met = fFlagGetParSigmasFromTFs ? 10 : 1; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double sigma = fFlagGetParSigmasFromTFs ? fResEnergyBhad->GetSigma(E) : sqrt(E); + double Emin = std::max(m, E - nsigmas_jet* sigma); + double Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBhadE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyBlep->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBlepE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = fPhysicsConstants->MassW(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQE, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E) : sqrt(E); + Emin = std::max(0.001, E - nsigmas_lepton* sigma); + Emax = E + nsigmas_lepton* sigma; + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E*sintheta)/sintheta : E*E*sintheta; + double sigrange=nsigmas_lepton* sigma; + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + // note: this is hard-coded in the momement + + sigma = fFlagGetParSigmasFromTFs ? fResMET->GetSigma(SumET) : 100; + double sigrange = nsigmas_met*sigma; + SetParameterRange(parNuPx, ETmiss_x-sigrange, ETmiss_x+sigrange); + SetParameterRange(parNuPy, ETmiss_y-sigrange, ETmiss_y+sigrange); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::BoostedLikelihoodTopLeptonJets::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ->p(lq_fit_e, lq_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of leptonically decaying top quark + logprob += BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::BoostedLikelihoodTopLeptonJets::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::BoostedLikelihoodTopLeptonJets::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhadE] = bhad_meas_e; + values[parBlepE] = blep_meas_e; + values[parLQE] = lq_meas_e; + + // energy of the lepton + if (fTypeLepton == kElectron) + values[parLepE] = (*fParticlesPermuted)->Electron(0)->E(); + else if (fTypeLepton == kMuon) + values[parLepE] = (*fParticlesPermuted)->Muon(0)->E(); + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0.; + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2)).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::BoostedLikelihoodTopLeptonJets::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::BoostedLikelihoodTopLeptonJets::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::BoostedLikelihoodTopLeptonJets::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::SavePermutedParticles() { + bhad_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad_meas_px, bhad_meas_py, bhad_meas_pz, bhad_meas_e); + bhad_meas_p = sqrt(bhad_meas_e*bhad_meas_e - bhad_meas_m*bhad_meas_m); + + blep_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + blep_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + blep_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + blep_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + blep_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + blep_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), blep_meas_px, blep_meas_py, blep_meas_pz, blep_meas_e); + blep_meas_p = sqrt(blep_meas_e*blep_meas_e - blep_meas_m*blep_meas_m); + + lq_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq_meas_px, lq_meas_py, lq_meas_pz, lq_meas_e); + lq_meas_p = sqrt(lq_meas_e*lq_meas_e - lq_meas_m*lq_meas_m); + + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::BoostedLikelihoodTopLeptonJets::SaveResolutionFunctions() { + + fResEnergyBhad = (*fDetector)->ResEnergyBJet(bhad_meas_deteta); + fResEnergyBlep = (*fDetector)->ResEnergyBJet(blep_meas_deteta); + fResEnergyLQ = (*fDetector)->ResEnergyLightJet(lq_meas_deteta); + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::BoostedLikelihoodTopLeptonJets::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad = fParticlesModel->Parton(0); + TLorentzVector * blep = fParticlesModel->Parton(1); + TLorentzVector * lq = fParticlesModel->Parton(2); + TLorentzVector * lep(0); + if (fTypeLepton == kElectron) + lep = fParticlesModel->Electron(0); + else if (fTypeLepton == kMuon) + lep = fParticlesModel->Muon(0); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * wlep = fParticlesModel->Boson(0); + TLorentzVector * thad = fParticlesModel->Parton(3); + TLorentzVector * tlep = fParticlesModel->Parton(4); + + bhad->SetPxPyPzE(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + blep->SetPxPyPzE(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + lq ->SetPxPyPzE(lq_fit_px, lq_fit_py, lq_fit_pz, lq_fit_e); + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*wlep) = (*lep) + (*nu); + (*thad) = (*lq) + (*bhad); + (*tlep) = (*wlep) + (*blep); + + // no error + return 1; +} +// --------------------------------------------------------- + +// --------------------------------------------------------- +std::vector<double> KLFitter::BoostedLikelihoodTopLeptonJets::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ->p(lq_fit_e, lq_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) )); //comp3 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + vecci.push_back(log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of leptonically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW)); //comp6 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop)); //comp7 + + // Breit-Wigner of leptonically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop)); //comp8 + + // return log of likelihood + return vecci; +} \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_7TeV.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_7TeV.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3afc4c4deb303d4a07672d4aec5966129d0ac603 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_7TeV.cxx @@ -0,0 +1,497 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/ResDoubleGaussPt.h" +#include "KLFitter/ResDoubleGaussE_1.h" +#include "KLFitter/ResDoubleGaussE_2.h" +#include "KLFitter/ResDoubleGaussE_3.h" +#include "KLFitter/ResGauss.h" +#include "KLFitter/ResGauss_MET.h" + +#include "TString.h" + +#include <cmath> +#include <iostream> +#include <stdlib.h> + +// --------------------------------------------------------- + +KLFitter::DetectorAtlas_7TeV::DetectorAtlas_7TeV(std::string folder) : DetectorBase() +{ + //check: powheg sample with 7TeV? Must use 8! + if (strstr(folder.c_str(), "mc11c_powheg")) { +std::cout<<"ERROR! Don't use PowHeg TFs with the 7TeV Detector class!!! Exiting..."<<std::endl; + exit(1); + } + //check: MC11b? New parametrization! + if ((strstr(folder.c_str(), "mc11b"))||(strstr(folder.c_str(), "mc11c"))){ +std::cout<<"Using TF from MC11b or later..."<<std::endl; + // energy resolution + fResEnergyLightJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta1.txt", folder.c_str())); + fResEnergyBJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_bJets_eta1.txt", folder.c_str())); + fResEnergyGluonJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta1.txt", folder.c_str())); + fResEnergyElectron_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta1.txt", folder.c_str())); + fResEnergyMuon_eta1 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta1.txt", folder.c_str())); + fResEnergyPhoton_eta1 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta1.txt", folder.c_str())); + + fResEnergyLightJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta2.txt", folder.c_str())); + fResEnergyBJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_bJets_eta2.txt", folder.c_str())); + fResEnergyGluonJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta2.txt", folder.c_str())); + fResEnergyElectron_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta2.txt", folder.c_str())); + fResEnergyMuon_eta2 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta2.txt", folder.c_str())); + fResEnergyPhoton_eta2 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta2.txt", folder.c_str())); + + fResEnergyLightJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta3.txt", folder.c_str())); + fResEnergyBJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_bJets_eta3.txt", folder.c_str())); + fResEnergyGluonJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta3.txt", folder.c_str())); + fResEnergyElectron_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta3.txt", folder.c_str())); + fResEnergyMuon_eta3 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta3.txt", folder.c_str())); + fResEnergyPhoton_eta3 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta3.txt", folder.c_str())); + + fResEnergyLightJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta4.txt", folder.c_str())); + fResEnergyBJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_bJets_eta4.txt", folder.c_str())); + fResEnergyGluonJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta4.txt", folder.c_str())); + fResEnergyElectron_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta4.txt", folder.c_str())); + fResEnergyPhoton_eta4 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta4.txt", folder.c_str())); + + fResEnergyLightJet_eta5 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta5.txt", folder.c_str())); + fResEnergyBJet_eta5 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_bJets_eta5.txt", folder.c_str())); + } else { +std::cout<<"Using TF from MC11a or earlier..."<<std::endl; + // energy resolution + fResEnergyLightJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta1.txt", folder.c_str())); + fResEnergyBJet_eta1 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta1.txt", folder.c_str())); + fResEnergyGluonJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta1.txt", folder.c_str())); + fResEnergyElectron_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta1.txt", folder.c_str())); + fResEnergyMuon_eta1 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta1.txt", folder.c_str())); + fResEnergyPhoton_eta1 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta1.txt", folder.c_str())); + + fResEnergyLightJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta2.txt", folder.c_str())); + fResEnergyBJet_eta2 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta2.txt", folder.c_str())); + fResEnergyGluonJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta2.txt", folder.c_str())); + fResEnergyElectron_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta2.txt", folder.c_str())); + fResEnergyMuon_eta2 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta2.txt", folder.c_str())); + fResEnergyPhoton_eta2 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta2.txt", folder.c_str())); + + fResEnergyLightJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta3.txt", folder.c_str())); + fResEnergyBJet_eta3 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta3.txt", folder.c_str())); + fResEnergyGluonJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta3.txt", folder.c_str())); + fResEnergyElectron_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta3.txt", folder.c_str())); + fResEnergyMuon_eta3 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta3.txt", folder.c_str())); + fResEnergyPhoton_eta3 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta3.txt", folder.c_str())); + + fResEnergyLightJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta4.txt", folder.c_str())); + fResEnergyBJet_eta4 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta4.txt", folder.c_str())); + fResEnergyGluonJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta4.txt", folder.c_str())); + fResEnergyElectron_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_Electrons_eta4.txt", folder.c_str())); + fResEnergyPhoton_eta4 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta4.txt", folder.c_str())); + + fResEnergyLightJet_eta5 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_lJets_eta5.txt", folder.c_str())); + fResEnergyBJet_eta5 = new KLFitter::ResDoubleGaussE_2(Form("%s/par_energy_bJets_eta5.txt", folder.c_str())); + } + + // eta resolution + fResEtaLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta1.txt", folder.c_str())); + fResEtaLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta2.txt", folder.c_str())); + fResEtaLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta3.txt", folder.c_str())); + fResEtaLightJet_eta4 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta4.txt", folder.c_str())); + + fResEtaBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta1.txt", folder.c_str())); + fResEtaBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta2.txt", folder.c_str())); + fResEtaBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta3.txt", folder.c_str())); + fResEtaBJet_eta4 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta4.txt", folder.c_str())); + + // phi resolution + fResPhiLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta1.txt", folder.c_str())); + fResPhiLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta2.txt", folder.c_str())); + fResPhiLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta3.txt", folder.c_str())); + fResPhiLightJet_eta4 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta4.txt", folder.c_str())); + + fResPhiBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta1.txt", folder.c_str())); + fResPhiBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta2.txt", folder.c_str())); + fResPhiBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta3.txt", folder.c_str())); + fResPhiBJet_eta4 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta4.txt", folder.c_str())); + + // missing et resolution in x and y + fResMissingET = new KLFitter::ResGauss_MET(Form("%s/par_misset.txt", folder.c_str())); + + // default settings + fResEnergyLightJet = fResEnergyLightJet_eta1; + fResEnergyBJet = fResEnergyBJet_eta1; + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + fResEnergyElectron = fResEnergyElectron_eta1; + fResEnergyMuon = fResEnergyMuon_eta1; + fResEnergyPhoton = fResEnergyPhoton_eta1; + fResEtaLightJet = fResEtaLightJet_eta1; + fResEtaBJet = fResEtaBJet_eta1; + fResPhiLightJet = fResPhiLightJet_eta1; + fResPhiBJet = fResPhiBJet_eta1; + + // Set eta binning for different objects starting with eta=0 + fJetEtaBin_1 = 0.8; + fJetEtaBin_2 = 1.37; + fJetEtaBin_3 = 1.52; + fJetEtaBin_4 = 2.5; + fJetEtaBin_5 = 4.5; + + fElectronEtaBin_1 = 0.8; + fElectronEtaBin_2 = 1.37; + fElectronEtaBin_3 = 1.52; + fElectronEtaBin_4 = 2.5; + + fMuonEtaBin_1 = 1.11; + fMuonEtaBin_2 = 1.25; + fMuonEtaBin_3 = 2.5; + + fPhotonEtaBin_1 = 1.11; + fPhotonEtaBin_2 = 1.25; + fPhotonEtaBin_3 = 2.5; + fPhotonEtaBin_4 = 3.0; + +} + +// --------------------------------------------------------- + +KLFitter::DetectorAtlas_7TeV::~DetectorAtlas_7TeV() +{ + if (fResEnergyLightJet_eta1) + delete fResEnergyLightJet_eta1; + + if (fResEnergyLightJet_eta2) + delete fResEnergyLightJet_eta2; + + if (fResEnergyLightJet_eta3) + delete fResEnergyLightJet_eta3; + + if (fResEnergyLightJet_eta4) + delete fResEnergyLightJet_eta4; + + if (fResEnergyLightJet_eta5) + delete fResEnergyLightJet_eta5; + + if (fResEnergyBJet_eta1) + delete fResEnergyBJet_eta1; + + if (fResEnergyBJet_eta2) + delete fResEnergyBJet_eta2; + + if (fResEnergyBJet_eta3) + delete fResEnergyBJet_eta3; + + if (fResEnergyBJet_eta4) + delete fResEnergyBJet_eta4; + + if (fResEnergyBJet_eta5) + delete fResEnergyBJet_eta5; + + if (fResEnergyGluonJet_eta1) + delete fResEnergyGluonJet_eta1; + + if (fResEnergyGluonJet_eta2) + delete fResEnergyGluonJet_eta2; + + if (fResEnergyGluonJet_eta3) + delete fResEnergyGluonJet_eta3; + + if (fResEnergyGluonJet_eta4) + delete fResEnergyGluonJet_eta4; + + if (fResEnergyElectron_eta1) + delete fResEnergyElectron_eta1; + + if (fResEnergyElectron_eta2) + delete fResEnergyElectron_eta2; + + if (fResEnergyElectron_eta3) + delete fResEnergyElectron_eta3; + + if (fResEnergyElectron_eta4) + delete fResEnergyElectron_eta4; + + if (fResEnergyPhoton_eta1) + delete fResEnergyMuon_eta1; + + if (fResEnergyMuon_eta2) + delete fResEnergyMuon_eta2; + + if (fResEnergyMuon_eta3) + delete fResEnergyMuon_eta3; + + if (fResEnergyPhoton_eta1) + delete fResEnergyPhoton_eta1; + + if (fResEnergyPhoton_eta2) + delete fResEnergyPhoton_eta2; + + if (fResEnergyPhoton_eta3) + delete fResEnergyPhoton_eta3; + + if (fResEnergyPhoton_eta4) + delete fResEnergyPhoton_eta4; + + if (fResEtaLightJet_eta1) + delete fResEtaLightJet_eta1; + + if (fResEtaLightJet_eta2) + delete fResEtaLightJet_eta2; + + if (fResEtaLightJet_eta3) + delete fResEtaLightJet_eta3; + + if (fResEtaLightJet_eta4) + delete fResEtaLightJet_eta4; + + if (fResEtaBJet_eta1) + delete fResEtaBJet_eta1; + + if (fResEtaBJet_eta2) + delete fResEtaBJet_eta2; + + if (fResEtaBJet_eta3) + delete fResEtaBJet_eta3; + + if (fResEtaBJet_eta4) + delete fResEtaBJet_eta4; + + if (fResPhiLightJet_eta1) + delete fResPhiLightJet_eta1; + + if (fResPhiLightJet_eta2) + delete fResPhiLightJet_eta2; + + if (fResPhiLightJet_eta3) + delete fResPhiLightJet_eta3; + + if (fResPhiLightJet_eta4) + delete fResPhiLightJet_eta4; + + if (fResPhiBJet_eta1) + delete fResPhiBJet_eta1; + + if (fResPhiBJet_eta2) + delete fResPhiBJet_eta2; + + if (fResPhiBJet_eta3) + delete fResPhiBJet_eta3; + + if (fResPhiBJet_eta4) + delete fResPhiBJet_eta4; + + if (fResMissingET) + delete fResMissingET; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyLightJet = fResEnergyLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyLightJet = fResEnergyLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyLightJet = fResEnergyLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyLightJet = fResEnergyLightJet_eta4; + else if (fabs(eta) <= fJetEtaBin_5) + fResEnergyLightJet = fResEnergyLightJet_eta5; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyBJet = fResEnergyBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyBJet = fResEnergyBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyBJet = fResEnergyBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyBJet = fResEnergyBJet_eta4; + else if (fabs(eta) <= fJetEtaBin_5) + fResEnergyBJet = fResEnergyBJet_eta5; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyGluonJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyGluonJet = fResEnergyGluonJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyGluonJet = fResEnergyGluonJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyGluonJet = fResEnergyGluonJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyGluonJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyGluonJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyElectron(double eta) +{ + if (fabs(eta) < fElectronEtaBin_1) + fResEnergyElectron = fResEnergyElectron_eta1; + else if (fabs(eta) < fElectronEtaBin_2) + fResEnergyElectron = fResEnergyElectron_eta2; + else if (fabs(eta) < fElectronEtaBin_3){ + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyElectron(). Electron in crack region" << std::endl; + return 0; + } + else if (fabs(eta) <= fElectronEtaBin_4) + fResEnergyElectron = fResEnergyElectron_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyElectron(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyElectron; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyMuon(double eta) +{ + if (fabs(eta) < fMuonEtaBin_1) + fResEnergyMuon = fResEnergyMuon_eta1; + else if (fabs(eta) < fMuonEtaBin_2) + fResEnergyMuon = fResEnergyMuon_eta2; + else if (fabs(eta) < fMuonEtaBin_3) + fResEnergyMuon = fResEnergyMuon_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyMuon(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyMuon; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEnergyPhoton(double eta) +{ + if (fabs(eta) < fPhotonEtaBin_1) + fResEnergyPhoton = fResEnergyPhoton_eta1; + else if (fabs(eta) < fPhotonEtaBin_2) + fResEnergyPhoton = fResEnergyPhoton_eta2; + else if (fabs(eta) < fPhotonEtaBin_3) + fResEnergyPhoton = fResEnergyPhoton_eta3; + else if (fabs(eta) <= fPhotonEtaBin_4) + fResEnergyPhoton = fResEnergyPhoton_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEnergyPhoton(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyPhoton; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEtaLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEtaLightJet = fResEtaLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEtaLightJet = fResEtaLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEtaLightJet = fResEtaLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEtaLightJet = fResEtaLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEtaLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResEtaBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEtaBJet = fResEtaBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEtaBJet = fResEtaBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEtaBJet = fResEtaBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEtaBJet = fResEtaBJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResEtaBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResPhiLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResPhiLightJet = fResPhiLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResPhiLightJet = fResPhiLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResPhiLightJet = fResPhiLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResPhiLightJet = fResPhiLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResPhiLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResPhiLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResPhiBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResPhiBJet = fResPhiBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResPhiBJet = fResPhiBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResPhiBJet = fResPhiBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResPhiLightJet = fResPhiLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_7TeV::ResPhiBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResPhiBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_7TeV::ResMissingET() +{ + return fResMissingET; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_8TeV.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_8TeV.cxx new file mode 100644 index 0000000000000000000000000000000000000000..56ec69d75929eec0860fd2d2c27e64402b589e1a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorAtlas_8TeV.cxx @@ -0,0 +1,460 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/DetectorAtlas_8TeV.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/ResDoubleGaussPt.h" +#include "KLFitter/ResDoubleGaussE_1.h" +#include "KLFitter/ResDoubleGaussE_2.h" +#include "KLFitter/ResDoubleGaussE_3.h" +#include "KLFitter/ResDoubleGaussE_4.h" +#include "KLFitter/ResDoubleGaussE_5.h" +#include "KLFitter/ResGauss.h" +#include "KLFitter/ResGauss_MET.h" + +#include "TString.h" + +#include <cmath> +#include <iostream> + +// --------------------------------------------------------- + +KLFitter::DetectorAtlas_8TeV::DetectorAtlas_8TeV(std::string folder) : DetectorBase() +{ + +std::cout<<"Using TF from MC12 ..."<<std::endl; + // energy resolution + fResEnergyLightJet_eta1 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_lJets_eta1.txt", folder.c_str())); + fResEnergyBJet_eta1 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_bJets_eta1.txt", folder.c_str())); + fResEnergyGluonJet_eta1 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta1.txt", folder.c_str())); + fResEnergyElectron_eta1 = new KLFitter::ResDoubleGaussE_5(Form("%s/par_energy_Electrons_eta1.txt", folder.c_str())); + fResEnergyMuon_eta1 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta1.txt", folder.c_str())); + fResEnergyPhoton_eta1 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta1.txt", folder.c_str())); + + fResEnergyLightJet_eta2 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_lJets_eta2.txt", folder.c_str())); + fResEnergyBJet_eta2 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_bJets_eta2.txt", folder.c_str())); + fResEnergyGluonJet_eta2 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta2.txt", folder.c_str())); + fResEnergyElectron_eta2 = new KLFitter::ResDoubleGaussE_5(Form("%s/par_energy_Electrons_eta2.txt", folder.c_str())); + fResEnergyMuon_eta2 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta2.txt", folder.c_str())); + fResEnergyPhoton_eta2 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta2.txt", folder.c_str())); + + fResEnergyLightJet_eta3 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_lJets_eta3.txt", folder.c_str())); + fResEnergyBJet_eta3 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_bJets_eta3.txt", folder.c_str())); + fResEnergyGluonJet_eta3 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta3.txt", folder.c_str())); + fResEnergyElectron_eta3 = new KLFitter::ResDoubleGaussE_5(Form("%s/par_energy_Electrons_eta3.txt", folder.c_str())); + fResEnergyMuon_eta3 = new KLFitter::ResDoubleGaussPt(Form("%s/par_energy_Muons_eta3.txt", folder.c_str())); + fResEnergyPhoton_eta3 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta3.txt", folder.c_str())); + + fResEnergyLightJet_eta4 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_lJets_eta4.txt", folder.c_str())); + fResEnergyBJet_eta4 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_bJets_eta4.txt", folder.c_str())); + fResEnergyGluonJet_eta4 = new KLFitter::ResDoubleGaussE_1(Form("%s/par_energy_gluon_eta4.txt", folder.c_str())); + fResEnergyElectron_eta4 = new KLFitter::ResDoubleGaussE_5(Form("%s/par_energy_Electrons_eta4.txt", folder.c_str())); + fResEnergyPhoton_eta4 = new KLFitter::ResGauss(Form("%s/par_energy_photon_eta4.txt", folder.c_str())); + +// fResEnergyLightJet_eta5 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_lJets_eta5.txt", folder.c_str())); +// fResEnergyBJet_eta5 = new KLFitter::ResDoubleGaussE_4(Form("%s/par_energy_bJets_eta5.txt", folder.c_str())); + + // eta resolution + fResEtaLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta1.txt", folder.c_str())); + fResEtaLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta2.txt", folder.c_str())); + fResEtaLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta3.txt", folder.c_str())); + fResEtaLightJet_eta4 = new KLFitter::ResGauss(Form("%s/par_eta_lJets_eta4.txt", folder.c_str())); + + fResEtaBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta1.txt", folder.c_str())); + fResEtaBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta2.txt", folder.c_str())); + fResEtaBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta3.txt", folder.c_str())); + fResEtaBJet_eta4 = new KLFitter::ResGauss(Form("%s/par_eta_bJets_eta4.txt", folder.c_str())); + + // phi resolution + fResPhiLightJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta1.txt", folder.c_str())); + fResPhiLightJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta2.txt", folder.c_str())); + fResPhiLightJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta3.txt", folder.c_str())); + fResPhiLightJet_eta4 = new KLFitter::ResGauss(Form("%s/par_phi_lJets_eta4.txt", folder.c_str())); + + fResPhiBJet_eta1 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta1.txt", folder.c_str())); + fResPhiBJet_eta2 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta2.txt", folder.c_str())); + fResPhiBJet_eta3 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta3.txt", folder.c_str())); + fResPhiBJet_eta4 = new KLFitter::ResGauss(Form("%s/par_phi_bJets_eta4.txt", folder.c_str())); + + // missing et resolution in x and y + fResMissingET = new KLFitter::ResGauss_MET(Form("%s/par_misset.txt", folder.c_str())); + + // default settings + fResEnergyLightJet = fResEnergyLightJet_eta1; + fResEnergyBJet = fResEnergyBJet_eta1; + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + fResEnergyElectron = fResEnergyElectron_eta1; + fResEnergyMuon = fResEnergyMuon_eta1; + fResEnergyPhoton = fResEnergyPhoton_eta1; + fResEtaLightJet = fResEtaLightJet_eta1; + fResEtaBJet = fResEtaBJet_eta1; + fResPhiLightJet = fResPhiLightJet_eta1; + fResPhiBJet = fResPhiBJet_eta1; + + // Set eta binning for different objects starting with eta=0 + fJetEtaBin_1 = 0.8; + fJetEtaBin_2 = 1.37; + fJetEtaBin_3 = 1.52; + fJetEtaBin_4 = 2.50001; +// fJetEtaBin_5 = 4.5; + + fElectronEtaBin_1 = 0.8; + fElectronEtaBin_2 = 1.37; + fElectronEtaBin_3 = 1.52; + fElectronEtaBin_4 = 2.50001; + + fMuonEtaBin_1 = 1.11; + fMuonEtaBin_2 = 1.25; + fMuonEtaBin_3 = 2.50001; + + fPhotonEtaBin_1 = 1.11; + fPhotonEtaBin_2 = 1.25; + fPhotonEtaBin_3 = 2.5; + fPhotonEtaBin_4 = 3.0; + +} + +// --------------------------------------------------------- + +KLFitter::DetectorAtlas_8TeV::~DetectorAtlas_8TeV() +{ + if (fResEnergyLightJet_eta1) + delete fResEnergyLightJet_eta1; + + if (fResEnergyLightJet_eta2) + delete fResEnergyLightJet_eta2; + + if (fResEnergyLightJet_eta3) + delete fResEnergyLightJet_eta3; + + if (fResEnergyLightJet_eta4) + delete fResEnergyLightJet_eta4; + +// if (fResEnergyLightJet_eta5) +// delete fResEnergyLightJet_eta5; + + if (fResEnergyBJet_eta1) + delete fResEnergyBJet_eta1; + + if (fResEnergyBJet_eta2) + delete fResEnergyBJet_eta2; + + if (fResEnergyBJet_eta3) + delete fResEnergyBJet_eta3; + + if (fResEnergyBJet_eta4) + delete fResEnergyBJet_eta4; + +// if (fResEnergyBJet_eta5) +// delete fResEnergyBJet_eta5; + + if (fResEnergyGluonJet_eta1) + delete fResEnergyGluonJet_eta1; + + if (fResEnergyGluonJet_eta2) + delete fResEnergyGluonJet_eta2; + + if (fResEnergyGluonJet_eta3) + delete fResEnergyGluonJet_eta3; + + if (fResEnergyGluonJet_eta4) + delete fResEnergyGluonJet_eta4; + + if (fResEnergyElectron_eta1) + delete fResEnergyElectron_eta1; + + if (fResEnergyElectron_eta2) + delete fResEnergyElectron_eta2; + + if (fResEnergyElectron_eta3) + delete fResEnergyElectron_eta3; + + if (fResEnergyElectron_eta4) + delete fResEnergyElectron_eta4; + + if (fResEnergyPhoton_eta1) + delete fResEnergyMuon_eta1; + + if (fResEnergyMuon_eta2) + delete fResEnergyMuon_eta2; + + if (fResEnergyMuon_eta3) + delete fResEnergyMuon_eta3; + + if (fResEnergyPhoton_eta1) + delete fResEnergyPhoton_eta1; + + if (fResEnergyPhoton_eta2) + delete fResEnergyPhoton_eta2; + + if (fResEnergyPhoton_eta3) + delete fResEnergyPhoton_eta3; + + if (fResEnergyPhoton_eta4) + delete fResEnergyPhoton_eta4; + + if (fResEtaLightJet_eta1) + delete fResEtaLightJet_eta1; + + if (fResEtaLightJet_eta2) + delete fResEtaLightJet_eta2; + + if (fResEtaLightJet_eta3) + delete fResEtaLightJet_eta3; + + if (fResEtaLightJet_eta4) + delete fResEtaLightJet_eta4; + + if (fResEtaBJet_eta1) + delete fResEtaBJet_eta1; + + if (fResEtaBJet_eta2) + delete fResEtaBJet_eta2; + + if (fResEtaBJet_eta3) + delete fResEtaBJet_eta3; + + if (fResEtaBJet_eta4) + delete fResEtaBJet_eta4; + + if (fResPhiLightJet_eta1) + delete fResPhiLightJet_eta1; + + if (fResPhiLightJet_eta2) + delete fResPhiLightJet_eta2; + + if (fResPhiLightJet_eta3) + delete fResPhiLightJet_eta3; + + if (fResPhiLightJet_eta4) + delete fResPhiLightJet_eta4; + + if (fResPhiBJet_eta1) + delete fResPhiBJet_eta1; + + if (fResPhiBJet_eta2) + delete fResPhiBJet_eta2; + + if (fResPhiBJet_eta3) + delete fResPhiBJet_eta3; + + if (fResPhiBJet_eta4) + delete fResPhiBJet_eta4; + + if (fResMissingET) + delete fResMissingET; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyLightJet = fResEnergyLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyLightJet = fResEnergyLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyLightJet = fResEnergyLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyLightJet = fResEnergyLightJet_eta4; +// else if (fabs(eta) <= fJetEtaBin_5) +// fResEnergyLightJet = fResEnergyLightJet_eta5; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyBJet = fResEnergyBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyBJet = fResEnergyBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyBJet = fResEnergyBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyBJet = fResEnergyBJet_eta4; +// else if (fabs(eta) <= fJetEtaBin_5) +// fResEnergyBJet = fResEnergyBJet_eta5; + else + { + + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyGluonJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEnergyGluonJet = fResEnergyGluonJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEnergyGluonJet = fResEnergyGluonJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEnergyGluonJet = fResEnergyGluonJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEnergyGluonJet = fResEnergyGluonJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyGluonJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyGluonJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyElectron(double eta) +{ + if (fabs(eta) < fElectronEtaBin_1) + fResEnergyElectron = fResEnergyElectron_eta1; + else if (fabs(eta) < fElectronEtaBin_2) + fResEnergyElectron = fResEnergyElectron_eta2; + else if (fabs(eta) < fElectronEtaBin_3){ + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyElectron(). Electron in crack region" << std::endl; + return 0; + } + else if (fabs(eta) <= fElectronEtaBin_4) + fResEnergyElectron = fResEnergyElectron_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyElectron(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyElectron; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyMuon(double eta) +{ + if (fabs(eta) < fMuonEtaBin_1) + fResEnergyMuon = fResEnergyMuon_eta1; + else if (fabs(eta) < fMuonEtaBin_2) + fResEnergyMuon = fResEnergyMuon_eta2; + else if (fabs(eta) < fMuonEtaBin_3) + fResEnergyMuon = fResEnergyMuon_eta3; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyMuon(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyMuon; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEnergyPhoton(double eta) +{ + if (fabs(eta) < fPhotonEtaBin_1) + fResEnergyPhoton = fResEnergyPhoton_eta1; + else if (fabs(eta) < fPhotonEtaBin_2) + fResEnergyPhoton = fResEnergyPhoton_eta2; + else if (fabs(eta) < fPhotonEtaBin_3) + fResEnergyPhoton = fResEnergyPhoton_eta3; + else if (fabs(eta) <= fPhotonEtaBin_4) + fResEnergyPhoton = fResEnergyPhoton_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEnergyPhoton(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEnergyPhoton; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEtaLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEtaLightJet = fResEtaLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEtaLightJet = fResEtaLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEtaLightJet = fResEtaLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEtaLightJet = fResEtaLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEtaLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResEtaBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResEtaBJet = fResEtaBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResEtaBJet = fResEtaBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResEtaBJet = fResEtaBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResEtaBJet = fResEtaBJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResEtaBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResEtaBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResPhiLightJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResPhiLightJet = fResPhiLightJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResPhiLightJet = fResPhiLightJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResPhiLightJet = fResPhiLightJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResPhiLightJet = fResPhiLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResPhiLightJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResPhiLightJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResPhiBJet(double eta) +{ + if (fabs(eta) < fJetEtaBin_1) + fResPhiBJet = fResPhiBJet_eta1; + else if (fabs(eta) < fJetEtaBin_2) + fResPhiBJet = fResPhiBJet_eta2; + else if (fabs(eta) < fJetEtaBin_3) + fResPhiBJet = fResPhiBJet_eta3; + else if (fabs(eta) <= fJetEtaBin_4) + fResPhiLightJet = fResPhiLightJet_eta4; + else + { + std::cout << "KLFitter::DetectorAtlas_8TeV::ResPhiBJet(). Eta range exceeded." << std::endl; + return 0; + } + + return fResPhiBJet; +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase * KLFitter::DetectorAtlas_8TeV::ResMissingET() +{ + return fResMissingET; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorBase.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d11cb0991812831fbb0a36573bd2fa18176d47a5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/DetectorBase.cxx @@ -0,0 +1,146 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/DetectorBase.h" +#include "KLFitter/ResolutionBase.h" +#include <iostream> + +// --------------------------------------------------------- +KLFitter::DetectorBase::DetectorBase(std::string /*folder*/) : + fResEnergyLightJet(0), + fResEnergyBJet(0), + fResEnergyGluonJet(0), + fResEnergyElectron(0), + fResEnergyMuon(0), + fResEnergyPhoton(0), + fResMissingET(0) +{ +} + +// --------------------------------------------------------- +KLFitter::DetectorBase::~DetectorBase() +{ +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyBJet(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyBJet = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyLightJet(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyLightJet = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyGluonJet(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyGluonJet = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyElectron(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyElectron = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyMuon(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyMuon = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResEnergyPhoton(KLFitter::ResolutionBase * res) +{ + // set resolution + fResEnergyPhoton = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::SetResMissingET(KLFitter::ResolutionBase * res) +{ + // set resolution + fResMissingET = res; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::DetectorBase::Status() +{ + if (!fResEnergyLightJet) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of light jets not defined." << std::endl; + return 0; + } + + if (!fResEnergyBJet) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of b jets not defined." << std::endl; + return 0; + } + + if (!fResEnergyGluonJet) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of gluon jets not defined." << std::endl; + return 0; + } + + if (!fResEnergyElectron) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of electrons not defined." << std::endl; + return 0; + } + + if (!fResEnergyMuon) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of muons not defined." << std::endl; + return 0; + } + + if (!fResEnergyPhoton) + { + std::cout << "KLFitter::DetectorBase::Status(). Energy resolution of photons not defined." << std::endl; + return 0; + } + + if (!fResMissingET) + { + std::cout << "KLFitter::DetectorBase::Status(). Missing ET resolution not defined." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/Fitter.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/Fitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c52e82e6d72d933f0c8d5ee4d13454e3e49dde09 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/Fitter.cxx @@ -0,0 +1,414 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/Fitter.h" +#include "KLFitter/DetectorBase.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/Particles.h" + +#include <iostream> + +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::Fitter::Fitter() +{ + fDetector = 0; + fLikelihood = 0; + fParticles = 0; + ETmiss_x = 0.; + ETmiss_y = 0.; + SumET = 0.; + fParticlesPermuted = 0; + fMyParticlesTruth = 0; + fPermutations = new KLFitter::Permutations(&fParticles, &fParticlesPermuted); + fMinuitStatus = 0; + fConvergenceStatus = 0; + fTurnOffSA = false; + fMinimizationMethod = kMinuit; +} + +// --------------------------------------------------------- +KLFitter::Fitter::~Fitter() +{ + if (fPermutations) + delete fPermutations; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::SetParticles(KLFitter::Particles * particles, int nPartonsInPermutations) +{ + fParticles = particles; + + // reset old table of permutations + if (fPermutations) + fPermutations->Reset(); + + // create table of permutations + fPermutations->CreatePermutations(nPartonsInPermutations); + + // remove invariant permutations if likelihood exists + if (fLikelihood) + fLikelihood->RemoveInvariantParticlePermutations(); + + // remove forbidden permutations + if (fLikelihood) + fLikelihood->RemoveForbiddenParticlePermutations(); + + // set first permutation + if (!fPermutations->SetPermutation(0)) + return 0; + + // get new permutation + fParticlesPermuted = fPermutations->ParticlesPermuted(); + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::Fitter::SetMyParticlesTruth(KLFitter::Particles * particles) +{ + fMyParticlesTruth = particles; + + // set pointer to truth particles + + fLikelihood->SetMyParticlesTruth(&fMyParticlesTruth); + + //std:: cout << "fMyParticlesTruth set in Fitter!!!!!" << std::endl; + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::Fitter::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and sumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::SetDetector(KLFitter::DetectorBase * detector) +{ + // set detector + fDetector = detector; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::SetLikelihood(KLFitter::LikelihoodBase * likelihood) +{ + // set likelihood + fLikelihood = likelihood; + + // set pointer to pointer of detector + fLikelihood->SetDetector(&fDetector); + + // set pointer to pointer of permutation object + fLikelihood->SetPermutations(&fPermutations); + + // set pointer to permuted particles + fLikelihood->SetParticlesPermuted(&fParticlesPermuted); + + + + // remove invariant permutations if particles are defined alreday + if (fParticles) + fLikelihood->RemoveInvariantParticlePermutations(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::Fit(int index) +{ + fLikelihood->ResetCache(); + fLikelihood->ResetResults(); + ResetCache(); + + // check status + if (!Status()) + return 0; + + // set permutation + if (!fPermutations->SetPermutation(index)) + return 0; + + // get new permutation + fParticlesPermuted = fPermutations->ParticlesPermuted(); + + // set missing ET x and y components and the sumET + fLikelihood->SetET_miss_XY_SumET(ETmiss_x, ETmiss_y, SumET); + + // initialize likelihood (likelihood MUST be initialized after + // setting the missing ET, because AdjustParameterRanges() might + // make use of the missing ET information !!!) + fLikelihood->Initialize(); + fLikelihood->SetFlagIsNan(false); + + // set flavor tags if b-tagging is on + if (fLikelihood->GetBTagging() != LikelihoodBase::kNotag) { + fLikelihood->PropagateBTaggingInformation(); + } + + // perform fitting + // Check if LH is invariant + int dummy; + int nperms = fPermutations->NPermutations(); + int partnerindex = fLikelihood->LHInvariantPermutationPartner(index, nperms, dummy, dummy); + + + // check if permutation is LH invariant and has already been calculated + if ((partnerindex > -1)&&(partnerindex < index)){ + fLikelihood->GetParametersFromCache(index); + GetFitStatusFromCache(index); + + } else { + + // Markov Chain MC + if (fMinimizationMethod == kMarkovChainMC) { + // comment out BCLog lines if interested in more BAT details + //BCLog * log = new BCLog(); + //log->OpenLog("help.txt",BCLog::detail,BCLog::detail); + fLikelihood->MCMCSetFlagFillHistograms(true); + fLikelihood->MCMCSetNChains(5); + fLikelihood->MCMCSetNIterationsRun(20000); + fLikelihood->MCMCSetNIterationsMax(1000000); + fLikelihood->MCMCSetNIterationsUpdate(100); + fLikelihood->MarginalizeAll(); + //log->CloseLog(); + //delete log; + } + // simulated annealing + else if (fMinimizationMethod == kSimulatedAnnealing) { + fLikelihood->SetOptimizationMethod( BCIntegrate::kOptSimAnn ); + fLikelihood->SetSAT0(10); + fLikelihood->SetSATmin(0.001); + fLikelihood->FindMode( fLikelihood->GetInitialParameters() ); + } + // MINUIT + else if (fMinimizationMethod == kMinuit) { + fLikelihood->SetOptimizationMethod( BCIntegrate::kOptMinuit); + fLikelihood->FindMode( fLikelihood->GetInitialParameters() ); + // fLikelihood->FindMode( fLikelihood->GetBestFitParameters() ); + + fMinuitStatus = fLikelihood->GetMinuitErrorFlag(); + + // check if any parameter is at its borders->set MINUIT flag to 500 + if ( fMinuitStatus == 0) + { + std::vector<double> BestParameters = fLikelihood->GetBestFitParameters(); + for (unsigned int iPar = 0; iPar < fLikelihood->GetNParameters(); iPar++) + { + if ( fLikelihood->GetParameter(0)->IsAtLimit(BestParameters[iPar]) ) + { + fMinuitStatus = 500; + } + } + } + if(fLikelihood->GetFlagIsNan()==true) + { + fMinuitStatus=508; + } + + // re-run if Minuit status bad + if (fMinuitStatus != 0) + { + fLikelihood->ResetCache(); + fLikelihood->ResetResults(); + // print to screen + // std::cout << "KLFitter::Fit(). Minuit did not find proper minimum. Rerun with Simulated Annealing."<<std::endl; + if (!fTurnOffSA) { + fLikelihood->SetFlagIsNan(false); + fLikelihood->SetOptimizationMethod( BCIntegrate::kOptSimAnn ); + fLikelihood->FindMode( fLikelihood->GetInitialParameters() ); + } + + fLikelihood->SetOptimizationMethod( BCIntegrate::kOptMinuit); + fLikelihood->FindMode( fLikelihood->GetBestFitParameters() ); + fMinuitStatus = fLikelihood->GetMinuitErrorFlag(); + } + + fConvergenceStatus = 0; + if (fMinuitStatus == 4) + fConvergenceStatus |= MinuitDidNotConvergeMask; + } + + + // check if any parameter is at its borders->set MINUIT flag to 501 + if ( fMinuitStatus == 0) + { + std::vector<double> BestParameters = fLikelihood->GetBestFitParameters(); + for (unsigned int iPar = 0; iPar < fLikelihood->GetNParameters(); iPar++) + { + if ( fLikelihood->GetParameter(0)->IsAtLimit(BestParameters[iPar]) ) + { + fMinuitStatus = 501; + fConvergenceStatus |= AtLeastOneFitParameterAtItsLimitMask; + } + } + } + if(fLikelihood->GetFlagIsNan()==true) + { + fMinuitStatus=509; + fConvergenceStatus |= FitAbortedDueToNaNMask; + } + else { + // check if TF problem + if (! fLikelihood->NoTFProblem(fLikelihood->GetBestFitParameters())) { + fMinuitStatus = 510; + fConvergenceStatus |= InvalidTransferFunctionAtConvergenceMask; + } + } + + // calculate integral + if (fLikelihood->FlagIntegrate()) + { + fLikelihood->SetIntegrationMethod(BCIntegrate::kIntCuba); + fLikelihood->Normalize(); + } + + // caching parameters + fLikelihood->SetParametersToCache(index, nperms); + SetFitStatusToCache(index, nperms); + + } //end of fitting "else" + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::Fit() +{ + // check status + if (!Status()) + return 0; + + // get number of permutations + int npermutations = fPermutations->NPermutations(); + + // loop over all permutations + for (int ipermutation = 0; ipermutation < npermutations; ++ipermutation) + { + // set permutation + if (!fPermutations->SetPermutation(ipermutation)) + return 0; + + // get new permutation + fParticlesPermuted = fPermutations->ParticlesPermuted(); + + // initialize likelihood + fLikelihood->Initialize(); + + // perform fitting + fLikelihood->MCMCSetNChains(5); + fLikelihood->MCMCSetNIterationsRun(2000); + fLikelihood->MCMCSetNIterationsMax(1000); + fLikelihood->MCMCSetNIterationsUpdate(100); + fLikelihood->MarginalizeAll(); + fLikelihood->FindMode(BCIntegrate::kOptMinuit, fLikelihood->GetBestFitParameters()); + fMinuitStatus = fLikelihood->GetMinuitErrorFlag(); + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Fitter::Status() +{ + // check if measured particles exist + if (!fParticles) + { + std::cout << "KLFitter::Fitter::Status(). Set of measured particles not defined." << std::endl; + return 0; + } + + // check if detector exists + if (!fDetector) + { + std::cout << "KLFitter::Fitter::Status(). No detector defined." << std::endl; + return 0; + } + + // check detector + if (!fDetector->Status()) + { + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- + +int KLFitter::Fitter::GetFitStatusFromCache(int iperm) +{ + if (((int)fCachedConvergenceStatusVector.size() > iperm)&&((int)fCachedMinuitStatusVector.size() > iperm)) { + fConvergenceStatus = fCachedConvergenceStatusVector.at(iperm); + fMinuitStatus = fCachedMinuitStatusVector.at(iperm); + } else { + std::cout<<"KLFitter::Fitter::GetFitStatusFromCache: size of fCachedConvergenceStatusVector or fCachedMinuitStatusVector too small!"<<std::endl; + } + +return 1; +} + +// --------------------------------------------------------- + +int KLFitter::Fitter::SetFitStatusToCache(int iperm, int nperms) +{ + +if (iperm==0) { + fCachedMinuitStatusVector.clear(); + fCachedMinuitStatusVector.assign(nperms, -1); + + fCachedConvergenceStatusVector.clear(); + fCachedConvergenceStatusVector.assign(nperms, -1); +} + +if ((iperm>(int)fCachedMinuitStatusVector.size())||(iperm>(int)fCachedConvergenceStatusVector.size())) { + std::cout<<"KLFitter::Fitter::SetFitStatusToCache: iperm > size of fCachedMinuitStatusVector or fCachedConvergenceStatusVector!"<<std::endl; + return 0; +} +fCachedMinuitStatusVector.at(iperm) = fMinuitStatus; +fCachedConvergenceStatusVector.at(iperm) = fConvergenceStatus; + +int dummy; +int partner = fLikelihood->LHInvariantPermutationPartner(iperm, nperms, dummy, dummy); + +if (partner > iperm) { + + if (((int)fCachedMinuitStatusVector.size() > partner)&&((int)fCachedConvergenceStatusVector.size() > partner)){ + + fCachedMinuitStatusVector.at(partner) = fMinuitStatus; + fCachedConvergenceStatusVector.at(partner) = fConvergenceStatus; + + } else { + std::cout<<"KLFitter::Fitter::SetFitStatusToCache: size of fCachedMinuitStatusVector or fCachedConvergenceStatusVector too small!"<<std::endl; + } +} + +GetFitStatusFromCache(iperm); +return 1; +} + +// ---------------------------------------------------------. + + int KLFitter::Fitter::ResetCache() +{ +fMinuitStatus = -1; +fConvergenceStatus = -1; + +return 1; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodBase.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b7c6cc6f81c143fd04c437edce6ce5c317126777 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodBase.cxx @@ -0,0 +1,472 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/DetectorBase.h" + +#include "TRandom3.h" + +#include "BAT/BCLog.h" +#include "BAT/BCParameter.h" + +#include <iostream> +#include <string> + + + +// --------------------------------------------------------- +KLFitter::LikelihoodBase::LikelihoodBase(Particles** particles) : BCModel(), + fParticlesPermuted(particles), + fPermutations(0), + fParticlesModel(0), + fMyParticlesTruth(0), + fPhysicsConstants(new KLFitter::PhysicsConstants()), + fDetector(0), + fEventProbability(std::vector<double>(0)), + fFlagIntegrate(0), + fFlagIsNan(false), + fBTagMethod(kNotag) + +{ + + BCLog::SetLogLevel(BCLog::nothing); + MCMCSetRandomSeed(123456789); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodBase::~LikelihoodBase() +{ + if (fParticlesModel) + delete fParticlesModel; + + if (fPhysicsConstants) + delete fPhysicsConstants; + +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetPhysicsConstants(KLFitter::PhysicsConstants* physicsconstants) +{ + fPhysicsConstants = physicsconstants; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetInitialParameters(std::vector<double> const& parameters) +{ + // check number of parameters + if (int(parameters.size()) != NParameters()) + { + std::cout << "KLFitter::SetInitialPosition(). Length of vector does not equal the number of parameters." << std::endl; + return 0; + } + + // set starting point for MCMC + MCMCSetInitialPositions(parameters); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetInitialParametersNChains(std::vector<double> const& parameters, unsigned int nchains) +{ + // check number of parameters + if (int(parameters.size()) != NParameters()) + { + std::cout << "KLFitter::SetInitialPosition(). Length of vector does not equal the number of parameters." << std::endl; + return 0; + } + + // set starting point for MCMC + std::vector< std::vector<double> > par(0.); + + for(unsigned int i=0; i< nchains; ++i) { + par.push_back(parameters); + } + + MCMCSetInitialPositions(par); + + MCMCSetFlagInitialPosition(2); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetParameterRange(int index, double parmin, double parmax) +{ + // check index + if (index < 0 || index >= NParameters()) + { + std::cout << " KLFitter::Combinatorics::SetParameterRange(). Index out of range." << std::endl; + return 0; + } + + // set parameter ranges in BAT + GetParameter(index)->SetLowerLimit(parmin); + GetParameter(index)->SetUpperLimit(parmax); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetDetector(KLFitter::DetectorBase** detector) +{ + // set pointer to pointer of detector + fDetector = detector; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetParticlesPermuted(KLFitter::Particles** particles) +{ + // set pointer to pointer of permuted particles + fParticlesPermuted = particles; + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetMyParticlesTruth(KLFitter::Particles** particles) +{ + // set pointer to pointer of truth particles + fMyParticlesTruth = particles; + + //std::cout << "set particlestruth inside likelihoodbase!" << std::endl; + + // no error + return 1; +} +// --------------------------------------------------------- +int KLFitter::LikelihoodBase::SetPermutations(KLFitter::Permutations** permutations) +{ + // error code + int err = 1; + + // set pointer to pointer of permutation object + fPermutations = permutations; + + // return error code + return err; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodBase::ParMin(int index) +{ + // check index + if (index < 0 || index >= NParameters()) { + std::cout << " KLFitter::Combinatorics::ParMin(). Index out of range." << std::endl; + return 0; + } + + // return parameter range from BAT + return GetParameter(index)->GetLowerLimit(); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodBase::ParMax(int index) +{ + // check index + if (index < 0 || index >= NParameters()) + { + std::cout << " KLFitter::Combinatorics::ParMax(). Index out of range." << std::endl; + return 0; + } + + // return parameter range from BAT + return GetParameter(index)->GetUpperLimit(); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodBase::LogEventProbability() +{ + double logprob = 0; + + if (fBTagMethod != kNotag) { + double logprobbtag = LogEventProbabilityBTag(); + if (logprobbtag <= -1e99) return -1e99; + logprob += logprobbtag; + } + + // use integrated value of LogLikelihood (default) + if (fFlagIntegrate) + logprob += log(GetIntegral()); + else + logprob += LogLikelihood( GetBestFitParameters() ); + + return logprob; +} + + + +// --------------------------------------------------------- +double KLFitter::LikelihoodBase::LogEventProbabilityBTag() +{ + double logprob = 0; + + double probbtag = 1; + + if(fBTagMethod == kVeto){ + // loop over all model particles. calculate the overall b-tagging + // probability which is the product of all probabilities. + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + if (trueFlavor == KLFitter::Particles::kLight && isBTagged == true) + probbtag = 0.; + } + + if (probbtag > 0) + logprob += log(probbtag); + else + return -1e99; + } + else if(fBTagMethod == kVetoLight){ + // loop over all model particles. calculate the overall b-tagging + // probability which is the product of all probabilities. + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + if (trueFlavor == KLFitter::Particles::kB && isBTagged == false) + probbtag = 0.; + } + + if (probbtag > 0) + logprob += log(probbtag); + else + return -1e99; + } + else if(fBTagMethod == kVetoBoth){ + // loop over all model particles. calculate the overall b-tagging + // probability which is the product of all probabilities. + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + if (trueFlavor == KLFitter::Particles::kLight && isBTagged == true) + probbtag = 0.; + if (trueFlavor == KLFitter::Particles::kB && isBTagged == false) + probbtag = 0.; + } + + if (probbtag > 0) + logprob += log(probbtag); + else + return -1e99; + } + else if (fBTagMethod == kWorkingPoint){ + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + double efficiency = fParticlesModel->BTaggingEfficiency(i); + double rejection = fParticlesModel->BTaggingRejection(i); + if(rejection < 0 || efficiency < 0){ + std::cout << " KLFitter::LikelihoodBase::LogEventProbability() : Your working points are not set properly! Returning 0 probability " << std::endl; + return -1e99; + } + + if(trueFlavor == KLFitter::Particles::kLight && isBTagged) + logprob += log(1./rejection); + else if(trueFlavor == KLFitter::Particles::kLight && !isBTagged) + logprob += log(1 - 1./rejection); + else if(trueFlavor == KLFitter::Particles::kB && isBTagged) + logprob += log(efficiency); + else if(trueFlavor == KLFitter::Particles::kB && !isBTagged) + logprob += log(1 - efficiency); + else + std::cout << " KLFitter::LikelihoodBase::LogEventProbability() : b-tagging association failed! " << std::endl; + } + } + + return logprob; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodBase::PropagateBTaggingInformation() +{ + // get number of partons + unsigned int npartons = fParticlesModel->NPartons(); + + // loop over all model particles. + for (unsigned int i = 0; i < npartons; ++i) + { + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + + if (index<0) { + continue; + } + + fParticlesModel->SetIsBTagged( index, (*fParticlesPermuted)->IsBTagged(index)); + fParticlesModel->SetBTaggingEfficiency(index, (*fParticlesPermuted)->BTaggingEfficiency(index)); + fParticlesModel->SetBTaggingRejection( index, (*fParticlesPermuted)->BTaggingRejection(index)); + } +} +// ---------------------------------------------------------. + + std::vector <double> KLFitter::LikelihoodBase::GetBestFitParameters() +{ +if (fCachedParameters.size() > 0) { + return fCachedParameters; +} +else return BCModel::GetBestFitParameters(); + +} + + + +// ---------------------------------------------------------. + + std::vector <double> KLFitter::LikelihoodBase::GetBestFitParameterErrors() +{ + +if (fCachedParameterErrors.size() > 0) { + return fCachedParameterErrors; +} +else return BCModel::GetBestFitParameterErrors(); + +} + +// --------------------------------------------------------- + +int KLFitter::LikelihoodBase::SetParametersToCache(int iperm, int nperms) +{ +//set correct size of cachevector +if (iperm==0) { + fCachedParametersVector.clear(); + fCachedParametersVector.assign(nperms, std::vector<double>(NParameters(), 0)); + + fCachedParameterErrorsVector.clear(); + fCachedParameterErrorsVector.assign(nperms, std::vector<double>(NParameters(), 0)); + + fCachedNormalizationVector.clear(); + fCachedNormalizationVector.assign(nperms, 0.); +} + +if ((iperm>(int)fCachedParametersVector.size())||(iperm>(int)fCachedParameterErrorsVector.size())) { + std::cout<<"KLFitter::LikelihoodBase::SetParametersToCache: iperm > size of fCachedParametersVector or fCachedParameterErrorsVector!"<<std::endl; + return 0; +} +fCachedParametersVector.at(iperm) = BCModel::GetBestFitParameters(); +fCachedParameterErrorsVector.at(iperm) = BCModel::GetBestFitParameterErrors(); +fCachedNormalizationVector.at(iperm) = BCIntegrate::GetIntegral(); + +int switchpar1 = -1; +int switchpar2 = -1; +double switchcache = 0; +int partner = LHInvariantPermutationPartner(iperm, nperms, switchpar1, switchpar2); + +if (partner > iperm) { + + if (((int)fCachedParametersVector.size() > partner)&&((int)fCachedParameterErrorsVector.size() > partner)){ + fCachedParametersVector.at(partner) = BCModel::GetBestFitParameters(); + switchcache = fCachedParametersVector.at(partner).at(switchpar1); + fCachedParametersVector.at(partner).at(switchpar1) = fCachedParametersVector.at(partner).at(switchpar2); + fCachedParametersVector.at(partner).at(switchpar2) = switchcache; + + fCachedParameterErrorsVector.at(partner) = BCModel::GetBestFitParameterErrors(); + switchcache = fCachedParameterErrorsVector.at(partner).at(switchpar1); + fCachedParameterErrorsVector.at(partner).at(switchpar1) = fCachedParameterErrorsVector.at(partner).at(switchpar2); + fCachedParameterErrorsVector.at(partner).at(switchpar2) = switchcache; + + fCachedNormalizationVector.at(partner) = BCIntegrate::GetIntegral(); + + + } else { + std::cout<<"KLFitter::LikelihoodBase::SetParametersToCache: size of fCachedParametersVector too small!"<<std::endl; + } +} +GetParametersFromCache(iperm); + +return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodBase::GetParametersFromCache(int iperm) +{ + + if (((int)fCachedParametersVector.size() > iperm)&&((int)fCachedParameterErrorsVector.size() > iperm)) { + fCachedParameters = fCachedParametersVector.at(iperm); + fCachedParameterErrors = fCachedParameterErrorsVector.at(iperm); + fCachedNormalization = fCachedNormalizationVector.at(iperm); + } else { + std::cout<<"KLFitter::LikelihoodBase::GetParametersFromCache: size of fCachedParametersVector, fCachedParameterErrorsVector or fCachedNormalizationVector too small!"<<std::endl; + } +return 1; +} + +// ---------------------------------------------------------. + + double KLFitter::LikelihoodBase::GetIntegral() +{ + +if (fCachedNormalizationVector.size() > 0) { + return fCachedNormalization; +} +else { +return BCIntegrate::GetIntegral(); +} +} +// ---------------------------------------------------------. + + int KLFitter::LikelihoodBase::ResetCache() +{ +fCachedParameters.clear(); +fCachedParameterErrors.clear(); + +fCachedNormalization = 0.; + +return 1; +} +// ---------------------------------------------------------. + + double KLFitter::LikelihoodBase::GetBestFitParameter(unsigned int index) +{ +if (fCachedParameters.size() > 0) { + return fCachedParameters.at(index); +} +else return BCModel::GetBestFitParameter(index); + +} + + + +// ---------------------------------------------------------. + + double KLFitter::LikelihoodBase::GetBestFitParameterError(unsigned int index) +{ + +if (fCachedParameterErrors.size() > 0) { + return fCachedParameterErrors.at(index); +} +else return BCModel::GetBestFitParameterError(index); + +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodSgTopWtLJ.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodSgTopWtLJ.cxx new file mode 100644 index 0000000000000000000000000000000000000000..36877b22e1c9f07ae457915f07238116521a5c7c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodSgTopWtLJ.cxx @@ -0,0 +1,618 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodSgTopWtLJ.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +#include <cmath> + +// --------------------------------------------------------- +KLFitter::LikelihoodSgTopWtLJ::LikelihoodSgTopWtLJ(): KLFitter::LikelihoodBase::LikelihoodBase() + , fHadronicTop(kTRUE) + , fFlagUseJetMass(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) +{ + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodSgTopWtLJ::~LikelihoodSgTopWtLJ(){ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::LikelihoodSgTopWtLJ::GetLepton(KLFitter::Particles* particles) { + if (!particles) { + std::cout << "KLFitter::LikelihoodSgTopWtLJ::GetLepton():\tERROR\t Null pointer to particles object." << std::endl; + return 0; + } + TLorentzVector* lepton = 0; + if (fTypeLepton == kElectron) + lepton = particles->Electron(0); + else if (fTypeLepton == kMuon) + lepton = particles->Muon(0); + else + std::cout << "KLFitter::LikelihoodSgTopWtLJ::GetLepton():\tERROR\tInvalid letpon type: " << fTypeLepton << std::endl; + + return lepton; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::GetLeptonType() { + return fTypeLepton; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodSgTopWtLJ::SetLeptonType(int leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon ) + { + std::cout << "KLFitter::SetLeptonType()\tWARNING\t lepton type not defined: " << leptontype << ". Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::DefineModelParticles() +{ + // check if model particles exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + /* add model particles */ + + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kParton, "b quark", 0, KLFitter::Particles::kB); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kParton, "light quark 1", 1, KLFitter::Particles::kLight); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kParton, "light quark 2", 2, KLFitter::Particles::kLight); + + if (fTypeLepton == kElectron) + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kElectron, "electron"); + else if (fTypeLepton == kMuon) + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kMuon, "muon"); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kNeutrino, "neutrino"); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kBoson, "hadronic W"); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kBoson, "leptonic W"); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kParton, "hadronic top"); + + fParticlesModel->AddParticle(dummy, KLFitter::Particles::kParton, "leptonic top"); + + // free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodSgTopWtLJ::DefineParameters() +{ + // add parameters of model + this->AddParameter("energy b", fPhysicsConstants->MassBottom(), 1000.0); // parBE + this->AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + this->AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + this->AddParameter("energy lepton", 0.0, 1000.0); // parLepE + this->AddParameter("missPx", -1000.0, 1000.0); // parNuPx + this->AddParameter("missPy", -1000.0, 1000.0); // parNuPy + this->AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::CalculateLorentzVectors(std::vector <double> parameters) +{ + // variables + static double scale; + + static double whad_fit_e; + static double whad_fit_px; + static double whad_fit_py; + static double whad_fit_pz; + static double wlep_fit_e; + static double wlep_fit_px; + static double wlep_fit_py; + static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + // b quark + b_fit_e = parameters[parBE]; + scale = sqrt(b_fit_e*b_fit_e - b_meas_m*b_meas_m) / b_meas_p; + b_fit_px = scale * b_meas_px; + b_fit_py = scale * b_meas_py; + b_fit_pz = scale * b_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // composite particles + + // hadronic W + whad_fit_e = lq1_fit_e +lq2_fit_e; + whad_fit_px = lq1_fit_px+lq2_fit_px; + whad_fit_py = lq1_fit_py+lq2_fit_py; + whad_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad_fit_m = sqrt(whad_fit_e*whad_fit_e - (whad_fit_px*whad_fit_px + whad_fit_py*whad_fit_py + whad_fit_pz*whad_fit_pz)); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = whad_fit_e+b_fit_e; + thad_fit_px = whad_fit_px+b_fit_px; + thad_fit_py = whad_fit_py+b_fit_py; + thad_fit_pz = whad_fit_pz+b_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+b_fit_e; + tlep_fit_px = wlep_fit_px+b_fit_px; + tlep_fit_py = wlep_fit_py+b_fit_py; + tlep_fit_pz = wlep_fit_pz+b_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::Initialize() +{ + // error code + int err = 1; + + ResetResults(); // since BAT-0.9.3 no error code produced by this method anymore + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the first and the second jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(1); + indexVector_Jets.push_back(2); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from all jet not used for the likelihood + KLFitter::Particles * particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int i = 3; i < particles->NPartons(); i++) + indexVector_Jets.push_back(i); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); +// +// // remove the permutation from the other lepton type +// std::vector<int> indexVector_Leptons; +// if (fTypeLepton == kEletron) { +// ptype = KLFitter::Particles::kMuon; +// for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) +// indexVector_Leptons.push_back(iMuon); +// } else if (fTypeLepton == kMuon) { +// ptype = KLFitter::Particles::kElectron; +// for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) +// indexVector_Leptons.push_back(iElectron); +// } +// err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Leptons); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = 7.0; + double nsigmas_lepton = 2.0; + + // energy of b quark + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = TMath::Max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double Emin = TMath::Max(m, E - nsigmas_jet * sqrt(E)); + double Emax = E + nsigmas_jet * sqrt(E); + SetParameterRange(parBE, Emin, Emax); + + // energy of light quark 1 + E = (*fParticlesPermuted)->Parton(1)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = TMath::Max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + Emin = TMath::Max(m, E - nsigmas_jet * sqrt(E)); + Emax = E + nsigmas_jet * sqrt(E); + SetParameterRange(parLQ1E, Emin, Emax); + + // energy of light quark2 + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = TMath::Max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + Emin = TMath::Max(m, E - nsigmas_jet * sqrt(E)); + Emax = E + nsigmas_jet * sqrt(E); + SetParameterRange(parLQ2E, Emin, Emax); + + // energy of lepton + if (fTypeLepton == kElectron) { + E = (*fParticlesPermuted)->Electron(0)->E(); + Emin = TMath::Max(0.001, E - nsigmas_lepton * sqrt(E)); + Emax = E + nsigmas_lepton * sqrt(E); + } else if (fTypeLepton == kMuon) { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta = sin((*fParticlesPermuted)->Muon(0)->Theta()); + double sigrange = nsigmas_lepton * (E * E * sintheta); + Emin = std::max(0.001, E - sigrange); + Emax = E + sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + // note: this is hard-coded in the momement + + // missing ET + SetParameterRange(parNuPx, ETmiss_x-100.0, ETmiss_x+100); + SetParameterRange(parNuPy, ETmiss_y-100.0, ETmiss_y+100); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodSgTopWtLJ::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + this->CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyB->p(b_fit_e, b_meas_e, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + double massTop = fPhysicsConstants->MassTop(); + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW); + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of top quark - user either leptonic or hadronic W, dependic on fHadronicTop flag. +// /* Set fHadronicTop automatically if applicable */ +// if ((*fParticlesPermuted)->NBosons() == 2){ +// if ((*fParticlesPermuted)->NameBoson(0) == "LepW" && (*fParticlesPermuted)->NameBoson(1) == "HadW") +// fHadronicTop = true; +// else if ((*fParticlesPermuted)->NameBoson(0) == "HadW" && (*fParticlesPermuted)->NameBoson(1) == "LepW") +// fHadronicTop = false; +// } + if (fHadronicTop) + logprob += BCMath::LogBreitWignerRel(thad_fit_m, massTop, gammaTop); + else + logprob += BCMath::LogBreitWignerRel(tlep_fit_m, massTop, gammaTop); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodSgTopWtLJ::GetInitialParameters() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBE] = b_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + + // energy of the lepton + values[parLepE] = lep_meas_e; + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0; + + // check neutrino solutions + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions.at(0); + else if (int(neutrino_pz_solutions.size()) == 2) { + if (fHadronicTop) { + if (std::fabs(neutrino_pz_solutions[0]) < std::fabs(neutrino_pz_solutions[1])) + values[parNuPz] = neutrino_pz_solutions[0]; + else + values[parNuPz] = neutrino_pz_solutions[1]; + SetParameterRange(parNuPx, values[parNuPx], values[parNuPx]); + SetParameterRange(parNuPy, values[parNuPy], values[parNuPy]); + SetParameterRange(parNuPz, values[parNuPz], values[parNuPz]); + SetParameterRange(parLepE, values[parLepE], values[parLepE]); + } else { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions.at(0); + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions.at(1); + sol2 = LogLikelihood(values); + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions.at(0); + + /* Let's see what happens when we fix the neutrino pz */ +// if (std::fabs(neutrino_pz_solutions[0]) < std::fabs(neutrino_pz_solutions[1])) +// values[parNuPz] = neutrino_pz_solutions[0]; +// else +// values[parNuPz] = neutrino_pz_solutions[1]; +// SetParameterRange(parNuPz, values[parNuPz], values[parNuPz]); + } + } else { + /* scaleMET method */ + TLorentzVector* lepton = GetLepton(*fParticlesPermuted); + KLFitter::PhysicsConstants constants; + double mW = constants.MassW(); + double cosDeltaPhi = (lepton->Px()*ETmiss_x + lepton->Py()*ETmiss_y) / (lepton->Perp() * sqrt(ETmiss_x * ETmiss_x + ETmiss_y * ETmiss_y)); + values[parNuPz] = mW * mW * lepton->Pz() / (2 * lepton->Perp2()*(1 - cosDeltaPhi)); + if (fHadronicTop) + SetParameterRange(parNuPz, values[parNuPz], values[parNuPz]); + } + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodSgTopWtLJ::GetNeutrinoPzSolutions() +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + TLorentzVector* lepton = GetLepton(*fParticlesPermuted); + + double px_c = lepton->Px(); + double py_c = lepton->Py(); + double pz_c = lepton->Pz(); + double Ec = lepton->E(); + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha * pz_c; + double c = - Ec*Ec * (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodSgTopWtLJ::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::SavePermutedParticles() { + b_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + b_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + b_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + b_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + b_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + b_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), b_meas_px, b_meas_py, b_meas_pz, b_meas_e); + b_meas_p = sqrt(b_meas_e*b_meas_e - b_meas_m*b_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodSgTopWtLJ::SaveResolutionFunctions() { + + fResEnergyB = (*fDetector)->ResEnergyBJet(b_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodSgTopWtLJ::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * b = fParticlesModel->Parton(0); + TLorentzVector * lq1 = fParticlesModel->Parton(1); + TLorentzVector * lq2 = fParticlesModel->Parton(2); + TLorentzVector * lep = GetLepton(fParticlesModel); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * whad = fParticlesModel->Boson(0); + TLorentzVector * wlep = fParticlesModel->Boson(1); + TLorentzVector * thad = fParticlesModel->Parton(3); + TLorentzVector * tlep = fParticlesModel->Parton(4); + + b->SetPxPyPzE(b_fit_px, b_fit_py, b_fit_pz, b_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*whad) = (*lq1) + (*lq2); + (*wlep) = (*lep) + (*nu); + (*thad) = (*whad) + (*b); + (*tlep) = (*wlep) + (*b); + + // no error + return 1; +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTHLeptonJets.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTHLeptonJets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5564bc8809eb4f117d59020289dc04ffb979115c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTHLeptonJets.cxx @@ -0,0 +1,987 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTTHLeptonJets.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTHLeptonJets::LikelihoodTTHLeptonJets() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagHiggsMassFixed(false) + , fFlagUseJetMass(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + // this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTHLeptonJets::~LikelihoodTTHLeptonJets() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTHLeptonJets::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTHLeptonJets::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "Higgs b quark 1", // name + 4, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "Higgs b quark 2", + 5, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "Higgs"); + + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTHLeptonJets::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // parBhadE + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // parBlepE + AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + AddParameter("energy lepton", 0.0, 1000.0); // parLepE + AddParameter("p_x neutrino", -1000.0, 1000.0); // parNuPx + AddParameter("p_y neutrino", -1000.0, 1000.0); // parNuPy + AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz + AddParameter("top mass", 100.0, 1000.0); // parTopM + AddParameter("energy Higgs b quark 1", fPhysicsConstants->MassBottom(), 1000.0); // parBHiggs1E + AddParameter("energy Higgs b quark 2", fPhysicsConstants->MassBottom(), 1000.0); // parBHiggs2E + if (fFlagHiggsMassFixed) AddParameter("Higgs mass", 100.0, 1000.0); // parHiggsM + //++++++++++++++++// +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + static double whad_fit_e; + static double whad_fit_px; + static double whad_fit_py; + static double whad_fit_pz; + static double wlep_fit_e; + static double wlep_fit_px; + static double wlep_fit_py; + static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + //++++++++++++++++// + static double Higgs_fit_e; + static double Higgs_fit_px; + static double Higgs_fit_py; + static double Higgs_fit_pz; + //++++++++++++++++// + + + // hadronic b quark + bhad_fit_e = parameters[parBhadE]; + scale = sqrt(bhad_fit_e*bhad_fit_e - bhad_meas_m*bhad_meas_m) / bhad_meas_p; + bhad_fit_px = scale * bhad_meas_px; + bhad_fit_py = scale * bhad_meas_py; + bhad_fit_pz = scale * bhad_meas_pz; + + // leptonic b quark + blep_fit_e = parameters[parBlepE]; + scale = sqrt(blep_fit_e*blep_fit_e - blep_meas_m*blep_meas_m) / blep_meas_p; + blep_fit_px = scale * blep_meas_px; + blep_fit_py = scale * blep_meas_py; + blep_fit_pz = scale * blep_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + + //++++++++++++++++// + // Higgs b quark 1 + BHiggs1_fit_e = parameters[parBHiggs1E]; + scale = sqrt(BHiggs1_fit_e*BHiggs1_fit_e - BHiggs1_meas_m*BHiggs1_meas_m) / BHiggs1_meas_p; + BHiggs1_fit_px = scale * BHiggs1_meas_px; + BHiggs1_fit_py = scale * BHiggs1_meas_py; + BHiggs1_fit_pz = scale * BHiggs1_meas_pz; + + + // Higgs b quark 2 + BHiggs2_fit_e = parameters[parBHiggs2E]; + scale = sqrt(BHiggs2_fit_e*BHiggs2_fit_e - BHiggs2_meas_m*BHiggs2_meas_m) / BHiggs2_meas_p; + BHiggs2_fit_px = scale * BHiggs2_meas_px; + BHiggs2_fit_py = scale * BHiggs2_meas_py; + BHiggs2_fit_pz = scale * BHiggs2_meas_pz; + //++++++++++++++++// + + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // hadronic W + whad_fit_e = lq1_fit_e +lq2_fit_e; + whad_fit_px = lq1_fit_px+lq2_fit_px; + whad_fit_py = lq1_fit_py+lq2_fit_py; + whad_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad_fit_m = sqrt(whad_fit_e*whad_fit_e - (whad_fit_px*whad_fit_px + whad_fit_py*whad_fit_py + whad_fit_pz*whad_fit_pz)); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = whad_fit_e+bhad_fit_e; + thad_fit_px = whad_fit_px+bhad_fit_px; + thad_fit_py = whad_fit_py+bhad_fit_py; + thad_fit_pz = whad_fit_pz+bhad_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+blep_fit_e; + tlep_fit_px = wlep_fit_px+blep_fit_px; + tlep_fit_py = wlep_fit_py+blep_fit_py; + tlep_fit_pz = wlep_fit_pz+blep_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + + //++++++++++++++++// + // Higgs + Higgs_fit_e = BHiggs1_fit_e + BHiggs2_fit_e; + Higgs_fit_px = BHiggs1_fit_px + BHiggs2_fit_px; + Higgs_fit_py = BHiggs1_fit_py + BHiggs2_fit_py; + Higgs_fit_pz = BHiggs1_fit_pz + BHiggs2_fit_pz; + Higgs_fit_m = sqrt(Higgs_fit_e*Higgs_fit_e - (Higgs_fit_px*Higgs_fit_px + Higgs_fit_py*Higgs_fit_py + Higgs_fit_pz*Higgs_fit_pz)); + //++++++++++++++++// + + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + this->DefineParameters(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //++++++++++++++++// + // remove the permutation from the two Higgs b jets + KLFitter::Particles::ParticleType ptypeBB = KLFitter::Particles::kParton; + std::vector<int> indexVector_JetsBB; + indexVector_JetsBB.push_back(4); + indexVector_JetsBB.push_back(5); + err *= (*fPermutations)->InvariantParticlePermutations(ptypeBB, indexVector_JetsBB); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 6; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + //++++++++++++++++// + + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = 7.0; + double nsigmas_lepton = 2.0; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + double Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBhadE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBlepE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parLQ1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parLQ2E, Emin, Emax); + + //++++++++++++++++// + E = (*fParticlesPermuted)->Parton(4)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(4)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBHiggs1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(5)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(5)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBHiggs2E, Emin, Emax); + //++++++++++++++++// + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + Emin = std::max(0.001, E - nsigmas_lepton* sqrt(E)); + Emax = E + nsigmas_lepton* sqrt(E); + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + double sigrange=nsigmas_lepton* (E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + // note: this is hard-coded in the momement + + SetParameterRange(parNuPx, ETmiss_x-100.0, ETmiss_x+100); + SetParameterRange(parNuPy, ETmiss_y-100.0, ETmiss_y+100); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + //++++++++++++++++// + if (fFlagHiggsMassFixed) + SetParameterRange(parHiggsM, fPhysicsConstants->MassHiggs(), fPhysicsConstants->MassHiggs()); + //++++++++++++++++// + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTTHLeptonJets::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + //++++++++++++++++// + logprob += log( fResEnergyBHiggs1->p(BHiggs1_fit_e, BHiggs1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBHiggs2->p(BHiggs2_fit_e, BHiggs2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + //++++++++++++++++// + + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + double gammaTop = fPhysicsConstants->GammaTop(); + + //++++++++++++++++// + double gammaHiggs = fPhysicsConstants->GammaHiggs(); + //++++++++++++++++// + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW); + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of leptonically decaying top quark + logprob += BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop); + + //++++++++++++++++// + // Breit-Wigner of Higgs decaying into 2 b-quark + if (fFlagHiggsMassFixed) logprob += BCMath::LogBreitWignerRel(Higgs_fit_m, parameters[parHiggsM], gammaHiggs); + + //++++++++++++++++// + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTHLeptonJets::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTHLeptonJets::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhadE] = bhad_meas_e; + values[parBlepE] = blep_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + //++++++++++++++++// + values[parBHiggs1E] = BHiggs1_meas_e; + values[parBHiggs2E] = BHiggs2_meas_e; + //++++++++++++++++// + + + + // energy of the lepton + if (fTypeLepton == kElectron) + values[parLepE] = (*fParticlesPermuted)->Electron(0)->E(); + else if (fTypeLepton == kMuon) + values[parLepE] = (*fParticlesPermuted)->Muon(0)->E(); + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0.; + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + //++++++++++++++++// + // Higgs mass + if (fFlagHiggsMassFixed){ + double mhiggs = ( *(*fParticlesPermuted)->Parton(4) + *(*fParticlesPermuted)->Parton(5)).M(); + if (mhiggs < GetParameter(parHiggsM)->GetLowerLimit()) + mhiggs = GetParameter(parHiggsM)->GetLowerLimit(); + else if (mhiggs > GetParameter(parHiggsM)->GetUpperLimit()) + mhiggs = GetParameter(parHiggsM)->GetUpperLimit(); + values[parHiggsM] = mhiggs; + } + //++++++++++++++++// + + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTHLeptonJets::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTHLeptonJets::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTTHLeptonJets::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::SavePermutedParticles() { + bhad_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad_meas_px, bhad_meas_py, bhad_meas_pz, bhad_meas_e); + bhad_meas_p = sqrt(bhad_meas_e*bhad_meas_e - bhad_meas_m*bhad_meas_m); + + blep_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + blep_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + blep_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + blep_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + blep_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + blep_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), blep_meas_px, blep_meas_py, blep_meas_pz, blep_meas_e); + blep_meas_p = sqrt(blep_meas_e*blep_meas_e - blep_meas_m*blep_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(3)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(3)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(3)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(3)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(3)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + //++++++++++++++++// + BHiggs1_meas_e = (*fParticlesPermuted)->Parton(4)->E(); + BHiggs1_meas_deteta = (*fParticlesPermuted)->DetEta(4, KLFitter::Particles::kParton); + BHiggs1_meas_px = (*fParticlesPermuted)->Parton(4)->Px(); + BHiggs1_meas_py = (*fParticlesPermuted)->Parton(4)->Py(); + BHiggs1_meas_pz = (*fParticlesPermuted)->Parton(4)->Pz(); + BHiggs1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(4)->M(), fPhysicsConstants->MassBottom(), BHiggs1_meas_px, BHiggs1_meas_py, BHiggs1_meas_pz, BHiggs1_meas_e); + BHiggs1_meas_p = sqrt(BHiggs1_meas_e*BHiggs1_meas_e - BHiggs1_meas_m*BHiggs1_meas_m); + + BHiggs2_meas_e = (*fParticlesPermuted)->Parton(5)->E(); + BHiggs2_meas_deteta = (*fParticlesPermuted)->DetEta(5, KLFitter::Particles::kParton); + BHiggs2_meas_px = (*fParticlesPermuted)->Parton(5)->Px(); + BHiggs2_meas_py = (*fParticlesPermuted)->Parton(5)->Py(); + BHiggs2_meas_pz = (*fParticlesPermuted)->Parton(5)->Pz(); + BHiggs2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(5)->M(), fPhysicsConstants->MassBottom(), BHiggs2_meas_px, BHiggs2_meas_py, BHiggs2_meas_pz, BHiggs2_meas_e); + BHiggs2_meas_p = sqrt(BHiggs2_meas_e*BHiggs2_meas_e - BHiggs2_meas_m*BHiggs2_meas_m); + //++++++++++++++++// + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTHLeptonJets::SaveResolutionFunctions() { + + fResEnergyBhad = (*fDetector)->ResEnergyBJet(bhad_meas_deteta); + fResEnergyBlep = (*fDetector)->ResEnergyBJet(blep_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + + //++++++++++++++++// + fResEnergyBHiggs1 = (*fDetector)->ResEnergyBJet(BHiggs1_meas_deteta); + fResEnergyBHiggs2 = (*fDetector)->ResEnergyBJet(BHiggs2_meas_deteta); + //++++++++++++++++// + + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTTHLeptonJets::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad = fParticlesModel->Parton(0); + TLorentzVector * blep = fParticlesModel->Parton(1); + TLorentzVector * lq1 = fParticlesModel->Parton(2); + TLorentzVector * lq2 = fParticlesModel->Parton(3); + + //++++++++++++++++// + TLorentzVector * BHiggs1 = fParticlesModel->Parton(4); + TLorentzVector * BHiggs2 = fParticlesModel->Parton(5); + //++++++++++++++++// + + TLorentzVector * lep(0); + if (fTypeLepton == kElectron) + lep = fParticlesModel->Electron(0); + else if (fTypeLepton == kMuon) + lep = fParticlesModel->Muon(0); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * whad = fParticlesModel->Boson(0); + TLorentzVector * wlep = fParticlesModel->Boson(1); + + //++++++++++++++++// + TLorentzVector * thad = fParticlesModel->Parton(6); + TLorentzVector * tlep = fParticlesModel->Parton(7); + TLorentzVector * Higgs = fParticlesModel->Boson(2); + //++++++++++++++++// + + bhad->SetPxPyPzE(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + blep->SetPxPyPzE(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + + //++++++++++++++++// + BHiggs1->SetPxPyPzE(BHiggs1_fit_px, BHiggs1_fit_py, BHiggs1_fit_pz, BHiggs1_fit_e); + BHiggs2->SetPxPyPzE(BHiggs2_fit_px, BHiggs2_fit_py, BHiggs2_fit_pz, BHiggs2_fit_e); + //++++++++++++++++// + + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*whad) = (*lq1) + (*lq2); + (*wlep) = (*lep) + (*nu); + (*thad) = (*whad) + (*bhad); + (*tlep) = (*wlep) + (*blep); + + //++++++++++++++++// + (*Higgs) = (*BHiggs1) + (*BHiggs2); + //++++++++++++++++// + + // no error + return 1; +} +// --------------------------------------------------------- + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTHLeptonJets::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBHiggs1->p(BHiggs1_fit_e, BHiggs1_meas_e, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBHiggs2->p(BHiggs2_fit_e, BHiggs2_meas_e, TFgoodTmp) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) )); //comp6 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) )); //comp6 + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + vecci.push_back(log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) )); //comp7 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) )); //comp8 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + double gammaTop = fPhysicsConstants->GammaTop(); + double gammaHiggs = fPhysicsConstants->GammaHiggs(); + + // Breit-Wigner of hadronically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW)); //comp9 + + // Breit-Wigner of leptonically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW)); //comp10 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop)); //comp11 + + // Breit-Wigner of leptonically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop)); //comp12 + + // Breit-Wigner of Higgs decaying into 2 b-quark + if (fFlagHiggsMassFixed) vecci.push_back(BCMath::LogBreitWignerRel(Higgs_fit_m, parameters[parHiggsM], gammaHiggs)); //comp13 + + // return log of likelihood + return vecci; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTZTrilepton.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTZTrilepton.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d579170b3333327742dbc68d0f3722be48b257ef --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTTZTrilepton.cxx @@ -0,0 +1,1063 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTTZTrilepton.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTTZTrilepton::LikelihoodTTZTrilepton() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , fFlagGetParSigmasFromTFs(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) + , fInvMassCutoff(5.) + , fOnShellFraction(0.869) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTTZTrilepton::~LikelihoodTTZTrilepton() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTZTrilepton::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTZTrilepton::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron Z1"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron Z2"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon Z1"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon Z2"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "Z boson"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTTZTrilepton::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // parBhadE + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // parBlepE + AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + AddParameter("energy lepton", 0.0, 1000.0); // parLepE + AddParameter("energy Z lepton 1", 0.0, 1000.0); // parLepZ1E + AddParameter("energy Z lepton 2", 0.0, 1000.0); // parLepZ2E + AddParameter("p_x neutrino", -1000.0, 1000.0); // parNuPx + AddParameter("p_y neutrino", -1000.0, 1000.0); // parNuPy + AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz + AddParameter("top mass", 100.0, 1000.0); // parTopM + AddParameter("Z mass", 0.0, 1000.0); // parZM +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTTZTrilepton::LogBreitWignerRelNorm(const double& x, const double& mean, const double& gamma) +{ + double g = std::sqrt(pow(mean, 2) * (pow(mean, 2) + pow(gamma, 2))); + double k = (2 * std::sqrt(2) * mean * gamma * g) / (M_PI * std::sqrt(pow(mean, 2) + g)); + double f = k / (pow(pow(x, 2) - pow(mean, 2), 2) + pow(mean * gamma, 2)); + return log(f); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTTZTrilepton::LogZCombinedDistribution(const double& x, const double& mean, const double& gamma) +{ + // note: This catches exceptions when the variables are set to non-sensible + // values. If there is any common way to handle exceptions, it should be + // implemented here. + const auto fraction = fOnShellFraction; + if (fraction < 0 || fraction > 1) throw; + if (fInvMassCutoff < 0) throw; + + double g = std::sqrt(pow(mean, 2) * (pow(mean, 2) + pow(gamma, 2))); + double k = (2 * std::sqrt(2) * mean * gamma * g) / (M_PI * std::sqrt(pow(mean, 2) + g)); + double on_shell = k / (pow(pow(x, 2) - pow(mean, 2), 2) + pow(mean * gamma, 2)); + double off_shell = fInvMassCutoff / x / x; + return log(on_shell * fraction + off_shell * (1 - fraction)); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + static double whad_fit_e; + static double whad_fit_px; + static double whad_fit_py; + static double whad_fit_pz; + static double wlep_fit_e; + static double wlep_fit_px; + static double wlep_fit_py; + static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + static double Z_fit_e; + static double Z_fit_px; + static double Z_fit_py; + static double Z_fit_pz; + + // hadronic b quark + bhad_fit_e = parameters[parBhadE]; + scale = sqrt(bhad_fit_e*bhad_fit_e - bhad_meas_m*bhad_meas_m) / bhad_meas_p; + bhad_fit_px = scale * bhad_meas_px; + bhad_fit_py = scale * bhad_meas_py; + bhad_fit_pz = scale * bhad_meas_pz; + + // leptonic b quark + blep_fit_e = parameters[parBlepE]; + scale = sqrt(blep_fit_e*blep_fit_e - blep_meas_m*blep_meas_m) / blep_meas_p; + blep_fit_px = scale * blep_meas_px; + blep_fit_py = scale * blep_meas_py; + blep_fit_pz = scale * blep_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + // Z lepton 1 + lepZ1_fit_e = parameters[parLepZ1E]; + scale = lepZ1_fit_e / lepZ1_meas_e; + lepZ1_fit_px = scale * lepZ1_meas_px; + lepZ1_fit_py = scale * lepZ1_meas_py; + lepZ1_fit_pz = scale * lepZ1_meas_pz; + + // Z lepton 2 + lepZ2_fit_e = parameters[parLepZ2E]; + scale = lepZ2_fit_e / lepZ2_meas_e; + lepZ2_fit_px = scale * lepZ2_meas_px; + lepZ2_fit_py = scale * lepZ2_meas_py; + lepZ2_fit_pz = scale * lepZ2_meas_pz; + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // hadronic W + whad_fit_e = lq1_fit_e +lq2_fit_e; + whad_fit_px = lq1_fit_px+lq2_fit_px; + whad_fit_py = lq1_fit_py+lq2_fit_py; + whad_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad_fit_m = sqrt(whad_fit_e*whad_fit_e - (whad_fit_px*whad_fit_px + whad_fit_py*whad_fit_py + whad_fit_pz*whad_fit_pz)); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = whad_fit_e+bhad_fit_e; + thad_fit_px = whad_fit_px+bhad_fit_px; + thad_fit_py = whad_fit_py+bhad_fit_py; + thad_fit_pz = whad_fit_pz+bhad_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+blep_fit_e; + tlep_fit_px = wlep_fit_px+blep_fit_px; + tlep_fit_py = wlep_fit_py+blep_fit_py; + tlep_fit_pz = wlep_fit_pz+blep_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + // Z boson + Z_fit_e = lepZ1_fit_e + lepZ2_fit_e; + Z_fit_px = lepZ1_fit_px + lepZ2_fit_px; + Z_fit_py = lepZ1_fit_py + lepZ2_fit_py; + Z_fit_pz = lepZ1_fit_pz + lepZ2_fit_pz; + Z_fit_m = sqrt(Z_fit_e*Z_fit_e - (Z_fit_px*Z_fit_px + Z_fit_py*Z_fit_py + Z_fit_pz*Z_fit_pz)); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the two Z leptons + KLFitter::Particles::ParticleType ptypeLepZ; + if (fTypeLepton == kElectron) { + ptypeLepZ = KLFitter::Particles::kElectron; + } else { + ptypeLepZ = KLFitter::Particles::kMuon; + } + + std::vector<int> indexVector_LepZ; + indexVector_LepZ.push_back(1); + indexVector_LepZ.push_back(2); + err *= (*fPermutations)->InvariantParticlePermutations(ptypeLepZ, indexVector_LepZ); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 4; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = fFlagGetParSigmasFromTFs ? 10 : 7; + double nsigmas_lepton = fFlagGetParSigmasFromTFs ? 10 : 2; + double nsigmas_met = fFlagGetParSigmasFromTFs ? 10 : 1; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double sigma = fFlagGetParSigmasFromTFs ? fResEnergyBhad->GetSigma(E) : sqrt(E); + double Emin = std::max(m, E - nsigmas_jet* sigma); + double Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBhadE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyBlep->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBlepE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ1->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ2->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ2E, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E) : sqrt(E); + Emin = std::max(0.001, E - nsigmas_lepton* sigma); + Emax = E + nsigmas_lepton* sigma; + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E*sintheta)/sintheta : E*E*sintheta; + double sigrange=nsigmas_lepton* sigma; + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(1)->E(); + sigma = fFlagGetParSigmasFromTFs ? fResLeptonZ1->GetSigma(E) : sqrt(E); + Emin = std::max(0.001, E - nsigmas_lepton* sigma); + Emax = E + nsigmas_lepton* sigma; + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(1)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(1)->Theta()); + sigma = fFlagGetParSigmasFromTFs ? fResLeptonZ1->GetSigma(E*sintheta)/sintheta : E*E*sintheta; + double sigrange=nsigmas_lepton* sigma; + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepZ1E, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(2)->E(); + sigma = fFlagGetParSigmasFromTFs ? fResLeptonZ2->GetSigma(E) : sqrt(E); + Emin = std::max(0.001, E - nsigmas_lepton* sigma); + Emax = E + nsigmas_lepton* sigma; + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(2)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(2)->Theta()); + sigma = fFlagGetParSigmasFromTFs ? fResLeptonZ2->GetSigma(E*sintheta)/sintheta : E*E*sintheta; + double sigrange=nsigmas_lepton* sigma; + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepZ2E, Emin, Emax); + + // note: this is hard-coded at the moment + + sigma = fFlagGetParSigmasFromTFs ? fResMET->GetSigma(SumET) : 100; + double sigrange = nsigmas_met*sigma; + SetParameterRange(parNuPx, ETmiss_x-sigrange, ETmiss_x+sigrange); + SetParameterRange(parNuPy, ETmiss_y-sigrange, ETmiss_y+sigrange); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + SetParameterRange(parZM, fPhysicsConstants->MassZ(), fPhysicsConstants->MassZ()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTTZTrilepton::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + if (fTypeLepton == kElectron) + logprob += log( fResLeptonZ1->p(lepZ1_fit_e, lepZ1_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLeptonZ1->p(lepZ1_fit_e* lepZ1_meas_sintheta, lepZ1_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + if (fTypeLepton == kElectron) + logprob += log( fResLeptonZ2->p(lepZ2_fit_e, lepZ2_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLeptonZ2->p(lepZ2_fit_e* lepZ2_meas_sintheta, lepZ2_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + double gammaZ = fPhysicsConstants->GammaZ(); + + // note: as opposed to the LikelihoodTopLeptonJets class, we use a normalised + // version of the Breit-Wigner here to make sure that weightings between + // functions are handled correctly. + + // Breit-Wigner of hadronically decaying W-boson + logprob += LogBreitWignerRelNorm(whad_fit_m, massW, gammaW); + + // Breit-Wigner of leptonically decaying W-boson + logprob += LogBreitWignerRelNorm(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying top quark + logprob += LogBreitWignerRelNorm(thad_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of leptonically decaying top quark + logprob += LogBreitWignerRelNorm(tlep_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of Z boson decaying into two leptons + logprob += LogZCombinedDistribution(Z_fit_m, parameters[parZM], gammaZ); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTZTrilepton::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTZTrilepton::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhadE] = bhad_meas_e; + values[parBlepE] = blep_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + values[parLepZ1E] = lepZ1_meas_e; + values[parLepZ2E] = lepZ2_meas_e; + + // energy of the lepton + if (fTypeLepton == kElectron) + values[parLepE] = (*fParticlesPermuted)->Electron(0)->E(); + else if (fTypeLepton == kMuon) + values[parLepE] = (*fParticlesPermuted)->Muon(0)->E(); + + if (fTypeLepton == kElectron) + values[parLepZ1E] = (*fParticlesPermuted)->Electron(1)->E(); + else if (fTypeLepton == kMuon) + values[parLepZ1E] = (*fParticlesPermuted)->Muon(1)->E(); + + if (fTypeLepton == kElectron) + values[parLepZ2E] = (*fParticlesPermuted)->Electron(2)->E(); + else if (fTypeLepton == kMuon) + values[parLepZ2E] = (*fParticlesPermuted)->Muon(2)->E(); + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0.; + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + // Z mass + double mz; + if (fTypeLepton == kElectron) { + mz = ( *(*fParticlesPermuted)->Electron(1) + *(*fParticlesPermuted)->Electron(2)).M(); + } else { + mz = ( *(*fParticlesPermuted)->Muon(1) + *(*fParticlesPermuted)->Muon(2)).M(); + } + if (mz < GetParameter(parZM)->GetLowerLimit()) + mz = GetParameter(parZM)->GetLowerLimit(); + else if (mz > GetParameter(parZM)->GetUpperLimit()) + mz = GetParameter(parZM)->GetUpperLimit(); + values[parZM] = mz; + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTZTrilepton::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTZTrilepton::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTTZTrilepton::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::SavePermutedParticles() { + bhad_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad_meas_px, bhad_meas_py, bhad_meas_pz, bhad_meas_e); + bhad_meas_p = sqrt(bhad_meas_e*bhad_meas_e - bhad_meas_m*bhad_meas_m); + + blep_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + blep_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + blep_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + blep_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + blep_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + blep_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), blep_meas_px, blep_meas_py, blep_meas_pz, blep_meas_e); + blep_meas_p = sqrt(blep_meas_e*blep_meas_e - blep_meas_m*blep_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(3)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(3)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(3)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(3)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(3)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + TLorentzVector * leptonZ1(0); + TLorentzVector * leptonZ2(0); + if (fTypeLepton == kElectron) { + leptonZ1 = (*fParticlesPermuted)->Electron(1); + lepZ1_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kElectron); + leptonZ2 = (*fParticlesPermuted)->Electron(2); + lepZ2_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kElectron); + } else { + leptonZ1 = (*fParticlesPermuted)->Muon(1); + lepZ1_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kMuon); + leptonZ2 = (*fParticlesPermuted)->Muon(2); + lepZ2_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kMuon); + } + + lepZ1_meas_e = leptonZ1->E(); + lepZ1_meas_sintheta = sin(leptonZ1->Theta()); + lepZ1_meas_pt = leptonZ1->Pt(); + lepZ1_meas_px = leptonZ1->Px(); + lepZ1_meas_py = leptonZ1->Py(); + lepZ1_meas_pz = leptonZ1->Pz(); + + lepZ2_meas_e = leptonZ2->E(); + lepZ2_meas_sintheta = sin(leptonZ2->Theta()); + lepZ2_meas_pt = leptonZ2->Pt(); + lepZ2_meas_px = leptonZ2->Px(); + lepZ2_meas_py = leptonZ2->Py(); + lepZ2_meas_pz = leptonZ2->Pz(); + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTTZTrilepton::SaveResolutionFunctions() { + + fResEnergyBhad = (*fDetector)->ResEnergyBJet(bhad_meas_deteta); + fResEnergyBlep = (*fDetector)->ResEnergyBJet(blep_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + if (fTypeLepton == kElectron) + fResLeptonZ1 = (*fDetector)->ResEnergyElectron(lepZ1_meas_deteta); + else if (fTypeLepton == kMuon) + fResLeptonZ1 = (*fDetector)->ResEnergyMuon(lepZ1_meas_deteta); + + if (fTypeLepton == kElectron) + fResLeptonZ2 = (*fDetector)->ResEnergyElectron(lepZ2_meas_deteta); + else if (fTypeLepton == kMuon) + fResLeptonZ2 = (*fDetector)->ResEnergyMuon(lepZ2_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTTZTrilepton::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad = fParticlesModel->Parton(0); + TLorentzVector * blep = fParticlesModel->Parton(1); + TLorentzVector * lq1 = fParticlesModel->Parton(2); + TLorentzVector * lq2 = fParticlesModel->Parton(3); + TLorentzVector * lep(0); + if (fTypeLepton == kElectron) + lep = fParticlesModel->Electron(0); + else if (fTypeLepton == kMuon) + lep = fParticlesModel->Muon(0); + TLorentzVector * lepZ1(0); + if (fTypeLepton == kElectron) + lepZ1 = fParticlesModel->Electron(1); + else if (fTypeLepton == kMuon) + lepZ1 = fParticlesModel->Muon(1); + TLorentzVector * lepZ2(0); + if (fTypeLepton == kElectron) + lepZ2 = fParticlesModel->Electron(2); + else if (fTypeLepton == kMuon) + lepZ2 = fParticlesModel->Muon(2); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * whad = fParticlesModel->Boson(0); + TLorentzVector * wlep = fParticlesModel->Boson(1); + TLorentzVector * thad = fParticlesModel->Parton(4); + TLorentzVector * tlep = fParticlesModel->Parton(5); + + TLorentzVector * Z = fParticlesModel->Boson(2); + + bhad->SetPxPyPzE(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + blep->SetPxPyPzE(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + lepZ1->SetPxPyPzE(lepZ1_fit_px, lepZ1_fit_py, lepZ1_fit_pz, lepZ1_fit_e); + lepZ2->SetPxPyPzE(lepZ2_fit_px, lepZ2_fit_py, lepZ2_fit_pz, lepZ2_fit_e); + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*whad) = (*lq1) + (*lq2); + (*wlep) = (*lep) + (*nu); + (*thad) = (*whad) + (*bhad); + (*tlep) = (*wlep) + (*blep); + + (*Z) = (*lepZ1) + (*lepZ2); + + // no error + return 1; +} +// --------------------------------------------------------- + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTTZTrilepton::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) )); //comp4 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLeptonZ1->p(lepZ1_fit_e, lepZ1_meas_e, TFgoodTmp) )); //comp4 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLeptonZ1->p(lepZ1_fit_e* lepZ1_meas_sintheta, lepZ1_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLeptonZ2->p(lepZ2_fit_e, lepZ2_meas_e, TFgoodTmp) )); //comp4 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLeptonZ2->p(lepZ2_fit_e* lepZ2_meas_sintheta, lepZ2_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + vecci.push_back(log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) )); //comp6 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + double gammaZ = fPhysicsConstants->GammaZ(); + + // note: as opposed to the LikelihoodTopLeptonJets class, we use a normalised + // version of the Breit-Wigner here to make sure that weightings between + // functions are handled correctly. + + // Breit-Wigner of hadronically decaying W-boson + vecci.push_back(LogBreitWignerRelNorm(whad_fit_m, massW, gammaW)); //comp7 + + // Breit-Wigner of leptonically decaying W-boson + vecci.push_back(LogBreitWignerRelNorm(wlep_fit_m, massW, gammaW)); //comp8 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(LogBreitWignerRelNorm(thad_fit_m, parameters[parTopM], gammaTop)); //comp9 + + // Breit-Wigner of leptonically decaying top quark + vecci.push_back(LogBreitWignerRelNorm(tlep_fit_m, parameters[parTopM], gammaTop)); //comp10 + + // Breit-Wigner of Z decaying into 2 leptons + vecci.push_back(LogZCombinedDistribution(Z_fit_m, parameters[parZM], gammaZ)); //comp11 + + // return log of likelihood + return vecci; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopAllHadronic.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopAllHadronic.cxx new file mode 100644 index 0000000000000000000000000000000000000000..89ff15edd65cf64d6859ea32eab2fae4da56085e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopAllHadronic.cxx @@ -0,0 +1,637 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopAllHadronic.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> +#include <set> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTopAllHadronic::LikelihoodTopAllHadronic() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , fFlagGetParSigmasFromTFs(false) + , fTFgood(true) +{ + // define model particles + DefineModelParticles(); + + // define parameters + DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopAllHadronic::~LikelihoodTopAllHadronic() +{ +} + + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark 1", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic b quark 2", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 3", + 4, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 4", + 5, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W 1"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W 2"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top 1"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top 2"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopAllHadronic::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b 1", fPhysicsConstants->MassBottom(), 1000.0); // parBhad1E + AddParameter("energy hadronic b 2", fPhysicsConstants->MassBottom(), 1000.0); // parBhad2E + AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + AddParameter("energy light quark 3", 0.0, 1000.0); // parLQ3E + AddParameter("energy light quark 4", 0.0, 1000.0); // parLQ4E + AddParameter("top mass", 100.0, 1000.0); // parTopM +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + static double whad1_fit_e; + static double whad1_fit_px; + static double whad1_fit_py; + static double whad1_fit_pz; + static double whad2_fit_e; + static double whad2_fit_px; + static double whad2_fit_py; + static double whad2_fit_pz; + static double thad1_fit_e; + static double thad1_fit_px; + static double thad1_fit_py; + static double thad1_fit_pz; + static double thad2_fit_e; + static double thad2_fit_px; + static double thad2_fit_py; + static double thad2_fit_pz; + + // hadronic b quark 1 + bhad1_fit_e = parameters[parBhad1E]; + scale = sqrt(bhad1_fit_e*bhad1_fit_e - bhad1_meas_m*bhad1_meas_m) / bhad1_meas_p; + bhad1_fit_px = scale * bhad1_meas_px; + bhad1_fit_py = scale * bhad1_meas_py; + bhad1_fit_pz = scale * bhad1_meas_pz; + + // hadronic b quark 2 + bhad2_fit_e = parameters[parBhad2E]; + scale = sqrt(bhad2_fit_e*bhad2_fit_e - bhad2_meas_m*bhad2_meas_m) / bhad2_meas_p; + bhad2_fit_px = scale * bhad2_meas_px; + bhad2_fit_py = scale * bhad2_meas_py; + bhad2_fit_pz = scale * bhad2_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + // light quark 3 + lq3_fit_e = parameters[parLQ3E]; + scale = sqrt(lq3_fit_e*lq3_fit_e - lq3_meas_m*lq3_meas_m) / lq3_meas_p; + lq3_fit_px = scale * lq3_meas_px; + lq3_fit_py = scale * lq3_meas_py; + lq3_fit_pz = scale * lq3_meas_pz; + + // light quark 4 + lq4_fit_e = parameters[parLQ4E]; + scale = sqrt(lq4_fit_e*lq4_fit_e - lq4_meas_m*lq4_meas_m) / lq4_meas_p; + lq4_fit_px = scale * lq4_meas_px; + lq4_fit_py = scale * lq4_meas_py; + lq4_fit_pz = scale * lq4_meas_pz; + + // hadronic W 1 + whad1_fit_e = lq1_fit_e +lq2_fit_e; + whad1_fit_px = lq1_fit_px+lq2_fit_px; + whad1_fit_py = lq1_fit_py+lq2_fit_py; + whad1_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad1_fit_m = sqrt(whad1_fit_e*whad1_fit_e - (whad1_fit_px*whad1_fit_px + whad1_fit_py*whad1_fit_py + whad1_fit_pz*whad1_fit_pz)); + + // hadronic W 2 + whad2_fit_e = lq3_fit_e +lq4_fit_e; + whad2_fit_px = lq3_fit_px+lq4_fit_px; + whad2_fit_py = lq3_fit_py+lq4_fit_py; + whad2_fit_pz = lq3_fit_pz+lq4_fit_pz; + whad2_fit_m = sqrt(whad2_fit_e*whad2_fit_e - (whad2_fit_px*whad2_fit_px + whad2_fit_py*whad2_fit_py + whad2_fit_pz*whad2_fit_pz)); + + // hadronic top 1 + thad1_fit_e = whad1_fit_e+bhad1_fit_e; + thad1_fit_px = whad1_fit_px+bhad1_fit_px; + thad1_fit_py = whad1_fit_py+bhad1_fit_py; + thad1_fit_pz = whad1_fit_pz+bhad1_fit_pz; + thad1_fit_m = sqrt(thad1_fit_e*thad1_fit_e - (thad1_fit_px*thad1_fit_px + thad1_fit_py*thad1_fit_py + thad1_fit_pz*thad1_fit_pz)); + + // hadronic top 2 + thad2_fit_e = whad2_fit_e+bhad2_fit_e; + thad2_fit_px = whad2_fit_px+bhad2_fit_px; + thad2_fit_py = whad2_fit_py+bhad2_fit_py; + thad2_fit_pz = whad2_fit_pz+bhad2_fit_pz; + thad2_fit_m = sqrt(thad2_fit_e*thad2_fit_e - (thad2_fit_px*thad2_fit_px + thad2_fit_py*thad2_fit_py + thad2_fit_pz*thad2_fit_pz)); + + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + indexVector_Jets.clear(); + indexVector_Jets.push_back(4); + indexVector_Jets.push_back(5); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove invariant permutation when exchanging both top quarks + std::vector<int> indexVector_JetsTop1; + indexVector_JetsTop1.push_back(0); + indexVector_JetsTop1.push_back(2); + indexVector_JetsTop1.push_back(3); + std::vector<int> indexVector_JetsTop2; + indexVector_JetsTop2.push_back(1); + indexVector_JetsTop2.push_back(4); + indexVector_JetsTop2.push_back(5); + err *= (*fPermutations)->InvariantParticleGroupPermutations(ptype, indexVector_JetsTop1, indexVector_JetsTop2); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 6; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // return error code + return err; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTopAllHadronic::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + + // only in kVetoNoFitAndSoOn mode... + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + + // remove all permutations where a b-tagged jet/non-tagged jet is on a wrong position + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = fFlagGetParSigmasFromTFs ? 10 : 7; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double sigma = fFlagGetParSigmasFromTFs ? fResEnergyBhad1->GetSigma(E) : sqrt(E); + double Emin = std::max(m, E - nsigmas_jet* sigma); + double Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBhad1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyBhad2->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBhad2E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ1->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ2->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ2E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(4)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(4)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ3->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ3E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(5)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(5)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ4->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ4E, Emin, Emax); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopAllHadronic::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad1->p(bhad1_fit_e, bhad1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBhad2->p(bhad2_fit_e, bhad2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ3->p(lq3_fit_e, lq3_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ4->p(lq4_fit_e, lq4_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad1_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad2_fit_m, massW, gammaW); + + // Breit-Wigner of first hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad1_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of second hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad2_fit_m, parameters[parTopM], gammaTop); + + // return log of likelihood + return logprob; +} + + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopAllHadronic::GetInitialParameters() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhad1E] = bhad1_meas_e; + values[parBhad2E] = bhad2_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + values[parLQ3E] = lq3_meas_e; + values[parLQ4E] = lq4_meas_e; + + // still need to think about appropriate start value for top mass + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + // return the vector + return values; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTopAllHadronic::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::SavePermutedParticles() { + bhad1_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad1_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad1_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad1_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad1_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad1_meas_px, bhad1_meas_py, bhad1_meas_pz, bhad1_meas_e); + bhad1_meas_p = sqrt(bhad1_meas_e*bhad1_meas_e - bhad1_meas_m*bhad1_meas_m); + + bhad2_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + bhad2_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + bhad2_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + bhad2_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + bhad2_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + bhad2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), bhad2_meas_px, bhad2_meas_py, bhad2_meas_pz, bhad2_meas_e); + bhad2_meas_p = sqrt(bhad2_meas_e*bhad2_meas_e - bhad2_meas_m*bhad2_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(3)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(3)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(3)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(3)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(3)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + lq3_meas_e = (*fParticlesPermuted)->Parton(4)->E(); + lq3_meas_deteta = (*fParticlesPermuted)->DetEta(4, KLFitter::Particles::kParton); + lq3_meas_px = (*fParticlesPermuted)->Parton(4)->Px(); + lq3_meas_py = (*fParticlesPermuted)->Parton(4)->Py(); + lq3_meas_pz = (*fParticlesPermuted)->Parton(4)->Pz(); + lq3_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(4)->M(), 0., lq3_meas_px, lq3_meas_py, lq3_meas_pz, lq3_meas_e); + lq3_meas_p = sqrt(lq3_meas_e*lq3_meas_e - lq3_meas_m*lq3_meas_m); + + lq4_meas_e = (*fParticlesPermuted)->Parton(5)->E(); + lq4_meas_deteta = (*fParticlesPermuted)->DetEta(5, KLFitter::Particles::kParton); + lq4_meas_px = (*fParticlesPermuted)->Parton(5)->Px(); + lq4_meas_py = (*fParticlesPermuted)->Parton(5)->Py(); + lq4_meas_pz = (*fParticlesPermuted)->Parton(5)->Pz(); + lq4_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(5)->M(), 0., lq4_meas_px, lq4_meas_py, lq4_meas_pz, lq4_meas_e); + lq4_meas_p = sqrt(lq4_meas_e*lq4_meas_e - lq4_meas_m*lq4_meas_m); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopAllHadronic::SaveResolutionFunctions() { + + fResEnergyBhad1 = (*fDetector)->ResEnergyBJet(bhad1_meas_deteta); + fResEnergyBhad2 = (*fDetector)->ResEnergyBJet(bhad2_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + fResEnergyLQ3 = (*fDetector)->ResEnergyLightJet(lq3_meas_deteta); + fResEnergyLQ4 = (*fDetector)->ResEnergyLightJet(lq4_meas_deteta); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTopAllHadronic::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad1 = fParticlesModel->Parton(0); + TLorentzVector * bhad2 = fParticlesModel->Parton(1); + TLorentzVector * lq1 = fParticlesModel->Parton(2); + TLorentzVector * lq2 = fParticlesModel->Parton(3); + TLorentzVector * lq3 = fParticlesModel->Parton(4); + TLorentzVector * lq4 = fParticlesModel->Parton(5); + + TLorentzVector * whad1 = fParticlesModel->Boson(0); + TLorentzVector * whad2 = fParticlesModel->Boson(1); + TLorentzVector * thad1 = fParticlesModel->Parton(6); + TLorentzVector * thad2 = fParticlesModel->Parton(7); + + bhad1->SetPxPyPzE(bhad1_fit_px, bhad1_fit_py, bhad1_fit_pz, bhad1_fit_e); + bhad2->SetPxPyPzE(bhad2_fit_px, bhad2_fit_py, bhad2_fit_pz, bhad2_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + lq3 ->SetPxPyPzE(lq3_fit_px, lq3_fit_py, lq3_fit_pz, lq3_fit_e); + lq4 ->SetPxPyPzE(lq4_fit_px, lq4_fit_py, lq4_fit_pz, lq4_fit_e); + + (*whad1) = (*lq1) + (*lq2); + (*whad2) = (*lq3) + (*lq4); + (*thad1) = (*whad1) + (*bhad1); + (*thad2) = (*whad2) + (*bhad2); + + // no error + return 1; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopAllHadronic::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad1->p(bhad1_fit_e, bhad1_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBhad2->p(bhad2_fit_e, bhad2_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ3->p(lq3_fit_e, lq3_meas_e, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ4->p(lq4_fit_e, lq4_meas_e, TFgoodTmp) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson1 + vecci.push_back(BCMath::LogBreitWignerRel(whad1_fit_m, massW, gammaW)); //comp6 + + // Breit-Wigner of hadronically decaying W-boson2 + vecci.push_back(BCMath::LogBreitWignerRel(whad2_fit_m, massW, gammaW)); //comp7 + + // Breit-Wigner of hadronically decaying top quark1 + vecci.push_back(BCMath::LogBreitWignerRel(thad1_fit_m, parameters[parTopM], gammaTop)); //comp8 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(thad2_fit_m, parameters[parTopM], gammaTop)); //comp9 + + // return log of likelihood + return vecci; +} + + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopDilepton.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopDilepton.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c907bb58a22c13858ab756a064b824b555ef3adb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopDilepton.cxx @@ -0,0 +1,1475 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopDilepton.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" +#include <assert.h> +#include <iostream> +#include <algorithm> +#include <cmath> + +#include "BAT/BCModel.h" +#include "BAT/BCH1D.h" +#include <BAT/BCMath.h> + +// --------------------------------------------------------- +KLFitter::LikelihoodTopDilepton::LikelihoodTopDilepton() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton_1(kElectron) + , fTypeLepton_2(kElectron) + , nueta_params(0.) + , doSumloglik(false) + , fTFgood(true) + , hist_mttbar(new TH1D()) + , hist_costheta(new TH1D()) + , fHistMttbar(new BCH1D()) + , fHistCosTheta(new BCH1D()) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); + + // define prior + this->DefinePrior(); + +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopDilepton::~LikelihoodTopDilepton() +{ + delete fHistMttbar; + delete fHistCosTheta; + +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopDilepton::SetLeptonType(LeptonType leptontype_1, LeptonType leptontype_2) +{ + if ((leptontype_1 != kElectron && leptontype_1 != kMuon) || (leptontype_2 != kElectron && leptontype_2 != kMuon)) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron-electron as lepton type." << std::endl; + fTypeLepton_1 = kElectron; + fTypeLepton_2 = kElectron; + } + else { + fTypeLepton_1 = leptontype_1; + fTypeLepton_2 = leptontype_2; + } + + // define model particles + DefineModelParticles(); + + // define histograms + DefineHistograms(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopDilepton::SetLeptonType(int leptontype_1, int leptontype_2 ) +{ + if ((leptontype_1 != 1 && leptontype_1 != 2) || (leptontype_2 != 1 && leptontype_2 != 2)) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype_1 = 1; + leptontype_2 = 1; + } + + if (leptontype_1 == 1 && leptontype_2 == 1) + SetLeptonType(kElectron, kElectron); + else if (leptontype_1 == 1 && leptontype_2 == 2) + SetLeptonType(kElectron, kMuon); + else if (leptontype_1 == 2 && leptontype_2 == 2) + SetLeptonType(kMuon, kMuon); + else + std::cout << "LikelihoodTopDilepton::SetLeptonType Error: NOT POSSIBLE (2,1) conf! <---" << std::endl; +} + + + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "b quark 1", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "b quark 2", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron 1"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron 2"); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon 1"); + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon 2"); + } + + //free memory + delete dummy; + + // no error + return 1; +} + + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopDilepton::DefineParameters() +{ + // add parameters of model + + AddParameter("top mass", 100.0, 700.0); // parTopM + AddParameter("energy b1", fPhysicsConstants->MassBottom(), 1000.0); // parB1E + AddParameter("energy b2", fPhysicsConstants->MassBottom(), 1000.0); // parB2E + AddParameter("energy lepton1", 0.0, 1000.0); // parLep1E + AddParameter("energy lepton2", 0.0, 1000.0); // parLep2E + AddParameter("antinueta", -5.0, 5.0); // parAntiNuEta + AddParameter("nueta", -5.0, 5.0); // parNuEta + + +} + +// --------------------------------------------------------- + +void KLFitter::LikelihoodTopDilepton::DefinePrior() +{ + // define sharp Gaussian prior for mtop + if (fFlagTopMassFixed) + SetPriorGauss(0,fPhysicsConstants->MassTop(),fPhysicsConstants->MassTopUnc()); + +} + +// --------------------------------------------------------- + +void KLFitter::LikelihoodTopDilepton::DefineHistograms() +{ + const char *channel = 0; + + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + channel = "emu"; + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + channel = "ee"; + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + channel = "mumu"; + } + + // create a new ROOT and BAT histogram for mttbar + hist_mttbar = new TH1D(TString::Format("hist_mttbar_%s", channel), "", 100, 100., 1500.); + fHistMttbar->SetHistogram(hist_mttbar); + + // create a new ROOT and BAT histogram for costheta + hist_costheta = new TH1D(TString::Format("hist_costheta_%s", channel), "", 100, 0., 1.); + fHistCosTheta->SetHistogram(hist_costheta); + +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + + // b1 quark + b1_fit_e = parameters[parB1E]; + scale = sqrt(b1_fit_e*b1_fit_e - b1_meas_m*b1_meas_m) / b1_meas_p; + b1_fit_px = scale * b1_meas_px; + b1_fit_py = scale * b1_meas_py; + b1_fit_pz = scale * b1_meas_pz; + + // b2 quark + b2_fit_e = parameters[parB2E]; + scale = sqrt(b2_fit_e*b2_fit_e - b2_meas_m*b2_meas_m) / b2_meas_p; + b2_fit_px = scale * b2_meas_px; + b2_fit_py = scale * b2_meas_py; + b2_fit_pz = scale * b2_meas_pz; + + // lepton1 + lep1_fit_e = parameters[parLep1E]; + scale = lep1_fit_e / lep1_meas_e; + lep1_fit_px = scale * lep1_meas_px; + lep1_fit_py = scale * lep1_meas_py; + lep1_fit_pz = scale * lep1_meas_pz; + + // lepton2 + lep2_fit_e = parameters[parLep2E]; + scale = lep2_fit_e / lep2_meas_e; + lep2_fit_px = scale * lep2_meas_px; + lep2_fit_py = scale * lep2_meas_py; + lep2_fit_pz = scale * lep2_meas_pz; + + // no error + return 1; +} + + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // only for Markov chains: SPECIFY NChains!! + SetInitialParametersNChains( GetInitialParameters(), 5 ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 2; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove lepton permutations within the same kind + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + + if(doSumloglik) { + // remove the permutation from the 2 bjets + ptype = KLFitter::Particles::kParton; + indexVector_Jets.clear(); + indexVector_Jets.push_back(0); + indexVector_Jets.push_back(1); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::AdjustParameterRanges() +{ + // adjust limits + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop()-3*fPhysicsConstants->MassTopUnc(), fPhysicsConstants->MassTop()+3*fPhysicsConstants->MassTopUnc()); + + double nsigmas_jet = 7.0; + double nsigmas_lepton = 7.0; + + // TF parameters for lepton1 and lepton2 + double par2_1=0.; + double par3_1=0.; + + double par2_2=0.; + double par3_2=0.; + + fResLepton1->Par(2, par2_1); + fResLepton1->Par(3, par3_1); + fResLepton2->Par(2, par2_2); + fResLepton2->Par(3, par3_2); + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + double Emax = E + nsigmas_jet* sqrt(E); + //std::cout << "Emin b1: " << Emin << " Emax b1: " << Emax << std::endl; + SetParameterRange(parB1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + //std::cout << "Emin b2: " << Emin << " Emax b2: " << Emax << std::endl; + SetParameterRange(parB2E, Emin, Emax); + + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + E = (*fParticlesPermuted)->Electron(0)->E(); + double sigrange = nsigmas_lepton*std::max(par2_1*sqrt(E),par3_1*E); + Emin = std::max(0.001, E - sigrange); + Emax = E + sigrange; + //std::cout << "Emin el: " << Emin << " Emax el: " << Emax << std::endl; + SetParameterRange(parLep1E, Emin, Emax); + + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + sigrange = nsigmas_lepton*std::max(par2_2*E,par3_2*E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + //std::cout << "Emin mu: " << Emin << " Emax mu: " << Emax << std::endl; + SetParameterRange(parLep2E, Emin, Emax); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + E = (*fParticlesPermuted)->Electron(0)->E(); + double sigrange = nsigmas_lepton*std::max(par2_1*sqrt(E),par3_1*E); + Emin = std::max(0.001, E - sigrange); + Emax = E + sigrange; + // std::cout << "Emin el 1: " << Emin << " Emax el 1: " << Emax << std::endl; + SetParameterRange(parLep1E, Emin, Emax); + + E = (*fParticlesPermuted)->Electron(1)->E(); + sigrange = nsigmas_lepton*std::max(par2_2*sqrt(E),par3_2*E); + Emin = std::max(0.001, E - sigrange); + Emax = E + sigrange; + //std::cout << "Emin el 2: " << Emin << " Emax el 2: " << Emax << std::endl; + SetParameterRange(parLep2E, Emin, Emax); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + double sigrange= nsigmas_lepton*std::max(par2_1*E,par3_1*E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + //std::cout << "Emin mu 1: " << Emin << " Emax mu 1: " << Emax << std::endl; + SetParameterRange(parLep1E, Emin, Emax); + + E = (*fParticlesPermuted)->Muon(1)->E(); + sintheta= sin((*fParticlesPermuted)->Muon(1)->Theta()); + sigrange= nsigmas_lepton*std::max(par2_2*E,par3_2*E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + //std::cout << "Emin mu 2: " << Emin << " Emax mu 2: " << Emax << std::endl; + SetParameterRange(parLep2E, Emin, Emax); + } + + SetParameterRange(parAntiNuEta, -5.0, 5.0); + SetParameterRange(parNuEta, -5.0, 5.0); + + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopDilepton::LogLikelihood(const std::vector<double> & parameters) +{ + // define log of likelihood + double logweight(0.); + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + + ///////// NuWT likelihood term + double nuwt_weight(0.); + nuwt_weight = CalculateWeight(parameters); + // ensure that likelihood components are not zero to avoid loglik=inf + if(nuwt_weight == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log(nuwt_weight); + //std::cout << "NUWT : " << logweight << std::endl; + + if(logweight + 10 == logweight) std::cout << "NUWT inf! : " << logweight << std::endl; + + + //////// jet energy resolution terms + if( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) == 0. ){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + //std::cout << "TF b1 : " << log( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) ) << std::endl; + + if(logweight + 10 == logweight) std::cout << "TF b1 inf! : " << log( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) ) << std::endl; + + + if( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + //std::cout << "TF b2 : " << log( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) ) << std::endl; + + if(logweight + 10 == logweight) std::cout << "TF b2 inf! : " << log( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) ) << std::endl; + + + //////// lepton energy resolution terms EM + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + if( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) ); + + if( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + //std::cout << "TF lep emu : " << log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) ) << " and " << log( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) ) << std::endl; + + if(logweight + 10 == logweight) std::cout << "TF lep emu inf! : "<< log(fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp)) <<" and "<< log(fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp)) <<std::endl; + } + + //////// lepton energy resolution terms EE + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + if( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) ); + + if( fResLepton2->p(lep2_fit_e, lep2_meas_e, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton2->p(lep2_fit_e, lep2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + if(logweight + 10 == logweight) std::cout << "TF lep ee inf! : " << log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) ) << " and " << log( fResLepton2->p(lep2_fit_e, lep2_meas_e, TFgoodTmp) ) << std::endl; + } + + //////// lepton energy resolution terms MM + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + if( fResLepton1->p(lep1_fit_e*lep1_meas_sintheta, lep1_meas_pt, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton1->p(lep1_fit_e*lep1_meas_sintheta, lep1_meas_pt, TFgoodTmp) ); + + if( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + if(logweight + 10 == logweight) std::cout << "TF lep mumu inf! : " << log(fResLepton1->p(lep1_fit_e*lep1_meas_sintheta, lep1_meas_pt, TFgoodTmp)) << " and " << log(fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp)) << std::endl; + } + + //////// Antineutrino eta term + if (GaussAntiNuEta(parameters) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( GaussAntiNuEta(parameters) ); + //std::cout << "Gauss AntiNuEta : " << log( GaussAntiNuEta(parameters) ) << std::endl; + + if(logweight + 10 == logweight) std::cout << "Gauss AntiNuEta inf! : " << log( GaussAntiNuEta(parameters) ) << std::endl; + + + //////// Neutrino eta term + if (GaussNuEta(parameters) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( GaussNuEta(parameters) ); + //std::cout << "Gauss NuEta : " << log( GaussNuEta(parameters) ) << std::endl; + + if(logweight + 10 == logweight) std::cout << "Gauss NuEta inf! : " << log( GaussNuEta(parameters) ) << std::endl; + + + //////// Sum of invariant masses (lep,jet) term + if (CalculateMLepJet(parameters) == 0.){ + logweight = log(1e-99); + return logweight; + } + else + logweight += log( CalculateMLepJet(parameters) ); + + + if(logweight + 10 == logweight) std::cout << "CalculateMLepJet inf! : " << log( CalculateMLepJet(parameters) ) << std::endl; + + // check if total logweight is inf + if(logweight + 10 == logweight) std::cout << "logweight TOT = " << logweight << std::endl; + + // return log of weight + return logweight; +} + +double KLFitter::LikelihoodTopDilepton::CalculateMLepJet(const std::vector<double> & /*parameters*/){ + + double sumMinv=0.; + double norm=1.; + + // tuning factor alpha + double alpha=-2.; + + //charged leptons + TLorentzVector l1(0., 0., 0., 0.); + TLorentzVector l2(0., 0., 0., 0.); + + // include parLep1E, parLep2E + l1.SetPxPyPzE(lep1_fit_px, lep1_fit_py, lep1_fit_pz, lep1_fit_e); + l2.SetPxPyPzE(lep2_fit_px, lep2_fit_py, lep2_fit_pz, lep2_fit_e); + + // jet1 and jet2: + TLorentzVector j1(0., 0., 0., 0.); + TLorentzVector j2(0., 0., 0., 0.); + + // include parB1E, parB2E + j1.SetPxPyPzE(b1_fit_px, b1_fit_py, b1_fit_pz, b1_fit_e); + j2.SetPxPyPzE(b2_fit_px, b2_fit_py, b2_fit_pz, b2_fit_e); + + // normalized to the sum of all combinations of (lep,jet) + if ((pow((l1+j1).M() + (l2+j2).M(),alpha) + pow((l2+j1).M() + (l1+j2).M(),alpha))!=0.) + norm = 1/(pow((l1+j1).M() + (l2+j2).M(),alpha) + pow((l2+j1).M() + (l1+j2).M(),alpha)); + else + std::cout << "Error LikelihoodTopDilepton::CalculateMLepJet: normalization is inf!" << std::endl; + + // ensure correctly (lepton, nu) pair according to lepton charge + if (lep1_meas_charge == 1 && lep2_meas_charge == -1){ + //std::cout << "opt1: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + sumMinv = (l1+j1).M() + (l2+j2).M(); + } + else if (lep1_meas_charge == -1 && lep2_meas_charge == 1){ + //std::cout << "opt2: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + sumMinv = (l2+j1).M() + (l1+j2).M(); + } + else + std::cout << "ERROR KLFitter::LikelihoodTopDilepton::CalculateMLepJet -------> NO VALID LEPTON CHARGE!!!" << std::endl; + + // std::cout << "sumMinv: " << sumMinv << " pow(sumMinv," << alpha << "): " << pow(sumMinv,alpha) << std::endl; + + return norm*pow(sumMinv,alpha); +} + + +double KLFitter::LikelihoodTopDilepton::CalculateWeight(const std::vector<double> & parameters){ + + double Weight=0.; + + //charged leptons + TLorentzVector * l1 = new TLorentzVector(); + TLorentzVector * l2 = new TLorentzVector(); + + // include parLep1E, parLep2E + l1->SetPxPyPzE(lep1_fit_px, lep1_fit_py, lep1_fit_pz, lep1_fit_e); + l2->SetPxPyPzE(lep2_fit_px, lep2_fit_py, lep2_fit_pz, lep2_fit_e); + + // jet1 and jet2: + TLorentzVector * j1 = new TLorentzVector(); + TLorentzVector * j2 = new TLorentzVector(); + + // include parB1E, parB2E + j1->SetPxPyPzE(b1_fit_px, b1_fit_py, b1_fit_pz, b1_fit_e); + j2->SetPxPyPzE(b2_fit_px, b2_fit_py, b2_fit_pz, b2_fit_e); + + //std::cout << "mtop= " << parameters[parTopM] << std::endl; + + Weight += CalculateWeightPerm(l1,l2,j1,j2,parameters); + + // if sumloglik option, sum over jet permutations + if(doSumloglik) + Weight += CalculateWeightPerm(l1,l2,j2,j1,parameters); + + delete l1; + delete l2; + delete j1; + delete j2; + + return Weight; +} + +double KLFitter::LikelihoodTopDilepton::CalculateWeightPerm(TLorentzVector * l1, TLorentzVector * l2, TLorentzVector * j1, TLorentzVector * j2, const std::vector<double> & parameters) { + + double weight=0.; + int NSolutions=0; + + //set of kin solutions for neutrino/antineutrino + NuSolutions nus; + NuSolutions nubars; + + //std::cout << "parameters[parNuEta]: " << parameters[parNuEta] << " parameters[parAntiNuEta]: " << parameters[parAntiNuEta] << std::endl; + + // ensure correctly (lepton, nu) pair according to lepton charge + if (lep1_meas_charge == 1 && lep2_meas_charge == -1){ + //std::cout << "opt1: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + nus = SolveForNuMom(l1,j1,parameters[parTopM],parameters[parNuEta]); + nubars = SolveForNuMom(l2,j2,parameters[parTopM],parameters[parAntiNuEta]); + } + else if (lep1_meas_charge == -1 && lep2_meas_charge == 1){ + //std::cout << "opt2: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + nus = SolveForNuMom(l2,j1,parameters[parTopM],parameters[parNuEta]); + nubars = SolveForNuMom(l1,j2,parameters[parTopM],parameters[parAntiNuEta]); + } + else + std::cout << "ERROR KLFitter::LikelihoodTopDilepton::CalculateWeightPerm -------> NO VALID LEPTON CHARGE!!!" << std::endl; + + + if (nus.NSolutions>0 && nubars.NSolutions>0) { + weight += neutrino_weight(nus.nu1,nubars.nu1); // ***solution 1 + ++NSolutions; + + if (nus.NSolutions==1 && nubars.NSolutions==2) { + weight += neutrino_weight(nus.nu1,nubars.nu2);// ***solution 2 + + } + else if (nus.NSolutions==2 && nubars.NSolutions==1) { + weight += neutrino_weight(nus.nu2,nubars.nu1);// ***solution 2 + + } + else if (nus.NSolutions==2 && nubars.NSolutions==2) { + weight += neutrino_weight(nus.nu1,nubars.nu2);// ***solution 2 + + weight += neutrino_weight(nus.nu2,nubars.nu1);// ***solution 3 + + weight += neutrino_weight(nus.nu2,nubars.nu2);// ***solution 4 + + NSolutions+=3; + } + } + + //std::cout << "final weight: " << weight << std::endl; + return weight; +} + +double KLFitter::LikelihoodTopDilepton::GaussNuEta(std::vector<double> parameters) { + + double weight=0.; + + double nueta_sigma=0.; + double mtop_power=1.; + double mtop=0.; + + mtop= parameters[parTopM]; + + //build sigma of neutrino pseudorapidity dependency on mtop + for (unsigned int i=0;i!=nueta_params.size();++i) { + nueta_sigma+=nueta_params[i]*mtop_power; + mtop_power*=mtop; + } + + weight = 1/(nueta_sigma*sqrt(2*M_PI))*exp( - parameters[parNuEta]*parameters[parNuEta]/(2*nueta_sigma*nueta_sigma)); + + //std::cout << "parameters[parNuEta]: " << parameters[parNuEta] << " weight: " << weight << std::endl; + //std::cout << "sigma1: " << nueta_sigma << " mtop: " << mtop << std::endl; + + return weight; +} + +double KLFitter::LikelihoodTopDilepton::GaussAntiNuEta(std::vector<double> parameters) { + + double weight=0.; + + double nueta_sigma=0.; + double mtop_power=1.; + double mtop=0.; + + mtop= parameters[parTopM]; + + //build sigma of antineutrino pseudorapidity dependency on mtop + for (unsigned int i=0;i!=nueta_params.size();++i) { + nueta_sigma+=nueta_params[i]*mtop_power; + mtop_power*=mtop; + } + + weight = 1/(nueta_sigma*sqrt(2*M_PI))*exp( - parameters[parAntiNuEta]*parameters[parAntiNuEta]/(2*nueta_sigma*nueta_sigma)); + + //std::cout << "parameters[parAntiNuEta]: " << parameters[parAntiNuEta] << " weight: " << weight << std::endl; + //std::cout << "sigma2: " << nueta_sigma << " mtop: " << mtop << std::endl; + + return weight; +} + +KLFitter::NuSolutions KLFitter::LikelihoodTopDilepton::SolveForNuMom(TLorentzVector * l, TLorentzVector * b, double mtop, double nueta){ + + NuSolutions ret; + double Wmass = fPhysicsConstants->MassW(); + double Wmass2=Wmass*Wmass; + + double bmass = fPhysicsConstants->MassBottom(); + + double coshnueta; + double sinhnueta; + double Elprime; + double Ebprime; + double A; + double B; + double par1; + double C; + double par2; + double D; + double F; + double det; + double py; + double px; + double pT2; + double pz; + double tmp; + double py1; + double py2; + double px1; + double px2; + double pT2_1; + double pT2_2; + double pz1; + double pz2; + double E1; + double E2; + + + coshnueta = cosh(nueta); + sinhnueta = sinh(nueta); + Elprime = l->E()*coshnueta-l->Pz()*sinhnueta; + Ebprime = b->E()*coshnueta-b->Pz()*sinhnueta; + + //std::cout << "Elprime: " << Elprime << std::endl; + //std::cout << "Ebprime: " << Ebprime << std::endl; + + A = (l->Py()*Ebprime-b->Py()*Elprime)/(b->Px()*Elprime-l->Px()*Ebprime); + B = (Elprime*(mtop*mtop-Wmass2-bmass*bmass-2.*(*l)*(*b))-Ebprime*Wmass2)/(2.*(l->Px()*Ebprime-b->Px()*Elprime)); + + par1 = (l->Px()*A+l->Py())/Elprime; + C = A*A+1.-par1*par1; + par2 = (Wmass2/2.+l->Px()*B)/Elprime; + D = 2.*(A*B-par2*par1); + F = B*B-par2*par2; + det = D*D-4.*C*F; + + if (det<0.) { + ret.NSolutions=0; + } + else if (det==0.) { + ret.NSolutions=1; + py=-D/(2.*C); + px=A*py+B; + pT2=px*px+py*py; + pz=sqrt(pT2)*sinhnueta; + ret.nu1.SetPxPyPzE(px,py,pz,sqrt(pT2+pz*pz)); + } + else { + ret.NSolutions=2; + tmp=sqrt(det)/(2.*C); + py1=-D/(2.*C)+tmp; + py2=-D/(2.*C)-tmp; + px1=A*py1+B; + px2=A*py2+B; + pT2_1=px1*px1+py1*py1; + pT2_2=px2*px2+py2*py2; + pz1=sqrt(pT2_1)*sinhnueta; + pz2=sqrt(pT2_2)*sinhnueta; + E1 = sqrt(pT2_1+pz1*pz1); + E2 = sqrt(pT2_2+pz2*pz2); + //std::cout << "py1= " << py1 << " py2= " << py2 << " px1= " << px1 << " px2= " << px2 << " pz1= " << pz1 << " pz2= " << pz2 << " E1= " << E1 << " E2= " << E2 << std::endl; + //std::cout << "pT2_1= " << pT2_1 << " pT2_2= " << pT2_2 << " sqrt(pT2_1+pz1*pz1)= " << sqrt(pT2_1+pz1*pz1) << " sqrt(pT2_2+pz2*pz2)= " << sqrt(pT2_2+pz2*pz2) << std::endl; + + ret.nu1.SetPxPyPzE(px1,py1,pz1,E1); + ret.nu2.SetPxPyPzE(px2,py2,pz2,E2); + + } + if (ret.NSolutions==1) std::cout<<"KLFitter::LikelihoodTopDilepton::SolveForNuMom NSolutions==1 !!!!!!!!!!!!!!!!!"<<std::endl; + + return ret; +} + +double KLFitter::LikelihoodTopDilepton::neutrino_weight(TLorentzVector nu,TLorentzVector nubar) { + + static double sigmaX; + static double sigmaY; + static double dx; + static double dy; + + // MET resolution in terms of SumET + sigmaX = fResMET->GetSigma(SumET); + sigmaY = fResMET->GetSigma(SumET); + + //std::cout << "sigmaX: " << sigmaX << " sigmaY: " << sigmaY << std::endl; + + dx = ETmiss_x-nu.Px()-nubar.Px(); // check!! + dy = ETmiss_y-nu.Py()-nubar.Py(); // check!! + + //std::cout << "nu.Px(): " << nu.Px() << " nubar.Px(): " << nubar.Px() << std::endl; + //std::cout << "nu.Py(): " << nu.Py() << " nubar.Py(): " << nubar.Py() << std::endl; + + //std::cout << "dx: " << dx << "|| dy: " << dy << std::endl; + + return exp( -dx*dx/(2.*sigmaX*sigmaX) - dy*dy/(2.*sigmaY*sigmaY) ); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopDilepton::GetInitialParameters() +{ + std::vector<double> values(GetNParameters()); + + //std::cout << "GetNParameters: " << GetNParameters() << std::endl; + + // mtop + values[parTopM] = fPhysicsConstants->MassTop(); + + // energies of the quarks + values[parB1E] = b1_meas_e; + values[parB2E] = b2_meas_e; + + // energy of the lepton + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + values[parLep1E] = (*fParticlesPermuted)->Electron(0)->E(); + values[parLep2E] = (*fParticlesPermuted)->Muon(0)->E(); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + values[parLep1E] = (*fParticlesPermuted)->Electron(0)->E(); + values[parLep2E] = (*fParticlesPermuted)->Electron(1)->E(); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + values[parLep1E] = (*fParticlesPermuted)->Muon(0)->E(); + values[parLep2E] = (*fParticlesPermuted)->Muon(1)->E(); + } + + values[parAntiNuEta] = 0.; + values[parNuEta] = 0.; + + + return values; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTopDilepton::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::SavePermutedParticles() { + b1_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + b1_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + b1_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + b1_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + b1_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + b1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), b1_meas_px, b1_meas_py, b1_meas_pz, b1_meas_e); + b1_meas_p = sqrt(b1_meas_e*b1_meas_e - b1_meas_m*b1_meas_m); + + b2_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + b2_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + b2_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + b2_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + b2_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + b2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), b2_meas_px, b2_meas_py, b2_meas_pz, b2_meas_e); + b2_meas_p = sqrt(b2_meas_e*b2_meas_e - b2_meas_m*b2_meas_m); + + TLorentzVector * lepton_1(0); + TLorentzVector * lepton_2(0); + + + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon){ + lepton_1 = (*fParticlesPermuted)->Electron(0); + lep1_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + lep1_meas_charge = (*fParticlesPermuted)->LeptonCharge(0, KLFitter::Particles::kElectron); + lepton_2 = (*fParticlesPermuted)->Muon(0); + lep2_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + lep2_meas_charge = (*fParticlesPermuted)->LeptonCharge(0, KLFitter::Particles::kMuon); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + lepton_1 = (*fParticlesPermuted)->Electron(0); + lep1_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + lep1_meas_charge = (*fParticlesPermuted)->LeptonCharge(0, KLFitter::Particles::kElectron); + lepton_2 = (*fParticlesPermuted)->Electron(1); + lep2_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kElectron); + lep2_meas_charge = (*fParticlesPermuted)->LeptonCharge(1, KLFitter::Particles::kElectron); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + lepton_1 = (*fParticlesPermuted)->Muon(0); + lep1_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + lep1_meas_charge = (*fParticlesPermuted)->LeptonCharge(0, KLFitter::Particles::kMuon); + lepton_2 = (*fParticlesPermuted)->Muon(1); + lep2_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kMuon); + lep2_meas_charge = (*fParticlesPermuted)->LeptonCharge(1, KLFitter::Particles::kMuon); + } + + lep1_meas_e = lepton_1->E(); + lep1_meas_sintheta = sin(lepton_1->Theta()); + lep1_meas_pt = lepton_1->Pt(); + lep1_meas_px = lepton_1->Px(); + lep1_meas_py = lepton_1->Py(); + lep1_meas_pz = lepton_1->Pz(); + + lep2_meas_e = lepton_2->E(); + lep2_meas_sintheta = sin(lepton_2->Theta()); + lep2_meas_pt = lepton_2->Pt(); + lep2_meas_px = lepton_2->Px(); + lep2_meas_py = lepton_2->Py(); + lep2_meas_pz = lepton_2->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopDilepton::SaveResolutionFunctions() { + + fResEnergyB1 = (*fDetector)->ResEnergyBJet(b1_meas_deteta); + fResEnergyB2 = (*fDetector)->ResEnergyBJet(b2_meas_deteta); + + if(fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon){ + fResLepton1 = (*fDetector)->ResEnergyElectron(lep1_meas_deteta); + fResLepton2 = (*fDetector)->ResEnergyMuon(lep2_meas_deteta); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + fResLepton1 = (*fDetector)->ResEnergyElectron(lep1_meas_deteta); + fResLepton2 = (*fDetector)->ResEnergyElectron(lep2_meas_deteta); + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + fResLepton1 = (*fDetector)->ResEnergyMuon(lep1_meas_deteta); + fResLepton2 = (*fDetector)->ResEnergyMuon(lep2_meas_deteta); + } + + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTopDilepton::BuildModelParticles() { + if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * b1 = fParticlesModel->Parton(0); + TLorentzVector * b2 = fParticlesModel->Parton(1); + TLorentzVector * lep1(0); + TLorentzVector * lep2(0); + + if(fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon){ + lep1 = fParticlesModel->Electron(0); + lep2 = fParticlesModel->Muon(0); + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + lep1 = fParticlesModel->Electron(0); + lep2 = fParticlesModel->Electron(1); + } + else { + lep1 = fParticlesModel->Muon(0); + lep2 = fParticlesModel->Muon(1); + } + + b1 ->SetPxPyPzE(b1_fit_px, b1_fit_py, b1_fit_pz, b1_fit_e); + b2 ->SetPxPyPzE(b2_fit_px, b2_fit_py, b2_fit_pz, b2_fit_e); + lep1 ->SetPxPyPzE(lep1_fit_px, lep1_fit_py, lep1_fit_pz, lep1_fit_e); + lep2 ->SetPxPyPzE(lep2_fit_px, lep2_fit_py, lep2_fit_pz, lep2_fit_e); + + // no error + return 1; +} + +// --------------------------------------------------------- + +std::vector<double> KLFitter::LikelihoodTopDilepton::LogLikelihoodComponents(std::vector<double> parameters) +{ + std::vector<double> vecci(0); + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // NuWT likelihood term + double nuwt_weight(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // NuWT weight + nuwt_weight = CalculateWeight(parameters); + if(nuwt_weight == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( CalculateWeight(parameters) )); //comp0 + + // jet energy resolution terms + if( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) == 0. ) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResEnergyB1->p(b1_fit_e, b1_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + + if( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResEnergyB2->p(b2_fit_e, b2_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kMuon) { + if( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) )); //comp3 + + if( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton2->p(lep2_fit_e* lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + } + else if (fTypeLepton_1 == kElectron && fTypeLepton_2 == kElectron) { + if( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton1->p(lep1_fit_e, lep1_meas_e, TFgoodTmp) )); //comp3 + + if( fResLepton2->p(lep2_fit_e, lep2_meas_e, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton2->p(lep2_fit_e, lep2_meas_e, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + } + else if (fTypeLepton_1 == kMuon && fTypeLepton_2 == kMuon) { + if( fResLepton1->p(lep1_fit_e*lep1_meas_sintheta, lep1_meas_pt, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton1->p(lep1_fit_e* lep1_meas_sintheta, lep1_meas_pt, TFgoodTmp) )); //comp3 + + if( fResLepton2->p(lep2_fit_e*lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log( fResLepton2->p(lep2_fit_e* lep2_meas_sintheta, lep2_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + } + + // nueta and antinueta terms + + if (GaussAntiNuEta(parameters) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log (GaussAntiNuEta(parameters)) ); //comp5 + + if (GaussNuEta(parameters) == 0.) + vecci.push_back(log(1e-99)); + else + vecci.push_back(log (GaussNuEta(parameters)) ); //comp6 + + // sum of invariant masses (lep,jet) term + + if (CalculateMLepJet(parameters) == 0.){ + vecci.push_back(log(1e-99)); + } + else + vecci.push_back(log( CalculateMLepJet(parameters)) ); //comp7 + + + // return log of likelihood + return vecci; +} + +// --------------------------------------------------------- + +void KLFitter::LikelihoodTopDilepton::MCMCIterationInterface() +{ + TLorentzVector MCMC_b1(0., 0., 0., 0.); + TLorentzVector MCMC_b2(0., 0., 0., 0.); + TLorentzVector MCMC_lep1(0., 0., 0., 0.); + TLorentzVector MCMC_lep2(0., 0., 0., 0.); + TLorentzVector MCMC_nu1(0., 0., 0., 0.); + TLorentzVector MCMC_nu2(0., 0., 0., 0.); + + TLorentzVector MCMC_lep(0., 0., 0., 0.); + TLorentzVector MCMC_antilep(0., 0., 0., 0.); + + double scale_b1(0.); + double scale_b2(0.); + double scale_l1(0.); + double scale_l2(0.); + + NuSolutions nus; + NuSolutions nubars; + + // for mttbar + double mttbar(0.); + + // for costheta + std::pair<float, float> costheta(0.,0.); + std::vector <TLorentzVector> * help_ParticleVector = new std::vector<TLorentzVector>(0); + + // get number of chains + int nchains = MCMCGetNChains(); + + // get number of parameters + int npar = GetNParameters(); + + // loop over all chains and fill histogram + for (int i = 0; i < nchains; ++i) { + // get the current values of the KLFitter parameters. These are + // stored in fMCMCx. + double mtop = fMCMCx.at(i * npar + 0); + double Eb1 = fMCMCx.at(i * npar + 1); + double Eb2 = fMCMCx.at(i * npar + 2); + double El1 = fMCMCx.at(i * npar + 3); + double El2 = fMCMCx.at(i * npar + 4); + double antinueta = fMCMCx.at(i * npar + 5); + double nueta = fMCMCx.at(i * npar + 6); + + // std::cout << "mtop: " << mtop << std::endl; + // std::cout << "Eb1: " << Eb1 << std::endl; + // std::cout << "Eb2: " << Eb2 << std::endl; + // std::cout << "El1: " << El1 << std::endl; + // std::cout << "El2: " << El2 << std::endl; + // std::cout << "antinueta: " << antinueta<< std::endl; + // std::cout << "nueta: " << nueta << std::endl; + + + scale_b1 = sqrt(Eb1*Eb1 - b1_meas_m*b1_meas_m) / b1_meas_p; + scale_b2 = sqrt(Eb2*Eb2 - b2_meas_m*b2_meas_m) / b2_meas_p; + scale_l1 = El1 / lep1_meas_e; + scale_l2 = El2 / lep2_meas_e; + + MCMC_b1 .SetPxPyPzE(scale_b1 * b1_meas_px,scale_b1 * b1_meas_py,scale_b1 * b1_meas_pz,Eb1); + MCMC_b2 .SetPxPyPzE(scale_b2 * b2_meas_px,scale_b2 * b2_meas_py,scale_b2 * b2_meas_pz,Eb2); + MCMC_lep1.SetPxPyPzE(scale_l1 * lep1_meas_px,scale_l1 * lep1_meas_py,scale_l1 * lep1_meas_pz,El1); + MCMC_lep2.SetPxPyPzE(scale_l2 * lep2_meas_px,scale_l2 * lep2_meas_py,scale_l2 * lep2_meas_pz,El2); + + + // ensure correctly (lepton, nu) pair according to lepton charge + if (lep1_meas_charge == 1 && lep2_meas_charge == -1){ + //std::cout << "opt1: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + nus = SolveForNuMom(&MCMC_lep1,&MCMC_b1,mtop,nueta); + nubars = SolveForNuMom(&MCMC_lep2,&MCMC_b2,mtop,antinueta); + //for costheta + MCMC_lep = MCMC_lep2; + MCMC_antilep = MCMC_lep1; + } + else if (lep1_meas_charge == -1 && lep2_meas_charge == 1){ + //std::cout << "opt2: lep1_meas_charge: " << lep1_meas_charge << " and lep2_meas_charge: " << lep2_meas_charge << std::endl; + nus = SolveForNuMom(&MCMC_lep2,&MCMC_b1,mtop,nueta); + nubars = SolveForNuMom(&MCMC_lep1,&MCMC_b2,mtop,antinueta); + //for costheta + MCMC_lep = MCMC_lep1; + MCMC_antilep = MCMC_lep2; + } + else + std::cout << "ERROR KLFitter::LikelihoodTopDilepton::MCMCIterationInterface -------> NO VALID LEPTON CHARGE!!!" << std::endl; + + + if (nus.NSolutions > 0 && nubars.NSolutions > 0) { // 1 nu 1 nubar + + if (nus.nu1.M() >= 0 && nubars.nu1.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu1 + nubars.nu1).M(); + //std::cout << "1 mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu1); + help_ParticleVector -> push_back(nubars.nu1); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + + if (nus.NSolutions == 1 && nubars.NSolutions == 2) { // 1 nu 2 nubar + if (nus.nu1.M() >= 0 && nubars.nu2.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu1 + nubars.nu2).M(); + //std::cout << "2 mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu1); + help_ParticleVector -> push_back(nubars.nu2); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + }// 1 nu 2 nubar + else if (nus.NSolutions == 2 && nubars.NSolutions == 1){ // 2 nu 1 nubar + if (nus.nu2.M() >= 0 && nubars.nu1.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu2 + nubars.nu1).M(); + //std::cout << "3 mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu2); + help_ParticleVector -> push_back(nubars.nu1); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + }// 2 nu 1 nubar + else if (nus.NSolutions == 2 && nubars.NSolutions == 2){ // 2 nu 2 nubar + + if (nus.nu1.M() >= 0 && nubars.nu2.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu1 + nubars.nu2).M(); + //std::cout << "4a mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu1); + help_ParticleVector -> push_back(nubars.nu2); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + + if (nus.nu2.M() >= 0 && nubars.nu1.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu2 + nubars.nu1).M(); + // std::cout << "4b mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu2); + help_ParticleVector -> push_back(nubars.nu1); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + + if (nus.nu2.M() >= 0 && nubars.nu2.M() >= 0) { + //mttbar + mttbar = (MCMC_b1 + MCMC_b2 + MCMC_lep1 + MCMC_lep2 + nus.nu2 + nubars.nu2).M(); + //std::cout << "4c mttbar: " << mttbar << std::endl; + fHistMttbar->GetHistogram()->Fill(mttbar); + //costheta + help_ParticleVector->clear(); + help_ParticleVector -> push_back(MCMC_lep); + help_ParticleVector -> push_back(MCMC_antilep); + help_ParticleVector -> push_back(nus.nu2); + help_ParticleVector -> push_back(nubars.nu2); + help_ParticleVector -> push_back(MCMC_b1); + help_ParticleVector -> push_back(MCMC_b2); + costheta = CalculateCosTheta( help_ParticleVector ); + fHistCosTheta->GetHistogram()->Fill(costheta.first); + fHistCosTheta->GetHistogram()->Fill(costheta.second); + //std::cout << "costheta: " << costheta.first << std::endl; + } + }// 2 nu 2 nubar + }//Nsol + + }//Nchains + delete help_ParticleVector; +} + +// --------------------------------------------------------- +std::pair<float, float> KLFitter::LikelihoodTopDilepton::CalculateCosTheta(std::vector <TLorentzVector> *particles) +{ + + TLorentzVector lep(0.0, 0.0, 0.0, 0.0); + TLorentzVector antilep(0.0, 0.0, 0.0, 0.0); + TLorentzVector nu(0.0, 0.0, 0.0, 0.0); + TLorentzVector nubar(0.0, 0.0, 0.0, 0.0); + TLorentzVector b(0.0, 0.0, 0.0, 0.0); + TLorentzVector bbar(0.0, 0.0, 0.0, 0.0); + + + TLorentzVector top(0.0, 0.0, 0.0, 0.0); + TLorentzVector antitop(0.0, 0.0, 0.0, 0.0); + TLorentzVector Wplus(0.0, 0.0, 0.0, 0.0); + TLorentzVector Wminus(0.0, 0.0, 0.0, 0.0); + + TVector3 lep3(0.0, 0.0, 0.0); + TVector3 antilep3(0.0, 0.0, 0.0); + TVector3 Wplus_bo(0.0, 0.0, 0.0); + TVector3 Wminus_bo(0.0, 0.0, 0.0); + TVector3 b3(0.0, 0.0, 0.0); + TVector3 bbar3(0.0, 0.0, 0.0); + + + lep = particles -> at(0); + antilep = particles -> at(1); + nu = particles -> at(2); + nubar = particles -> at(3); + b = particles -> at(4); + bbar = particles -> at(5); + + //std::cout << "nu Px: " << nu.Px() << " nu Py: " << nu.Py() << std::endl; + //std::cout << "nubar Px: " << nubar.Px() << " nubar Py: " << nubar.Py() << std::endl; + + + Wplus = antilep + nu; + Wminus = lep + nubar; + top = Wplus + b; + antitop = Wminus + bbar; + + //std::cout << "Wplus->Pt(): " << Wplus.Pt() << " Wminus->Pt(): " << Wminus.Pt() << std::endl; + + Wplus_bo = Wplus.BoostVector(); + Wminus_bo = Wminus.BoostVector(); + + b.Boost(-Wplus_bo); + antilep.Boost(-Wplus_bo); + + bbar.Boost(-Wminus_bo); + lep.Boost(-Wminus_bo); + + lep3.SetXYZ(lep.Px(), lep.Py(), lep.Pz()); + antilep3.SetXYZ(antilep.Px(), antilep.Py(), antilep.Pz()); + b3.SetXYZ(b.Px(), b.Py(), b.Pz()); + bbar3.SetXYZ(bbar.Px(), bbar.Py(), bbar.Pz()); + + // std::cout << "lep.Px(): " << lep.Px() << " lep.Py(): "<< lep.Py() << std::endl; +// std::cout << "antilep.Px(): " << antilep.Px() << " antilep.Py(): "<< antilep.Py() << std::endl; +// std::cout << "b.Px(): " << b.Px() << " b.Py(): "<< b.Py() << std::endl; +// std::cout << "bbar.Px(): " << bbar.Px() << " bbar.Py(): "<< bbar.Py() << std::endl; + + + float cos_theta_top = cos(antilep3.Angle(-b3)); + float cos_theta_antitop = cos(lep3.Angle(-bbar3)); + + std::pair<float, float> cos; + + cos.first = cos_theta_top; + cos.second = cos_theta_antitop; + + //std::cout << "cos_theta_top: " << cos_theta_top << " and cos_theta_antitop: " << cos_theta_antitop << std::endl; + + return cos; + +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6aa5abcde19f80d69245dabc61779bcbcc33971c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets.cxx @@ -0,0 +1,816 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopLeptonJets.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets::LikelihoodTopLeptonJets() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , fFlagGetParSigmasFromTFs(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets::~LikelihoodTopLeptonJets() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // parBhadE + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // parBlepE + AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + AddParameter("energy lepton", 0.0, 1000.0); // parLepE + AddParameter("p_x neutrino", -1000.0, 1000.0); // parNuPx + AddParameter("p_y neutrino", -1000.0, 1000.0); // parNuPy + AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz + AddParameter("top mass", 100.0, 1000.0); // parTopM +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + static double whad_fit_e; + static double whad_fit_px; + static double whad_fit_py; + static double whad_fit_pz; + static double wlep_fit_e; + static double wlep_fit_px; + static double wlep_fit_py; + static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + // hadronic b quark + bhad_fit_e = parameters[parBhadE]; + scale = sqrt(bhad_fit_e*bhad_fit_e - bhad_meas_m*bhad_meas_m) / bhad_meas_p; + bhad_fit_px = scale * bhad_meas_px; + bhad_fit_py = scale * bhad_meas_py; + bhad_fit_pz = scale * bhad_meas_pz; + + // leptonic b quark + blep_fit_e = parameters[parBlepE]; + scale = sqrt(blep_fit_e*blep_fit_e - blep_meas_m*blep_meas_m) / blep_meas_p; + blep_fit_px = scale * blep_meas_px; + blep_fit_py = scale * blep_meas_py; + blep_fit_pz = scale * blep_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // hadronic W + whad_fit_e = lq1_fit_e +lq2_fit_e; + whad_fit_px = lq1_fit_px+lq2_fit_px; + whad_fit_py = lq1_fit_py+lq2_fit_py; + whad_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad_fit_m = sqrt(whad_fit_e*whad_fit_e - (whad_fit_px*whad_fit_px + whad_fit_py*whad_fit_py + whad_fit_pz*whad_fit_pz)); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = whad_fit_e+bhad_fit_e; + thad_fit_px = whad_fit_px+bhad_fit_px; + thad_fit_py = whad_fit_py+bhad_fit_py; + thad_fit_pz = whad_fit_pz+bhad_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+blep_fit_e; + tlep_fit_px = wlep_fit_px+blep_fit_px; + tlep_fit_py = wlep_fit_py+blep_fit_py; + tlep_fit_pz = wlep_fit_pz+blep_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 4; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = fFlagGetParSigmasFromTFs ? 10 : 7; + double nsigmas_lepton = fFlagGetParSigmasFromTFs ? 10 : 2; + double nsigmas_met = fFlagGetParSigmasFromTFs ? 10 : 1; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double sigma = fFlagGetParSigmasFromTFs ? fResEnergyBhad->GetSigma(E) : sqrt(E); + double Emin = std::max(m, E - nsigmas_jet* sigma); + double Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBhadE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyBlep->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parBlepE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ1->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + sigma = fFlagGetParSigmasFromTFs ? fResEnergyLQ2->GetSigma(E) : sqrt(E); + Emin = std::max(m, E - nsigmas_jet* sigma); + Emax = E + nsigmas_jet* sigma; + SetParameterRange(parLQ2E, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E) : sqrt(E); + Emin = std::max(0.001, E - nsigmas_lepton* sigma); + Emax = E + nsigmas_lepton* sigma; + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + sigma = fFlagGetParSigmasFromTFs ? fResLepton->GetSigma(E*sintheta)/sintheta : E*E*sintheta; + double sigrange=nsigmas_lepton* sigma; + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + // note: this is hard-coded in the momement + + sigma = fFlagGetParSigmasFromTFs ? fResMET->GetSigma(SumET) : 100; + double sigrange = nsigmas_met*sigma; + SetParameterRange(parNuPx, ETmiss_x-sigrange, ETmiss_x+sigrange); + SetParameterRange(parNuPy, ETmiss_y-sigrange, ETmiss_y+sigrange); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJets::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW); + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of leptonically decaying top quark + logprob += BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhadE] = bhad_meas_e; + values[parBlepE] = blep_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + + // energy of the lepton + if (fTypeLepton == kElectron) + values[parLepE] = (*fParticlesPermuted)->Electron(0)->E(); + else if (fTypeLepton == kMuon) + values[parLepE] = (*fParticlesPermuted)->Muon(0)->E(); + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0.; + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTopLeptonJets::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::SavePermutedParticles() { + bhad_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad_meas_px, bhad_meas_py, bhad_meas_pz, bhad_meas_e); + bhad_meas_p = sqrt(bhad_meas_e*bhad_meas_e - bhad_meas_m*bhad_meas_m); + + blep_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + blep_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + blep_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + blep_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + blep_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + blep_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), blep_meas_px, blep_meas_py, blep_meas_pz, blep_meas_e); + blep_meas_p = sqrt(blep_meas_e*blep_meas_e - blep_meas_m*blep_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(3)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(3)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(3)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(3)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(3)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets::SaveResolutionFunctions() { + + fResEnergyBhad = (*fDetector)->ResEnergyBJet(bhad_meas_deteta); + fResEnergyBlep = (*fDetector)->ResEnergyBJet(blep_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTopLeptonJets::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad = fParticlesModel->Parton(0); + TLorentzVector * blep = fParticlesModel->Parton(1); + TLorentzVector * lq1 = fParticlesModel->Parton(2); + TLorentzVector * lq2 = fParticlesModel->Parton(3); + TLorentzVector * lep(0); + if (fTypeLepton == kElectron) + lep = fParticlesModel->Electron(0); + else if (fTypeLepton == kMuon) + lep = fParticlesModel->Muon(0); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * whad = fParticlesModel->Boson(0); + TLorentzVector * wlep = fParticlesModel->Boson(1); + TLorentzVector * thad = fParticlesModel->Parton(4); + TLorentzVector * tlep = fParticlesModel->Parton(5); + + bhad->SetPxPyPzE(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + blep->SetPxPyPzE(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*whad) = (*lq1) + (*lq2); + (*wlep) = (*lep) + (*nu); + (*thad) = (*whad) + (*bhad); + (*tlep) = (*wlep) + (*blep); + + // no error + return 1; +} +// --------------------------------------------------------- + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) )); //comp4 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + vecci.push_back(log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) )); //comp6 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW)); //comp7 + + // Breit-Wigner of leptonically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW)); //comp8 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop)); //comp9 + + // Breit-Wigner of leptonically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop)); //comp10 + + // return log of likelihood + return vecci; +} + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJetsUDSep.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJetsUDSep.cxx new file mode 100644 index 0000000000000000000000000000000000000000..42bdc65a86539ff8b98663d16b222ba5c1850140 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJetsUDSep.cxx @@ -0,0 +1,417 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopLeptonJetsUDSep.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJetsUDSep::LikelihoodTopLeptonJetsUDSep() : KLFitter::LikelihoodTopLeptonJets::LikelihoodTopLeptonJets(), + fLJetSeparationMethod(KLFitter::LikelihoodTopLeptonJetsUDSep::kNone) + +{ + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJetsUDSep::~LikelihoodTopLeptonJetsUDSep() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJetsUDSep::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light up type quark", + 2, // index of corresponding particle + KLFitter::Particles::kLightUp); // light up type jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light down type quark", + 3, // index of corresponding particle + KLFitter::Particles::kLightDown); // light down type jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJetsUDSep::DefineParameters() +{ + // rename light quark parameters + this->GetParameter("energy light quark 1")->SetName("energy light up type quark"); + this->GetParameter("energy light quark 2")->SetName("energy light down type quark"); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJetsUDSep::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 4; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbability() +{ + double logprob = 0; + if (fBTagMethod != kNotag) { + double logprobbtag = LogEventProbabilityBTag(); + if (logprobbtag <= -1e99) return -1e99; + logprob += logprobbtag; + } + if (fLJetSeparationMethod != kNone){ + double logprobljetweight = LogEventProbabilityLJetReweight(); + if (logprobljetweight <= -1e99) return -1e99; + logprob += logprobljetweight; + } + + // use integrated value of LogLikelihood (default) + if (fFlagIntegrate) + logprob += log(GetIntegral()); + else + logprob += LogLikelihood( GetBestFitParameters() ); + return logprob; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityLJetReweight() +{ +// std::cout << " KDEBUG! Extraweight " << std::endl; + double logprob = 0; +switch (fLJetSeparationMethod){ + +case kPermReweight: + + if (!(fUpJetPtHisto && fDownJetPtHisto&& fBJetPtHisto && fUpJetTagWeightHisto && fDownJetTagWeightHisto && fBJetTagWeightHisto)) { + std::cout << " KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityLJetReweight() : Histograms were not set properly! " << std::endl; + return -1e99; + } + + + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + + int index = fParticlesModel->JetIndex(i); + + if (index<0) { + continue; + } + if (!((*fParticlesPermuted)->BTagWeightSet(index))){ + std::cout << " KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityLJetReweight() : bTag weight for particle was not set ! " << std::endl; + return -1e99; + } + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + if(trueFlavor==KLFitter::Particles::kB) { + logprob += log(BJetPt((*fParticlesPermuted)->Parton(index)->Pt())); + logprob += log(BJetTagWeight((*fParticlesPermuted)->BTagWeight(index))); +//std::cout<<"DEBUG! adding pT weight for b: "<<BJetPt((*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; +//std::cout<<"DEBUG! adding tag weight for b: "<<BJetTagWeight((*fParticlesPermuted)->BTagWeight(index))<<std::endl; + } + if(trueFlavor==KLFitter::Particles::kLightUp) { + logprob += log(UpJetPt((*fParticlesPermuted)->Parton(index)->Pt())); + logprob += log(UpJetTagWeight((*fParticlesPermuted)->BTagWeight(index))); +//std::cout<<"DEBUG! adding pT weight for b: "<<UpJetPt((*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; +//std::cout<<"DEBUG! adding tag weight for b: "<<UpJetTagWeight((*fParticlesPermuted)->BTagWeight(index))<<std::endl; + } + if(trueFlavor==KLFitter::Particles::kLightDown) { + logprob += log(DownJetPt((*fParticlesPermuted)->Parton(index)->Pt())); + logprob += log(DownJetTagWeight((*fParticlesPermuted)->BTagWeight(index))); +//std::cout<<"DEBUG! adding pT weight for b: "<<DownJetPt((*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; +//std::cout<<"DEBUG! adding tag weight for b: "<<DownJetTagWeight((*fParticlesPermuted)->BTagWeight(index))<<std::endl; + } + } + return logprob; +break; +////////////////////////////////////////// +case kPermReweight2D: + if (!(fUpJet2DWeightHisto && fDownJet2DWeightHisto && fBJet2DWeightHisto)) { + std::cout << " KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityLJetReweight() : 2D Histograms were not set properly! " << std::endl; + return -1e99; + } + + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + + int index = fParticlesModel->JetIndex(i); + + if (index<0) { + continue; + } + if (!((*fParticlesPermuted)->BTagWeightSet(index))){ + std::cout << " KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityLJetReweight() : bTag weight for particle was not set ! " << std::endl; + return -1e99; + } + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + if(trueFlavor==KLFitter::Particles::kB) { + logprob += log(BJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())); +//std::cout<<"DEBUG! adding prob weight for b: "<<BJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; + + } + if(trueFlavor==KLFitter::Particles::kLightUp) { + logprob += log(UpJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())); +//std::cout<<"DEBUG! adding prob weight for up: "<<UpJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; + } + if(trueFlavor==KLFitter::Particles::kLightDown) { + logprob += log(DownJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())); +//std::cout<<"DEBUG! adding prob weight for down: "<<DownJetProb((*fParticlesPermuted)->BTagWeight(index), (*fParticlesPermuted)->Parton(index)->Pt())<<std::endl; + } + } + return logprob; +break; + +default: + return logprob; +break; + +} +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::LogEventProbabilityBTag() +{ + double logprob = 0; + + double probbtag = 1; + + if(fBTagMethod == kVeto){ + // loop over all model particles. calculate the overall b-tagging + // probability which is the product of all probabilities. + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + if (((trueFlavor == KLFitter::Particles::kLightUp)||(trueFlavor == KLFitter::Particles::kLightDown)) && isBTagged == true) + probbtag = 0.; + } + + if (probbtag > 0) + logprob += log(probbtag); + else + return -1e99; + } + else if (fBTagMethod == kWorkingPoint){ + for (int i = 0; i < fParticlesModel->NPartons(); ++i){ + // get index of corresponding measured particle. + int index = fParticlesModel->JetIndex(i); + if (index < 0) + continue; + + KLFitter::Particles::TrueFlavorType trueFlavor = fParticlesModel->TrueFlavor(i); + bool isBTagged = fParticlesModel->IsBTagged(i); + double efficiency = fParticlesModel->BTaggingEfficiency(i); + double rejection = fParticlesModel->BTaggingRejection(i); + if(rejection < 0 || efficiency < 0){ + std::cout << " KLFitter::LikelihoodBase::LogEventProbability() : Your working points are not set properly! Returning 0 probability " << std::endl; + return -1e99; + } + + if(((trueFlavor == KLFitter::Particles::kLightUp)||(trueFlavor == KLFitter::Particles::kLightDown)) && isBTagged) + logprob += log(1./rejection); + else if(((trueFlavor == KLFitter::Particles::kLightUp)||(trueFlavor == KLFitter::Particles::kLightDown)) && !isBTagged) + logprob += log(1 - 1./rejection); + else if(trueFlavor == KLFitter::Particles::kB && isBTagged) + logprob += log(efficiency); + else if(trueFlavor == KLFitter::Particles::kB && !isBTagged) + logprob += log(1 - efficiency); + else + std::cout << " KLFitter::LikelihoodBase::LogEventProbability() : b-tagging association failed! " << std::endl; + } + } + + return logprob; +} + + + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::UpJetPt(double pt) +{ +return fUpJetPtHisto->GetBinContent(fUpJetPtHisto->GetXaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::DownJetPt(double pt) +{ +return fDownJetPtHisto->GetBinContent(fDownJetPtHisto->GetXaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::BJetPt(double pt) +{ +return fBJetPtHisto->GetBinContent(fBJetPtHisto->GetXaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::UpJetTagWeight(double tagweight) +{ +return fUpJetTagWeightHisto->GetBinContent(fUpJetTagWeightHisto->GetXaxis()->FindBin(tagweight)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::DownJetTagWeight(double tagweight) +{ +return fDownJetTagWeightHisto->GetBinContent(fDownJetTagWeightHisto->GetXaxis()->FindBin(tagweight)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::BJetTagWeight(double tagweight) +{ +return fBJetTagWeightHisto->GetBinContent(fBJetTagWeightHisto->GetXaxis()->FindBin(tagweight)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::UpJetProb(double tagweight, double pt) +{ +return fUpJet2DWeightHisto->GetBinContent(fUpJet2DWeightHisto->GetXaxis()->FindBin(tagweight), fUpJet2DWeightHisto->GetYaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::DownJetProb(double tagweight, double pt) +{ +return fDownJet2DWeightHisto->GetBinContent(fDownJet2DWeightHisto->GetXaxis()->FindBin(tagweight), fDownJet2DWeightHisto->GetYaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJetsUDSep::BJetProb(double tagweight, double pt) +{ +return fBJet2DWeightHisto->GetBinContent(fBJet2DWeightHisto->GetXaxis()->FindBin(tagweight), fBJet2DWeightHisto->GetYaxis()->FindBin(pt)); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJetsUDSep::LHInvariantPermutationPartner(int iperm, int nperms, int &switchpar1, int &switchpar2) +{ + int partnerid = -1; + int cache = iperm%6; + switch (nperms) + { + case 24: + if ((iperm)%2) { + partnerid = (iperm -1); + } else { + partnerid = (iperm+1); + } + break; + + case 120: + if (cache > 2) { + partnerid = (iperm -3); + } else { + partnerid = (iperm+3); + } + break; + + default: partnerid = -1; + } +switchpar1 = 2; +switchpar2 = 3; +return partnerid; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_Angular.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_Angular.cxx new file mode 100644 index 0000000000000000000000000000000000000000..abe7c446bd5bc1686356c64ca60742012994844f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_Angular.cxx @@ -0,0 +1,865 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopLeptonJets_Angular.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets_Angular::LikelihoodTopLeptonJets_Angular() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , SumET(0.) + , fTypeLepton(kElectron) + , fTFgood(true) +{ + + + // define model particles + this->DefineModelParticles(); + + // define parameters + this->DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets_Angular::~LikelihoodTopLeptonJets_Angular() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::SetET_miss_XY_SumET(double etx, double ety, double sumet) +{ + // set missing ET x and y component and the SumET + ETmiss_x = etx; + ETmiss_y = ety; + SumET = sumet; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_Angular::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_Angular::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_Angular::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // parBhadE + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // parBlepE + AddParameter("energy light quark 1", 0.0, 1000.0); // parLQ1E + AddParameter("energy light quark 2", 0.0, 1000.0); // parLQ2E + AddParameter("energy lepton", 0.0, 1000.0); // parLepE + AddParameter("p_x neutrino", -1000.0, 1000.0); // parNuPx + AddParameter("p_y neutrino", -1000.0, 1000.0); // parNuPy + AddParameter("p_z neutrino", -1000.0, 1000.0); // parNuPz + AddParameter("top mass", 100.0, 1000.0); // parTopM +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + static double scale; + // static double whad_fit_e; + // static double whad_fit_px; + // static double whad_fit_py; + // static double whad_fit_pz; +// static double wlep_fit_e; +// static double wlep_fit_px; +// static double wlep_fit_py; +// static double wlep_fit_pz; + static double thad_fit_e; + static double thad_fit_px; + static double thad_fit_py; + static double thad_fit_pz; + static double tlep_fit_e; + static double tlep_fit_px; + static double tlep_fit_py; + static double tlep_fit_pz; + + // hadronic b quark + bhad_fit_e = parameters[parBhadE]; + scale = sqrt(bhad_fit_e*bhad_fit_e - bhad_meas_m*bhad_meas_m) / bhad_meas_p; + bhad_fit_px = scale * bhad_meas_px; + bhad_fit_py = scale * bhad_meas_py; + bhad_fit_pz = scale * bhad_meas_pz; + + // leptonic b quark + blep_fit_e = parameters[parBlepE]; + scale = sqrt(blep_fit_e*blep_fit_e - blep_meas_m*blep_meas_m) / blep_meas_p; + blep_fit_px = scale * blep_meas_px; + blep_fit_py = scale * blep_meas_py; + blep_fit_pz = scale * blep_meas_pz; + + // light quark 1 + lq1_fit_e = parameters[parLQ1E]; + scale = sqrt(lq1_fit_e*lq1_fit_e - lq1_meas_m*lq1_meas_m) / lq1_meas_p; + lq1_fit_px = scale * lq1_meas_px; + lq1_fit_py = scale * lq1_meas_py; + lq1_fit_pz = scale * lq1_meas_pz; + + // light quark 2 + lq2_fit_e = parameters[parLQ2E]; + scale = sqrt(lq2_fit_e*lq2_fit_e - lq2_meas_m*lq2_meas_m) / lq2_meas_p; + lq2_fit_px = scale * lq2_meas_px; + lq2_fit_py = scale * lq2_meas_py; + lq2_fit_pz = scale * lq2_meas_pz; + + // lepton + lep_fit_e = parameters[parLepE]; + scale = lep_fit_e / lep_meas_e; + lep_fit_px = scale * lep_meas_px; + lep_fit_py = scale * lep_meas_py; + lep_fit_pz = scale * lep_meas_pz; + + // neutrino + nu_fit_px = parameters[parNuPx]; + nu_fit_py = parameters[parNuPy]; + nu_fit_pz = parameters[parNuPz]; + nu_fit_e = sqrt(nu_fit_px*nu_fit_px + nu_fit_py*nu_fit_py + nu_fit_pz*nu_fit_pz); + + // hadronic W + whad_fit_e = lq1_fit_e +lq2_fit_e; + whad_fit_px = lq1_fit_px+lq2_fit_px; + whad_fit_py = lq1_fit_py+lq2_fit_py; + whad_fit_pz = lq1_fit_pz+lq2_fit_pz; + whad_fit_m = sqrt(whad_fit_e*whad_fit_e - (whad_fit_px*whad_fit_px + whad_fit_py*whad_fit_py + whad_fit_pz*whad_fit_pz)); + + // leptonic W + wlep_fit_e = lep_fit_e +nu_fit_e; + wlep_fit_px = lep_fit_px+nu_fit_px; + wlep_fit_py = lep_fit_py+nu_fit_py; + wlep_fit_pz = lep_fit_pz+nu_fit_pz; + wlep_fit_m = sqrt(wlep_fit_e*wlep_fit_e - (wlep_fit_px*wlep_fit_px + wlep_fit_py*wlep_fit_py + wlep_fit_pz*wlep_fit_pz)); + + // hadronic top + thad_fit_e = whad_fit_e+bhad_fit_e; + thad_fit_px = whad_fit_px+bhad_fit_px; + thad_fit_py = whad_fit_py+bhad_fit_py; + thad_fit_pz = whad_fit_pz+bhad_fit_pz; + thad_fit_m = sqrt(thad_fit_e*thad_fit_e - (thad_fit_px*thad_fit_px + thad_fit_py*thad_fit_py + thad_fit_pz*thad_fit_pz)); + + // leptonic top + tlep_fit_e = wlep_fit_e+blep_fit_e; + tlep_fit_px = wlep_fit_px+blep_fit_px; + tlep_fit_py = wlep_fit_py+blep_fit_py; + tlep_fit_pz = wlep_fit_pz+blep_fit_pz; + tlep_fit_m = sqrt(tlep_fit_e*tlep_fit_e - (tlep_fit_px*tlep_fit_px + tlep_fit_py*tlep_fit_py + tlep_fit_pz*tlep_fit_pz)); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::Initialize() +{ + // error code + int err = 1; + + // save the current permuted particles + err *= SavePermutedParticles(); + + // save the corresponding resolution functions + err *= SaveResolutionFunctions(); + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 4; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + else if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = 7.0; + double nsigmas_lepton = 2.0; + + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + double Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBhadE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parBlepE, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parLQ1E, Emin, Emax); + + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(parLQ2E, Emin, Emax); + + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + Emin = std::max(0.001, E - nsigmas_lepton* sqrt(E)); + Emax = E + nsigmas_lepton* sqrt(E); + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + double sigrange=nsigmas_lepton* (E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(parLepE, Emin, Emax); + + // note: this is hard-coded in the momement + + SetParameterRange(parNuPx, ETmiss_x-100.0, ETmiss_x+100); + SetParameterRange(parNuPy, ETmiss_y-100.0, ETmiss_y+100); + + if (fFlagTopMassFixed) + SetParameterRange(parTopM, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJets_Angular::LogLikelihood(const std::vector<double> & parameters) +{ + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob(0.); + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron) + logprob += log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) ); + else if (fTypeLepton == kMuon) + logprob += log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) ); + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + logprob += log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + logprob += log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) ); + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW); + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW); + + // Breit-Wigner of hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop); + + // Breit-Wigner of leptonically decaying top quark + logprob += BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop); + + // angular information of leptonic decay + + // create 4-vector for leptonically decaying W boson, charge lepton and corresponding b quark + TLorentzVector Wlep(wlep_fit_px, wlep_fit_py, wlep_fit_pz, wlep_fit_e); + TLorentzVector Whad(whad_fit_px, whad_fit_py, whad_fit_pz, whad_fit_e); + TLorentzVector lep (lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + TLorentzVector blep(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + TLorentzVector bhad(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + TLorentzVector lq1(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + TLorentzVector lq2(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + + // get boost vectors + TVector3 Wlep_bo(0.0, 0.0, 0.0); + Wlep_bo = Wlep.BoostVector(); + + TVector3 Whad_bo(0.0, 0.0, 0.0); + Whad_bo = Whad.BoostVector(); + + // boost everything into W rest frames + blep.Boost(-Wlep_bo); + lep.Boost(-Wlep_bo); + + bhad.Boost(-Whad_bo); + lq1.Boost(-Whad_bo); + lq2.Boost(-Whad_bo); + + // calculate 3-vectors + TVector3 lep3 (0.0, 0.0, 0.0); + TVector3 blep3(0.0, 0.0, 0.0); + TVector3 bhad3(0.0, 0.0, 0.0); + TVector3 lq13 (0.0, 0.0, 0.0); + TVector3 lq23(0.0, 0.0, 0.0); + + lep3.SetXYZ (lep.Px(), lep.Py(), lep.Pz()); + blep3.SetXYZ(blep.Px(), blep.Py(), blep.Pz()); + bhad3.SetXYZ(bhad.Px(), bhad.Py(), bhad.Pz()); + lq13.SetXYZ(lq1.Px(), lq1.Py(), lq1.Pz()); + lq23.SetXYZ(lq2.Px(), lq2.Py(), lq2.Pz()); + + // calculate cos theta * + double cos_theta = cos(lep3.Angle(-blep3)); + double cos_theta_had = cos(lq23.Angle(-bhad3)); + + // fix helicity fractions + double F0 = 0.687; + double FL = 0.311; + double FR = 0.0017; + + // calculate probability + double p_angular_lep = ( 3./4.*(1.-cos_theta*cos_theta) * F0 + + 3./8.*(1.-cos_theta)*(1.-cos_theta) * FL + + 3./8.*(1.+cos_theta)*(1.+cos_theta) * FR ); + + double p_angular_had = ( 3./4.*(1.-cos_theta_had*cos_theta_had) * F0 + + 3./8.*(1.+cos_theta_had*cos_theta_had) * (FL + FR) ); + + logprob += log(p_angular_lep); + logprob += log(p_angular_had); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_Angular::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[parNuPz] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[parNuPz] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[parNuPz] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[parNuPz] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_Angular::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values(GetNParameters()); + + // energies of the quarks + values[parBhadE] = bhad_meas_e; + values[parBlepE] = blep_meas_e; + values[parLQ1E] = lq1_meas_e; + values[parLQ2E] = lq2_meas_e; + + // energy of the lepton + if (fTypeLepton == kElectron) + values[parLepE] = (*fParticlesPermuted)->Electron(0)->E(); + else if (fTypeLepton == kMuon) + values[parLepE] = (*fParticlesPermuted)->Muon(0)->E(); + + // missing px and py + values[parNuPx] = ETmiss_x; + values[parNuPy] = ETmiss_y; + + // pz of the neutrino + values[parNuPz] = 0.; + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(parTopM)->GetLowerLimit()) + mtop = GetParameter(parTopM)->GetLowerLimit(); + else if (mtop > GetParameter(parTopM)->GetUpperLimit()) + mtop = GetParameter(parTopM)->GetUpperLimit(); + values[parTopM] = mtop; + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_Angular::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_Angular::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTopLeptonJets_Angular::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::SavePermutedParticles() { + bhad_meas_e = (*fParticlesPermuted)->Parton(0)->E(); + bhad_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton); + bhad_meas_px = (*fParticlesPermuted)->Parton(0)->Px(); + bhad_meas_py = (*fParticlesPermuted)->Parton(0)->Py(); + bhad_meas_pz = (*fParticlesPermuted)->Parton(0)->Pz(); + bhad_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(0)->M(), fPhysicsConstants->MassBottom(), bhad_meas_px, bhad_meas_py, bhad_meas_pz, bhad_meas_e); + bhad_meas_p = sqrt(bhad_meas_e*bhad_meas_e - bhad_meas_m*bhad_meas_m); + + blep_meas_e = (*fParticlesPermuted)->Parton(1)->E(); + blep_meas_deteta = (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton); + blep_meas_px = (*fParticlesPermuted)->Parton(1)->Px(); + blep_meas_py = (*fParticlesPermuted)->Parton(1)->Py(); + blep_meas_pz = (*fParticlesPermuted)->Parton(1)->Pz(); + blep_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(1)->M(), fPhysicsConstants->MassBottom(), blep_meas_px, blep_meas_py, blep_meas_pz, blep_meas_e); + blep_meas_p = sqrt(blep_meas_e*blep_meas_e - blep_meas_m*blep_meas_m); + + lq1_meas_e = (*fParticlesPermuted)->Parton(2)->E(); + lq1_meas_deteta = (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton); + lq1_meas_px = (*fParticlesPermuted)->Parton(2)->Px(); + lq1_meas_py = (*fParticlesPermuted)->Parton(2)->Py(); + lq1_meas_pz = (*fParticlesPermuted)->Parton(2)->Pz(); + lq1_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(2)->M(), 0., lq1_meas_px, lq1_meas_py, lq1_meas_pz, lq1_meas_e); + lq1_meas_p = sqrt(lq1_meas_e*lq1_meas_e - lq1_meas_m*lq1_meas_m); + + lq2_meas_e = (*fParticlesPermuted)->Parton(3)->E(); + lq2_meas_deteta = (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton); + lq2_meas_px = (*fParticlesPermuted)->Parton(3)->Px(); + lq2_meas_py = (*fParticlesPermuted)->Parton(3)->Py(); + lq2_meas_pz = (*fParticlesPermuted)->Parton(3)->Pz(); + lq2_meas_m = SetPartonMass((*fParticlesPermuted)->Parton(3)->M(), 0., lq2_meas_px, lq2_meas_py, lq2_meas_pz, lq2_meas_e); + lq2_meas_p = sqrt(lq2_meas_e*lq2_meas_e - lq2_meas_m*lq2_meas_m); + + TLorentzVector * lepton(0); + if (fTypeLepton == kElectron) { + lepton = (*fParticlesPermuted)->Electron(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron); + } + else { + lepton = (*fParticlesPermuted)->Muon(0); + lep_meas_deteta = (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon); + } + lep_meas_e = lepton->E(); + lep_meas_sintheta = sin(lepton->Theta()); + lep_meas_pt = lepton->Pt(); + lep_meas_px = lepton->Px(); + lep_meas_py = lepton->Py(); + lep_meas_pz = lepton->Pz(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_Angular::SaveResolutionFunctions() { + + fResEnergyBhad = (*fDetector)->ResEnergyBJet(bhad_meas_deteta); + fResEnergyBlep = (*fDetector)->ResEnergyBJet(blep_meas_deteta); + fResEnergyLQ1 = (*fDetector)->ResEnergyLightJet(lq1_meas_deteta); + fResEnergyLQ2 = (*fDetector)->ResEnergyLightJet(lq2_meas_deteta); + if (fTypeLepton == kElectron) + fResLepton = (*fDetector)->ResEnergyElectron(lep_meas_deteta); + else if (fTypeLepton == kMuon) + fResLepton = (*fDetector)->ResEnergyMuon(lep_meas_deteta); + fResMET = (*fDetector)->ResMissingET(); + + // no error + return 1; +} +// --------------------------------------------------------- + +int KLFitter::LikelihoodTopLeptonJets_Angular::BuildModelParticles() { +if (GetBestFitParameters().size() > 0) CalculateLorentzVectors(GetBestFitParameters()); + + TLorentzVector * bhad = fParticlesModel->Parton(0); + TLorentzVector * blep = fParticlesModel->Parton(1); + TLorentzVector * lq1 = fParticlesModel->Parton(2); + TLorentzVector * lq2 = fParticlesModel->Parton(3); + TLorentzVector * lep(0); + if (fTypeLepton == kElectron) + lep = fParticlesModel->Electron(0); + else if (fTypeLepton == kMuon) + lep = fParticlesModel->Muon(0); + TLorentzVector * nu = fParticlesModel->Neutrino(0); + TLorentzVector * whad = fParticlesModel->Boson(0); + TLorentzVector * wlep = fParticlesModel->Boson(1); + TLorentzVector * thad = fParticlesModel->Parton(4); + TLorentzVector * tlep = fParticlesModel->Parton(5); + + bhad->SetPxPyPzE(bhad_fit_px, bhad_fit_py, bhad_fit_pz, bhad_fit_e); + blep->SetPxPyPzE(blep_fit_px, blep_fit_py, blep_fit_pz, blep_fit_e); + lq1 ->SetPxPyPzE(lq1_fit_px, lq1_fit_py, lq1_fit_pz, lq1_fit_e); + lq2 ->SetPxPyPzE(lq2_fit_px, lq2_fit_py, lq2_fit_pz, lq2_fit_e); + lep ->SetPxPyPzE(lep_fit_px, lep_fit_py, lep_fit_pz, lep_fit_e); + nu ->SetPxPyPzE(nu_fit_px, nu_fit_py, nu_fit_pz, nu_fit_e); + + (*whad) = (*lq1) + (*lq2); + (*wlep) = (*lep) + (*nu); + (*thad) = (*whad) + (*bhad); + (*tlep) = (*wlep) + (*blep); + + // no error + return 1; +} +// --------------------------------------------------------- + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_Angular::LogLikelihoodComponents(std::vector<double> parameters) +{ +std::vector<double> vecci; + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + + // temporary flag for a safe use of the transfer functions + bool TFgoodTmp(true); + + // jet energy resolution terms + vecci.push_back(log( fResEnergyBhad->p(bhad_fit_e, bhad_meas_e, TFgoodTmp) )); //comp0 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyBlep->p(blep_fit_e, blep_meas_e, TFgoodTmp) )); //comp1 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ1->p(lq1_fit_e, lq1_meas_e, TFgoodTmp) )); //comp2 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResEnergyLQ2->p(lq2_fit_e, lq2_meas_e, TFgoodTmp) )); //comp3 + if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron){ + vecci.push_back(log( fResLepton->p(lep_fit_e, lep_meas_e, TFgoodTmp) )); //comp4 + } + else if (fTypeLepton == kMuon) + vecci.push_back(log( fResLepton->p(lep_fit_e* lep_meas_sintheta, lep_meas_pt, TFgoodTmp) )); //comp4 + if (!TFgoodTmp) fTFgood = false; + + // neutrino px and py + vecci.push_back(log( fResMET->p(nu_fit_px, ETmiss_x, TFgoodTmp, SumET) )); //comp5 + if (!TFgoodTmp) fTFgood = false; + + vecci.push_back(log( fResMET->p(nu_fit_py, ETmiss_y, TFgoodTmp, SumET) )); //comp6 + if (!TFgoodTmp) fTFgood = false; + + // physics constants + double massW = fPhysicsConstants->MassW(); + double gammaW = fPhysicsConstants->GammaW(); + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[parTopM]); + // (this will also set the correct width for the top) + double gammaTop = fPhysicsConstants->GammaTop(); + + // Breit-Wigner of hadronically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(whad_fit_m, massW, gammaW)); //comp7 + + // Breit-Wigner of leptonically decaying W-boson + vecci.push_back(BCMath::LogBreitWignerRel(wlep_fit_m, massW, gammaW)); //comp8 + + // Breit-Wigner of hadronically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(thad_fit_m, parameters[parTopM], gammaTop)); //comp9 + + // Breit-Wigner of leptonically decaying top quark + vecci.push_back(BCMath::LogBreitWignerRel(tlep_fit_m, parameters[parTopM], gammaTop)); //comp10 + + // return log of likelihood + return vecci; +} + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_JetAngles.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_JetAngles.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6e1db65470733cd0a6ac1fcccca5e971223d09ae --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/LikelihoodTopLeptonJets_JetAngles.cxx @@ -0,0 +1,799 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/LikelihoodTopLeptonJets_JetAngles.h" +#include "KLFitter/ResolutionBase.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorBase.h" + +#include <iostream> +#include <algorithm> + +#include <BAT/BCMath.h> +#include "BAT/BCParameter.h" + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets_JetAngles::LikelihoodTopLeptonJets_JetAngles() : KLFitter::LikelihoodBase::LikelihoodBase() + , fFlagTopMassFixed(false) + , fFlagUseJetMass(false) + , ETmiss_x(0.) + , ETmiss_y(0.) + , fTypeLepton(kElectron) + , fPi(3.14159265358979312) + , fTwoPi(6.28318530717958623) + , fTFgood(true) +{ + // define model particles + DefineModelParticles(); + + // define parameters + DefineParameters(); +} + +// --------------------------------------------------------- +KLFitter::LikelihoodTopLeptonJets_JetAngles::~LikelihoodTopLeptonJets_JetAngles() +{ +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::SetET_miss_XY(double etx, double ety) +{ + // set missing ET x and y component + ETmiss_x = etx; + ETmiss_y = ety; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_JetAngles::SetLeptonType(LeptonType leptontype) +{ + if (leptontype != kElectron && leptontype != kMuon) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + fTypeLepton = kElectron; + } + else + fTypeLepton = leptontype; + + // define model particles + DefineModelParticles(); +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_JetAngles::SetLeptonType(int leptontype) +{ + if (leptontype != 1 && leptontype != 2) + { + std::cout << "KLFitter::SetLeptonTyp(). Warning: lepton type not defined. Set electron as lepton type." << std::endl; + leptontype = 1; + } + + if (leptontype == 1) + SetLeptonType(kElectron); + else if (leptontype == 2) + SetLeptonType(kMuon); +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::DefineModelParticles() +{ + // check if model particles and lorentz vector container exist and delete + if (fParticlesModel) { + delete fParticlesModel; + fParticlesModel = 0; + } + + // create the particles of the model + fParticlesModel = new KLFitter::Particles(); + + // add model particles + //create dummy TLorentzVector + TLorentzVector * dummy = new TLorentzVector(0,0,0,0); // 4-vector + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, // type + "hadronic b quark", // name + 0, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic b quark", + 1, // index of corresponding particle + KLFitter::Particles::kB); // b jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 1", + 2, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "light quark 2", + 3, // index of corresponding particle + KLFitter::Particles::kLight); // light jet (truth) + + if (fTypeLepton == kElectron) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kElectron, + "electron"); + } + else if (fTypeLepton == kMuon) { + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kMuon, + "muon"); + } + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kNeutrino, + "neutrino"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "hadronic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kBoson, + "leptonic W"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "hadronic top"); + + fParticlesModel->AddParticle(dummy, + KLFitter::Particles::kParton, + "leptonic top"); + //free memory + delete dummy; + + // no error + return 1; +} + +// --------------------------------------------------------- +void KLFitter::LikelihoodTopLeptonJets_JetAngles::DefineParameters() +{ + // add parameters of model + AddParameter("energy hadronic b", fPhysicsConstants->MassBottom(), 1000.0); // par 0 + AddParameter("energy leptonic b", fPhysicsConstants->MassBottom(), 1000.0); // par 1 + AddParameter("energy light quark 1", 0.0, 1000.0); // par 2 + AddParameter("energy light quark 2", 0.0, 1000.0); // par 3 + AddParameter("energy lepton", 0.0, 1000.0); // par 4 + AddParameter("p_z neutrino", -1000.0, 1000.0); // par 5 + AddParameter("missPx", -1000.0, 1000.0); // par 6 + AddParameter("missPy", -1000.0, 1000.0); // par 7 + AddParameter("eta hadronic b", -2.5, 2.5); // par 8 + AddParameter("eta leptonic b", -2.5, 2.5); // par 9 + AddParameter("eta light quark 1", -2.5, 2.5); // par 10 + AddParameter("eta light quark 2", -2.5, 2.5); // par 11 + AddParameter("phi hadronic b", -fPi, fPi); // par 12 + AddParameter("phi leptonic b", -fPi, fPi); // par 13 + AddParameter("phi light quark 1", -fPi, fPi); // par 14 + AddParameter("phi light quark 2", -fPi, fPi); // par 15 + AddParameter("top mass", 100.0, 1000.0); // par 16 +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::CalculateLorentzVectors(std::vector <double> const& parameters) +{ + // variables + double E, m, px, py, pz, pabs, theta, scale; + TLorentzVector* vect; + + // short cut to model particles for CPU-time reasons + TLorentzVector* parton0 = fParticlesModel->Parton(0); + TLorentzVector* parton1 = fParticlesModel->Parton(1); + TLorentzVector* parton2 = fParticlesModel->Parton(2); + TLorentzVector* parton3 = fParticlesModel->Parton(3); + TLorentzVector* neutrino = fParticlesModel->Neutrino(0); + + // hadronic b quark + E = parameters[0]; + if (fFlagUseJetMass) + m = std::max(0., (*fParticlesPermuted)->Parton(0)->M()); + else + m = fPhysicsConstants->MassBottom(); + pabs = sqrt(E*E - m*m); + theta = atan(exp(-parameters[8]))*2; + px = pabs* cos(parameters[12])* sin(theta); + py = pabs* sin(parameters[12])* sin(theta); + pz = pabs* cos(theta); + parton0->SetPxPyPzE(px, py, pz, E); + + // leptonic b quark + E = parameters[1]; + if (fFlagUseJetMass) + m = std::max(0., (*fParticlesPermuted)->Parton(1)->M()); + else + m = fPhysicsConstants->MassBottom(); + pabs = sqrt(E*E - m*m); + theta = atan(exp(-parameters[9]))*2; + px = pabs* cos(parameters[13])* sin(theta); + py = pabs* sin(parameters[13])* sin(theta); + pz = pabs* cos(theta); + parton1->SetPxPyPzE(px, py, pz, E); + + // light quark 1 + E = parameters[2]; + if (fFlagUseJetMass) + m = std::max(0., (*fParticlesPermuted)->Parton(2)->M()); + else + m = 0; + pabs = sqrt(E*E - m*m); + theta = atan(exp(-parameters[10]))*2; + px = pabs* cos(parameters[14])* sin(theta); + py = pabs* sin(parameters[14])* sin(theta); + pz = pabs* cos(theta); + parton2->SetPxPyPzE(px, py, pz, E); + + // light quark 2 + E = parameters[3]; + if (fFlagUseJetMass) + m = std::max(0., (*fParticlesPermuted)->Parton(3)->M()); + else + m = 0; + pabs = sqrt(E*E - m*m); + theta = atan(exp(-parameters[11]))*2; + px = pabs* cos(parameters[15])* sin(theta); + py = pabs* sin(parameters[15])* sin(theta); + pz = pabs* cos(theta); + parton3->SetPxPyPzE(px, py, pz, E); + + // lepton + if (fTypeLepton == kElectron) + { + vect = (*fParticlesPermuted)->Electron(0); + E = parameters[4]; + px = vect->Px(); + py = vect->Py(); + pz = vect->Pz(); + pabs = sqrt(px*px + py*py + pz*pz); + scale = E / vect->E(); + fParticlesModel->Electron(0)->SetPxPyPzE(scale* px, scale* py, scale* pz, E); + } + else if (fTypeLepton == kMuon) + { + vect = (*fParticlesPermuted)->Muon(0); + E = parameters[4]; + px = vect->Px(); + py = vect->Py(); + pz = vect->Pz(); + pabs = sqrt(px*px + py*py + pz*pz); + scale = E / vect->E(); + fParticlesModel->Muon(0)->SetPxPyPzE(scale* px, scale* py, scale* pz, E); + } + + // neutrino + px = parameters[6]; // yes: (px, py, pz) = (par6, par7, par5) - this order (!) + py = parameters[7]; + pz = parameters[5]; + E = sqrt(px*px + py*py + pz*pz); + neutrino->SetPxPyPzE(px, py, pz, E); + + // composite particles + + // hadronic W + *(fParticlesModel->Boson(0)) = *(parton2) + *(parton3); + + // leptonic W + if (fTypeLepton == kElectron) + *(fParticlesModel->Boson(1)) = *(fParticlesModel->Electron(0)) + *(neutrino); + else if (fTypeLepton == kMuon) + *(fParticlesModel->Boson(1)) = *(fParticlesModel->Muon(0)) + *(neutrino); + + // hadronic top + *(fParticlesModel->Parton(4)) = *(fParticlesModel->Boson(0)) + *(parton0); + + // leptonic top + *(fParticlesModel->Parton(5)) = *(fParticlesModel->Boson(1)) + *(parton1); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::Initialize() +{ + // error code + int err = 1; + + // adjust parameter ranges + err *= AdjustParameterRanges(); + + // set initial values + // (only for Markov chains - initial parameters for other minimisation methods are set in Fitter.cxx) + SetInitialParameters( GetInitialParameters() ); + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::RemoveInvariantParticlePermutations() +{ + // error code + int err = 1; + + // remove the permutation from the second and the third jet + KLFitter::Particles::ParticleType ptype = KLFitter::Particles::kParton; + std::vector<int> indexVector_Jets; + indexVector_Jets.push_back(2); + indexVector_Jets.push_back(3); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + //remove invariant jet permutations of notevent jets + KLFitter::Particles* particles = (*fPermutations)->Particles(); + indexVector_Jets.clear(); + for (int iPartons = 4; iPartons < particles->NPartons(); iPartons++) + indexVector_Jets.push_back(iPartons); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Jets); + + // remove the permutation from the other lepton + if (fTypeLepton == kElectron) + { + ptype = KLFitter::Particles::kMuon; + std::vector<int> indexVector_Muons; + for (int iMuon = 0; iMuon < particles->NMuons(); iMuon++) + indexVector_Muons.push_back(iMuon); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Muons); + } + if (fTypeLepton == kMuon) + { + ptype = KLFitter::Particles::kElectron; + std::vector<int> indexVector_Electrons; + for (int iElectron = 0; iElectron < particles->NElectrons(); iElectron++) + indexVector_Electrons.push_back(iElectron); + err *= (*fPermutations)->InvariantParticlePermutations(ptype, indexVector_Electrons); + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::RemoveForbiddenParticlePermutations() +{ + // error code + int err = 1; + + // only in b-tagging type kVetoNoFit + if (!((fBTagMethod == kVetoNoFit)||(fBTagMethod == kVetoNoFitLight)||(fBTagMethod == kVetoNoFitBoth))) + return err; + + // remove all permutations where a b-tagged jet is in the position of a model light quark + KLFitter::Particles * particles = (*fPermutations)->Particles(); + int nPartons = particles->NPartons(); + + KLFitter::Particles * particlesModel = fParticlesModel; + int nPartonsModel = particlesModel->NPartons(); + for (int iParton(0); iParton < nPartons; ++iParton) { + bool isBtagged = particles->IsBTagged(iParton); + + for (int iPartonModel(0); iPartonModel < nPartonsModel; ++iPartonModel) { + + KLFitter::Particles::TrueFlavorType trueFlavor = particlesModel->TrueFlavor(iPartonModel); + if ((fBTagMethod == kVetoNoFit)&&((!isBtagged)||(trueFlavor != KLFitter::Particles::kLight))) + continue; + if ((fBTagMethod == kVetoNoFitLight)&&((isBtagged)||(trueFlavor != KLFitter::Particles::kB))) + continue; + if ((fBTagMethod == kVetoNoFitBoth)&&(((isBtagged)&&(trueFlavor != KLFitter::Particles::kLight))||((!isBtagged)&&(trueFlavor != KLFitter::Particles::kB)))) + continue; + + err *= (*fPermutations)->RemoveParticlePermutations(KLFitter::Particles::kParton, iParton, iPartonModel); + } + } + + // return error code + return err; +} + +// --------------------------------------------------------- +int KLFitter::LikelihoodTopLeptonJets_JetAngles::AdjustParameterRanges() +{ + // adjust limits + double nsigmas_jet = 7.0; + double nsigmas_lepton = 2.0; + + // parameter 0: energy of hadronic b quark + double E = (*fParticlesPermuted)->Parton(0)->E(); + double m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(0)->M()); + double Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + double Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(0, Emin, Emax); + + // parameter 1: energy of leptonic b quark + E = (*fParticlesPermuted)->Parton(1)->E(); + m = fPhysicsConstants->MassBottom(); + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(1)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(1, Emin, Emax); + + // parameter 2: energy of light quark 1 + E = (*fParticlesPermuted)->Parton(2)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(2)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(2, Emin, Emax); + + // parameter 3: energy of light quark2 + E = (*fParticlesPermuted)->Parton(3)->E(); + m = 0.001; + if (fFlagUseJetMass) + m = std::max(0.0, (*fParticlesPermuted)->Parton(3)->M()); + Emin = std::max(m, E - nsigmas_jet* sqrt(E)); + Emax = E + nsigmas_jet* sqrt(E); + SetParameterRange(3, Emin, Emax); + + // parameter 2: energy of lepton + if (fTypeLepton == kElectron) + { + E = (*fParticlesPermuted)->Electron(0)->E(); + Emin = std::max(0.001, E - nsigmas_lepton* sqrt(E)); + Emax = E + nsigmas_lepton* sqrt(E); + } + else if (fTypeLepton == kMuon) + { + E = (*fParticlesPermuted)->Muon(0)->E(); + double sintheta= sin((*fParticlesPermuted)->Muon(0)->Theta()); + double sigrange=nsigmas_lepton* (E*E*sintheta); + Emin=std::max(0.001,E -sigrange); + Emax=E +sigrange; + } + SetParameterRange(4, Emin, Emax); + + // note: this is hard-coded in the momement + + // missing ET + SetParameterRange(6, ETmiss_x-100.0, ETmiss_x+100); + SetParameterRange(7, ETmiss_y-100.0, ETmiss_y+100); + + // eta + double eta = (*fParticlesPermuted)->Parton(0)->Eta(); + double etamin = std::max(-2.5, eta - 0.2); + double etamax = std::min(2.5, eta + 0.2); + //SetParameterRange(8, etamin, etamax); + SetParameterRange(8, eta, eta); // Fix temporarily eta & phi until proper TFs are available + + eta = (*fParticlesPermuted)->Parton(1)->Eta(); + etamin = std::max(-2.5, eta - 0.2); + etamax = std::min(2.5, eta + 0.2); + //SetParameterRange(9, etamin, etamax); + SetParameterRange(9, eta, eta); // Fix temporarily eta & phi until proper TFs are available + + eta = (*fParticlesPermuted)->Parton(2)->Eta(); + etamin = std::max(-2.5, eta - 0.2); + etamax = std::min(2.5, eta + 0.2); + //SetParameterRange(10, etamin, etamax); + SetParameterRange(10, eta, eta); // Fix temporarily eta & phi until proper TFs are available + + eta = (*fParticlesPermuted)->Parton(3)->Eta(); + etamin = std::max(-2.5, eta - 0.2); + etamax = std::min(2.5, eta + 0.2); + //SetParameterRange(11, etamin, etamax); + SetParameterRange(11, eta, eta); // Fix temporarily eta & phi until proper TFs are available + + // phi + double phi = (*fParticlesPermuted)->Parton(0)->Phi(); + double phimin = phi - 0.1; + double phimax = phi + 0.1; + //SetParameterRange(12, phimin, phimax); + SetParameterRange(12, phi, phi); // Fix temporarily eta & phi until proper TFs are available + + phi = (*fParticlesPermuted)->Parton(1)->Phi(); + phimin = phi - 0.1; + phimax = phi + 0.1; + //SetParameterRange(13, phimin, phimax); + SetParameterRange(13, phi, phi); // Fix temporarily eta & phi until proper TFs are available + + phi = (*fParticlesPermuted)->Parton(2)->Phi(); + phimin = phi - 0.1; + phimax = phi + 0.1; + //SetParameterRange(14, phimin, phimax); + SetParameterRange(14, phi, phi); // Fix temporarily eta & phi until proper TFs are available + + phi = (*fParticlesPermuted)->Parton(3)->Phi(); + phimin = phi - 0.1; + phimax = phi + 0.1; + //SetParameterRange(15, phimin, phimax); + SetParameterRange(15, phi, phi); // Fix temporarily eta & phi until proper TFs are available + + + // top mass + if (fFlagTopMassFixed) + SetParameterRange(16, fPhysicsConstants->MassTop(), fPhysicsConstants->MassTop()); + + // no error + return 1; +} + +// --------------------------------------------------------- +double KLFitter::LikelihoodTopLeptonJets_JetAngles::LogLikelihood(const std::vector<double> & parameters) +{ + // // check if W mass is within range + // TLorentzVector Whad; + // double px, py, pz, E; + // px = (*fParticlesPermuted)->Parton(2)->Px() + (*fParticlesPermuted)->Parton(3)->Px(); + // py = (*fParticlesPermuted)->Parton(2)->Py() + (*fParticlesPermuted)->Parton(3)->Py(); + // pz = (*fParticlesPermuted)->Parton(2)->Pz() + (*fParticlesPermuted)->Parton(3)->Pz(); + // E = (*fParticlesPermuted)->Parton(2)->E() + (*fParticlesPermuted)->Parton(3)->E(); + // Whad.SetPxPyPzE(px, py, pz, E); + // + // if ( fabs(Whad.M() - fPhysicsConstants->MassW()) > 40.0 ) + // return -500; + + // short cut for particles for CPU-time reasons + TLorentzVector* parton0 = (*fParticlesPermuted)->Parton(0); + TLorentzVector* parton1 = (*fParticlesPermuted)->Parton(1); + TLorentzVector* parton2 = (*fParticlesPermuted)->Parton(2); + TLorentzVector* parton3 = (*fParticlesPermuted)->Parton(3); + + //Sometimes the Error ResEnergyBJet .Eta Range exceeded appears. As fast bug fix the next two if statements are implemented + // - need only to check one variable (the first one to be used later one) - all parameters are 'nan' + if(isnan(parameters[8])) + { + SetFlagIsNan(true); + return -999999.999; + } + + // calculate 4-vectors + CalculateLorentzVectors(parameters); + + // define log of likelihood + double logprob = 0.; + + fTFgood = true; + bool TFgoodTmp(true); + + // jet energy resolution terms + logprob += log( (*fDetector)->ResEnergyBJet( (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton) )->p( parameters[0], parton0->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEnergyBJet( (*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton) )->p( parameters[1], parton1->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEnergyLightJet( (*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton) )->p( parameters[2], parton2->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEnergyLightJet( (*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton) )->p( parameters[3], parton3->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + + // lepton energy resolution terms + if (fTypeLepton == kElectron) { + TLorentzVector* electron = (*fParticlesPermuted)->Electron(0); + logprob += log( (*fDetector)->ResEnergyElectron( (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kElectron) )->p( parameters[4], electron->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + } + + else if (fTypeLepton == kMuon) { + // logprob += log( (*fDetector)->ResEnergyMuon( (*fParticlesPermuted)->Muon(0)->Eta() )->p( parameters[4], (*fParticlesPermuted)->Muon(0)->E(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + TLorentzVector* muon = (*fParticlesPermuted)->Muon(0); + double pt_fit = parameters[4]* sin(muon->Theta()); + double pt_reco = muon->Pt(); + logprob += log( (*fDetector)->ResEnergyMuon( (*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kMuon) )->p( pt_fit, pt_reco, TFgoodTmp )); if (!TFgoodTmp) fTFgood = false; + } + + // ETmiss_x and ETmiss_y + logprob += log( (*fDetector)->ResMissingET()->p( parameters[6], ETmiss_x, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResMissingET()->p( parameters[7], ETmiss_y, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + + // eta resolution + logprob += log( (*fDetector)->ResEtaBJet((*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton))->p(parameters[8], parton0->Eta(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEtaBJet((*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton))->p(parameters[9], parton1->Eta(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEtaLightJet((*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton))->p(parameters[10], parton2->Eta(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResEtaLightJet((*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton))->p(parameters[11], parton3->Eta(), TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + + double temp_phi_angles[4]; + + temp_phi_angles[0] = parameters[12]; + temp_phi_angles[1] = parameters[13]; + temp_phi_angles[2] = parameters[14]; + temp_phi_angles[3] = parameters[15]; + + + // check phi variable + if (temp_phi_angles[0] < -fPi) + temp_phi_angles[0] += fTwoPi; + if (temp_phi_angles[0] > fPi) + temp_phi_angles[0] -= fTwoPi; + + if (temp_phi_angles[1] < -fPi) + temp_phi_angles[1] += fTwoPi; + if (temp_phi_angles[1] > fPi) + temp_phi_angles[1] -= fTwoPi; + + if (temp_phi_angles[2] < -fPi) + temp_phi_angles[2] += fTwoPi; + if (temp_phi_angles[2] > fPi) + temp_phi_angles[2] -= fTwoPi; + + if (temp_phi_angles[3] < -fPi) + temp_phi_angles[3] += fTwoPi; + if (temp_phi_angles[3] > fPi) + temp_phi_angles[3] -= fTwoPi; + + // phi resolution (this implementation assumes a symmetric phi resolution function + double diff0 = fabs(temp_phi_angles[0]-parton0->Phi()); + double diff1 = fabs(temp_phi_angles[1]-parton1->Phi()); + double diff2 = fabs(temp_phi_angles[2]-parton2->Phi()); + double diff3 = fabs(temp_phi_angles[3]-parton3->Phi()); + + if (diff0>fPi) + diff0 -= fTwoPi; + if (diff1>fPi) + diff1 -= fTwoPi; + if (diff2>fPi) + diff2 -= fTwoPi; + if (diff3>fPi) + diff3 -= fTwoPi; + + logprob += log( (*fDetector)->ResPhiBJet((*fParticlesPermuted)->DetEta(0, KLFitter::Particles::kParton))->p(0.0, diff0, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResPhiBJet((*fParticlesPermuted)->DetEta(1, KLFitter::Particles::kParton))->p(0.0, diff1, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResPhiLightJet((*fParticlesPermuted)->DetEta(2, KLFitter::Particles::kParton))->p(0.0, diff2, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + logprob += log( (*fDetector)->ResPhiLightJet((*fParticlesPermuted)->DetEta(3, KLFitter::Particles::kParton))->p(0.0, diff3, TFgoodTmp) ); if (!TFgoodTmp) fTFgood = false; + + // Breit-Wigner of hadronically decaying W-boson + logprob += BCMath::LogBreitWignerRel( fParticlesModel->Boson(0)->M(), fPhysicsConstants->MassW(), fPhysicsConstants->GammaW()); + + // Breit-Wigner of leptonically decaying W-boson + logprob += BCMath::LogBreitWignerRel( fParticlesModel->Boson(1)->M(), fPhysicsConstants->MassW(), fPhysicsConstants->GammaW()); + + // note: top mass width should be made DEPENDENT on the top mass at a certain point + // fPhysicsConstants->SetMassTop(parameters[16]); + + // Breit-Wigner of hadronically decaying top quark + logprob += BCMath::LogBreitWignerRel( fParticlesModel->Parton(4)->M(), parameters[16], fPhysicsConstants->GammaTop()); + + // Breit-Wigner of leptonically decaying top quark + logprob += BCMath::LogBreitWignerRel( fParticlesModel->Parton(5)->M(), parameters[16], fPhysicsConstants->GammaTop()); + + // return log of likelihood + return logprob; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_JetAngles::GetInitialParameters() +{ + std::vector<double> values(GetInitialParametersWoNeutrinoPz()); + + // check second neutrino solution + std::vector<double> neutrino_pz_solutions = GetNeutrinoPzSolutions(); + if (int(neutrino_pz_solutions.size()) == 1) + values[5] = neutrino_pz_solutions[0]; + else if(int(neutrino_pz_solutions.size()) == 2) + { + double sol1, sol2; + values[5] = neutrino_pz_solutions[0]; + sol1 = LogLikelihood(values); + values[5] = neutrino_pz_solutions[1]; + sol2 = LogLikelihood(values); + + if (sol1 > sol2) + values[5] = neutrino_pz_solutions[0]; + } + + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_JetAngles::GetInitialParametersWoNeutrinoPz() +{ + std::vector<double> values; + + // energies of the quarks + values.push_back( (*fParticlesPermuted)->Parton(0)->E() ); + values.push_back( (*fParticlesPermuted)->Parton(1)->E() ); + values.push_back( (*fParticlesPermuted)->Parton(2)->E() ); + values.push_back( (*fParticlesPermuted)->Parton(3)->E() ); + + // energy of the lepton + if (fTypeLepton == kElectron) + values.push_back( (*fParticlesPermuted)->Electron(0)->E() ); + else if (fTypeLepton == kMuon) + values.push_back( (*fParticlesPermuted)->Muon(0)->E() ); + + // pz of the neutrino + values.push_back(0.0); + + // missing px and py + values.push_back(ETmiss_x); + values.push_back(ETmiss_y); + + // eta and phi values of the jets + values.push_back( (*fParticlesPermuted)->Parton(0)->Eta() ); + values.push_back( (*fParticlesPermuted)->Parton(1)->Eta() ); + values.push_back( (*fParticlesPermuted)->Parton(2)->Eta() ); + values.push_back( (*fParticlesPermuted)->Parton(3)->Eta() ); + values.push_back( (*fParticlesPermuted)->Parton(0)->Phi() ); + values.push_back( (*fParticlesPermuted)->Parton(1)->Phi() ); + values.push_back( (*fParticlesPermuted)->Parton(2)->Phi() ); + values.push_back( (*fParticlesPermuted)->Parton(3)->Phi() ); + + // top mass + double mtop = ( *(*fParticlesPermuted)->Parton(0) + *(*fParticlesPermuted)->Parton(2) + *(*fParticlesPermuted)->Parton(3) ).M(); + if (mtop < GetParameter(16)->GetLowerLimit()) + mtop = GetParameter(16)->GetLowerLimit(); + else if (mtop > GetParameter(16)->GetUpperLimit()) + mtop = GetParameter(16)->GetUpperLimit(); + values.push_back( mtop); + + // return the vector + return values; +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_JetAngles::GetNeutrinoPzSolutions() { + return CalculateNeutrinoPzSolutions(); +} + +// --------------------------------------------------------- +std::vector<double> KLFitter::LikelihoodTopLeptonJets_JetAngles::CalculateNeutrinoPzSolutions(TLorentzVector* additionalParticle) +{ + std::vector<double> pz; + + KLFitter::PhysicsConstants constants; + // electron mass + double mE = 0.; + + double px_c = 0.0; + double py_c = 0.0; + double pz_c = 0.0; + double Ec = 0.0; + + if (fTypeLepton == kElectron) + { + px_c = (*fParticlesPermuted)->Electron(0)->Px(); + py_c = (*fParticlesPermuted)->Electron(0)->Py(); + pz_c = (*fParticlesPermuted)->Electron(0)->Pz(); + Ec = (*fParticlesPermuted)->Electron(0)->E(); + } + else if (fTypeLepton == kMuon) + { + px_c = (*fParticlesPermuted)->Muon(0)->Px(); + py_c = (*fParticlesPermuted)->Muon(0)->Py(); + pz_c = (*fParticlesPermuted)->Muon(0)->Pz(); + Ec = (*fParticlesPermuted)->Muon(0)->E(); + } + + // add additional particle to "charged lepton" 4-vector + if (additionalParticle) { + px_c += additionalParticle->Px(); + py_c += additionalParticle->Py(); + pz_c += additionalParticle->Pz(); + Ec += additionalParticle->E(); + } + + double px_nu = ETmiss_x; + double py_nu = ETmiss_y; + double alpha = constants.MassW()*constants.MassW() - mE*mE + 2*(px_c*px_nu + py_c*py_nu); + + double a = pz_c*pz_c - Ec*Ec; + double b = alpha* pz_c; + double c = - Ec*Ec* (px_nu*px_nu + py_nu*py_nu) + alpha*alpha/4.; + + double discriminant = b*b - 4*a*c; + if (discriminant < 0.) + return pz; + + double pz_offset = - b / (2*a); + + double squareRoot = sqrt(discriminant); + if (squareRoot < 1.e-6) + pz.push_back(pz_offset); + else { + pz.push_back(pz_offset + squareRoot / (2*a)); + pz.push_back(pz_offset - squareRoot / (2*a)); + } + + return pz; +} + +// --------------------------------------------------------- +bool KLFitter::LikelihoodTopLeptonJets_JetAngles::NoTFProblem(std::vector<double> parameters) { + fTFgood = true; + this->LogLikelihood(parameters); + return fTFgood; +} +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/Particles.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/Particles.cxx new file mode 100644 index 0000000000000000000000000000000000000000..36942bf8080ea7af9e3db958caf0e829891ac6fa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/Particles.cxx @@ -0,0 +1,942 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/Particles.h" + +#include <iostream> + +// --------------------------------------------------------- +KLFitter::Particles::Particles() : + fPartons(new std::vector <TLorentzVector *>(0)), + fElectrons(new std::vector <TLorentzVector *>(0)), + fMuons(new std::vector <TLorentzVector *>(0)), + fTaus(new std::vector <TLorentzVector *>(0)), + fNeutrinos(new std::vector <TLorentzVector *>(0)), + fBosons(new std::vector <TLorentzVector *>(0)), + fPhotons(new std::vector <TLorentzVector *>(0)), + + fNamePartons(new std::vector <std::string>(0)), + fNameElectrons(new std::vector <std::string>(0)), + fNameMuons(new std::vector <std::string>(0)), + fNameTaus(new std::vector <std::string>(0)), + fNameNeutrinos(new std::vector <std::string>(0)), + fNameBosons(new std::vector <std::string>(0)), + fNamePhotons(new std::vector <std::string>(0)), + + fJetIndex(new std::vector <int>(0)), + fElectronIndex(new std::vector <int>(0)), + fMuonIndex(new std::vector <int>(0)), + fPhotonIndex(new std::vector <int>(0)), + + fTrueFlavor(new std::vector<TrueFlavorType>(0)), + fIsBTagged(new std::vector<bool>(0)), + fBTaggingEfficiency(new std::vector<double>(0)), + fBTaggingRejection(new std::vector<double>(0)), + + fBTagWeight(new std::vector<double>(0)), + fBTagWeightSet(new std::vector<bool>(0)), + + fElectronDetEta(new std::vector<double>(0)), + fMuonDetEta(new std::vector<double>(0)), + fJetDetEta(new std::vector<double>(0)), + fPhotonDetEta(new std::vector<double>(0)), + fElectronCharge(new std::vector<float>(0)), + fMuonCharge(new std::vector<float>(0)) +{ +} + +// --------------------------------------------------------- +KLFitter::Particles::~Particles() +{ + while (!fPartons->empty()) { + TLorentzVector* lv = fPartons->front(); + fPartons->erase( fPartons->begin() ); + if (lv) + delete lv; + } + delete fPartons; + + while (!fElectrons->empty()) { + TLorentzVector* lv = fElectrons->front(); + fElectrons->erase( fElectrons->begin() ); + if (lv) + delete lv; + } + delete fElectrons; + + while (!fMuons->empty()) { + TLorentzVector* lv = fMuons->front(); + fMuons->erase( fMuons->begin() ); + if (lv) + delete lv; + } + delete fMuons; + + while (!fTaus->empty()) { + TLorentzVector* lv = fTaus->front(); + fTaus->erase( fTaus->begin() ); + if (lv) + delete lv; + } + delete fTaus; + + while (!fNeutrinos->empty()) { + TLorentzVector* lv = fNeutrinos->front(); + fNeutrinos->erase( fNeutrinos->begin() ); + if (lv) + delete lv; + } + delete fNeutrinos; + + while (!fBosons->empty()) { + TLorentzVector* lv = fBosons->front(); + fBosons->erase( fBosons->begin() ); + if (lv) + delete lv; + } + delete fBosons; + + while (!fPhotons->empty()) { + TLorentzVector* lv = fPhotons->front(); + fPhotons->erase( fPhotons->begin() ); + if (lv) + delete lv; + } + delete fPhotons; + + if (fNamePartons) + delete fNamePartons; + + if (fNameElectrons) + delete fNameElectrons; + + if (fNameMuons) + delete fNameMuons; + + if (fNameTaus) + delete fNameTaus; + + if (fNameNeutrinos) + delete fNameNeutrinos; + + if (fNameBosons) + delete fNameBosons; + + if (fNamePhotons) + delete fNamePhotons; + + if (fJetIndex) + delete fJetIndex; + + if (fElectronIndex) + delete fElectronIndex; + + if (fMuonIndex) + delete fMuonIndex; + + if (fPhotonIndex) + delete fPhotonIndex; + + if (fTrueFlavor) + delete fTrueFlavor; + + if (fIsBTagged) + delete fIsBTagged; + + if (fBTaggingEfficiency) + delete fBTaggingEfficiency; + + if (fBTaggingRejection) + delete fBTaggingRejection; + + if (fBTagWeight) + delete fBTagWeight; + + if (fBTagWeightSet) + delete fBTagWeightSet; + + if (fElectronDetEta) + delete fElectronDetEta; + + if (fMuonDetEta) + delete fMuonDetEta; + + if (fJetDetEta) + delete fJetDetEta; + + if (fPhotonDetEta) + delete fPhotonDetEta; + + if (fElectronCharge) + delete fElectronCharge; + + if (fMuonCharge) + delete fMuonCharge; +} + +// --------------------------------------------------------- +int KLFitter::Particles::AddParticle(TLorentzVector * particle, double DetEta, float LepCharge, KLFitter::Particles::ParticleType ptype, std::string name, int measuredindex) +{ + // get particle container + std::vector <TLorentzVector *>* container = ParticleContainer(ptype); + + //std::string name = ""; + //int measuredindex = -1; + + // check if container exists + if (!container) + { + std::cout << "KLFitter::Particles::AddParticle(). Container does not exist." << std::endl; + return 0; + } + + // check name + if (name == "") + name = Form("particle_%i", NParticles()); + + // get index and type + TLorentzVector* vect = 0; + int index = 0; + KLFitter::Particles::ParticleType temptype = kParton; + + // check if particle with name exists already + if (!FindParticle(name, vect, index, temptype)) { + + // add particle + // create pointer copy of particle content which is owend by Particles + TLorentzVector * cparticle = new TLorentzVector(particle->Px(), particle->Py(), particle->Pz(), particle->E()); + container->push_back(cparticle); + ParticleNameContainer(ptype)->push_back(name); + if (ptype == KLFitter::Particles::kElectron){ + fElectronIndex->push_back(measuredindex); + fElectronDetEta->push_back(DetEta); + fElectronCharge->push_back(LepCharge); + } + else if (ptype == KLFitter::Particles::kMuon){ + fMuonIndex->push_back(measuredindex); + fMuonDetEta->push_back(DetEta); + fMuonCharge->push_back(LepCharge); + } + else if (ptype == KLFitter::Particles::kPhoton){ + fPhotonIndex->push_back(measuredindex); + fPhotonDetEta->push_back(DetEta); + } + } + else { + std::cout << "KLFitter::Particles::AddParticle(). Particle with the name " << name << " exists already." << std::endl; + return 0; + } + + if (fabs(particle->P()/particle->E()-1) > 1.e-6 && particle->M() < 0) { // No Warning if P differs less than 1e-6 from E + std::cout << "KLFitter::Particles::AddParticle(). WARNING : A particle with negative mass " << particle->M() << " of type " << ptype << " was added." << std::endl; + return 1; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::AddParticle(TLorentzVector * particle, double DetEta, KLFitter::Particles::ParticleType ptype, std::string name, int measuredindex, bool isBtagged, double bTagEff, double bTagRej, TrueFlavorType trueflav, double btagweight) +{ + // get particle container + std::vector <TLorentzVector *>* container = ParticleContainer(ptype); + + // check if container exists + if (!container) + { + std::cout << "KLFitter::Particles::AddParticle(). Container does not exist." << std::endl; + return 0; + } + + // check name + if (name == "") + name = Form("particle_%i", NParticles()); + + // get index and type + TLorentzVector* vect = 0; + int index = 0; + KLFitter::Particles::ParticleType temptype = kParton; + + // check if particle with name exists already + if (!FindParticle(name, vect, index, temptype)) { + + // add particle + // create pointer copy of particle content which is owend by Particles + TLorentzVector * cparticle = new TLorentzVector(particle->Px(), particle->Py(), particle->Pz(), particle->E()); + container->push_back(cparticle); + ParticleNameContainer(ptype)->push_back(name); + if (ptype == KLFitter::Particles::kParton) { + fTrueFlavor->push_back(trueflav); + fIsBTagged->push_back(isBtagged); + fBTaggingEfficiency->push_back(bTagEff); + fBTaggingRejection->push_back(bTagRej); + fJetIndex->push_back(measuredindex); + fJetDetEta->push_back(DetEta); + fBTagWeight->push_back(btagweight); + if (btagweight != 999) { + fBTagWeightSet->push_back(true); + } + else { + fBTagWeightSet->push_back(false); + } + } + else if (ptype == KLFitter::Particles::kElectron){ + fElectronIndex->push_back(measuredindex); + fElectronDetEta->push_back(DetEta); + } + else if (ptype == KLFitter::Particles::kMuon){ + fMuonIndex->push_back(measuredindex); + fMuonDetEta->push_back(DetEta); + } + else if (ptype == KLFitter::Particles::kPhoton){ + fPhotonIndex->push_back(measuredindex); + fPhotonDetEta->push_back(DetEta); + } + } + else { + std::cout << "KLFitter::Particles::AddParticle(). Particle with the name " << name << " exists already." << std::endl; + return 0; + } + + if (fabs(particle->P()/particle->E()-1) > 1.e-6 && particle->M() < 0) { // No Warning if P differs less than 1e-6 from E + std::cout << "KLFitter::Particles::AddParticle(). WARNING : A particle with negative mass " << particle->M() << " of type " << ptype << " was added." << std::endl; + return 1; + } + + // no error + return 1; +} + + + +// --------------------------------------------------------- +int KLFitter::Particles::AddParticle(TLorentzVector * particle, KLFitter::Particles::ParticleType ptype, std::string name, int measuredindex, bool isBtagged, double bTagEff, double bTagRej, TrueFlavorType trueflav, double btagweight) +{ + //set default DetEta + double DetEta=-999; + + this->AddParticle(particle, DetEta, ptype, name, measuredindex, isBtagged, bTagEff, bTagRej, trueflav, btagweight); + + // no error + return 1; + +} + +// --------------------------------------------------------- +int KLFitter::Particles::AddParticle(TLorentzVector * particle, KLFitter::Particles::ParticleType ptype, std::string name, int measuredindex, TrueFlavorType trueflav, double btagweight) +{ + //set default DetEta + double DetEta=-999; + + this->AddParticle(particle, DetEta, ptype, name, measuredindex, false, -1., -1., trueflav, btagweight); + + // no error + return 1; +} + +// --------------------------------------------------------- + +int KLFitter::Particles::RemoveParticle(int index, KLFitter::Particles::ParticleType ptype) +{ + // check container and index + if (!CheckIndex(ParticleContainer(ptype), index)) + return 0; + + // remove particle + TLorentzVector* lv = (*ParticleContainer(ptype))[index]; + ParticleContainer(ptype)->erase( ParticleContainer(ptype)->begin() + index); + delete lv; + ParticleNameContainer(ptype)->erase( ParticleNameContainer(ptype)->begin() + index); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::RemoveParticle(std::string name) +{ + // get index and type + TLorentzVector* vect = 0; + int index = 0; + KLFitter::Particles::ParticleType ptype = kParton; + + // remove particle + if (FindParticle(name, vect, index, ptype)) + return RemoveParticle(index, ptype); + else { + std::cout << "KLFitter::Particles::RemoveParticles(). Could not find particle with name " << name << "." << std::endl; + return 0; + } +} + + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Particle(std::string name) +{ + TLorentzVector* particle = 0; + int index = 0; + KLFitter::Particles::ParticleType ptype = kParton; + + // find particle + if (!FindParticle(name, particle, index, ptype)) { + std::cout << "KLFitter::Particles::Particle(). Could not find particles." << std::endl; + return 0; + } + + // return 4-vector + return particle; +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Particle(int index, KLFitter::Particles::ParticleType ptype) +{ + // get particle container + std::vector <TLorentzVector*>* container = ParticleContainer(ptype); + + if (index < 0 || index > NParticles(ptype)) { + std::cout << "KLFitter::Particles::Particle(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return (*container)[index]; +} + +// --------------------------------------------------------- +int KLFitter::Particles::FindParticle(std::string name, TLorentzVector* &particle, int &index, KLFitter::Particles::ParticleType &ptype) +{ + + // loop over all partons + unsigned int npartons = fNamePartons->size(); + for (unsigned int i = 0; i < npartons; ++i) + if (name == (*fNamePartons)[i]) { + particle = (*fPartons)[i]; + index = i; + ptype = KLFitter::Particles::kParton; + return 1; + } + + // loop over all electrons + unsigned int nelectrons = fNameElectrons->size(); + for (unsigned int i = 0; i < nelectrons; ++i) + if (name == (*fNameElectrons)[i]) { + particle = (*fElectrons)[i]; + index = i; + ptype = KLFitter::Particles::kElectron; + return 1; + } + + // loop over all muons + unsigned int nmuons = fNameMuons->size(); + for (unsigned int i = 0; i < nmuons; ++i) + if (name == (*fNameMuons)[i]) { + particle = (*fMuons)[i]; + index = i; + ptype = KLFitter::Particles::kMuon; + return 1; + } + + // loop over all taus + unsigned int ntaus = fNameTaus->size(); + for (unsigned int i = 0; i < ntaus; ++i) + if (name == (*fNameTaus)[i]) { + particle = (*fTaus)[i]; + index = i; + ptype = KLFitter::Particles::kTau; + return 1; + } + + // loop over all neutrinos + unsigned int nneutrinos = fNameNeutrinos->size(); + for (unsigned int i = 0; i < nneutrinos; ++i) + if (name == (*fNameNeutrinos)[i]) { + particle = (*fNeutrinos)[i]; + index = i; + ptype = KLFitter::Particles::kNeutrino; + return 1; + } + + // loop over all bosons + unsigned int nbosons = fNameBosons->size(); + for (unsigned int i = 0; i < nbosons; ++i) + if (name == (*fNameBosons)[i]) { + particle = (*fBosons)[i]; + index = i; + ptype = KLFitter::Particles::kBoson; + return 1; + } + + // loop over all photons + unsigned int nphotons = fNamePhotons->size(); + for (unsigned int i = 0; i < nphotons; ++i) + if (name == (*fNamePhotons)[i]) { + particle = (*fPhotons)[i]; + index = i; + ptype = KLFitter::Particles::kPhoton; + return 1; + } + + // particle not found + return 0; +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Parton(int index) +{ + // no check on index range for CPU-time reasons + return (*fPartons)[index]; + + /* + // check index + if (index < 0 || index >= NPartons()) + { + std::cout << "KLFitter::Particles::Parton(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fPartons->at(index); + */ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Electron(int index) +{ + // no check on index range for CPU-time reasons + return (*fElectrons)[index]; + + /* + // check index + if (index < 0 || index >= NElectrons()) + { + std::cout << "KLFitter::Particles::Electron(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fElectrons->at(index); + */ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Muon(int index) +{ + // no check on index range for CPU-time reasons + return (*fMuons)[index]; + + /* + // check index + if (index < 0 || index >= NMuons()) + { + std::cout << "KLFitter::Particles::Muon(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fMuons->at(index); + */ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Tau(int index) +{ + // no check on index range for CPU-time reasons + return (*fTaus)[index]; + + /* + // check index + if (index < 0 || index >= NTaus()) + { + std::cout << "KLFitter::Particles::Tau(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fTaus->at(index); + */ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Boson(int index) +{ + // no check on index range for CPU-time reasons + return (*fBosons)[index]; + + /* + // check index + if (index < 0 || index >= NBosons()) + { + std::cout << "KLFitter::Particles::Boson(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fBosons->at(index); + */ + +} + +// --------------------------------------------------------- + +TLorentzVector* KLFitter::Particles::Neutrino(int index) +{ + // no check on index range for CPU-time reasons + return (*fNeutrinos)[index]; + + /* + // check index + if (index < 0 || index >= NNeutrinos()) + { + std::cout << "KLFitter::Particles::Neutrino(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fNeutrinos->at(index); + */ +} + +// --------------------------------------------------------- +TLorentzVector* KLFitter::Particles::Photon(int index) +{ + // no check on index range for CPU-time reasons + return (*fPhotons)[index]; + + /* + // check index + if (index < 0 || index >= NPhotons()) + { + std::cout << "KLFitter::Particles::Photon(). Index out of range." << std::endl; + return 0; + } + + // return pointer + return fPhotons->at(index); + */ +} + +// --------------------------------------------------------- +int KLFitter::Particles::NParticles(KLFitter::Particles::ParticleType ptype) +{ + return int(ParticleContainer(ptype)->size()); +} + +// --------------------------------------------------------- +std::string KLFitter::Particles::NameParticle(int index, KLFitter::Particles::ParticleType ptype) +{ + // get particle container + std::vector <TLorentzVector *>* container = ParticleContainer(ptype); + + // check container and index + if (!CheckIndex(container, index)) + return ""; + + // return name + return (*ParticleNameContainer(ptype))[index]; + +} + +// --------------------------------------------------------- +int KLFitter::Particles::CheckIndex(std::vector <TLorentzVector *>* container, int index) +{ + // check container + if (!container) + { + std::cout << "KLFitter::Particles::CheckIndex(). Container does not exist." << std::endl; + return 0; + } + + // check index + if (index < 0 || index >= int(container->size())) + { + std::cout << "KLFitter::Particles::CheckIndex(). Index out of range." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- +std::vector <TLorentzVector *>* KLFitter::Particles::ParticleContainer(KLFitter::Particles::ParticleType ptype) +{ + // return particle container + switch(ptype) + { + case KLFitter::Particles::kParton: + return fPartons; + break; + case KLFitter::Particles::kElectron: + return fElectrons; + break; + case KLFitter::Particles::kMuon: + return fMuons; + break; + case KLFitter::Particles::kTau: + return fTaus; + break; + case KLFitter::Particles::kNeutrino: + return fNeutrinos; + break; + case KLFitter::Particles::kBoson: + return fBosons; + break; + case KLFitter::Particles::kPhoton: + return fPhotons; + break; + } + + // or null pointer + std::cout << "KLFitter::Particles::ParticleContainer(). Particle type unknown." << std::endl; + return 0; +} + +// --------------------------------------------------------- +std::vector <std::string>* KLFitter::Particles::ParticleNameContainer(KLFitter::Particles::ParticleType ptype) +{ + // return container + if (ptype == KLFitter::Particles::kParton) + return fNamePartons; + + else if (ptype == KLFitter::Particles::kElectron) + return fNameElectrons; + + else if (ptype == KLFitter::Particles::kMuon) + return fNameMuons; + + else if (ptype == KLFitter::Particles::kTau) + return fNameTaus; + + else if (ptype == KLFitter::Particles::kBoson) + return fNameBosons; + + else if (ptype == KLFitter::Particles::kNeutrino) + return fNameNeutrinos; + + else if (ptype == KLFitter::Particles::kPhoton) + return fNamePhotons; + + // or null pointer + else + { + std::cout << "KLFitter::Particles::ParticleNameContainer(). Particle type not known." << std::endl; + return 0; + } +} + +// --------------------------------------------------------- +double KLFitter::Particles::DetEta(int index, KLFitter::Particles::ParticleType ptype) +{ + if (index < 0 || index > NParticles(ptype)) { + std::cout << "KLFitter::Particles::DetEta(). Index out of range." << std::endl; + return 0; + } + + if (ptype == KLFitter::Particles::kParton) + return (*fJetDetEta)[index]; + else if (ptype == KLFitter::Particles::kElectron) + return (*fElectronDetEta)[index]; + else if (ptype == KLFitter::Particles::kMuon) + return (*fMuonDetEta)[index]; + else if (ptype == KLFitter::Particles::kPhoton) + return (*fPhotonDetEta)[index]; + + // return error value + return -100; +} +// --------------------------------------------------------- +float KLFitter::Particles::LeptonCharge(int index, KLFitter::Particles::ParticleType ptype) +{ + if (index < 0 || index > NParticles(ptype)) { + std::cout << "KLFitter::Particles::LepCharge(). Index out of range." << std::endl; + return 0; + } + + + if (ptype == KLFitter::Particles::kElectron){ + if (fElectronCharge->size()==0) + return -9; + else + return (*fElectronCharge)[index]; + } + else if (ptype == KLFitter::Particles::kMuon){ + if (fMuonCharge->size()==0) + return -9; + else + return (*fMuonCharge)[index]; + } + else + std::cout << "KLFitter::Particles::LepCharge NO LEPTON TYPE!" << std::endl; + + // return error value + return -9; +} +// --------------------------------------------------------- +int KLFitter::Particles::JetIndex(int index) +{ + // no check on index range for CPU-time reasons + return (*fJetIndex)[index]; + + /* + // check index + if (index < 0 || index >= NPartons()) + { + std::cout << "KLFitter::Particles::JetIndex(). Index out of range." << std::endl; + return 0; + } + + // return jet index + return fJetIndex->at(index); + */ +} + +// --------------------------------------------------------- +int KLFitter::Particles::ElectronIndex(int index) +{ + // no check on index range for CPU-time reasons + return (*fElectronIndex)[index]; + + /* + // check index + if (index < 0 || index >= NElectrons()) + { + std::cout << "KLFitter::Particles::ElectronIndex(). Index out of range." << std::endl; + return 0; + } + + // return electron index + return fElectronIndex->at(index); + */ +} + +// --------------------------------------------------------- +int KLFitter::Particles::MuonIndex(int index) +{ + // no check on index range for CPU-time reasons + return (*fMuonIndex)[index]; + + /* + // check index + if (index < 0 || index >= NMuons()) + { + std::cout << "KLFitter::Particles::MuonIndex(). Index out of range." << std::endl; + return 0; + } + + // return muon index + return fMuonIndex->at(index); + */ +} + +// --------------------------------------------------------- +int KLFitter::Particles::PhotonIndex(int index) +{ + // no check on index range for CPU-time reasons + return (*fPhotonIndex)[index]; + + /* + // check index + if (index < 0 || index >= NPhotons()) + { + std::cout << "KLFitter::Particles::PhotonIndex(). Index out of range." << std::endl; + return 0; + } + + // return photon index + return fPhotonIndex->at(index); + */ +} + +// --------------------------------------------------------- +int KLFitter::Particles::SetIsBTagged(int index, bool isBTagged) +{ + // check index + if (index < 0 || index >= int(fIsBTagged->size())) + { + std::cout << " KLFitter::SetIsBTagged(). Index out of range." << std::endl; + return 0; + } + + (*fIsBTagged)[index] = isBTagged; + + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::SetBTagWeight(int index, double btagweight) +{ + // check index + if (index < 0 || index >= int(fBTagWeight->size())) + { + std::cout << " KLFitter::SetBTagWeight(). Index out of range." << std::endl; + return 0; + } + + (*fBTagWeight)[index] = btagweight; + SetBTagWeightSet(index, true); + + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::SetBTagWeightSet(int index, bool btagweightset) +{ + // check index + if (index < 0 || index >= int(fBTagWeightSet->size())) + { + std::cout << " KLFitter::SetBTagWeightSet(). Index out of range." << std::endl; + return 0; + } + + (*fBTagWeightSet)[index] = btagweightset; + + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::SetBTaggingEfficiency(int index, double btagEff) +{ + // check index + if (index < 0 || index >= int(fBTaggingEfficiency->size())) + { + std::cout << " KLFitter::SetBTaggingEfficiency(). Index out of range." << std::endl; + return 0; + } + + (*fBTaggingEfficiency)[index] = btagEff; + + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::SetBTaggingRejection(int index, double btagRej) +{ + // check index + if (index < 0 || index >= int(fBTaggingRejection->size())) + { + std::cout << " KLFitter::SetBTaggingRejection(). Index out of range." << std::endl; + return 0; + } + + (*fBTaggingRejection)[index] = btagRej; + + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Particles::NBTags() +{ + unsigned int n = fIsBTagged->size(); + int sum = 0; + + for (unsigned int i = 0; i < n; ++i) { + if ((*fIsBTagged)[i]) + sum++; + } + + return sum; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/Permutations.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/Permutations.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a579c23f1f0acd8ad5ebc037920d2afea7f858c0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/Permutations.cxx @@ -0,0 +1,728 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/Permutations.h" +#include <iostream> +#include <set> + +// --------------------------------------------------------- +KLFitter::Permutations::Permutations(KLFitter::Particles ** p, KLFitter::Particles ** pp) +{ + fParticles = p; + fParticlesPermuted = pp; + fParticlesTable = new std::vector <KLFitter::Particles *>(0); + fPermutationTable = new std::vector < std::vector<int> *>(0); + fPermutationIndex = -1; + fTablePartons = 0; + fTableElectrons = 0; + fTableMuons = 0; + fTablePhotons = 0; +} + +// --------------------------------------------------------- +KLFitter::Permutations::~Permutations() +{ + // delete particles and permutations tables + Reset(); +} + +// --------------------------------------------------------- +int KLFitter::Permutations::SetPermutation(int index) +{ + // check if permutation table exists + if (!fParticlesTable) + { + std::cout << "KLFitter::Permutations::SetPermutation(). Table does not exist yet." << std::endl; + return 0; + } + + // check index + if (index < 0 || index >= NPermutations()) + { + std::cout << "KLFitter::Permutations::SetPermutation(). Index out of range." << std::endl; + return 0; + } + + if (!fParticlesPermuted) + { + std::cout << "KLFitter::Permutations::SetPermutation(). Pointer to permuted particles not available." << std::endl; + return 0; + } + + // set permutation + (*fParticlesPermuted) = (*fParticlesTable)[index]; + + // set permutation index + fPermutationIndex = index; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Permutations::CreatePermutations(int nPartonsInPermutations) +{ + // reset existing particle and permuation tables + Reset(); + + // create new table of particles + if (!fParticlesTable) + fParticlesTable = new std::vector <KLFitter::Particles *>(0); + + // create new table of permutations + if (!fPermutationTable) + fPermutationTable = new std::vector < std::vector<int> *>(0); + + // check particles + CheckParticles(); + + // get number of objects per category + int npartons = (*fParticles)->NPartons(); + int nelectrons = (*fParticles)->NElectrons(); + int nmuons = (*fParticles)->NMuons(); + int nphotons = (*fParticles)->NPhotons(); + + bool isDilepton(false); + + if(nelectrons!=0 && (*fParticles)->LeptonCharge(0, KLFitter::Particles::kElectron)!=-9) + isDilepton=true; + + if(nmuons!=0 && (*fParticles)->LeptonCharge(0, KLFitter::Particles::kMuon)!=-9) + isDilepton=true; + + //std::cout << "isDilepton? " << isDilepton << std::endl; + + // create table for parton, electron, muon and photons permutations + fTablePartons = new std::vector < std::vector<int> * >(0); + CreateSubTable(npartons, fTablePartons, nPartonsInPermutations); + + fTableElectrons = new std::vector < std::vector<int> * >(0); + CreateSubTable(nelectrons, fTableElectrons); + + fTableMuons = new std::vector < std::vector<int> * >(0); + CreateSubTable(nmuons, fTableMuons); + + fTablePhotons = new std::vector < std::vector<int> * >(0); + CreateSubTable(nphotons, fTablePhotons); + + int npartonsPerm = npartons; + if (nPartonsInPermutations >= 0) + npartonsPerm = nPartonsInPermutations; + + // get number of possible permutations for each category + int npermpartons = fTablePartons->size() <= 0 ? 1 : fTablePartons->size(); + int npermelectrons = fTableElectrons->size() <= 0 ? 1 : fTableElectrons->size(); + int npermmuons = fTableMuons->size() <= 0 ? 1 : fTableMuons->size(); + int npermphotons = fTablePhotons->size() <= 0 ? 1 : fTablePhotons->size(); + int npermoverall = npartonsPerm + nelectrons + nmuons + nphotons; + + // loop over all parton permutations + for (int ipermparton = 0; ipermparton < npermpartons; ++ipermparton) + { + // loop over all electron permutations + for (int ipermelectron = 0; ipermelectron < npermelectrons; ++ipermelectron) + { + // loop over all muon permutations + for (int ipermmuon = 0; ipermmuon < npermmuons; ++ipermmuon) + { + // loop over all photon permutations + for (int ipermphoton = 0; ipermphoton < npermphotons; ++ipermphoton) + { + // create new particles + KLFitter::Particles * particles = new KLFitter::Particles(); + + // create new permutation + std::vector <int> * permutation = new std::vector <int>(npermoverall); + + // loop over all partons + for (int i = 0; i < npartonsPerm; ++i) + { + // get index + int index = (*(*fTablePartons)[ipermparton])[i]; + + // add parton + particles->AddParticle((*fParticles)->Parton(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kParton), + KLFitter::Particles::kParton, + (*fParticles)->NameParticle(index, KLFitter::Particles::kParton), + (*fParticles)->JetIndex(index), + (*fParticles)->IsBTagged(index), + (*fParticles)->BTaggingEfficiency(index), + (*fParticles)->BTaggingRejection(index), + (*fParticles)->TrueFlavor(index), + (*fParticles)->BTagWeight(index)); + + // set permutation + (*permutation)[i] = index; + } + + // loop over all electrons + for (int i = 0; i < nelectrons; ++i) + { + // get index + int index = (*(*fTableElectrons)[ipermelectron])[i]; + + // if isDilepton include charge of the lepton + if (isDilepton){ + + // add electron + particles->AddParticle((*fParticles)->Electron(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kElectron), + (*fParticles)->LeptonCharge(index, KLFitter::Particles::kElectron), + KLFitter::Particles::kElectron, + (*fParticles)->NameParticle(index, KLFitter::Particles::kElectron), + (*fParticles)->ElectronIndex(index)); + } + else{ + // add electron + particles->AddParticle((*fParticles)->Electron(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kElectron), + KLFitter::Particles::kElectron, + (*fParticles)->NameParticle(index, KLFitter::Particles::kElectron), + (*fParticles)->ElectronIndex(index)); + } + + // set permutation + (*permutation)[npartonsPerm + i] = index; + } + + // loop over all muons + for (int i = 0; i < nmuons; ++i) + { + // get index + int index = (*(*fTableMuons)[ipermmuon])[i]; + + // if isDilepton include charge of the lepton + if (isDilepton){ + + // add muon + particles->AddParticle((*fParticles)->Muon(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kMuon), + (*fParticles)->LeptonCharge(index, KLFitter::Particles::kMuon), + KLFitter::Particles::kMuon, + (*fParticles)->NameParticle(index, KLFitter::Particles::kMuon), + (*fParticles)->MuonIndex(index)); + } + else{ + // add muon + particles->AddParticle((*fParticles)->Muon(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kMuon), + KLFitter::Particles::kMuon, + (*fParticles)->NameParticle(index, KLFitter::Particles::kMuon), + (*fParticles)->MuonIndex(index)); + + } + + // set permutation + (*permutation)[npartonsPerm + nelectrons + i] = index; + } + + // loop over all photons + for (int i = 0; i < nphotons; ++i) + { + // get index + int index = (*(*fTablePhotons)[ipermphoton])[i]; + + // add photon + particles->AddParticle((*fParticles)->Photon(index), + (*fParticles)->DetEta(index, KLFitter::Particles::kPhoton), + KLFitter::Particles::kPhoton, + (*fParticles)->NameParticle(index, KLFitter::Particles::kPhoton), + (*fParticles)->PhotonIndex(index)); + + // set permutation + (*permutation)[npartonsPerm + nelectrons + nmuons + i] = index; + } + + // add particles to table + fParticlesTable->push_back(particles); + + // add permutation to table + fPermutationTable->push_back(permutation); + } + } + } + } + + // no error + return 1; + +} + +// --------------------------------------------------------- +int KLFitter::Permutations::Reset() +{ + // delete table of particles + if (fParticlesTable) + { + while (!fParticlesTable->empty()) + { + KLFitter::Particles * p = fParticlesTable->front(); + fParticlesTable->erase( fParticlesTable->begin() ); + delete p; + } + delete fParticlesTable; + fParticlesTable = 0; + } + + // delete permutation table + if (fPermutationTable) + { + while (!fPermutationTable->empty()) + { + std::vector <int> * p = fPermutationTable->front(); + fPermutationTable->erase( fPermutationTable->begin() ); + delete p; + } + delete fPermutationTable; + fPermutationTable = 0; + } + + // free memory + if (fTablePartons) { + while (!fTablePartons->empty()) + { + std::vector<int> * l = fTablePartons->front(); + fTablePartons->erase( fTablePartons->begin() ); + l->clear(); + delete l; + } + delete fTablePartons; + fTablePartons = 0; + } + + if (fTableElectrons) { + while (!fTableElectrons->empty()) + { + std::vector<int> * l = fTableElectrons->front(); + fTableElectrons->erase( fTableElectrons->begin() ); + l->clear(); + delete l; + } + delete fTableElectrons; + fTableElectrons = 0; + } + + if (fTableMuons) { + while (!fTableMuons->empty()) + { + std::vector<int> * l = fTableMuons->front(); + fTableMuons->erase( fTableMuons->begin() ); + l->clear(); + delete l; + } + delete fTableMuons; + fTableMuons = 0; + } + + if (fTablePhotons) { + while (!fTablePhotons->empty()) + { + std::vector<int> * l = fTablePhotons->front(); + fTablePhotons->erase( fTablePhotons->begin() ); + l->clear(); + delete l; + } + delete fTablePhotons; + fTablePhotons = 0; + } + + // no error + return 1; +} + + +// --------------------------------------------------------- +int KLFitter::Permutations::CreateSubTable(int Nobj, std::vector < std::vector<int> * > * table, int Nmax) +{ + if (Nmax < 0) { + std::vector<int> vidx; + for (int i(0); i < Nobj; ++i) + vidx.push_back(i); + + do table->push_back(new std::vector<int>(vidx)); + while (next_permutation(vidx.begin(), vidx.end())); + } + + else { + + std::vector<std::vector<int> > v = Get_M_from_N(Nobj, Nmax); + + for (unsigned int i(0), n(v.size()); i < n; ++i) { + std::vector<int> vidx = v[i]; + do table->push_back(new std::vector<int>(vidx)); + while (next_permutation(vidx.begin(), vidx.end())); + } + + } + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Permutations::InvariantParticlePermutations(KLFitter::Particles::ParticleType ptype, std::vector<int> indexVector) +{ + // check if particles are defined + if (!CheckParticles()) + return 0; + + // check indices + std::set<int> indexSet; + for (unsigned int i = 0, I = indexVector.size(); i < I; i++) + { + if (indexSet.find(indexVector[i]) != indexSet.end()) + { + std::cout << "KLFitter::Permutations::InvariantParticlePermutations(). Indices have to be different." << std::endl; + return 0; + } + else + indexSet.insert(indexVector[i]); + } + + for (unsigned int i = 0, I = indexVector.size(); i < I; i++) + { + int index = indexVector[i]; + if (index < 0 || index >= (*fParticles)->NParticles(ptype)) + { + std::cout << "KLFitter::Permutations::InvariantParticlePermutations(). Index out of range." << std::endl; + return 0; + } + } + + // swap indices + indexVector.clear(); + std::set<int>::iterator it_indexSetBegin = indexSet.begin(); + std::set<int>::iterator it_indexSetEnd = indexSet.end(); + for (; it_indexSetBegin != it_indexSetEnd; it_indexSetBegin++) + indexVector.push_back(*it_indexSetBegin); + + // check particles table + if (!fParticlesTable) + { + std::cout << "KLFitter::Permutations::InvariantParticlePermutations(). Table does not exist yet." << std::endl; + return 0; + } + + // check permutation table + if (!fPermutationTable) + { + std::cout << "KLFitter::Permutations::InvariantParticlePermutations(). Table of parton permutations doesn ot exist." << std::endl; + return 0; + } + + // no error + int err = 1; + + // loop over all permutations (if there are only 2 indices left) + if (indexVector.size() == 2) + { + // get number of permutations + int nperm = NPermutations(); + + for (int iperm = nperm-1; iperm >= 0; --iperm) + { + int offset = 0; + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype < ptype; ++itype) + offset += (*fParticles)->NParticles(itype); + int index1 = indexVector[0] + offset; + int index2 = indexVector[1] + offset; + + // get permutation + std::vector<int> * permutation = (*fPermutationTable)[iperm]; + + // check indices + if ((*permutation)[index1] >= (*permutation)[index2]) + { + std::vector <int> * pt = (*fPermutationTable)[iperm]; + fPermutationTable->erase( fPermutationTable->begin() + iperm ); + delete pt; + + KLFitter::Particles * p = (*fParticlesTable)[iperm]; + fParticlesTable->erase( fParticlesTable->begin() + iperm ); + delete p; + } + } + } + else + { + // repeat until there are only 2 indices left + while (indexVector.size() >= 2) + { + int index2 = indexVector.back(); + for (unsigned int i = 0, I = indexVector.size()-1; i < I; i++) + { + int index1 = indexVector[i]; + std::vector<int> newIndexVector; + newIndexVector.push_back(index1); + newIndexVector.push_back(index2); + err *= InvariantParticlePermutations(ptype, newIndexVector); + } + indexVector.erase(--indexVector.end()); + } + } + + // return error code + return err; +} +// --------------------------------------------------------- +int KLFitter::Permutations::InvariantParticleGroupPermutations(KLFitter::Particles::ParticleType ptype, std::vector<int> indexVectorPosition1, std::vector<int> indexVectorPosition2) +{ + // check if particles are defined + if (!CheckParticles()) + return 0; + + // check if index vectors have the same size + if (indexVectorPosition1.size()!=indexVectorPosition2.size()) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Index Vectors need to have the same size." << std::endl; + return 0; + } + + // check indices + std::set<int> indexSetPosition1; + std::set<int> indexSetPosition2; + for (unsigned int i = 0, I = indexVectorPosition1.size(); i < I; i++) + { + if (indexSetPosition1.find(indexVectorPosition1[i]) != indexSetPosition1.end()) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Indices within same index vector have to be different." << std::endl; + return 0; + } + else if (indexSetPosition2.find(indexVectorPosition2[i]) != indexSetPosition2.end()) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Indices within same index vector have to be different." << std::endl; + return 0; + } + else if (indexVectorPosition1[i] == indexVectorPosition2[i]) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Indices have to be different." << std::endl; + return 0; + } + else + { + indexSetPosition1.insert(indexVectorPosition1[i]); + indexSetPosition2.insert(indexVectorPosition2[i]); + } + } + + for (unsigned int i = 0, I = indexVectorPosition1.size(); i < I; i++) + { + int index1 = indexVectorPosition1[i]; + if (index1 < 0 || index1 >= (*fParticles)->NParticles(ptype)) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Index out of range." << index1 << " " << (*fParticles)->NParticles(ptype) << std::endl; + return 0; + } + int index2 = indexVectorPosition2[i]; + if (index2 < 0 || index2 >= (*fParticles)->NParticles(ptype)) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Index out of range." << index2 << " " << (*fParticles)->NParticles(ptype) << std::endl; + return 0; + } + } + + // swap indices + indexVectorPosition1.clear(); + std::set<int>::iterator it_indexSetPosition1Begin = indexSetPosition1.begin(); + std::set<int>::iterator it_indexSetPosition1End = indexSetPosition1.end(); + for (; it_indexSetPosition1Begin != it_indexSetPosition1End; it_indexSetPosition1Begin++) + indexVectorPosition1.push_back(*it_indexSetPosition1Begin); + + // check particles table + if (!fParticlesTable) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Table does not exist yet." << std::endl; + return 0; + } + + // check permutation table + if (!fPermutationTable) + { + std::cout << "KLFitter::Permutations::InvariantParticleGroupPermutations(). Table of parton permutations doesn ot exist." << std::endl; + return 0; + } + + // no error + int err = 1; + + // loop over all permutations + // get number of permutations + int nperm = NPermutations(); + + for (int iperm1 = nperm-1; iperm1 >= 1; --iperm1) + { + int offset = 0; + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype < ptype; ++itype) + offset += (*fParticles)->NParticles(itype); + + // get permutation + std::vector<int> * permutation1 = (*fPermutationTable)[iperm1]; + + for(int iperm2 = iperm1-1; iperm2 >= 0; --iperm2) + { + // get second permutation + std::vector<int> * permutation2 = (*fPermutationTable)[iperm2]; + + // loop over index vectors + + unsigned int numberOfInvariantMatches(0); + + for (unsigned int i = 0, I = indexVectorPosition1.size(); i < I; i++) + { + int indexPosition1 = indexVectorPosition1[i] + offset; + int indexPosition2 = indexVectorPosition2[i] + offset; + + // check indices + if ((*permutation1)[indexPosition1] == (*permutation2)[indexPosition2] && (*permutation1)[indexPosition2] == (*permutation2)[indexPosition1]) + numberOfInvariantMatches ++; + } + + if (numberOfInvariantMatches == indexVectorPosition1.size()) + { + std::vector <int> * pt = (*fPermutationTable)[iperm2]; + fPermutationTable->erase( fPermutationTable->begin() + iperm2 ); + delete pt; + + KLFitter::Particles * p = (*fParticlesTable)[iperm2]; + fParticlesTable->erase( fParticlesTable->begin() + iperm2 ); + delete p; + } + } // second permutation + } // first permutation + + // return error code + return err; +} +// --------------------------------------------------------- + +int KLFitter::Permutations::RemoveParticlePermutations(KLFitter::Particles::ParticleType ptype, int index, int position) { + // check if particles are defined + if (!CheckParticles()) + return 0; + + // check index + if (index < 0 || index >= (*fParticles)->NParticles(ptype)) { + std::cout << "KLFitter::Permutations::RemoveParticlePermutations(). Index out of range." << std::endl; + return 0; + } + + // check particles table + if (!fParticlesTable) { + std::cout << "KLFitter::Permutations::RemoveParticlePermutations(). Table does not exist yet." << std::endl; + return 0; + } + + // check permutation table + if (!fPermutationTable) { + std::cout << "KLFitter::Permutations::RemoveParticlePermutations(). Table of parton permutations does not exist." << std::endl; + return 0; + } + + // get offset for the particle type + int offset = 0; + for (KLFitter::Particles::ParticleType itype = KLFitter::Particles::kParton; itype < ptype; ++itype) + offset += (*fParticles)->NParticles(itype); + position += offset; + + // loop over all permutations + for (int iPerm(NPermutations()-1); iPerm >= 0; --iPerm) { + std::vector<int> * permutation = (*fPermutationTable)[iPerm]; + + if ((*permutation)[position] == index) { + std::vector<int> * pt = (*fPermutationTable)[iPerm]; + fPermutationTable->erase(fPermutationTable->begin() + iPerm); + delete pt; + + KLFitter::Particles * p = (*fParticlesTable)[iPerm]; + fParticlesTable->erase(fParticlesTable->begin() + iPerm); + delete p; + } + } + + // return error code; + return 1; +} + +// --------------------------------------------------------- +int KLFitter::Permutations::CheckParticles() +{ + // check if particles are defined + if (!fParticles) + { + std::cout << "KLFitter::Permutations::CheckParticles(). Pointer to particles not defined yet." << std::endl; + return 0; + } + + if (!(*fParticles)) + { + std::cout << "KLFitter::Permutations::CheckParticles(). Particles not defined yet." << std::endl; + return 0; + } + + // no error + return 1; +} + +// --------------------------------------------------------- + +std::vector<std::vector<int>* > *KLFitter::Permutations::PermutationTable() +{ + return fPermutationTable; + + /* + // copy the table + std::vector<std::vector<int>* > *permutationTable = new std::vector<std::vector<int>* >(0); + int npartons = (*fParticles)->NPartons(); + int nelectrons = (*fParticles)->NElectrons(); + int nmuons = (*fParticles)->NMuons(); + int nphotons = (*fParticles)->NPhotons(); + for (unsigned int iPerm = 0; iPerm < fPermutationTable->size(); iPerm++) + { + std::vector<int> *iVec = new std::vector<int>; + for (int iParticle = 0; iParticle < npartons + nelectrons + nmuons + nphotons; iParticle++) + iVec->push_back(fPermutationTable->at(iPerm)->at(iParticle)); + permutationTable->push_back(iVec); + } + + // return copy + return permutationTable; + */ + +} + +// --------------------------------------------------------- + +std::vector<int> KLFitter::Permutations::Get_int_vector(int i) { + std::vector<int> vtmp; + vtmp.push_back(i); + return vtmp; +} + +// --------------------------------------------------------- + +std::vector<int> KLFitter::Permutations::Get_int_plus_vector(int i, std::vector<int> v) { + std::vector<int> vtmp = Get_int_vector(i); + for (unsigned int j(0), jend(v.size()); j < jend; ++j) + vtmp.push_back(v[j]); + return vtmp; +} + +// --------------------------------------------------------- + +std::vector<std::vector<int> > KLFitter::Permutations::Get_M_from_N(unsigned int N, unsigned int M, unsigned int start) { + std::vector<std::vector<int> > v(0); + for (unsigned int i(start); i < N-(M-1); ++i) { + if (M == 1) + v.push_back(Get_int_vector(i)); + else { + std::vector<std::vector<int> > vnext = Get_M_from_N(N, M-1, i+1); + for (unsigned int j(0), jend(vnext.size()); j < jend; ++j) + v.push_back(Get_int_plus_vector(i, vnext[j])); + } + } + return v; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/PhysicsConstants.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/PhysicsConstants.cxx new file mode 100644 index 0000000000000000000000000000000000000000..21a13cdcd594c1fe775ca061f3871038dd039290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/PhysicsConstants.cxx @@ -0,0 +1,265 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/PhysicsConstants.h" +#include <cmath> +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::PhysicsConstants::PhysicsConstants() +{ + fMassBottom = 4.7; // bottom quark mass in GeV/c^{2} + fMassW = 80.4; // W boson mass in GeV/c^{2} + fMassTop = 170.0; // top quark pole mass in GeV/c^{2} + fMassZ = 91.2; // Z boson mass in GeV/c^{2} + fGammaW = 2.1; // W boson width + fGammaTop = 1.5; // top quark width + fGammaZ = 2.5; // Z boson width + fGF = 1.16637e-5; // in GeV^{-2} + fAlphaS = 0.118; + fMassTopUnc = 1.4; // top quark LHC uncertainty + //++++++++++++++++// + fMassHiggs = 120.0; // Higgs mass in GeV/c^{2} + fGammaHiggs = 0.003512; // Higgs width + +} + +// --------------------------------------------------------- +KLFitter::PhysicsConstants::~PhysicsConstants() +{ +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetMassBottom(double mass) +{ + // check argument + if (mass < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetMassBottom(). Mass cannot be negative. Set mass to zero." << std::endl; + fMassBottom = 0.; + return 0; + } + + //set mass + fMassBottom = mass; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetMassTop(double mass) +{ + // check argument + if (mass < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetMassTop(). Mass cannot be negative. Set mass to zero." << std::endl; + fMassTop = 0.; + return 0; + } + + //set mass + fMassTop = mass; + + // calculate top width + CalculateGammaTop(); + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetMassHiggs(double mass) +{ + // check argument + if (mass < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetMassHiggs(). Mass cannot be negative. Set mass to zero." << std::endl; + fMassHiggs = 0.; + return 0; + } + + //set mass + fMassHiggs = mass; + + // calculate top width + CalculateGammaHiggs(); + + // no error + return 1; +} + + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetMassW(double mass) +{ + // check argument + if (mass < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetMassW(). Mass cannot be negative. Set mass to zero." << std::endl; + fMassW = 0.; + return 0; + } + + //set mass + fMassW = mass; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetMassZ(double mass) +{ + // check argument + if (mass < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetMassZ(). Mass cannot be negative. Set mass to zero." << std::endl; + fMassZ = 0.; + return 0; + } + + //set mass + fMassZ = mass; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetGammaW(double gamma) +{ + // check argument + if (gamma < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetGammaW(). Width cannot be negative. Set width to zero." << std::endl; + fGammaW = 0.; + return 0; + } + + //set gamma + fGammaW = gamma; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetGammaZ(double gamma) +{ + // check argument + if (gamma < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetGammaZ(). Width cannot be negative. Set width to zero." << std::endl; + fGammaW = 0.; + return 0; + } + + //set gamma + fGammaZ = gamma; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetGammaTop(double gamma) +{ + // check argument + if (gamma < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetGammaTop(). Width cannot be negative. Set width to zero." << std::endl; + fGammaTop = 0.; + return 0; + } + + //set gamma + fGammaTop = gamma; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::PhysicsConstants::SetGammaHiggs(double gamma) +{ + // check argument + if (gamma < 0) + { + std::cout << "KLFitter::PhysicsConstants::SetGammaHiggs(). Width cannot be negative. Set width to zero." << std::endl; + fGammaHiggs = 0.; + return 0; + } + + //set gamma + fGammaHiggs = gamma; + + // no error + return 1; +} + + +// --------------------------------------------------------- +void KLFitter::PhysicsConstants::CalculateGammaTop() +{ + // use formula used in: + // T.~M.~Liss and A.~Quadt, + // ``The Top Quark,'' in + // C.~Amsler {\it et al.} [Particle Data Group], + // ``Review of particle physics,'' + // Phys.\ Lett.\ B {\bf 667} (2008) 1. + + double gamma = fGF * fMassTop * fMassTop * fMassTop / 8 / M_PI / sqrt(2); + gamma *= (1 - fMassW*fMassW/fMassTop/fMassTop) * (1 - fMassW*fMassW/fMassTop/fMassTop); + gamma *= (1 + 2 * fMassW * fMassW / fMassTop / fMassTop); + gamma *= (1 - 2 * fAlphaS / 3 / M_PI * (2*M_PI*M_PI/3 - 5./2.)); + + SetGammaTop(gamma); +} + +// --------------------------------------------------------- + +void KLFitter::PhysicsConstants::CalculateGammaHiggs() +{ + // numbers calculated by HDECAY + // A.Djouadi, J.Kalinowski and M.Spira, + // Comp. Phys. Commun. 108 C (1998) 56, hep-ph/9704448. + // + // MHSM(GeV) WIDTH(GeV/c2) + // __________________________ + // + // 110.000 0.2849E-02 + // 115.000 0.3124E-02 + // 120.000 0.3512E-02 + // 125.000 0.4078E-02 + // 130.000 0.4920E-02 + // 140.000 0.8196E-02 + + double gamma = 0.0; + + if ( fMassHiggs < 111.0) + gamma = 0.002849; + if ( fMassHiggs > 114.0 && fMassHiggs < 116.0) + gamma = 0.003124; + if ( fMassHiggs > 119.0 && fMassHiggs < 121.0) + gamma = 0.003512; + if ( fMassHiggs > 124.0 && fMassHiggs < 126.0) + gamma = 0.004078; + if ( fMassHiggs > 129.0 && fMassHiggs < 131.0) + gamma = 0.004920; + if ( fMassHiggs > 139.0 ) + gamma = 0.008196; + + SetGammaHiggs(gamma); +} + + + + + + + + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussBase.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9bb6364e3c79642e8b7d43d058081e8de4c4b7a7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussBase.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussBase.h" +#include <iostream> + +#include <cmath> + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussBase::ResDoubleGaussBase(const char * filename) : KLFitter::ResolutionBase(10) +{ + // read parameters from file + ReadParameters(filename, 10); +} + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussBase::ResDoubleGaussBase(std::vector<double> const& parameters) : KLFitter::ResolutionBase(parameters) +{ + // check number of parameters + if (parameters.size() != 10) + { + std::cout << "KLFitter::ResDoubleGaussBase::ResDoubleGaussBase(). Number of parameters != 10." << std::endl; + return; + } +} + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussBase::~ResDoubleGaussBase() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussBase::GetSigma(double xmeas){ + /* Calculate mean width of both gaussians; weight the width of the 2nd one with its amplitude */ + double sigma1 = GetSigma1(xmeas); + double sigma2 = GetSigma2(xmeas); + double amplitude2 = GetAmplitude2(xmeas); + double sigma = (sigma1 + amplitude2*sigma2) / (1+amplitude2); + + /* sigma estimates the fractional resolution, but we want absolute */ + return sigma*xmeas; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussBase::p(double x, double xmeas, bool &good) +{ + double m1 = GetMean1(x); + double s1 = GetSigma1(x); + double a2 = GetAmplitude2(x); + double m2 = GetMean2(x); + double s2 = GetSigma2(x); + + // sanity checks for p2, p3 and p5 + good = CheckDoubleGaussianSanity(s1, a2, s2); + + double dx = (x - xmeas) / x; + + // calculate double-Gaussian + return 1./sqrt(2.*M_PI) / (s1 + a2 * s2) * ( exp( -(dx-m1)*(dx-m1)/(2 * s1*s1) ) + a2 * exp( -(dx-m2)*(dx-m2)/(2 * s2 * s2) ) ); +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_1.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..29171e7cd3dd1f0b0924fde708c6b7c02971df90 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_1.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussE_1.h" +#include <iostream> + +#include <cmath> + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_1::ResDoubleGaussE_1(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_1::ResDoubleGaussE_1(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_1::~ResDoubleGaussE_1() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_1::GetMean1(double x){ + return fParameters[0] + fParameters[1] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_1::GetSigma1(double x){ + return fParameters[2] / sqrt(x) + fParameters[3]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_1::GetAmplitude2(double x){ + return fParameters[4] + fParameters[5] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_1::GetMean2(double x){ + return fParameters[6] + fParameters[7] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_1::GetSigma2(double x){ + return fParameters[8] + fParameters[9] * x; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_2.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c8a3f1f55e14e38a8b5e426a4faf632072f079ee --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_2.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussE_2.h" +#include <iostream> + +#include <cmath> + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_2::ResDoubleGaussE_2(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_2::ResDoubleGaussE_2(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_2::~ResDoubleGaussE_2() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_2::GetMean1(double x){ + return fParameters[0] / sqrt(x) + fParameters[1] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_2::GetSigma1(double x){ + return fParameters[2] / sqrt(x) + fParameters[3]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_2::GetAmplitude2(double x){ + return fParameters[4] / sqrt(x) + fParameters[5] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_2::GetMean2(double x){ + return fParameters[6] + fParameters[7] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_2::GetSigma2(double x){ + return fParameters[8] + fParameters[9] * x; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_3.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_3.cxx new file mode 100644 index 0000000000000000000000000000000000000000..52ae4e702b05831045ccca04edbe67343f7562c2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_3.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussE_3.h" +#include <iostream> + +#include <cmath> + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_3::ResDoubleGaussE_3(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_3::ResDoubleGaussE_3(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_3::~ResDoubleGaussE_3() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_3::GetMean1(double x){ + return fParameters[0] / x + fParameters[1]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_3::GetSigma1(double x){ + return sqrt( fParameters[2]*fParameters[2] / x + fParameters[3]*fParameters[3] ); +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_3::GetAmplitude2(double x){ + return fParameters[4] + fParameters[5] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_3::GetMean2(double x){ + return fParameters[6] / x + fParameters[7]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_3::GetSigma2(double x){ + return fParameters[8]/ x + fParameters[9]; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_4.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..357b48a22f55e48b680d77f07413ad9ec82d918f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_4.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussE_4.h" +#include <iostream> + +#include <cmath> +//used for lJets/bjets in mc12 +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_4::ResDoubleGaussE_4(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_4::ResDoubleGaussE_4(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_4::~ResDoubleGaussE_4() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_4::GetMean1(double x){ + return fParameters[0] + fParameters[1] / x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_4::GetSigma1(double x){ + return fParameters[2] + fParameters[3] / sqrt(x); +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_4::GetAmplitude2(double x){ + return fParameters[4] + fParameters[5] / x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_4::GetMean2(double x){ + return fParameters[6] + fParameters[7] / sqrt(x); +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_4::GetSigma2(double x){ + return fParameters[8] + fParameters[9] * x; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_5.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_5.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aac59245a5e4710d067b59dc07172ef66578e6f9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussE_5.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussE_5.h" +#include <iostream> + +#include <cmath> +//used for electrons in mc12 +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_5::ResDoubleGaussE_5(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_5::ResDoubleGaussE_5(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussE_5::~ResDoubleGaussE_5() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_5::GetMean1(double x){ + return fParameters[0] + fParameters[1] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_5::GetSigma1(double x){ + return fParameters[2] + fParameters[3]/sqrt(x); +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_5::GetAmplitude2(double x){ + return fParameters[4] + fParameters[5] * x; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_5::GetMean2(double x){ + return fParameters[6] + fParameters[7]/sqrt(x); +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussE_5::GetSigma2(double x){ + return fParameters[8] + fParameters[9] * x; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussPt.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussPt.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8ff9547922bdaceb684fd1f44e07546c971f36de --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResDoubleGaussPt.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResDoubleGaussPt.h" +#include <iostream> +#include <cmath> + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussPt::ResDoubleGaussPt(const char * filename) : KLFitter::ResDoubleGaussBase(filename) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussPt::ResDoubleGaussPt(std::vector<double> const& parameters) : KLFitter::ResDoubleGaussBase(parameters) +{ } + +// --------------------------------------------------------- +KLFitter::ResDoubleGaussPt::~ResDoubleGaussPt() +{ + ; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussPt::GetMean1(double x){ + return fParameters[0] + x * fParameters[1]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussPt::GetSigma1(double x){ + return fParameters[2] + x * fParameters[3]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussPt::GetAmplitude2(double x){ + return fParameters[4] + x * fParameters[5]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussPt::GetMean2(double x){ + return fParameters[6] + x * fParameters[7]; +} + +// --------------------------------------------------------- +double KLFitter::ResDoubleGaussPt::GetSigma2(double x){ + return fParameters[8] + x * fParameters[9]; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3f158e8c12b8284ae5c9ba2a2bf65e5be7a4779b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResGauss.h" +#include <TMath.h> +#include <iostream> + +// --------------------------------------------------------- +KLFitter::ResGauss::ResGauss(const char * filename) : KLFitter::ResolutionBase(1) +{ + // read parameters from file + ReadParameters(filename, 1); +} + +// --------------------------------------------------------- +KLFitter::ResGauss::ResGauss(double sigma) : KLFitter::ResolutionBase(1) +{ + // set parameter + SetPar(0, sigma); +} + +// --------------------------------------------------------- +KLFitter::ResGauss::~ResGauss() +{ + +} + +// --------------------------------------------------------- +double KLFitter::ResGauss::GetSigma(double /*dummy*/){ + return fParameters[0]; +} + +// --------------------------------------------------------- +double KLFitter::ResGauss::p(double x, double xmeas, bool &good) +{ + good = true; + return TMath::Gaus(xmeas, x, fParameters[0], true); +} + +// --------------------------------------------------------- + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss_MET.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss_MET.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7dd5cdd3920c3b72085eaf90f7aafafbbdd7f615 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResGauss_MET.cxx @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResGauss_MET.h" +#include <TMath.h> +#include <iostream> + +// --------------------------------------------------------- +KLFitter::ResGauss_MET::ResGauss_MET(const char * filename) : KLFitter::ResolutionBase(4) +{ + // read parameters from file + ReadParameters(filename, 4); +} + +// --------------------------------------------------------- +KLFitter::ResGauss_MET::ResGauss_MET(std::vector<double> const& parameters) :KLFitter::ResolutionBase(parameters) +{ + // check number of parameters + if (parameters.size() != 4) + { + std::cout << "KLFitter::ResGauss_MET::ResGauss_MET(). Number of parameters != 4." << std::endl; + return; + } +} + +// --------------------------------------------------------- +KLFitter::ResGauss_MET::~ResGauss_MET() +{ + +} + +// --------------------------------------------------------- +double KLFitter::ResGauss_MET::GetSigma(double sumet){ + return fParameters[0]+fParameters[1]/(1+exp(-fParameters[2]*(sumet-fParameters[3]))); +} + +// --------------------------------------------------------- +double KLFitter::ResGauss_MET::p(double x, double xmeas, bool &good, double sumet) +{ + good = true; + // calculate MET TF with 4 parameters (MC10b or later) + double sigma = GetSigma(sumet); + return TMath::Gaus(xmeas, x, sigma, true); +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/Root/ResolutionBase.cxx b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResolutionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2f4e6ddf6e969ae961cf32730c1a1921f7a292a8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/Root/ResolutionBase.cxx @@ -0,0 +1,130 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "KLFitter/ResolutionBase.h" +#include <iostream> +#include <fstream> + +// --------------------------------------------------------- +KLFitter::ResolutionBase::ResolutionBase(int npar) +{ + if (npar < 0) + npar = 0; + + fNParameters = npar; + + fParameters.clear(); + fParameters.assign(npar, 0); +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase::ResolutionBase(std::vector <double> parameters) +{ + fNParameters = int(parameters.size()); + + // clear parameters + fParameters.clear(); + + // copy values + for (int i = 0; i < fNParameters; ++i) + fParameters.push_back(parameters[i]); +} + +// --------------------------------------------------------- +KLFitter::ResolutionBase::~ResolutionBase() +{ + fParameters.clear(); +} + +// --------------------------------------------------------- +int KLFitter::ResolutionBase::Par(int index, double &par) +{ + // check parameter range + if (index < 0 || index >= fNParameters) + { + std::cout << "KLFitter:ResolutionBase::Par(). Index out of range." << std::endl; + // error + return 0; + } + + par = fParameters[index]; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::ResolutionBase::SetPar(int index, double value) +{ + // check parameter range + if (index < 0 || index >= fNParameters) + { + std::cout << "KLFitter:ResolutionBase::SetPar(). Index out of range." << std::endl; + // error + return 1; + } + + fParameters[index] = value; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::ResolutionBase::SetPar(std::vector <double> parameters) +{ + // check vector size + int npar = parameters.size(); + + if (npar != fNParameters) + { + std::cout << "KLFitter:ResolutionBase::SetPar(). Number of parameters is inconsistent." << std::endl; + + // return error code + return 1; + } + + // set parameters + for (int i = 0; i < fNParameters; ++i) + fParameters[i] = parameters[i]; + + // no error + return 1; +} + +// --------------------------------------------------------- +int KLFitter::ResolutionBase::ReadParameters(const char * filename, int nparameters) +{ + // define input file + std::ifstream inputfile; + + // open file + inputfile.open(filename); + + // check if file is open + if (!inputfile.is_open()) + { + std::cout << "KLFitter::ResolutionBase::ReadParameters(). File \"" << filename << "\" not found." << std::endl; + return 0; + } + + // reset parameters + fParameters.clear(); + + // read parameters + for (int i = 0; i < nparameters; ++i) + { + double par = 0.0; + inputfile >> par; + fParameters.push_back(par); + } + + // close file + inputfile.close(); + + // no error + return 1; +} + +// --------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/KLFitter/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..c036970fb1d3fd1a763c1fca80db2f0755ac4335 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/cmt/Makefile.RootCore @@ -0,0 +1,22 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + +PACKAGE = KLFitter +PACKAGE_PRELOAD = BAT +PACKAGE_CXXFLAGS = +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = Asg_BAT +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/KLFitter/cmt/SymLinkHeaders b/PhysicsAnalysis/TopPhys/KLFitter/cmt/SymLinkHeaders new file mode 100755 index 0000000000000000000000000000000000000000..d33d711a90713f77c14110befab3f25bbc462ebe --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/cmt/SymLinkHeaders @@ -0,0 +1,49 @@ +#!/bin/bash + +################################################################ +# Goal : Copy header files from library/include to KLFitter +# Syntax: SymLinkHeaders $KLFITTERROOT/library/include KLFitter +# Author: <Venkat.Kaushik@cern.ch> +# Date : 2011 Apr. 20 +################################################################# + +E_NOARGS=85 +declare -a args + +## need exactly two arguments (source and destination) +if [ "$#" -ne 2 ]; then + echo "#CMT---> Error: `basename $0`: Nothing copied. Wrong number of arguments." + exit $E_NOARGS; +fi + +## store args in array +for comp in $@; do + args=( ${args[@]-} $(echo "$comp") ) +done + +## assign source and destination dirs +srcdir=${args[0]} +destdir=${args[1]} +reldir=../ +relpath=$reldir/$destdir + + +## prepare links to directory with header files +if [ ! -d $relpath ]; then + echo "#CMT---> Info: $destdir does not exist. Creating it." + ln -f -s $srcdir $relpath +else + echo "#CMT---> Info: $relpath already exists. Cleaning up." + rm -f $relpath + ln -f -s $srcdir $relpath +fi + +## create a readme with timestamp +readme=$reldir/README.`basename $destdir` +if [ -f $readme ]; then + rm -f $readme +fi +echo -e "$srcdir is linked as ${destdir}\nCreated on `date`" > $readme +echo "#CMT---> Info: Done with document `basename $0`" + +########################################################################## diff --git a/PhysicsAnalysis/TopPhys/KLFitter/cmt/requirements b/PhysicsAnalysis/TopPhys/KLFitter/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..925871178c582f2605605673ea561bcea39cc697 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/cmt/requirements @@ -0,0 +1,98 @@ +package KLFitter + +## authors of KLFitter +author K. Kroeninger <Kevin.Alexander.Kroeninger@cern.ch> +author J. Erdmann <johannes.erdmann@cern.ch> +author O. Nackenhorst <olaf.nackenhorst@cern.ch> + +## author of cmt-based compilation +author V. Kaushik <venkat.kaushik@cern.ch> + +############################################################## + +private +apply_tag ROOTBasicLibs +apply_tag ROOTMathLibs +apply_tag ROOTSTLDictLibs +apply_tag ROOTGraphicsLibs +apply_tag ROOTTableLibs +end_private + +public +use AtlasPolicy AtlasPolicy-* +use AtlasROOT AtlasROOT-* External +use BAT BAT-* External + + +############################################################### +# library: libKLFitter +############################################################### + + +# Rules to use KLFitter library +macro KLFitter_dir "$(KLFITTERROOT)/library" +macro KLFitter_include_dir "$(KLFitter_dir)/include" + +include_path none +include_dirs "$(KLFitter_include_dir)" + + +library KLFitter "$(KLFitter_dir)/src/*.cxx" +macro_append KLFitter_dependencies " SymLink_KLinc " + +action SymLink_KLinc "./SymLinkHeaders $(KLFITTERROOT)/library/include KLFitter" +apply_pattern install_non_standard_includes name=KLFitter + +## copy action depends on install_*_includes +## files need to be linked before installing them +macro_prepend install_KLFitter_includes_dependencies " SymLink_KLinc " + + +macro KLFitter_shlibflags "$($(ROOTSYS)/bin/root-config --libs)" +macro_append KLFitter_shlibflags " -lBAT" +macro_append KLFitter_shlibflags " -L$(ROOTSYS)/lib -lTreePlayer -lMinuit -lMinuit2 -lPhysics" + + +############################################################### +# library: libKLFitterExtras +############################################################## + + +macro KLFitterExtras_dir "$(KLFITTERROOT)/extras" +macro KLFitterExtras_include_dir "$(KLFitterExtras_dir)/include" + +include_path none +include_dirs "$(KLFitterExtras_include_dir)" + +library KLFitterExtras "$(KLFitterExtras_dir)/src/*.cxx" +macro_append KLFitterExtras_dependencies " SymLink_KLExtrasInc " + +action SymLink_KLExtrasInc "./SymLinkHeaders $(KLFITTERROOT)/extras/include KLFitterExtras" +apply_pattern install_non_standard_includes name=KLFitterExtras + +macro_prepend install_KLFitterExtras_includes_dependencies " SymLink_KLExtrasInc " + +## remove virtual function hidden by another warning +macro_remove cppflags "-Woverloaded-virtual" + +macro KLFitterExtras_shlibflags $(KLFitter_shlibflags) + +############################################################### +# application: runKLFitter.exe +############################################################### + +application runKLFitter -no_prototypes "../examples/top_ljets/runKLFitter.cxx" + + +macro runKLFitterlinkopts "$($(ROOTSYS)/bin/root-config --libs) \ + -lm $(KLFitter_shlibflags) \ + -lKLFitter -lKLFitterExtras " + + + +############################################################### +# runtime extras +############################################################### +apply_pattern declare_runtime extras="../transferfunctions* ../examples/top_ljets/config.conf" + + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Electrons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Electrons.txt new file mode 100644 index 0000000000000000000000000000000000000000..79ee5eb664ec4a4df51dffa27cfc000d6d2c2332 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Electrons.txt @@ -0,0 +1,76 @@ +Electron transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b +last change: 07.06.2011 - Boris Lemmer + + +The transfer function for electrons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": 0.003437; +(1) Parameter "mean1_1": -2.57e-06; +(2) Parameter "width1_0": 0.04163; +(3) Parameter "width1_1": 0.01234; +(4) Parameter "scale_0": 0.06143; +(5) Parameter "scale_1": -7.19e-05; +(6) Parameter "mean2_0": 0.03288; +(7) Parameter "mean2_1": 9.926e-05; +(8) Parameter "width2_0": 0.03797; +(9) Parameter "width2_1": 0.0002145; + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": 0.008416; +(1) Parameter "mean1_1": -2.99e-05; +(2) Parameter "width1_0": 0.1977; +(3) Parameter "width1_1": 0.002103; +(4) Parameter "scale_0": 0.1217; +(5) Parameter "scale_1": -0.0004727; +(6) Parameter "mean2_0": 0.06286; +(7) Parameter "mean2_1": -0.000186; +(8) Parameter "width2_0": 0.05435; +(9) Parameter "width2_1": -2.652e-05; + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": --- +(1) Parameter "mean1_1": --- +(2) Parameter "width1_0": --- +(3) Parameter "width1_1": --- +(4) Parameter "scale_0": --- +(5) Parameter "scale_1": --- +(6) Parameter "mean2_0": --- +(7) Parameter "mean2_1": --- +(8) Parameter "width2_0": --- +(9) Parameter "width2_1": --- + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": 0.001174; +(1) Parameter "mean1_1": 1.8e-05; +(2) Parameter "width1_0": 0.1097; +(3) Parameter "width1_1": 0.01119; +(4) Parameter "scale_0": 0.353; +(5) Parameter "scale_1": -0.001028; +(6) Parameter "mean2_0": 0.06561; +(7) Parameter "mean2_1": -0.0001462; +(8) Parameter "width2_0": 0.06711; +(9) Parameter "width2_1": -1.035e-05; diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Muons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Muons.txt new file mode 100644 index 0000000000000000000000000000000000000000..a701889d28d0eb68ff79fe1ce8f2d8397a29a59c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/Muons.txt @@ -0,0 +1,64 @@ +Muon transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 +Version: 4.5 - 7 TeV, R16v2, new bin + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b +last change: 07.06.2011 - Boris Lemmer + + +The transfer function for muons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (p_T_truth - p_T_measured) / p_T_truth + +The parameters pi themselves depend on p_T_truth: + +p_1 = mean1_0 + mean1_1 p_T_truth +p_2 = width1_0 + width1_1 p_T_truth +p_3 = scale_0 + scale_1 p_T_truth +p_4 = mean2_0 + mean2_1 p_T_truth +p_5 = width2_0 + width2_1 p_T_truth + +The values are: + +0.00 < |eta| < 1.11: +(0) Parameter "mean1_0": -0.0002594; +(1) Parameter "mean1_1": 2.688e-05; +(2) Parameter "width1_0": 0.0162; +(3) Parameter "width1_1": 0.0001879; +(4) Parameter "scale_0": 0.01778; +(5) Parameter "scale_1": 0.000621; +(6) Parameter "mean2_0": 0.043; +(7) Parameter "mean2_1": -0.000288; +(8) Parameter "width2_0": 0.06278; +(9) Parameter "width2_1": 0.0002101; + +1.11 < |eta| < 1.25: +(0) Parameter "mean1_0": 0.0007124; +(1) Parameter "mean1_1": 2.876e-05; +(2) Parameter "width1_0": 0.01879; +(3) Parameter "width1_1": 0.0003442; +(4) Parameter "scale_0": 0.006506; +(5) Parameter "scale_1": 0.0003425; +(6) Parameter "mean2_0": 0.1846; +(7) Parameter "mean2_1": -0.002187; +(8) Parameter "width2_0": 0.1323; +(9) Parameter "width2_1": -0.0003159; + +1.25 < |eta| < 2.50: +(0) Parameter "mean1_0": -0.00245; +(1) Parameter "mean1_1": 6.758e-05; +(2) Parameter "width1_0": 0.02702; +(3) Parameter "width1_1": 0.0002335; +(4) Parameter "scale_0": 0.01639; +(5) Parameter "scale_1": 0.000606; +(6) Parameter "mean2_0": 0.05327; +(7) Parameter "mean2_1": -0.0004296; +(8) Parameter "width2_0": 0.07049; +(9) Parameter "width2_1": 0.0004137; diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/bJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/bJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..c09d030658eba709f4904859dfc3e895c33ddee6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/bJets.txt @@ -0,0 +1,89 @@ +B-jet transfer function +====================== + +// Version: 2.0 - major change in the parametrization functions !! +// Version: 3.0 - 7 TeV + Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b +last change: 07.06.2011 - Boris Lemmer + + +The transfer function for b-jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 / sqrt(E_truth) + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 / sqrt(E_truth) + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": 0.1423; +(1) Parameter "mean1_1": -4.497e-05; +(2) Parameter "width1_0": 0.8136; +(3) Parameter "width1_1": 0.03518; +(4) Parameter "scale_0": 4.339; +(5) Parameter "scale_1": 0.0003675; +(6) Parameter "mean2_0": 0.08763; +(7) Parameter "mean2_1": 0.0001819; +(8) Parameter "width2_0": 0.2787; +(9) Parameter "width2_1": -0.000177; + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": 0.0826; +(1) Parameter "mean1_1": -3.971e-05; +(2) Parameter "width1_0": 1.005; +(3) Parameter "width1_1": 0.02346; +(4) Parameter "scale_0": 8.023; +(5) Parameter "scale_1": -0.0007728; +(6) Parameter "mean2_0": 0.07406; +(7) Parameter "mean2_1": 0.0002357; +(8) Parameter "width2_0": 0.2583; +(9) Parameter "width2_1": -7.056e-05; + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": 0.2605; +(1) Parameter "mean1_1": -2.845e-05; +(2) Parameter "width1_0": 1.741; +(3) Parameter "width1_1": -0.01989; +(4) Parameter "scale_0": 7.689; +(5) Parameter "scale_1": -0.000375; +(6) Parameter "mean2_0": 0.05431; +(7) Parameter "mean2_1": 0.000272; +(8) Parameter "width2_0": 0.3005; +(9) Parameter "width2_1": -0.0002533; + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": 0.3645; +(1) Parameter "mean1_1": -3.299e-05; +(2) Parameter "width1_0": 1.011; +(3) Parameter "width1_1": 0.03746; +(4) Parameter "scale_0": 12.56; +(5) Parameter "scale_1": -0.0009417; +(6) Parameter "mean2_0": 0.04766; +(7) Parameter "mean2_1": 0.0003851; +(8) Parameter "width2_0": 0.254; +(9) Parameter "width2_1": -5.504e-05; + +2.50 < |eta| < 4.50: +(0) Parameter "mean1_0": 1.023; +(1) Parameter "mean1_1": 0.0001404; +(2) Parameter "width1_0": -1.708; +(3) Parameter "width1_1": 0.2785; +(4) Parameter "scale_0": 5.302; +(5) Parameter "scale_1": -0.0006653; +(6) Parameter "mean2_0": -0.5094; +(7) Parameter "mean2_1": 0.002147; +(8) Parameter "width2_0": 0.1269; +(9) Parameter "width2_1": 0.0007677; diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/lJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/lJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5c31db835765019c449cd7f71f36ab78cf22525 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/lJets.txt @@ -0,0 +1,88 @@ +Light jet transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b +last change: 07.06.2011 - Boris Lemmer + + +The transfer function for light jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": -0.0455; +(1) Parameter "mean1_1": 0.0001013; +(2) Parameter "width1_0": 1.119; +(3) Parameter "width1_1": 0.02524; +(4) Parameter "scale_0": 0.136; +(5) Parameter "scale_1": 4.685e-05; +(6) Parameter "mean2_0": 0.01998; +(7) Parameter "mean2_1": 5.32e-05; +(8) Parameter "width2_0": 0.3336; +(9) Parameter "width2_1": -0.0003165; + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": -0.04762; +(1) Parameter "mean1_1": 5.546e-05; +(2) Parameter "width1_0": 1.407; +(3) Parameter "width1_1": 0.006649; +(4) Parameter "scale_0": 0.2722; +(5) Parameter "scale_1": -0.0007768; +(6) Parameter "mean2_0": -0.1261; +(7) Parameter "mean2_1": 0.001057; +(8) Parameter "width2_0": 0.3385; +(9) Parameter "width2_1": -0.0004225; + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": -0.03978; +(1) Parameter "mean1_1": 9.214e-05; +(2) Parameter "width1_0": 1.471; +(3) Parameter "width1_1": 0.02057; +(4) Parameter "scale_0": 0.2855; +(5) Parameter "scale_1": -0.0008845; +(6) Parameter "mean2_0": -0.1804; +(7) Parameter "mean2_1": 0.00121; +(8) Parameter "width2_0": 0.3431; +(9) Parameter "width2_1": -0.0001929; + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": -0.04836; +(1) Parameter "mean1_1": 0.0001138; +(2) Parameter "width1_0": 1.327; +(3) Parameter "width1_1": 0.02581; +(4) Parameter "scale_0": 0.6945; +(5) Parameter "scale_1": -0.001618; +(6) Parameter "mean2_0": -0.1233; +(7) Parameter "mean2_1": 0.0007504; +(8) Parameter "width2_0": 0.2723; +(9) Parameter "width2_1": -0.0001365; + +2.50 < |eta| < 4.50: +(0) Parameter "mean1_0": -0.3679; +(1) Parameter "mean1_1": 0.001244; +(2) Parameter "width1_0": -2.756; +(3) Parameter "width1_1": 0.4537; +(4) Parameter "scale_0": -3.16; +(5) Parameter "scale_1": 0.03075; +(6) Parameter "mean2_0": 0.01696; +(7) Parameter "mean2_1": 4.189e-05; +(8) Parameter "width2_0": 0.1536; +(9) Parameter "width2_1": 1.871e-05; diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fd0f3de24c22e3654ff9be05a78cb154f63e2cb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta1.txt @@ -0,0 +1,10 @@ +0.003437 +-2.57e-06 +0.04163 +0.01234 +0.06143 +-7.19e-05 +0.03288 +9.926e-05 +0.03797 +0.0002145 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..039de3b0f93177760c0590e023b85d380d29909e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta2.txt @@ -0,0 +1,10 @@ +0.008416 +-2.99e-05 +0.1977 +0.002103 +0.1217 +-0.0004727 +0.06286 +-0.000186 +0.05435 +-2.652e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed064381149ec7cb39a27a52425d2223873936bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta3.txt @@ -0,0 +1,10 @@ +--- +--- +--- +--- +--- +--- +--- +--- +--- +--- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ba45ef1a1b7bdd43c0055f77a24bd26fdf2eff7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Electrons_eta4.txt @@ -0,0 +1,10 @@ +0.001174 +1.8e-05 +0.1097 +0.01119 +0.353 +-0.001028 +0.06561 +-0.0001462 +0.06711 +-1.035e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eed40442028a15379fbccf3b6d1b038d3a4324e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta1.txt @@ -0,0 +1,10 @@ +-0.0002594 +2.688e-05 +0.0162 +0.0001879 +0.01778 +0.000621 +0.043 +-0.000288 +0.06278 +0.0002101 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f11947bdfb92a133afaa812d2cc6e94616b88c9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta2.txt @@ -0,0 +1,10 @@ +0.0007124 +2.876e-05 +0.01879 +0.0003442 +0.006506 +0.0003425 +0.1846 +-0.002187 +0.1323 +-0.0003159 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..41a83ef77e898ec207affe1b37db1684a7e5be58 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_Muons_eta3.txt @@ -0,0 +1,10 @@ +-0.00245 +6.758e-05 +0.02702 +0.0002335 +0.01639 +0.000606 +0.05327 +-0.0004296 +0.07049 +0.0004137 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f8a8daeecf531a3dcc8b58e57eeb8e9701d7fd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta1.txt @@ -0,0 +1,10 @@ +0.1423 +-4.497e-05 +0.8136 +0.03518 +4.339 +0.0003675 +0.08763 +0.0001819 +0.2787 +-0.000177 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc33dcc084d3f7c842a5638c9cd02963167d0c47 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta2.txt @@ -0,0 +1,10 @@ +0.0826 +-3.971e-05 +1.005 +0.02346 +8.023 +-0.0007728 +0.07406 +0.0002357 +0.2583 +-7.056e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8373ab028e7c2ab45f38f4f982a0baa342d765df --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta3.txt @@ -0,0 +1,10 @@ +0.2605 +-2.845e-05 +1.741 +-0.01989 +7.689 +-0.000375 +0.05431 +0.000272 +0.3005 +-0.0002533 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3335efd241d7ec9bf163367424eab9e5e8eac60b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta4.txt @@ -0,0 +1,10 @@ +0.3645 +-3.299e-05 +1.011 +0.03746 +12.56 +-0.0009417 +0.04766 +0.0003851 +0.254 +-5.504e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca65c29b11eb225ba79f2bb4249b30a1b57633c9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_bJets_eta5.txt @@ -0,0 +1,10 @@ +1.023 +0.0001404 +-1.708 +0.2785 +5.302 +-0.0006653 +-0.5094 +0.002147 +0.1269 +0.0007677 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a65afbb2486752ea7a801c09f32648036e709e5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta1.txt @@ -0,0 +1,10 @@ +5.70888 +-0.0177622 +0.9171 +1.03688e-09 +0.108145 +8.71829e-14 +13.9756 +-0.0492207 +10.2439 +0.168606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d2a20e3bc75df753726d65ca031e0f695b60bea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta2.txt @@ -0,0 +1,10 @@ +10.5363 +0.0384147 +0.0110815 +0.260603 +0.612646 +0.0400015 +6.99759 +-0.00286044 +6.2565 +0.0573606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta3.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_gluon_eta4.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead084840644c7cc9b40016efcd80ce841551b62 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta1.txt @@ -0,0 +1,10 @@ +-0.0455 +0.0001013 +1.119 +0.02524 +0.136 +4.685e-05 +0.01998 +5.32e-05 +0.3336 +-0.0003165 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83d19917f4cc316177560ad7757c789dea990fab --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta2.txt @@ -0,0 +1,10 @@ +-0.04762 +5.546e-05 +1.407 +0.006649 +0.2722 +-0.0007768 +-0.1261 +0.001057 +0.3385 +-0.0004225 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..20431984d9f3ea984282e4b3d26f30409e4c5def --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta3.txt @@ -0,0 +1,10 @@ +-0.03978 +9.214e-05 +1.471 +0.02057 +0.2855 +-0.0008845 +-0.1804 +0.00121 +0.3431 +-0.0001929 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c15817dacff144584206291bc182144cd4ac189 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta4.txt @@ -0,0 +1,10 @@ +-0.04836 +0.0001138 +1.327 +0.02581 +0.6945 +-0.001618 +-0.1233 +0.0007504 +0.2723 +-0.0001365 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4298ca6e048a64280281287fc308b7600b627642 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_lJets_eta5.txt @@ -0,0 +1,10 @@ +-0.3679 +0.001244 +-2.756 +0.4537 +-3.16 +0.03075 +0.01696 +4.189e-05 +0.1536 +1.871e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145b0118f6d758fc512bfa153dcb1dd558c17650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta1.txt @@ -0,0 +1,10 @@ +0.0638905 +0.00099101 +0.122283 +0.00811736 +0.0809538 +3.99525e-13 +1.73586 +-0.00913178 +1.09186 +0.0374252 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfd4116b6aa7ebaf762a0e7375e7cd6b697b630 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta2.txt @@ -0,0 +1,10 @@ +0.492762 +-0.00325367 +0.247994 +0.0061249 +0.156081 +1.68648e-13 +2.82227 +0.00166837 +1.91903 +0.0473027 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta3.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_energy_photon_eta4.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..434d7c00ec2b64323cce56a3b2d52dc69f0e7a0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta1.txt @@ -0,0 +1 @@ +0.0366589 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf026df413130768796e7086820d634ca540e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta2.txt @@ -0,0 +1 @@ +0.0293887 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta3.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_bJets_eta4.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d7aa43ad2daf1d200e318d8a3840a4b4362e40 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta1.txt @@ -0,0 +1 @@ +0.0367427 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb29efef8c3929addae6e472f3486165dac8290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta2.txt @@ -0,0 +1 @@ +0.029579 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta3.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_eta_lJets_eta4.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_misset.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_misset.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d64a3f7075e1930770c85804b02ec03af24e98 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_misset.txt @@ -0,0 +1,4 @@ +19.562 +8.766 +0.00774 +630.444 \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8294cde858b664e6f5be7f5e1886942410f4a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta1.txt @@ -0,0 +1 @@ +0.0238451 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3708013ef1bd0e1a550081c7ad4037a4c6f31af4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta2.txt @@ -0,0 +1 @@ +0.0241915 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta3.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_bJets_eta4.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b55ab113d5b904407564acd518570aa88ef9f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta1.txt @@ -0,0 +1 @@ +0.0244004 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8d853c79be538e2c2148c052c66fb166491db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta2.txt @@ -0,0 +1 @@ +0.02426 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta3.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/par_phi_lJets_eta4.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/summary.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..294cb94ff6584a1c7565b4ad2c325b5be9278e59 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc10b/summary.txt @@ -0,0 +1,5 @@ + What changed in MC10b? +-Nominal sample with 50% more stats than MC10a. +-Added mTop170 and mTop180 samples -> gained 20% stats +-used muon smearing-> muons broader +-crack regions more stable \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Electrons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Electrons.txt new file mode 100644 index 0000000000000000000000000000000000000000..18524e194fab895c746c1b9d25f0c44272c8211d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Electrons.txt @@ -0,0 +1,77 @@ +Electron transfer function +====================== + +Version: 2.0 - 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b +last change: 15.01.2012 - Boris Lemmer + + +The transfer function for electrons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": 0.00488 +(1) Parameter "mean1_1": -1.315e-05 +(2) Parameter "width1_0": 0.04694 +(3) Parameter "width1_1": 0.01371 +(4) Parameter "scale_0": 0.01408 +(5) Parameter "scale_1": 0.0001271 +(6) Parameter "mean2_0": 0.0678 +(7) Parameter "mean2_1": -0.0001817 +(8) Parameter "width2_0": 0.06609 +(9) Parameter "width2_1": 3.291e-06 + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": 0.00497 +(1) Parameter "mean1_1": -2.419e-05 +(2) Parameter "width1_0": 0.1833 +(3) Parameter "width1_1": 0.005427 +(4) Parameter "scale_0": 0.04598 +(5) Parameter "scale_1": -0.0001284 +(6) Parameter "mean2_0": 0.1002 +(7) Parameter "mean2_1": -0.0002361 +(8) Parameter "width2_0": 0.07695 +(9) Parameter "width2_1": -0.0001173 + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": --- +(1) Parameter "mean1_1": --- +(2) Parameter "width1_0": --- +(3) Parameter "width1_1": --- +(4) Parameter "scale_0": --- +(5) Parameter "scale_1": --- +(6) Parameter "mean2_0": --- +(7) Parameter "mean2_1": --- +(8) Parameter "width2_0": --- +(9) Parameter "width2_1": --- + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": 0.004781 +(1) Parameter "mean1_1": 1.639e-07 +(2) Parameter "width1_0": 0.2502 +(3) Parameter "width1_1": 0.009483 +(4) Parameter "scale_0": 0.1829 +(5) Parameter "scale_1": -0.0004574 +(6) Parameter "mean2_0": 0.1111 +(7) Parameter "mean2_1": -0.0003 +(8) Parameter "width2_0": 0.105 +(9) Parameter "width2_1": -7.151e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Muons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Muons.txt new file mode 100644 index 0000000000000000000000000000000000000000..16ba25c9f5ea7fb05044132a55772d47d0fd654e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/Muons.txt @@ -0,0 +1,64 @@ +Muon transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 +Version: 4.5 - 7 TeV, R16v2, new bin + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b +last change: 15.01.2012 - Boris Lemmer + +The transfer function for muons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (p_T_truth - p_T_measured) / p_T_truth + +The parameters pi themselves depend on p_T_truth: + +p_1 = mean1_0 + mean1_1 p_T_truth +p_2 = width1_0 + width1_1 p_T_truth +p_3 = scale_0 + scale_1 p_T_truth +p_4 = mean2_0 + mean2_1 p_T_truth +p_5 = width2_0 + width2_1 p_T_truth + +The values are: + +0.00 < |eta| < 1.11: +(0) Parameter "mean1_0": 0.001063 +(1) Parameter "mean1_1": 4.352e-06 +(2) Parameter "width1_0": 0.01762 +(3) Parameter "width1_1": 0.0001293 +(4) Parameter "scale_0": 0.01929 +(5) Parameter "scale_1": 5.011e-05 +(6) Parameter "mean2_0": 0.06668 +(7) Parameter "mean2_1": -0.0006472 +(8) Parameter "width2_0": 0.07347 +(9) Parameter "width2_1": 0.0001793 + +1.11 < |eta| < 1.25: +(0) Parameter "mean1_0": 0.00172 +(1) Parameter "mean1_1": 7.754e-06 +(2) Parameter "width1_0": 0.01932 +(3) Parameter "width1_1": 0.0002313 +(4) Parameter "scale_0": 0.007584 +(5) Parameter "scale_1": 6.794e-05 +(6) Parameter "mean2_0": 0.1559 +(7) Parameter "mean2_1": -0.001808 +(8) Parameter "width2_0": 0.06628 +(9) Parameter "width2_1": 0.001438 + +1.25 < |eta| < 2.50: +(0) Parameter "mean1_0": 0.001947 +(1) Parameter "mean1_1": -1.451e-05 +(2) Parameter "width1_0": 0.02343 +(3) Parameter "width1_1": 0.0002 +(4) Parameter "scale_0": 0.01368 +(5) Parameter "scale_1": 5.776e-05 +(6) Parameter "mean2_0": 0.1149 +(7) Parameter "mean2_1": -0.001434 +(8) Parameter "width2_0": 0.1019 +(9) Parameter "width2_1": 0.0004483 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/bJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/bJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..f197adefc9cfdc3b774bc9411fd7468cb2aafaae --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/bJets.txt @@ -0,0 +1,90 @@ +B-jet transfer function +====================== + +// Version: 2.0 - major change in the parametrization functions !! +// Version: 3.0 - 7 TeV + Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b, new parametrization! +last change: 15.01.2012 - Boris Lemmer + + +The transfer function for b-jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": -0.007493 +(1) Parameter "mean1_1": 5.659e-05 +(2) Parameter "width1_0": 0.6261 +(3) Parameter "width1_1": 0.04685 +(4) Parameter "scale_0": 1.04 +(5) Parameter "scale_1": -0.001719 +(6) Parameter "mean2_0": 0.1358 +(7) Parameter "mean2_1": -1.298e-05 +(8) Parameter "width2_0": 0.2177 +(9) Parameter "width2_1": -2.177e-05 + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": 0.03921 +(1) Parameter "mean1_1": -0.0001368 +(2) Parameter "width1_0": 0.8042 +(3) Parameter "width1_1": 0.04099 +(4) Parameter "scale_0": 0.7681 +(5) Parameter "scale_1": -0.001605 +(6) Parameter "mean2_0": 0.04706 +(7) Parameter "mean2_1": 0.0005555 +(8) Parameter "width2_0": 0.2495 +(9) Parameter "width2_1": -0.0001016 + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": 0.0611 +(1) Parameter "mean1_1": -0.0001108 +(2) Parameter "width1_0": 0.5579 +(3) Parameter "width1_1": 0.06884 +(4) Parameter "scale_0": 1.207 +(5) Parameter "scale_1": -0.002966 +(6) Parameter "mean2_0": -0.0181 +(7) Parameter "mean2_1": 0.0008641 +(8) Parameter "width2_0": 0.2223 +(9) Parameter "width2_1": 4.552e-05 + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": 0.03515 +(1) Parameter "mean1_1": -4.026e-05 +(2) Parameter "width1_0": 1.353 +(3) Parameter "width1_1": 0.01158 +(4) Parameter "scale_0": 0.9683 +(5) Parameter "scale_1": -0.001252 +(6) Parameter "mean2_0": 0.07473 +(7) Parameter "mean2_1": 0.000223 +(8) Parameter "width2_0": 0.2218 +(9) Parameter "width2_1": -3.485e-05 + +2.50 < |eta| < 4.50: +(0) Parameter "mean1_0": -0.01541 +(1) Parameter "mean1_1": 0.0001958 +(2) Parameter "width1_0": 2.63 +(3) Parameter "width1_1": -0.004764 +(4) Parameter "scale_0": -0.2686 +(5) Parameter "scale_1": 0.001606 +(6) Parameter "mean2_0": 0.06686 +(7) Parameter "mean2_1": 0.0001294 +(8) Parameter "width2_0": 0.3242 +(9) Parameter "width2_1": -0.0001992 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/lJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/lJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd55e45a4254add7aacf99c12020e1b21f0af9bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/lJets.txt @@ -0,0 +1,89 @@ +Light jet transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b +last change: 15.01.2012 - Boris Lemmer + + +The transfer function for light jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: +(0) Parameter "mean1_0": -0.03147 +(1) Parameter "mean1_1": 0.0001147 +(2) Parameter "width1_0": 0.9631 +(3) Parameter "width1_1": 0.05161 +(4) Parameter "scale_0": 0.09602 +(5) Parameter "scale_1": -0.0001639 +(6) Parameter "mean2_0": 0.05316 +(7) Parameter "mean2_1": 0.0002674 +(8) Parameter "width2_0": 0.1581 +(9) Parameter "width2_1": 0.001323 + +0.80 < |eta| < 1.37: +(0) Parameter "mean1_0": -0.04391 +(1) Parameter "mean1_1": 0.0001312 +(2) Parameter "width1_0": 1.238 +(3) Parameter "width1_1": 0.0266 +(4) Parameter "scale_0": 0.1374 +(5) Parameter "scale_1": -0.000286 +(6) Parameter "mean2_0": -0.03468 +(7) Parameter "mean2_1": 0.0007615 +(8) Parameter "width2_0": 0.2511 +(9) Parameter "width2_1": 0.0003884 + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": 0.004073 +(1) Parameter "mean1_1": -3.352e-06 +(2) Parameter "width1_0": 0.5872 +(3) Parameter "width1_1": 0.08393 +(4) Parameter "scale_0": 0.5012 +(5) Parameter "scale_1": -0.001412 +(6) Parameter "mean2_0": -0.2264 +(7) Parameter "mean2_1": 0.001786 +(8) Parameter "width2_0": 0.2186 +(9) Parameter "width2_1": 0.0001553 + +1.52 < |eta| < 2.50: +(0) Parameter "mean1_0": -0.03437 +(1) Parameter "mean1_1": 0.0001187 +(2) Parameter "width1_0": 1.32 +(3) Parameter "width1_1": 0.03141 +(4) Parameter "scale_0": 0.2386 +(5) Parameter "scale_1": -0.000345 +(6) Parameter "mean2_0": -0.09605 +(7) Parameter "mean2_1": 0.000715 +(8) Parameter "width2_0": 0.2537 +(9) Parameter "width2_1": -2.252e-05 + +2.50 < |eta| < 4.50: +(0) Parameter "mean1_0": -0.2588 +(1) Parameter "mean1_1": 0.0006825 +(2) Parameter "width1_0": -0.1342 +(3) Parameter "width1_1": 0.2161 +(4) Parameter "scale_0": 0.8635 +(5) Parameter "scale_1": 0.002189 +(6) Parameter "mean2_0": 0.01911 +(7) Parameter "mean2_1": 5.351e-05 +(8) Parameter "width2_0": 0.08233 +(9) Parameter "width2_1": 0.0001076 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03bb39f4eb9bdf49a70b05f9918ed8c67b286dca --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta1.txt @@ -0,0 +1,10 @@ +0.00488 +-1.315e-05 +0.04694 +0.01371 +0.01408 +0.0001271 +0.0678 +-0.0001817 +0.06609 +3.291e-06 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..626cda9c21d6d5528b19e14f7ff05435f49a4cbb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta2.txt @@ -0,0 +1,10 @@ +0.00497 +-2.419e-05 +0.1833 +0.005427 +0.04598 +-0.0001284 +0.1002 +-0.0002361 +0.07695 +-0.0001173 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed064381149ec7cb39a27a52425d2223873936bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta3.txt @@ -0,0 +1,10 @@ +--- +--- +--- +--- +--- +--- +--- +--- +--- +--- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8410852465b986ab2ef7fc7adfdd60b5f7de30b1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Electrons_eta4.txt @@ -0,0 +1,10 @@ +0.004781 +1.639e-07 +0.2502 +0.009483 +0.1829 +-0.0004574 +0.1111 +-0.0003 +0.105 +-7.151e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ec6762e0828c7a0e46532fec944fc8bdba26a58 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta1.txt @@ -0,0 +1,10 @@ +0.001063 +4.352e-06 +0.01762 +0.0001293 +0.01929 +5.011e-05 +0.06668 +-0.0006472 +0.07347 +0.0001793 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1501897a77d1d6e9b8dff70f325d94ab464dd045 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta2.txt @@ -0,0 +1,10 @@ +0.00172 +7.754e-06 +0.01932 +0.0002313 +0.007584 +6.794e-05 +0.1559 +-0.001808 +0.06628 +0.001438 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..375de0c57bd70da9d002900f183906b3bc1e3b1b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_Muons_eta3.txt @@ -0,0 +1,10 @@ +0.001947 +-1.451e-05 +0.02343 +0.0002 +0.01368 +5.776e-05 +0.1149 +-0.001434 +0.1019 +0.0004483 \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50fcdfa07a671a0bcd46db163a24cda48c5ade23 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta1.txt @@ -0,0 +1,10 @@ +-0.007493 +5.659e-05 +0.6261 +0.04685 +1.04 +-0.001719 +0.1358 +-1.298e-05 +0.2177 +-2.177e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31e6d857077482a18a6bdd5d27a67383fc483db0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta2.txt @@ -0,0 +1,10 @@ +0.03921 +-0.0001368 +0.8042 +0.04099 +0.7681 +-0.001605 +0.04706 +0.0005555 +0.2495 +-0.0001016 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e4bb67a72702b6c1c1846a2855ed592724b947 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta3.txt @@ -0,0 +1,10 @@ +0.0611 +-0.0001108 +0.5579 +0.06884 +1.207 +-0.002966 +-0.0181 +0.0008641 +0.2223 +4.552e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ee017fb6933528f3b4e2e5d8ae8451d744acdd8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta4.txt @@ -0,0 +1,10 @@ +0.03515 +-4.026e-05 +1.353 +0.01158 +0.9683 +-0.001252 +0.07473 +0.000223 +0.2218 +-3.485e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcdfece0ff1ea3b709919e1ad1bd6308e1a36122 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_bJets_eta5.txt @@ -0,0 +1,10 @@ +-0.01541 +0.0001958 +2.63 +-0.004764 +-0.2686 +0.001606 +0.06686 +0.0001294 +0.3242 +-0.0001992 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a65afbb2486752ea7a801c09f32648036e709e5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta1.txt @@ -0,0 +1,10 @@ +5.70888 +-0.0177622 +0.9171 +1.03688e-09 +0.108145 +8.71829e-14 +13.9756 +-0.0492207 +10.2439 +0.168606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d2a20e3bc75df753726d65ca031e0f695b60bea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta2.txt @@ -0,0 +1,10 @@ +10.5363 +0.0384147 +0.0110815 +0.260603 +0.612646 +0.0400015 +6.99759 +-0.00286044 +6.2565 +0.0573606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta3.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_gluon_eta4.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c58ac2e83408d0266b4afc5b93d224f15181699e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta1.txt @@ -0,0 +1,10 @@ +-0.03147 +0.0001147 +0.9631 +0.05161 +0.09602 +-0.0001639 +0.05316 +0.0002674 +0.1581 +0.001323 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d50e0e1eadd24932be878562686e1a334404831 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta2.txt @@ -0,0 +1,10 @@ +-0.04391 +0.0001312 +1.238 +0.0266 +0.1374 +-0.000286 +-0.03468 +0.0007615 +0.2511 +0.0003884 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1621c8c628be4d48d4528f16abad1ebfdf760fcb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta3.txt @@ -0,0 +1,11 @@ +0.004073 +-3.352e-06 +0.5872 +0.08393 +0.5012 +-0.001412 +-0.2264 +0.001786 +0.2186 +0.0001553 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be815c2262ca1bb0e10da01bcc3bac2ce9926c1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta4.txt @@ -0,0 +1,11 @@ +-0.03437 +0.0001187 +1.32 +0.03141 +0.2386 +-0.000345 +-0.09605 +0.000715 +0.2537 +-2.252e-05 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..287917e8995b137e2d250365c18335932b104f56 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_lJets_eta5.txt @@ -0,0 +1,11 @@ +-0.2588 +0.0006825 +-0.1342 +0.2161 +0.8635 +0.002189 +0.01911 +5.351e-05 +0.08233 +0.0001076 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145b0118f6d758fc512bfa153dcb1dd558c17650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta1.txt @@ -0,0 +1,10 @@ +0.0638905 +0.00099101 +0.122283 +0.00811736 +0.0809538 +3.99525e-13 +1.73586 +-0.00913178 +1.09186 +0.0374252 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfd4116b6aa7ebaf762a0e7375e7cd6b697b630 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta2.txt @@ -0,0 +1,10 @@ +0.492762 +-0.00325367 +0.247994 +0.0061249 +0.156081 +1.68648e-13 +2.82227 +0.00166837 +1.91903 +0.0473027 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta3.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_energy_photon_eta4.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..434d7c00ec2b64323cce56a3b2d52dc69f0e7a0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta1.txt @@ -0,0 +1 @@ +0.0366589 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf026df413130768796e7086820d634ca540e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta2.txt @@ -0,0 +1 @@ +0.0293887 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta3.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_bJets_eta4.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d7aa43ad2daf1d200e318d8a3840a4b4362e40 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta1.txt @@ -0,0 +1 @@ +0.0367427 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb29efef8c3929addae6e472f3486165dac8290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta2.txt @@ -0,0 +1 @@ +0.029579 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta3.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_eta_lJets_eta4.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_misset.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_misset.txt new file mode 100644 index 0000000000000000000000000000000000000000..b97ef9bb59acd1b35f4e9569d3e51aa3adc0ba81 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_misset.txt @@ -0,0 +1,4 @@ +17.083 +13.039 +0.00463 +740.633 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8294cde858b664e6f5be7f5e1886942410f4a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta1.txt @@ -0,0 +1 @@ +0.0238451 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3708013ef1bd0e1a550081c7ad4037a4c6f31af4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta2.txt @@ -0,0 +1 @@ +0.0241915 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta3.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_bJets_eta4.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b55ab113d5b904407564acd518570aa88ef9f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta1.txt @@ -0,0 +1 @@ +0.0244004 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8d853c79be538e2c2148c052c66fb166491db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta2.txt @@ -0,0 +1 @@ +0.02426 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta3.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/par_phi_lJets_eta4.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/summary.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f349159dfba6ef259eba0a9f1011f533f216afa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11b/summary.txt @@ -0,0 +1,4 @@ + What changed in MC11b? +-Switched from R16 to R17 +-Much higher statistics. TFs fittet up to 600 GeV (instead of 300 GeV) +-New parametrizations of the TFs diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Electrons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Electrons.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2657f23a050192116f453cdc90abaa3f1efea06 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Electrons.txt @@ -0,0 +1,81 @@ +Electron transfer function +====================== + +Version: 2.0 - 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b + Version: 8.0 - 7 TeV, MC11c +last change: 05.06.2012 - Boris Lemmer + + +The transfer function for electrons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.0047708 + (1) Parameter "mean1_1": -8.31776e-06 + (2) Parameter "width1_0": 0.0551261 + (3) Parameter "width1_1": 0.0135272 + (4) Parameter "scale_0": 0.0344012 + (5) Parameter "scale_1": 8.1357e-05 + (6) Parameter "mean2_0": 0.0546478 + (7) Parameter "mean2_1": -0.000101212 + (8) Parameter "width2_0": 0.0591536 + (9) Parameter "width2_1": 5.04773e-05 + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": 0.00536575 + (1) Parameter "mean1_1": -1.88884e-05 + (2) Parameter "width1_0": 0.189046 + (3) Parameter "width1_1": 0.00544177 + (4) Parameter "scale_0": 0.0815538 + (5) Parameter "scale_1": -0.00027581 + (6) Parameter "mean2_0": 0.0924624 + (7) Parameter "mean2_1": -0.000230478 + (8) Parameter "width2_0": 0.0722181 + (9) Parameter "width2_1": -0.000139391 + + + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": --- +(1) Parameter "mean1_1": --- +(2) Parameter "width1_0": --- +(3) Parameter "width1_1": --- +(4) Parameter "scale_0": --- +(5) Parameter "scale_1": --- +(6) Parameter "mean2_0": --- +(7) Parameter "mean2_1": --- +(8) Parameter "width2_0": --- +(9) Parameter "width2_1": --- + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.00716482 + (1) Parameter "mean1_1": -1.22758e-06 + (2) Parameter "width1_0": 0.255181 + (3) Parameter "width1_1": 0.00864985 + (4) Parameter "scale_0": 0.201649 + (5) Parameter "scale_1": -0.000517387 + (6) Parameter "mean2_0": 0.0994971 + (7) Parameter "mean2_1": -0.000285629 + (8) Parameter "width2_0": 0.110927 + (9) Parameter "width2_1": -8.87397e-05 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Muons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Muons.txt new file mode 100644 index 0000000000000000000000000000000000000000..f991f38378bff9d78a147dac2935f529c98998d5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/Muons.txt @@ -0,0 +1,67 @@ +Muon transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 +Version: 4.5 - 7 TeV, R16v2, new bin + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b + Version: 8.0 - 7 TeV, MC11c +last change: 05.06.2012 - Boris Lemmer + +The transfer function for muons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (p_T_truth - p_T_measured) / p_T_truth + +The parameters pi themselves depend on p_T_truth: + +p_1 = mean1_0 + mean1_1 p_T_truth +p_2 = width1_0 + width1_1 p_T_truth +p_3 = scale_0 + scale_1 p_T_truth +p_4 = mean2_0 + mean2_1 p_T_truth +p_5 = width2_0 + width2_1 p_T_truth + +The values are: + +0.00 < |eta| < 1.11: + (0) Parameter "mean1_0": 0.00237446 + (1) Parameter "mean1_1": 1.4897e-05 + (2) Parameter "width1_0": 0.0174937 + (3) Parameter "width1_1": 0.000139458 + (4) Parameter "scale_0": 0.0202312 + (5) Parameter "scale_1": 1.12661e-06 + (6) Parameter "mean2_0": 0.0799549 + (7) Parameter "mean2_1": -0.000414296 + (8) Parameter "width2_0": 0.0776824 + (9) Parameter "width2_1": 0.000257894 + +1.11 < |eta| < 1.25: + (0) Parameter "mean1_0": 0.00610789 + (1) Parameter "mean1_1": -1.83222e-05 + (2) Parameter "width1_0": 0.0200285 + (3) Parameter "width1_1": 0.000216934 + (4) Parameter "scale_0": 0.00963178 + (5) Parameter "scale_1": 0.000154711 + (6) Parameter "mean2_0": 0.139158 + (7) Parameter "mean2_1": -0.00148167 + (8) Parameter "width2_0": 0.109968 + (9) Parameter "width2_1": 6.66435e-05 + + +1.25 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.00300893 + (1) Parameter "mean1_1": -2.50546e-05 + (2) Parameter "width1_0": 0.024707 + (3) Parameter "width1_1": 0.000192083 + (4) Parameter "scale_0": 0.012025 + (5) Parameter "scale_1": 8.86858e-05 + (6) Parameter "mean2_0": 0.143304 + (7) Parameter "mean2_1": -0.00145777 + (8) Parameter "width2_0": 0.125527 + (9) Parameter "width2_1": 0.000254535 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/bJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/bJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..56b75913c1a1e4843cd292873aa13eb8367bdb4c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/bJets.txt @@ -0,0 +1,97 @@ +B-jet transfer function +====================== + +// Version: 2.0 - major change in the parametrization functions !! +// Version: 3.0 - 7 TeV + Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b, new parametrization! + Version: 8.0 - 7 TeV, MC11c +last change: 05.06.2012 - Boris Lemmer + + +The transfer function for b-jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.0416403 + (1) Parameter "mean1_1": -0.000133032 + (2) Parameter "width1_0": 0.63635 + (3) Parameter "width1_1": 0.0455331 + (4) Parameter "scale_0": 0.69646 + (5) Parameter "scale_1": -0.0011256 + (6) Parameter "mean2_0": 0.0924025 + (7) Parameter "mean2_1": 0.000284853 + (8) Parameter "width2_0": 0.237605 + (9) Parameter "width2_1": -7.71834e-05 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": 0.0423057 + (1) Parameter "mean1_1": -0.000126523 + (2) Parameter "width1_0": 0.890524 + (3) Parameter "width1_1": 0.0338321 + (4) Parameter "scale_0": 0.805557 + (5) Parameter "scale_1": -0.00194616 + (6) Parameter "mean2_0": 0.0457723 + (7) Parameter "mean2_1": 0.000627242 + (8) Parameter "width2_0": 0.210852 + (9) Parameter "width2_1": 0.000137625 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": 0.0741983 + (1) Parameter "mean1_1": -0.000162807 + (2) Parameter "width1_0": 0.527051 + (3) Parameter "width1_1": 0.0699746 + (4) Parameter "scale_0": 1.05345 + (5) Parameter "scale_1": -0.00270522 + (6) Parameter "mean2_0": -0.0371157 + (7) Parameter "mean2_1": 0.001034 + (8) Parameter "width2_0": 0.2141 + (9) Parameter "width2_1": 9.74311e-05 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0622285 + (1) Parameter "mean1_1": -0.000117665 + (2) Parameter "width1_0": 0.565758 + (3) Parameter "width1_1": 0.0626795 + (4) Parameter "scale_0": 1.29969 + (5) Parameter "scale_1": -0.00283716 + (6) Parameter "mean2_0": -0.0392756 + (7) Parameter "mean2_1": 0.000785652 + (8) Parameter "width2_0": 0.204251 + (9) Parameter "width2_1": 3.32817e-05 + + +2.50 < |eta| < 4.50: + (0) Parameter "mean1_0": 0.0697423 + (1) Parameter "mean1_1": -2.29838e-05 + (2) Parameter "width1_0": -0.183802 + (3) Parameter "width1_1": 0.11942 + (4) Parameter "scale_0": 1.23299 + (5) Parameter "scale_1": -0.00118131 + (6) Parameter "mean2_0": -0.118493 + (7) Parameter "mean2_1": 0.000506198 + (8) Parameter "width2_0": 0.18749 + (9) Parameter "width2_1": 4.15728e-05 + + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/lJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/lJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd84c118288581d696a70aeee9797ace00359bcb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/lJets.txt @@ -0,0 +1,95 @@ +Light jet transfer function +====================== + +Version: 2.0 -- 7 TeV +Version: 4.0 - 7 TeV, R16 + Version: 4.5 - 7 TeV, R16v2, new binning + Version: 5.0 - 7 TeV, MC10a + Version: 6.0 - 7 TeV, MC10b + Version: 7.0 - 7 TeV, MC11b + Version: 8.0 - 7 TeV, MC11c +last change: 05.06.2012 - Boris Lemmer + + +The transfer function for light jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 / sqrt(E_truth) + width1_1 +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 E_truth +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": -0.00887444 + (1) Parameter "mean1_1": 3.8949e-06 + (2) Parameter "width1_0": 0.71723 + (3) Parameter "width1_1": 0.0557158 + (4) Parameter "scale_0": 0.277892 + (5) Parameter "scale_1": -0.000458276 + (6) Parameter "mean2_0": -0.0342356 + (7) Parameter "mean2_1": 0.00052632 + (8) Parameter "width2_0": 0.256602 + (9) Parameter "width2_1": -3.81878e-05 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": -0.0392354 + (1) Parameter "mean1_1": 7.14621e-05 + (2) Parameter "width1_0": 1.05917 + (3) Parameter "width1_1": 0.0233948 + (4) Parameter "scale_0": 0.745976 + (5) Parameter "scale_1": -0.00213218 + (6) Parameter "mean2_0": -0.00131801 + (7) Parameter "mean2_1": 0.000249029 + (8) Parameter "width2_0": 0.220434 + (9) Parameter "width2_1": 7.72689e-06 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": 0.00616293 + (1) Parameter "mean1_1": 1.18538e-05 + (2) Parameter "width1_0": 0.437714 + (3) Parameter "width1_1": 0.0904008 + (4) Parameter "scale_0": 0.59002 + (5) Parameter "scale_1": -0.00194377 + (6) Parameter "mean2_0": -0.279655 + (7) Parameter "mean2_1": 0.00230367 + (8) Parameter "width2_0": 0.206475 + (9) Parameter "width2_1": 0.000226209 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": -0.0134984 + (1) Parameter "mean1_1": 5.60061e-05 + (2) Parameter "width1_0": 0.866179 + (3) Parameter "width1_1": 0.0544066 + (4) Parameter "scale_0": 0.501023 + (5) Parameter "scale_1": -0.000960152 + (6) Parameter "mean2_0": -0.182959 + (7) Parameter "mean2_1": 0.0010942 + (8) Parameter "width2_0": 0.220212 + (9) Parameter "width2_1": 7.2565e-06 + + +2.50 < |eta| < 4.50: + (0) Parameter "mean1_0": -0.14655 + (1) Parameter "mean1_1": 0.000240508 + (2) Parameter "width1_0": 2.77129 + (3) Parameter "width1_1": 0.0130131 + (4) Parameter "scale_0": 1.97732 + (5) Parameter "scale_1": -0.00213959 + (6) Parameter "mean2_0": -0.0293982 + (7) Parameter "mean2_1": 0.000264308 + (8) Parameter "width2_0": 0.076049 + (9) Parameter "width2_1": 0.000180005 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..463e752c81f5d295db00b72722e9bf4d4aeb0c94 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta1.txt @@ -0,0 +1,10 @@ +0.0047708 +-8.31776e-06 +0.0551261 +0.0135272 +0.0344012 +8.1357e-05 +0.0546478 +-0.000101212 +0.0591536 +5.04773e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf38540de107615efbb405ad0d5d94fad93a0fe1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta2.txt @@ -0,0 +1,10 @@ +0.00536575 +-1.88884e-05 +0.189046 +0.00544177 +0.0815538 +-0.00027581 +0.0924624 +-0.000230478 +0.0722181 +-0.000139391 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed064381149ec7cb39a27a52425d2223873936bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta3.txt @@ -0,0 +1,10 @@ +--- +--- +--- +--- +--- +--- +--- +--- +--- +--- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3be5c77bc8c5cdfe05bda7d67616a386526c6187 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Electrons_eta4.txt @@ -0,0 +1,10 @@ +0.00716482 +-1.22758e-06 +0.255181 +0.00864985 +0.201649 +-0.000517387 +0.0994971 +-0.000285629 +0.110927 +-8.87397e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6434b633df7cf61766d1a639c886d7aee9d8f0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta1.txt @@ -0,0 +1,10 @@ +0.00237446 +1.4897e-05 +0.0174937 +0.000139458 +0.0202312 +1.12661e-06 +0.0799549 +-0.000414296 +0.0776824 +0.000257894 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d6bf176da701dfc29b32ad897b83f6d74f505c2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta2.txt @@ -0,0 +1,10 @@ +0.00610789 +-1.83222e-05 +0.0200285 +0.000216934 +0.00963178 +0.000154711 +0.139158 +-0.00148167 +0.109968 +6.66435e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52773ee420d307180f2d84683c2d753096c42f6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_Muons_eta3.txt @@ -0,0 +1,10 @@ +0.00300893 +-2.50546e-05 +0.024707 +0.000192083 +0.012025 +8.86858e-05 +0.143304 +-0.00145777 +0.125527 +0.000254535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2adc939e49e6fe2ea6e12c9b899d67017f2e19a1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta1.txt @@ -0,0 +1,10 @@ +0.0416403 +-0.000133032 +0.63635 +0.0455331 +0.69646 +-0.0011256 +0.0924025 +0.000284853 +0.237605 +-7.71834e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1f8d2820d9d1d61e793386df234f97c4cefea88 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta2.txt @@ -0,0 +1,10 @@ +0.0423057 +-0.000126523 +0.890524 +0.0338321 +0.805557 +-0.00194616 +0.0457723 +0.000627242 +0.210852 +0.000137625 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3efb87e776f1bb7d90232b50448b8221661bbef3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta3.txt @@ -0,0 +1,10 @@ +0.0741983 +-0.000162807 +0.527051 +0.0699746 +1.05345 +-0.00270522 +-0.0371157 +0.001034 +0.2141 +9.74311e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6412b70f4f802ecb16f7c044a6333552e893c2c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta4.txt @@ -0,0 +1,10 @@ +0.0622285 +-0.000117665 +0.565758 +0.0626795 +1.29969 +-0.00283716 +-0.0392756 +0.000785652 +0.204251 +3.32817e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1b0ee51e91689e71a1bacff6f874f6f1ee1cb47 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_bJets_eta5.txt @@ -0,0 +1,10 @@ +0.0697423 +-2.29838e-05 +-0.183802 +0.11942 +1.23299 +-0.00118131 +-0.118493 +0.000506198 +0.18749 +4.15728e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a65afbb2486752ea7a801c09f32648036e709e5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta1.txt @@ -0,0 +1,10 @@ +5.70888 +-0.0177622 +0.9171 +1.03688e-09 +0.108145 +8.71829e-14 +13.9756 +-0.0492207 +10.2439 +0.168606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d2a20e3bc75df753726d65ca031e0f695b60bea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta2.txt @@ -0,0 +1,10 @@ +10.5363 +0.0384147 +0.0110815 +0.260603 +0.612646 +0.0400015 +6.99759 +-0.00286044 +6.2565 +0.0573606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta3.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_gluon_eta4.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53f24f1a8bda526242cf2699af24fb285dfef10f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta1.txt @@ -0,0 +1,10 @@ +-0.00887444 +3.8949e-06 +0.71723 +0.0557158 +0.277892 +-0.000458276 +-0.0342356 +0.00052632 +0.256602 +-3.81878e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61dd310ef6c895f3cc2458eca365ff956ee58092 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta2.txt @@ -0,0 +1,10 @@ +-0.0392354 +7.14621e-05 +1.05917 +0.0233948 +0.745976 +-0.00213218 +-0.00131801 +0.000249029 +0.220434 +7.72689e-06 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f65d67bb01eeea8e8372e10cfe0ee47a916eb55a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta3.txt @@ -0,0 +1,10 @@ +0.00616293 +1.18538e-05 +0.437714 +0.0904008 +0.59002 +-0.00194377 +-0.279655 +0.00230367 +0.206475 +0.000226209 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a09f59b3036f393fb2edf1ee91afc26334b4a99 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta4.txt @@ -0,0 +1,10 @@ +-0.0134984 +5.60061e-05 +0.866179 +0.0544066 +0.501023 +-0.000960152 +-0.182959 +0.0010942 +0.220212 +7.2565e-06 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta5.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta5.txt new file mode 100644 index 0000000000000000000000000000000000000000..144ccc4954dcb4e98361f9f80cc8b89fb853b8b7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_lJets_eta5.txt @@ -0,0 +1,10 @@ +-0.14655 +0.000240508 +2.77129 +0.0130131 +1.97732 +-0.00213959 +-0.0293982 +0.000264308 +0.076049 +0.000180005 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145b0118f6d758fc512bfa153dcb1dd558c17650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta1.txt @@ -0,0 +1,10 @@ +0.0638905 +0.00099101 +0.122283 +0.00811736 +0.0809538 +3.99525e-13 +1.73586 +-0.00913178 +1.09186 +0.0374252 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfd4116b6aa7ebaf762a0e7375e7cd6b697b630 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta2.txt @@ -0,0 +1,10 @@ +0.492762 +-0.00325367 +0.247994 +0.0061249 +0.156081 +1.68648e-13 +2.82227 +0.00166837 +1.91903 +0.0473027 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta3.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_energy_photon_eta4.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..434d7c00ec2b64323cce56a3b2d52dc69f0e7a0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta1.txt @@ -0,0 +1 @@ +0.0366589 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf026df413130768796e7086820d634ca540e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta2.txt @@ -0,0 +1 @@ +0.0293887 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta3.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_bJets_eta4.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d7aa43ad2daf1d200e318d8a3840a4b4362e40 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta1.txt @@ -0,0 +1 @@ +0.0367427 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb29efef8c3929addae6e472f3486165dac8290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta2.txt @@ -0,0 +1 @@ +0.029579 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta3.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_eta_lJets_eta4.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_misset.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_misset.txt new file mode 100644 index 0000000000000000000000000000000000000000..0245365bf229af754f6e0374923fa80f79b9f795 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_misset.txt @@ -0,0 +1,4 @@ +13.615 +20.881 +0.00323 +739.223 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8294cde858b664e6f5be7f5e1886942410f4a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta1.txt @@ -0,0 +1 @@ +0.0238451 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3708013ef1bd0e1a550081c7ad4037a4c6f31af4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta2.txt @@ -0,0 +1 @@ +0.0241915 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta3.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_bJets_eta4.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b55ab113d5b904407564acd518570aa88ef9f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta1.txt @@ -0,0 +1 @@ +0.0244004 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8d853c79be538e2c2148c052c66fb166491db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta2.txt @@ -0,0 +1 @@ +0.02426 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta3.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/par_phi_lJets_eta4.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/summary.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..a43bd2981e62bd3cedce1b9e8dd63479c325b9bd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c/summary.txt @@ -0,0 +1,3 @@ + What changed in MC11c? +-jet recalibration +-Much higher statistics (added 117200 sample). TFs fittet up to 1000 GeV (instead of 600 GeV) diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Electrons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Electrons.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7c1b2c584ad686bbd756c6395313f5e5182bca5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Electrons.txt @@ -0,0 +1,76 @@ +Electron transfer function +====================== + + Version: 9.0 - 7 TeV, MC11c, PowHeg+Pythia, 8TeV parametrization +last change: 25.02.2013 - Boris Lemmer + + + +The transfer function for electrons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth) +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.00845494 + (1) Parameter "mean1_1": 3.90264e-05 + (2) Parameter "width1_0": 0.0198597 + (3) Parameter "width1_1": 0.0243028 + (4) Parameter "scale_0": 0.0814311 + (5) Parameter "scale_1": 3.26286e-05 + (6) Parameter "mean2_0": 0.128558 + (7) Parameter "mean2_1": -0.54491 + (8) Parameter "width2_0": 0.0594063 + (9) Parameter "width2_1": 0.000105761 + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": 0.00982234 + (1) Parameter "mean1_1": 2.6243e-05 + (2) Parameter "width1_0": 0.0119606 + (3) Parameter "width1_1": 0.154335 + (4) Parameter "scale_0": 0.134627 + (5) Parameter "scale_1": -0.000330058 + (6) Parameter "mean2_0": 0.112227 + (7) Parameter "mean2_1": -0.249097 + (8) Parameter "width2_0": 0.0847928 + (9) Parameter "width2_1": -0.00014211 + + + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": --- +(1) Parameter "mean1_1": --- +(2) Parameter "width1_0": --- +(3) Parameter "width1_1": --- +(4) Parameter "scale_0": --- +(5) Parameter "scale_1": --- +(6) Parameter "mean2_0": --- +(7) Parameter "mean2_1": --- +(8) Parameter "width2_0": --- +(9) Parameter "width2_1": --- + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0132276 + (1) Parameter "mean1_1": 1.21959e-05 + (2) Parameter "width1_0": 0.0203453 + (3) Parameter "width1_1": 0.134555 + (4) Parameter "scale_0": 0.339599 + (5) Parameter "scale_1": -0.000761589 + (6) Parameter "mean2_0": 0.0784652 + (7) Parameter "mean2_1": -0.020295 + (8) Parameter "width2_0": 0.0914089 + (9) Parameter "width2_1": -2.38977e-05 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Muons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Muons.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff842cb4493749a6c51c65771ffe165362b03f67 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/Muons.txt @@ -0,0 +1,64 @@ +Muon transfer function +====================== + + + Version: 9.0 - 7 TeV, MC11c, PowHeg+Pythia, 8TeV parametrization +last change: 25.02.2013 - Boris Lemmer + + + +The transfer function for muons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (p_T_truth - p_T_measured) / p_T_truth + +The parameters pi themselves depend on p_T_truth: + +p_1 = mean1_0 + mean1_1 p_T_truth +p_2 = width1_0 + width1_1 p_T_truth +p_3 = scale_0 + scale_1 p_T_truth +p_4 = mean2_0 + mean2_1 p_T_truth +p_5 = width2_0 + width2_1 p_T_truth + +The values are: + +0.00 < |eta| < 1.11: + (0) Parameter "mean1_0": 0.00195192 + (1) Parameter "mean1_1": 0.000151532 + (2) Parameter "width1_0": 0.0187574 + (3) Parameter "width1_1": 0.000156252 + (4) Parameter "scale_0": 0.05798 + (5) Parameter "scale_1": -6.6911e-05 + (6) Parameter "mean2_0": 0.0228021 + (7) Parameter "mean2_1": 0.000762403 + (8) Parameter "width2_0": 0.0713199 + (9) Parameter "width2_1": 0.000281388 + +1.11 < |eta| < 1.25: + (0) Parameter "mean1_0": 0.0043261 + (1) Parameter "mean1_1": 0.00016834 + (2) Parameter "width1_0": 0.019748 + (3) Parameter "width1_1": 0.000271 + (4) Parameter "scale_0": 0.0483587 + (5) Parameter "scale_1": -4.83071e-05 + (6) Parameter "mean2_0": 0.0113318 + (7) Parameter "mean2_1": 0.00137318 + (8) Parameter "width2_0": 0.0730483 + (9) Parameter "width2_1": 0.000535101 + + +1.25 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.00462121 + (1) Parameter "mean1_1": 0.000122126 + (2) Parameter "width1_0": 0.0272559 + (3) Parameter "width1_1": 0.000184604 + (4) Parameter "scale_0": 0.0474345 + (5) Parameter "scale_1": 0.00011473 + (6) Parameter "mean2_0": 0.0698657 + (7) Parameter "mean2_1": 0.000293695 + (8) Parameter "width2_0": 0.0990379 + (9) Parameter "width2_1": 0.000397836 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/bJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/bJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..8839a7ea1971bf5ed5848b252deaad03661135fe --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/bJets.txt @@ -0,0 +1,77 @@ +B-jet transfer function +====================== + + + Version: 9.0 - 7 TeV, MC11c, PowHeg+Pythia, 8TeV parametrizations +last change: 25.02.2013 - Boris Lemmer + +The transfer function for b-jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 / E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 / E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth ) +p_5 = width2_0 + width2_1 E_truth + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": -0.00246504 + (1) Parameter "mean1_1": 1.87129 + (2) Parameter "width1_0": 0.0685892 + (3) Parameter "width1_1": 0.341325 + (4) Parameter "scale_0": 0.103763 + (5) Parameter "scale_1": 58.2094 + (6) Parameter "mean2_0": 0.292295 + (7) Parameter "mean2_1": -1.56211 + (8) Parameter "width2_0": 0.222021 + (9) Parameter "width2_1": 6.06493e-05 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": -0.0136337 + (1) Parameter "mean1_1": 4.08397 + (2) Parameter "width1_0": 0.0636419 + (3) Parameter "width1_1": 0.441125 + (4) Parameter "scale_0": -0.146397 + (5) Parameter "scale_1": 103.816 + (6) Parameter "mean2_0": 0.398871 + (7) Parameter "mean2_1": -2.79089 + (8) Parameter "width2_0": 0.205129 + (9) Parameter "width2_1": 0.000179906 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": 0.00476892 + (1) Parameter "mean1_1": 5.60896 + (2) Parameter "width1_0": 0.066647 + (3) Parameter "width1_1": 0.502644 + (4) Parameter "scale_0": -0.328378 + (5) Parameter "scale_1": 175.183 + (6) Parameter "mean2_0": 0.457786 + (7) Parameter "mean2_1": -3.8114 + (8) Parameter "width2_0": 0.183568 + (9) Parameter "width2_1": 0.000255848 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.00405035 + (1) Parameter "mean1_1": 5.73037 + (2) Parameter "width1_0": 0.0387666 + (3) Parameter "width1_1": 0.8529 + (4) Parameter "scale_0": -0.154626 + (5) Parameter "scale_1": 198.029 + (6) Parameter "mean2_0": 0.410092 + (7) Parameter "mean2_1": -3.82386 + (8) Parameter "width2_0": 0.193993 + (9) Parameter "width2_1": 7.19315e-05 + + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/lJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/lJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..81667f0bb449496e24a6e0275a6d4d795fed504d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/lJets.txt @@ -0,0 +1,76 @@ +Light jet transfer function +====================== + + Version: 9.0 - 7 TeV, MC11c, PowHeg+Pythia, 8TeV parametrization +last change: 25.02.2013 - Boris Lemmer + +The transfer function for light jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 / E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 / E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth ) +p_5 = width2_0 + width2_1 E_truth + + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.00191954 + (1) Parameter "mean1_1": 0.0735198 + (2) Parameter "width1_0": 0.0827965 + (3) Parameter "width1_1": 0.376091 + (4) Parameter "scale_0": -0.0225416 + (5) Parameter "scale_1": 40.9027 + (6) Parameter "mean2_0": 0.270686 + (7) Parameter "mean2_1": -2.02792 + (8) Parameter "width2_0": 0.215805 + (9) Parameter "width2_1": 0.000227683 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": -0.00368 + (1) Parameter "mean1_1": 0.208668 + (2) Parameter "width1_0": 0.0784432 + (3) Parameter "width1_1": 0.45056 + (4) Parameter "scale_0": -0.186897 + (5) Parameter "scale_1": 70.6223 + (6) Parameter "mean2_0": 0.444614 + (7) Parameter "mean2_1": -3.89139 + (8) Parameter "width2_0": 0.1881 + (9) Parameter "width2_1": 0.000449047 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": 0.0357559 + (1) Parameter "mean1_1": -1.66498 + (2) Parameter "width1_0": 0.12333 + (3) Parameter "width1_1": 0.082741 + (4) Parameter "scale_0": -0.251784 + (5) Parameter "scale_1": 84.6277 + (6) Parameter "mean2_0": 0.601229 + (7) Parameter "mean2_1": -5.9233 + (8) Parameter "width2_0": 0.1554 + (9) Parameter "width2_1": 0.000650886 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0375875 + (1) Parameter "mean1_1": -4.31247 + (2) Parameter "width1_0": 0.0711534 + (3) Parameter "width1_1": 0.602219 + (4) Parameter "scale_0": -0.137003 + (5) Parameter "scale_1": 106.323 + (6) Parameter "mean2_0": 0.467874 + (7) Parameter "mean2_1": -5.31468 + (8) Parameter "width2_0": 0.183581 + (9) Parameter "width2_1": 0.000161399 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9258328b5d5df1873407c9bc8124f38c62a3ecba --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta1.txt @@ -0,0 +1,10 @@ +0.00845494 +3.90264e-05 +0.0198597 +0.0243028 +0.0814311 +3.26286e-05 +0.128558 +-0.54491 +0.0594063 +0.000105761 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..690da0a739bc2177c2fd63f85741837abf41d36e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta2.txt @@ -0,0 +1,10 @@ +0.00982234 +2.6243e-05 +0.0119606 +0.154335 +0.134627 +-0.000330058 +0.112227 +-0.249097 +0.0847928 +-0.00014211 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed064381149ec7cb39a27a52425d2223873936bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta3.txt @@ -0,0 +1,10 @@ +--- +--- +--- +--- +--- +--- +--- +--- +--- +--- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e4eaf7036d723e44ab221f3fbe9bdcebf8a0de7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Electrons_eta4.txt @@ -0,0 +1,10 @@ +0.0132276 +1.21959e-05 +0.0203453 +0.134555 +0.339599 +-0.000761589 +0.0784652 +-0.020295 +0.0914089 +-2.38977e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1c5888dcd8291a796d73d8dede0be348f773e45 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta1.txt @@ -0,0 +1,10 @@ +0.00195192 +0.000151532 +0.0187574 +0.000156252 +0.05798 +-6.6911e-05 +0.0228021 +0.000762403 +0.0713199 +0.000281388 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61876aaddff8db5e14d3718347a0bc2e4e63a623 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta2.txt @@ -0,0 +1,10 @@ +0.0043261 +0.00016834 +0.019748 +0.000271 +0.0483587 +-4.83071e-05 +0.0113318 +0.00137318 +0.0730483 +0.000535101 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..044107b61135f16eda365f02212b1fb6c1bbe7a0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_Muons_eta3.txt @@ -0,0 +1,10 @@ +0.00462121 +0.000122126 +0.0272559 +0.000184604 +0.0474345 +0.00011473 +0.0698657 +0.000293695 +0.0990379 +0.000397836 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f767755f7f5de6b704efb842b2f25971402f27 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta1.txt @@ -0,0 +1,10 @@ +-0.00246504 +1.87129 +0.0685892 +0.341325 +0.103763 +58.2094 +0.292295 +-1.56211 +0.222021 +6.06493e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4930b919971bb85368cc4f61c4b3a984e635a66 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta2.txt @@ -0,0 +1,10 @@ +-0.0136337 +4.08397 +0.0636419 +0.441125 +-0.146397 +103.816 +0.398871 +-2.79089 +0.205129 +0.000179906 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..776ca66e24aba84601253f0befdfc61b6505f681 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta3.txt @@ -0,0 +1,10 @@ +0.00476892 +5.60896 +0.066647 +0.502644 +-0.328378 +175.183 +0.457786 +-3.8114 +0.183568 +0.000255848 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..44d6adc7bb206b624186372202a9ae2daf9bbfde --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_bJets_eta4.txt @@ -0,0 +1,10 @@ +0.00405035 +5.73037 +0.0387666 +0.8529 +-0.154626 +198.029 +0.410092 +-3.82386 +0.193993 +7.19315e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a65afbb2486752ea7a801c09f32648036e709e5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta1.txt @@ -0,0 +1,10 @@ +5.70888 +-0.0177622 +0.9171 +1.03688e-09 +0.108145 +8.71829e-14 +13.9756 +-0.0492207 +10.2439 +0.168606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d2a20e3bc75df753726d65ca031e0f695b60bea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta2.txt @@ -0,0 +1,10 @@ +10.5363 +0.0384147 +0.0110815 +0.260603 +0.612646 +0.0400015 +6.99759 +-0.00286044 +6.2565 +0.0573606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta3.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_gluon_eta4.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08f618074e46d557024f9423b52c97e7307f56d5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta1.txt @@ -0,0 +1,10 @@ +0.00191954 +0.0735198 +0.0827965 +0.376091 +-0.0225416 +40.9027 +0.270686 +-2.02792 +0.215805 +0.000227683 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cee426c6cb81359852cda154fc7b38bf111820c3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta2.txt @@ -0,0 +1,10 @@ +-0.00368 +0.208668 +0.0784432 +0.45056 +-0.186897 +70.6223 +0.444614 +-3.89139 +0.1881 +0.000449047 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ffe7c171eeb0c8dc1aac572c1ba3cc995cf2c17 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta3.txt @@ -0,0 +1,10 @@ +0.0357559 +-1.66498 +0.12333 +0.082741 +-0.251784 +84.6277 +0.601229 +-5.9233 +0.1554 +0.000650886 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..88ec8787fa9b84b7f4c709527e0c4ac32a72b650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_lJets_eta4.txt @@ -0,0 +1,10 @@ +0.0375875 +-4.31247 +0.0711534 +0.602219 +-0.137003 +106.323 +0.467874 +-5.31468 +0.183581 +0.000161399 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145b0118f6d758fc512bfa153dcb1dd558c17650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta1.txt @@ -0,0 +1,10 @@ +0.0638905 +0.00099101 +0.122283 +0.00811736 +0.0809538 +3.99525e-13 +1.73586 +-0.00913178 +1.09186 +0.0374252 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfd4116b6aa7ebaf762a0e7375e7cd6b697b630 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta2.txt @@ -0,0 +1,10 @@ +0.492762 +-0.00325367 +0.247994 +0.0061249 +0.156081 +1.68648e-13 +2.82227 +0.00166837 +1.91903 +0.0473027 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta3.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_energy_photon_eta4.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..434d7c00ec2b64323cce56a3b2d52dc69f0e7a0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta1.txt @@ -0,0 +1 @@ +0.0366589 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf026df413130768796e7086820d634ca540e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta2.txt @@ -0,0 +1 @@ +0.0293887 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta3.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_bJets_eta4.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d7aa43ad2daf1d200e318d8a3840a4b4362e40 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta1.txt @@ -0,0 +1 @@ +0.0367427 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb29efef8c3929addae6e472f3486165dac8290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta2.txt @@ -0,0 +1 @@ +0.029579 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta3.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_eta_lJets_eta4.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_misset.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_misset.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ad793c4daa2490c6a654cf9acef744b90c728c8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_misset.txt @@ -0,0 +1,4 @@ +15.570 +17.518 +0.00350 +749.563 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8294cde858b664e6f5be7f5e1886942410f4a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta1.txt @@ -0,0 +1 @@ +0.0238451 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3708013ef1bd0e1a550081c7ad4037a4c6f31af4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta2.txt @@ -0,0 +1 @@ +0.0241915 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta3.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_bJets_eta4.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b55ab113d5b904407564acd518570aa88ef9f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta1.txt @@ -0,0 +1 @@ +0.0244004 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8d853c79be538e2c2148c052c66fb166491db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta2.txt @@ -0,0 +1 @@ +0.02426 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta3.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/par_phi_lJets_eta4.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/summary.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..0beb0b57f57d08107c983253b9a2cd1124e849c2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/7TeV/ttbar/mc11c_powheg/summary.txt @@ -0,0 +1,2 @@ +TFs derived from +mc11_7TeV.117050.TTbar_PowHeg_Pythia_P2011C.merge.NTUP_TOP.e1377_s1372_s1370_r3108_r3109_p937/ \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Electrons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Electrons.txt new file mode 100644 index 0000000000000000000000000000000000000000..2912fe6de4b8a6b8f33e56aae7f4355dad960331 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Electrons.txt @@ -0,0 +1,76 @@ +Electron transfer function +====================== + + Version: 9.0 - 8 TeV, MC12 +last change: 14.01.2013 - Boris Lemmer + + +The transfer function for electrons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth) +p_5 = width2_0 + width2_1 E_truth + + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.00444589 + (1) Parameter "mean1_1": -5.26501e-06 + (2) Parameter "width1_0": 0.0117624 + (3) Parameter "width1_1": 0.0685362 + (4) Parameter "scale_0": 0.0448982 + (5) Parameter "scale_1": 2.69913e-05 + (6) Parameter "mean2_0": -0.00176197 + (7) Parameter "mean2_1": 0.353825 + (8) Parameter "width2_0": 0.0579461 + (9) Parameter "width2_1": 1.06982e-06 + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": 0.00549471 + (1) Parameter "mean1_1": -1.85239e-05 + (2) Parameter "width1_0": 0.000302272 + (3) Parameter "width1_1": 0.221694 + (4) Parameter "scale_0": 0.0868421 + (5) Parameter "scale_1": -0.000238109 + (6) Parameter "mean2_0": -0.0256831 + (7) Parameter "mean2_1": 0.73618 + (8) Parameter "width2_0": 0.0548945 + (9) Parameter "width2_1": -5.95606e-05 + + + +1.37 < |eta| < 1.52: +(0) Parameter "mean1_0": --- +(1) Parameter "mean1_1": --- +(2) Parameter "width1_0": --- +(3) Parameter "width1_1": --- +(4) Parameter "scale_0": --- +(5) Parameter "scale_1": --- +(6) Parameter "mean2_0": --- +(7) Parameter "mean2_1": --- +(8) Parameter "width2_0": --- +(9) Parameter "width2_1": --- + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0079871 + (1) Parameter "mean1_1": -7.13884e-06 + (2) Parameter "width1_0": 0.00177702 + (3) Parameter "width1_1": 0.340822 + (4) Parameter "scale_0": 0.0995941 + (5) Parameter "scale_1": -0.00015726 + (6) Parameter "mean2_0": -0.0803862 + (7) Parameter "mean2_1": 1.67393 + (8) Parameter "width2_0": 0.105436 + (9) Parameter "width2_1": -9.67464e-05 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Muons.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Muons.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e680eb0f995f185b19ca9d66d297587c67f47d6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/Muons.txt @@ -0,0 +1,62 @@ +Muon transfer function +====================== + + + Version: 9.0 - 8 TeV, MC12 +last change: 14.01.2013 - Boris Lemmer + +The transfer function for muons is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (p_T_truth - p_T_measured) / p_T_truth + +The parameters pi themselves depend on p_T_truth: + +p_1 = mean1_0 + mean1_1 p_T_truth +p_2 = width1_0 + width1_1 p_T_truth +p_3 = scale_0 + scale_1 p_T_truth +p_4 = mean2_0 + mean2_1 p_T_truth +p_5 = width2_0 + width2_1 p_T_truth + +The values are: + +0.00 < |eta| < 1.11: + (0) Parameter "mean1_0": 0.00196555 + (1) Parameter "mean1_1": 8.3173e-06 + (2) Parameter "width1_0": 0.0164841 + (3) Parameter "width1_1": 0.000160441 + (4) Parameter "scale_0": 0.0191809 + (5) Parameter "scale_1": 3.9502e-06 + (6) Parameter "mean2_0": 0.0247272 + (7) Parameter "mean2_1": 0.000814179 + (8) Parameter "width2_0": 0.049973 + (9) Parameter "width2_1": 0.00103582 + +1.11 < |eta| < 1.25: + (0) Parameter "mean1_0": 0.00165842 + (1) Parameter "mean1_1": 1.62974e-05 + (2) Parameter "width1_0": 0.0210449 + (3) Parameter "width1_1": 0.000251978 + (4) Parameter "scale_0": 0.00163622 + (5) Parameter "scale_1": 0.000295175 + (6) Parameter "mean2_0": 0.214002 + (7) Parameter "mean2_1": -0.00158334 + (8) Parameter "width2_0": 0.151729 + (9) Parameter "width2_1": 1.13782e-05 + + +1.25 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.000442648 + (1) Parameter "mean1_1": 4.06821e-05 + (2) Parameter "width1_0": 0.024328 + (3) Parameter "width1_1": 0.000199516 + (4) Parameter "scale_0": -0.00042211 + (5) Parameter "scale_1": 0.000378664 + (6) Parameter "mean2_0": 0.146271 + (7) Parameter "mean2_1": -0.00104468 + (8) Parameter "width2_0": 0.142725 + (9) Parameter "width2_1": 2.19951e-05 + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/bJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/bJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..b759dbb4e6e420e07cd14ce205aa7d778272475c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/bJets.txt @@ -0,0 +1,92 @@ +B-jet transfer function +====================== + + + Version: 9.0 - 8 TeV, MC12 +last change: 14.01.2013 - Boris Lemmer + + +The transfer function for b-jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 / E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 / E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth) +p_5 = width2_0 + width2_1 E_truth + + +The values are: + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": -0.0020963 + (1) Parameter "mean1_1": 3.253 + (2) Parameter "width1_0": 0.054609 + (3) Parameter "width1_1": 0.461499 + (4) Parameter "scale_0": 0.179215 + (5) Parameter "scale_1": 52.1964 + (6) Parameter "mean2_0": 0.288286 + (7) Parameter "mean2_1": -1.73631 + (8) Parameter "width2_0": 0.234404 + (9) Parameter "width2_1": -2.54762e-05 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": -0.0126548 + (1) Parameter "mean1_1": 5.34751 + (2) Parameter "width1_0": 0.0549931 + (3) Parameter "width1_1": 0.549482 + (4) Parameter "scale_0": -0.140537 + (5) Parameter "scale_1": 102.086 + (6) Parameter "mean2_0": 0.386519 + (7) Parameter "mean2_1": -2.89377 + (8) Parameter "width2_0": 0.222311 + (9) Parameter "width2_1": 7.51057e-05 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": -0.00184705 + (1) Parameter "mean1_1": 6.98636 + (2) Parameter "width1_0": 0.0561314 + (3) Parameter "width1_1": 0.687561 + (4) Parameter "scale_0": -0.296518 + (5) Parameter "scale_1": 174.964 + (6) Parameter "mean2_0": 0.460882 + (7) Parameter "mean2_1": -4.09145 + (8) Parameter "width2_0": 0.213336 + (9) Parameter "width2_1": 0.000103354 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0109739 + (1) Parameter "mean1_1": 6.02177 + (2) Parameter "width1_0": 0.0424557 + (3) Parameter "width1_1": 0.812251 + (4) Parameter "scale_0": -0.121939 + (5) Parameter "scale_1": 217.198 + (6) Parameter "mean2_0": 0.421104 + (7) Parameter "mean2_1": -4.26916 + (8) Parameter "width2_0": 0.213189 + (9) Parameter "width2_1": 1.20014e-05 + + +2.50 < |eta| < 4.50: + (0) Parameter "mean1_0": + (1) Parameter "mean1_1": + (2) Parameter "width1_0": + (3) Parameter "width1_1": + (4) Parameter "scale_0": + (5) Parameter "scale_1": + (6) Parameter "mean2_0": + (7) Parameter "mean2_1": + (8) Parameter "width2_0": + (9) Parameter "width2_1": + + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/lJets.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/lJets.txt new file mode 100644 index 0000000000000000000000000000000000000000..60481f75bc4b3675447d0cd2ddd83b90886619a0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/lJets.txt @@ -0,0 +1,87 @@ +Light jet transfer function +====================== + + Version: 9.0 - 8 TeV, MC12 +last change: 14.01.2013 - Boris Lemmer + + +The transfer function for light jets is parametrized as: + +W(dE)=1/(sqrt(2 pi)(p2 + p3 p5)) * ( exp( -(dE - p1)(dE - p1)/(2 p2 p2) ) + p3 exp( -(dE - p4)(dE - p4)/(2 p5 p5) ) ) + +with + +dE = (E_truth - E_measured) / E_truth + +The parameters pi themselves depend on E_truth: + +p_1 = mean1_0 + mean1_1 / E_truth +p_2 = width1_0 + width1_1 / sqrt(E_truth) +p_3 = scale_0 + scale_1 / E_truth +p_4 = mean2_0 + mean2_1 / sqrt(E_truth) +p_5 = width2_0 + width2_1 E_truth + +0.00 < |eta| < 0.80: + (0) Parameter "mean1_0": 0.000333966 + (1) Parameter "mean1_1": 0.643768 + (2) Parameter "width1_0": 0.064171 + (3) Parameter "width1_1": 0.458461 + (4) Parameter "scale_0": 0.031802 + (5) Parameter "scale_1": 25.3972 + (6) Parameter "mean2_0": 0.352395 + (7) Parameter "mean2_1": -2.80026 + (8) Parameter "width2_0": 0.224978 + (9) Parameter "width2_1": 0.000263489 + + +0.80 < |eta| < 1.37: + (0) Parameter "mean1_0": -0.00859865 + (1) Parameter "mean1_1": 1.08563 + (2) Parameter "width1_0": 0.0471174 + (3) Parameter "width1_1": 0.702792 + (4) Parameter "scale_0": -0.0876056 + (5) Parameter "scale_1": 46.0504 + (6) Parameter "mean2_0": 0.5018 + (7) Parameter "mean2_1": -4.48954 + (8) Parameter "width2_0": 0.200929 + (9) Parameter "width2_1": 0.000418553 + + +1.37 < |eta| < 1.52: + (0) Parameter "mean1_0": 4.51875e-05 + (1) Parameter "mean1_1": 1.16357 + (2) Parameter "width1_0": 0.0722839 + (3) Parameter "width1_1": 0.59364 + (4) Parameter "scale_0": -0.165653 + (5) Parameter "scale_1": 77.6661 + (6) Parameter "mean2_0": 0.594011 + (7) Parameter "mean2_1": -6.04096 + (8) Parameter "width2_0": 0.186881 + (9) Parameter "width2_1": 0.000408546 + + +1.52 < |eta| < 2.50: + (0) Parameter "mean1_0": 0.0186284 + (1) Parameter "mean1_1": -1.46522 + (2) Parameter "width1_0": 0.042013 + (3) Parameter "width1_1": 0.887257 + (4) Parameter "scale_0": -0.0960286 + (5) Parameter "scale_1": 107.112 + (6) Parameter "mean2_0": 0.516533 + (7) Parameter "mean2_1": -6.04437 + (8) Parameter "width2_0": 0.193078 + (9) Parameter "width2_1": 0.000158566 + + +2.50 < |eta| < 4.50: + (0) Parameter "mean1_0": + (1) Parameter "mean1_1": + (2) Parameter "width1_0": + (3) Parameter "width1_1": + (4) Parameter "scale_0": + (5) Parameter "scale_1": + (6) Parameter "mean2_0": + (7) Parameter "mean2_1": + (8) Parameter "width2_0": + (9) Parameter "width2_1": + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdf3b53f0bd4a03cf249d3c3f9d4a68ab1ccad24 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta1.txt @@ -0,0 +1,10 @@ +0.00444589 +-5.26501e-06 +0.0117624 +0.0685362 +0.0448982 +2.69913e-05 +-0.00176197 +0.353825 +0.0579461 +1.06982e-06 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ba67df251b147a8b067a450763fe1a2a9d17f78 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta2.txt @@ -0,0 +1,10 @@ +0.00549471 +-1.85239e-05 +0.000302272 +0.221694 +0.0868421 +-0.000238109 +-0.0256831 +0.73618 +0.0548945 +-5.95606e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed064381149ec7cb39a27a52425d2223873936bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta3.txt @@ -0,0 +1,10 @@ +--- +--- +--- +--- +--- +--- +--- +--- +--- +--- diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aed8bbc60ef2df22bb7f62b9ace19e42af2874de --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Electrons_eta4.txt @@ -0,0 +1,10 @@ +0.0079871 +-7.13884e-06 +0.00177702 +0.340822 +0.0995941 +-0.00015726 +-0.0803862 +1.67393 +0.105436 +-9.67464e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc7996945a1b4c6c7014c2ea1bffc994d3a00c02 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta1.txt @@ -0,0 +1,10 @@ +0.00196555 +8.3173e-06 +0.0164841 +0.000160441 +0.0191809 +3.9502e-06 +0.0247272 +0.000814179 +0.049973 +0.00103582 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6535dc0c84ec7589ba00797cd05d2adc3f60d57a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta2.txt @@ -0,0 +1,10 @@ +0.00165842 +1.62974e-05 +0.0210449 +0.000251978 +0.00163622 +0.000295175 +0.214002 +-0.00158334 +0.151729 +1.13782e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72e3e64a7e4de6b9ef6c2998c00c0a7fc6b293cd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_Muons_eta3.txt @@ -0,0 +1,10 @@ +0.000442648 +4.06821e-05 +0.024328 +0.000199516 +-0.00042211 +0.000378664 +0.146271 +-0.00104468 +0.142725 +2.19951e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db4296656e58659dccaa2b5146ae4f42806ba334 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta1.txt @@ -0,0 +1,10 @@ +-0.0020963 +3.253 +0.054609 +0.461499 +0.179215 +52.1964 +0.288286 +-1.73631 +0.234404 +-2.54762e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e4d4ae4c75e3389c6e7daf2a51ee5804216705 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta2.txt @@ -0,0 +1,10 @@ +-0.0126548 +5.34751 +0.0549931 +0.549482 +-0.140537 +102.086 +0.386519 +-2.89377 +0.222311 +7.51057e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..079abbc6ba3620d674d981988435d9862c094de9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta3.txt @@ -0,0 +1,10 @@ +-0.00184705 +6.98636 +0.0561314 +0.687561 +-0.296518 +174.964 +0.460882 +-4.09145 +0.213336 +0.000103354 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9d1e81da06958ea7915f9206817754870ea57e4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_bJets_eta4.txt @@ -0,0 +1,10 @@ +0.0109739 +6.02177 +0.0424557 +0.812251 +-0.121939 +217.198 +0.421104 +-4.26916 +0.213189 +1.20014e-05 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a65afbb2486752ea7a801c09f32648036e709e5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta1.txt @@ -0,0 +1,10 @@ +5.70888 +-0.0177622 +0.9171 +1.03688e-09 +0.108145 +8.71829e-14 +13.9756 +-0.0492207 +10.2439 +0.168606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d2a20e3bc75df753726d65ca031e0f695b60bea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta2.txt @@ -0,0 +1,10 @@ +10.5363 +0.0384147 +0.0110815 +0.260603 +0.612646 +0.0400015 +6.99759 +-0.00286044 +6.2565 +0.0573606 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta3.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..648ee7bf4da53f98367648a87674074a0e80131c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_gluon_eta4.txt @@ -0,0 +1,10 @@ +15.4975 +0.0599086 +2.37372 +0.168409 +1.77669 +0.0160153 +10.5462 +-0.00294065 +10.8587 +0.0406823 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbf18d899f99aa173bed90290157c1c5db738d5f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta1.txt @@ -0,0 +1,10 @@ +0.000333966 +0.643768 +0.064171 +0.458461 +0.031802 +25.3972 +0.352395 +-2.80026 +0.224978 +0.000263489 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead4fcf45fc55241b736c7486bf0024377b0cc58 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta2.txt @@ -0,0 +1,10 @@ +-0.00859865 +1.08563 +0.0471174 +0.702792 +-0.0876056 +46.0504 +0.5018 +-4.48954 +0.200929 +0.000418553 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d9bf645d0649c58ed09862df7acaf39e744f54b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta3.txt @@ -0,0 +1,10 @@ +4.51875e-05 +1.16357 +0.0722839 +0.59364 +-0.165653 +77.6661 +0.594011 +-6.04096 +0.186881 +0.000408546 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa7375e3bcdb9cbd2e81d7584b155fda57e94f54 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_lJets_eta4.txt @@ -0,0 +1,10 @@ +0.0186284 +-1.46522 +0.042013 +0.887257 +-0.0960286 +107.112 +0.516533 +-6.04437 +0.193078 +0.000158566 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145b0118f6d758fc512bfa153dcb1dd558c17650 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta1.txt @@ -0,0 +1,10 @@ +0.0638905 +0.00099101 +0.122283 +0.00811736 +0.0809538 +3.99525e-13 +1.73586 +-0.00913178 +1.09186 +0.0374252 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfd4116b6aa7ebaf762a0e7375e7cd6b697b630 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta2.txt @@ -0,0 +1,10 @@ +0.492762 +-0.00325367 +0.247994 +0.0061249 +0.156081 +1.68648e-13 +2.82227 +0.00166837 +1.91903 +0.0473027 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta3.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe239b86f255cd120ceb42aead0b84882630f5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_energy_photon_eta4.txt @@ -0,0 +1,10 @@ +0.348351 +-0.000888768 +0.230715 +0.00586729 +0.118251 +1.53777e-15 +9.06358 +-0.0155434 +2.33885 +0.0333535 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..434d7c00ec2b64323cce56a3b2d52dc69f0e7a0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta1.txt @@ -0,0 +1 @@ +0.0366589 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf026df413130768796e7086820d634ca540e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta2.txt @@ -0,0 +1 @@ +0.0293887 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta3.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3bf2d0d90d8b08e87b46c2904c7a35357082d4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_bJets_eta4.txt @@ -0,0 +1 @@ +0.0269913 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d7aa43ad2daf1d200e318d8a3840a4b4362e40 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta1.txt @@ -0,0 +1 @@ +0.0367427 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb29efef8c3929addae6e472f3486165dac8290 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta2.txt @@ -0,0 +1 @@ +0.029579 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta3.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e94651dad7f2a71e20839a06b4fded98a12e61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_eta_lJets_eta4.txt @@ -0,0 +1 @@ +0.0264199 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_misset.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_misset.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0320d6879547ac13de0ad829b617b8f953b04a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_misset.txt @@ -0,0 +1,4 @@ +-86.267 +219.474 +0.00030 +667.455 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8294cde858b664e6f5be7f5e1886942410f4a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta1.txt @@ -0,0 +1 @@ +0.0238451 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3708013ef1bd0e1a550081c7ad4037a4c6f31af4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta2.txt @@ -0,0 +1 @@ +0.0241915 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta3.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee569b8d8923f6dae9f515908ee164ebfc41d2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_bJets_eta4.txt @@ -0,0 +1 @@ +0.0227963 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta1.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b55ab113d5b904407564acd518570aa88ef9f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta1.txt @@ -0,0 +1 @@ +0.0244004 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta2.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8d853c79be538e2c2148c052c66fb166491db2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta2.txt @@ -0,0 +1 @@ +0.02426 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta3.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta3.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta4.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfd52074411270442f9b07a60eb30ca27c87f4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/par_phi_lJets_eta4.txt @@ -0,0 +1 @@ +0.022925 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/summary.txt b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..7403f61822e14eba5edcb3957e1f610bb63bbd6e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/data/transferfunctions/8TeV/ttbar/mc12_LCJets_v1/summary.txt @@ -0,0 +1,5 @@ +MC12 +used +mc12_8TeV.105200.McAtNloJimmy_CT10_ttbar_LeptonFilter.merge.NTUP_TOP.e1193_s1469_s1470_r3542_r3549_p1269/ +with +TopRootCoreRelease-12-01-06 diff --git a/PhysicsAnalysis/TopPhys/KLFitter/doc/Doxyfile b/PhysicsAnalysis/TopPhys/KLFitter/doc/Doxyfile new file mode 100644 index 0000000000000000000000000000000000000000..d3cf255f81345cf544696febcc988bb6a470fd6f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/doc/Doxyfile @@ -0,0 +1,1562 @@ +# Doxyfile 1.6.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = KLFitter + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 1.3 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = /work/kkroeni/development/KLFitter2_20091203/KLFitter2/doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = /Users/dimitri/doxygen/mail/1.5.7/doxywizard/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set +# FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /work/kkroeni/development/KLFitter2_20091203/KLFitter2/include + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# If the HTML_TIMESTAMP tag is set to YES then the generated HTML +# documentation will contain the timesstamp. + +HTML_TIMESTAMP = NO + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# When the SEARCHENGINE tag is enable doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) +# there is already a search function so this one should typically +# be disabled. + +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/PhysicsAnalysis/TopPhys/KLFitter/doc/ExampleCode.C b/PhysicsAnalysis/TopPhys/KLFitter/doc/ExampleCode.C new file mode 100644 index 0000000000000000000000000000000000000000..de5930b531b5c8594461496a59dc73463095fe16 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/doc/ExampleCode.C @@ -0,0 +1,138 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +//////////////////////// +// include these headers +//////////////////////// +#include "Fitter.h" +#include "DetectorAtlas_7TeV.h" +#include "LikelihoodBase.h" +#include "LikelihoodTopLeptonJets.h" +#include "PhysicsConstants.h" +#include "Particles.h" +#include "Permutations.h" +#include "TLorentzVector.h" + +/////////////////////////// +// before the event loop do +/////////////////////////// + +// create an instance of the fitter +KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + +// create an instance of the detector, which holds the information on the resolutions (transfer functions); +// it takes as an argument the folder which contains the parameter files for the transfer functions +KLFitter::DetectorBase * myDetector = new KLFitter::DetectorAtlas_7TeV("<path to transferfunctions/7TeV/ttbar/mc10b>"); + +// tell the fitter which detector to use +if (!myFitter->SetDetector(myDetector)) + return 0; + +// create an instance of the likelihood for ttbar->l+jets channel and customize it according to your needs +// +// DISCLAIMER: THE CUSTOMIZATION GIVEN HERE IS JUST AN EXAMPLE +// YOU NEED TO ADAPT IT TO WHAT YOU NEED FOR YOUR ANALYSIS +// +KLFitter::LikelihoodTopLeptonJets * myLikelihood = new KLFitter::LikelihoodTopLeptonJets(); +// set the lepton type for the hypothesis to be tested by the fitter +// kElectron or kMuon +myLikelihood->SetLeptonType(KLFitter::LikelihoodTopLeptonJets::kElectron); +// if true: the top mass is constrained to the Breit-Wigner distribution around a fixed top mass value +myLikelihood->SetFlagTopMassFixed(false); +// set the central value for the fixed top mass for the case SetFlagTopMassFixed == true +myLikelihood->PhysicsConstants()->SetMassTop(172.5); + +// use a b-tagging information to constrain the number of permutations +// b-tagging settings: ( kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) +// - kNotag = don't use b-tagging information +// - kVeto = use the b-tagging veto +// - kWorkingPoint = use the b-tagging probabilites from a given working point +myLikelihood -> SetBTagging(KLFitter::LikelihoodBase::kNotag); + +// tell the fitter which likelihood to use +myFitter->SetLikelihood(myLikelihood); + +//////////////////////// +// in the event loop do +//////////////////////// + +// create an instance of the particles class filled with the particles to be fitted; +// here, you need to make sure that +// - the particles are in the range allowed by the transfer functions (eta and pt) +// - the energies and momenta are in GeV +// - be aware that *all* particles you're adding are considered in the fit +// (many particles lead to many permutations to be considered and hence a long +// running time and not necessarily good fitting results due to the many available +// permutations) +// the arguments taken py AddParticle() are +// - TLorentzVector of the physics 4-momentum +// - detector eta for the evaluation of the transfer functions (for muons: just use the physics eta) +// - type of particle +// - an optional name of the particle (pass empty string in case you don't want to give your particle a name) +// - index of the particle in your original collection (for convenience) +// - for jets: +// * bool isBtagged : mandatory only if you want to use b-tagging in the fit +// * double b-tagging efficiency for the given jet : mandatory only if you want to use the b-tagging option kWorkingPoint +// * double b-tagging rejection for the given jet : mandatory only if you want to use the b-tagging option kWorkingPoint +KLFitter::Particles * myParticles = new KLFitter::Particles(); +// add all jets like this (|eta| may not exceed 2.5): +TLorentzVector * vJet = new TLorentzVector((*Jet_Px)[iJet], (*Jet_Py)[iJet], (*Jet_Pz)[iJet], (*Jet_E)[iJet])); +myParticles->AddParticle(vJet, (*Jet_DetEta)[iJet], KLFitter::Particles::kParton, "", iJet, isBtagged, bTaggingEffiency, bTaggingRejection); +// add all electrons like this (|eta| may not exceed 2.5): +TLorentzVector * vElectron = new TLorentzVector((*Electron_Px)[iElectron], (*Electron_Py)[iElectron], (*Electron_Pz)[iElectron], (*Electron_E)[iElectron])); +myParticles->AddParticle(vElectron, (*Electron_DetEta)[iElectron], KLFitter::Particles::kElectron, "", iElectron); +// add all muons like this (|eta| may not exceed 2.5): +TLorentzVector * vMuon = new TLorentzVector((*Muon_Px)[iMuon], (*Muon_Py)[iMuon], (*Muon_Pz)[iMuon], (*Muon_E)[iMuon]); +myParticles->AddParticle(vMuon, (*Muon_Eta)[iMuon], KLFitter::Particles::kMuon, "", iMuon); + +//Don't forget to free memory !! +delete vJet; +delete vElectron; +delete vMuon; + +// check that there are at least 4 jets +if (myParticles->NPartons() < 4) + continue; +// for the electron hypothesis check that there is exactly one electron and no muon; +// (for the muon hypothesis require one muon and no electron) +if (myParticles->NElectrons() != 1 && myParticles->NMuons() != 0) + continue; + +// add the particles to the fitter +if (!myFitter->SetParticles(myParticles)) + return 0; + +// add the MET x and y components as well as the SumET to the fitter +if (!myFitter->SetET_miss_XY_SumET(MET_Etx, MET_Ety, MET_SumEt)) + return 0; + +// loop over all permutations +for (int iPerm = 0, nPerms(myFitter->Permutations()->NPermutations()); iPerm < nPerms; ++iPerm) { + // perform the fit + myFitter->Fit(iPerm); + + // get the output from the fitter: + // - the model particles + KLFitter::Particles * myModelParticles = myFitter->Likelihood()->ParticlesModel(); + // a bit word with potential problems of the convergence of the fit + // - the bit masks are defined in the Fitter class: + // * MinuitDidNotConvergeMask - Minuit fit did not converge + // * FitAbortedDueToNaNMask - fit was aborted due to a not-a-number value during the fit (typically remove it) + // * AtLeastOneFitParameterAtItsLimitMask - fit converged, but at least one parameter is at its allowed limit (typically keep it) + // * InvalidTransferFunctionAtConvergenceMask - invalid use of the transfer functions at the convergence point (typically remove it) + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + // in order to check if a certain had a specific problem, just check the bit mask as in this example: + bool MinuitDidNotConverge = (ConvergenceStatusBitWord & Fitter->MinuitDidNotConvergeMask) != 0; + // etc. + // get the log(likelihood) value from the fit + double LogLikelihood = myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()); + // get the event probability from the fit + // (it's NOT normalized, yet - you need to normalize it to unity as soon as all permutations have been fitted!) + double EventProbability = exp(myFitter->Likelihood()->LogEventProbability()); + // get the fit parameters + std::vector<double> Parameters = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParameterErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + } +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/doc/README b/PhysicsAnalysis/TopPhys/KLFitter/doc/README new file mode 100644 index 0000000000000000000000000000000000000000..f0e82e4f0bf4ae73eb78b0aa3921e37e6404b1da --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/doc/README @@ -0,0 +1,250 @@ +=========================================================== +KLFitter +=========================================================== + +Authors: Kevin Kroeninger, University of Goettingen + Johannes Erdmann, University of Goettingen + Olaf Nackenhorst, University of Goettingen +Email: kevin.kroeninger *AT* phys.uni-goettingen.de, + johannes.erdmann *AT* phys.uni-goettingen.de + olaf.nackenhorst *AT* phys.uni-goettingen.de +Version: 1.4 +Date: 23.02.2011 + +=========================================================== + +Outline: +-------- + +1. Purpose / motivation +2. Installation +3. Class structure +4. The fitting procedure +5. Using the KLFitter +6. How to run KLFitter - an example + + +1. Purpose / motivation +----------------------- + +The K(inematic)L(ikelihood)Fitter is a library for kinematic fitting +using a likelihood approach. It is primarily developed for the case of +top quark reconstruction, but it can be easily modified to fit other +processes. KLFitter is experiment independent in a sense that +different experiments can be parameterized. + + +2.Installation +-------------- + +2.1 Dependencies +---------------- + +KLFitter depends on ROOT and the BAT library. BAT can be obtained +from the following web page: + +http://www.mppmu.mpg.de/bat/ + +Please read the instructions on +how to install and run BAT. + +2.2 Installation +---------------- + +The installation procedure is simple: + +* Check out the latest KLFitter tag from SVN: + "svn co $SVNGRP/Institutes/Goettingen/KLFitter/KLFitter-<latest-tag> KLFitter" +* Change to the KLFitter directory +* Make sure that the environment variable $BATINSTALLDIR is correctly defined +* Compile the KLFitter library - this will produce the *standard* library (classes in the + folder 'library') you can use in your analysis + "make" +* Several additional classes are available from an additional library (classes in the + folder 'extras'), which you need in particular to run the provided examples: + "make extras" + +In order to run the ttbar lepton+jets example on a D3PD ntuple do the following: + +* Change into the KLFitter/examples/top_ljets +* Compile the example: + "make" +* Source the setup file: + "source setup.sh" +* Define your input files in input.txt +* Configure config.conf depending on the run options you would like to use +* Run the example over 100 events: + "./runKLFitter.exe 0 100" + + +3. Class structure +------------------ + +The KLFitter package is build in a modular way so as to allow the +implementation of different physics processes and parameterizations of +the detector response. All classes live in the "KLFitter" namespace. The +class structure is as follows: + +The central class is "Fitter". It contains objects which describe the +detector (an instance of "DetectorBase"), the input particles (an +instance of "Particles") and the likelihood (an instance of +"LikelihoodBase"). An additional object, an instance of +"Permutations", helps to manage the possible permutations of jets to +quarks, and leptons. + +The DetectorBase class summarizes the detector information. It +contains several objects (instances of "ResolutionBase") describing +the parameterizastion of, e.g., energy resolutions for different +particle types. The description of a detector should be done by +creating a class which inherits from DetectorBase. The resolution +objects can be created by additional classes which inherit from +ResolutionBase. An example exists for a dummy detector with Gaussian +energy resolutions. + +The Particle class holds containers for different types of particles, +partons (a common class for all quarks and gluons), electron, muons, taus, +neutrinos, photons and boson (a common class for photons and W/Z +bosons). Parton-level or reconstructed particles can be described +here. + +The actual fitting procedure is done in the LikelihoodBase class. This +class inherits from the BAT BCModel class. In order to implement a new +process, the user has to create a class which inherits from +LikelihoodBase. The user has to define the parameters of the fit and +the likelihood itself. One example is the LikelihoodTopLeptonJets class for l+jets ttbar channel. + + +4. The fitting procedure +------------------------ + +4.1 The likelihood +------------------ + +The KLFitter is based on a likelihood approach. The likelihood +function has to be specified separately for each process. It can +consist of any function defined by the user. Typically, it is the +product of some parameterization of the energy resolution of the +measured jets and leptons, and functions describing the physics +process, such as Breit-Wigner functions, matrix elements, etc. + +#In case of semileptonic ttbar events, the likelihood is the product of +#four quark energy resolution functions, four quark eta/phi resolution +#functions one lepton energy resolution function, neutrino pT resolution +#function and the Breit-Wigner functions of the W boson masses. Optionally, +#the Breit-Wigner functions of the top quarks can be used either with a free +#or a fixed top pole mass parameter. + +In case of semileptonic ttbar events, the likelihood is the product of +four quark energy resolution functions, one lepton energy resolution function, +neutrino pT resolution function and the Breit-Wigner functions of the W boson +masses. Optionally, the Breit-Wigner functions of the top quarks can be used +either with a free or a fixed top pole mass parameter. + +In this example, the parameters which are estimated are: +a) the energies of the four jets +b) the energy of the charged lepton +c) the x,y,z-components of the neutrino momentum +d) optionally, the top pole mass parameter + +This likelihood is implemented in the class LikelihoodTopLeptonJets. + +There is an extended version implemented in the class +LikelihoodTopLeptonJets_JetAngles, which also fits the angular +variables of the jets. Resolutions functions are multiplied to the +likelihood for eta and phi of the jets and there are, hence, eight +additional parameters which are estimated in the fit. +Please note that this likelihood is about a factor of two slower +compared to the simpler LikelihoodTopLeptonJets, because a lot of +trignometric functions need to be evaluated in each call of the +likelihood. + +Other parameters can easily be added. + +4.2 Optimization +---------------- + +Optimization is done using the methods provided by BAT. By default, +the optimization method used is TMinuit. + +4.3 Marginalization +------------------- + +Marginalization is done using the methods provided by BAT. By default, +this method is Markov Chain Monte Carlo. + +4.4 Default analysis +-------------------- + +In the default analysis a Markov chain is run to coarsly sample the +parameter space and locate a global maximum. Minuit is then used to +find the maximum with a greater precision. + + +5. Using the KLFitter +--------------------- + +5.1 Setting the measured quantities +----------------------------------- + +The measured quantities are the 4-vectors of four jets and one charged +lepton, as well as the missing transverse energy. An object of type +Particles is passed to the Fitter object. The input quantities can +either be set by defining TLorentzVectors and adding them to Particles +object, or by using an interface. An example for a Root interface exists +which reads the data from a flat Root tree. + +5.2 Combinatorics +----------------- + +The association of jets with partons and of reconstructed and parton +level leptons leads to several possible combinations. The class +Permutations calculates a table with all possible permutations. A +specific combination (index) can be set by the user, + +int KLFitter::Permutations::SetPermutation(int index). + +In case interchanging two (or three) particles leaves the likelihood +invariant two (three) indices can be defined which are interchangeable +(for example for hadronically decaying W bosons). The corresponding +permutations are removed from the table. The indices can be set via + +int InvariantPartonPermutations(int index1, int index2, int index3 = -1). + +5.3 Output +---------- + +The output in the provided examples comes in form of a ROOT file which contains the following +trees: + +* TreeMeasured | the measured particles. +* TreeSelected | the particles selected for the fitting. +* TreeModel | the model particles (e.g., including also the top quark. + | and other intermediate particles). +* TreeTruth | the Monte Carlo truth information (if avialable). +* TreeMap | maps containing the mapping between the measured and the selected particles. + +The TreeModel contains the results from the fit. The most important +stored variables are: + +* EventNumber | the event number. +* N_permutations | the number of permutations. +* best_permutation[N_permutations] | a list of indices ordered by the EventProbability. The + | best permutation has the index best_permutation[0], etc. +* EventProbability[N_permutations] | the event probability for each permutation. +* LogLikelihood[N_permutations] | the log Likelihood for each permutation. +* ConvergenceStatusBit[N_permutations] | the convergence status bit word for each permutation. +* x_E[N_permutations], x_pt, ... | x is a particle known in the model (i.e., initial state + | or intermediate particle, etc.). The _E, ... describe + | the kinematics for each permutation. +* par_x[N_permutations] | x is the best fit parameter for each permutation. +* parerr_x[N_permutations] | x is the estimated uncertainty on the best fit + | parameter for each permutation. + +6. How to run KLFitter - an example +----------------------------------- + +A example on how to use the KLFitter library is provided: ExampleCode.C. +The example is extensively commented. However, it is kept "minimal" in order to +briefly show the necessary steps to get the KLFitter running in your analysis. +It will hence not run out-of-the-box itself (for working example consult the example +directory). So, just go ahead and try it in your own analysis code. diff --git a/PhysicsAnalysis/TopPhys/KLFitter/doc/udhistos.root b/PhysicsAnalysis/TopPhys/KLFitter/doc/udhistos.root new file mode 100644 index 0000000000000000000000000000000000000000..8e4f17001da43d4765d70fe6015b337b0ade823d Binary files /dev/null and b/PhysicsAnalysis/TopPhys/KLFitter/doc/udhistos.root differ diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/config.conf b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/config.conf new file mode 100644 index 0000000000000000000000000000000000000000..d35927ca13933faa329c03a50c862feceea63333 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/config.conf @@ -0,0 +1,11 @@ +BTaggingMethod = VetoNoFit # Notag,Veto,VetoNoFit,WorkingPoint +CutBTagging = 0.601713 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input.txt +PathToOutputFile = out.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/input.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/input.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e90bd07c0c49db93c8a4fc5742388466b4a0094 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/input.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/a/adomeit/public/KLFitter/allhadronic.root \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/loader.C b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/loader.C new file mode 100644 index 0000000000000000000000000000000000000000..268d9e73cc815ba2ba7552b1d57d61b2d8d89b57 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/loader.C @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// File loader.C +#include <vector> +#ifdef __MAKECINT__ +#pragma link C++ class vector<vector<double> >+; +#pragma link C++ class vector<vector<int> >+; +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/runKLFitter.cxx b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/runKLFitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8016fe9b8b684ca9f48b9f86ed9c71e2bdc1a75e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_allhadronic/runKLFitter.cxx @@ -0,0 +1,403 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_Allhadronic.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput_Allhadronic.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopAllHadronic.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("config.conf", &valid); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_Allhadronic(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.497, 988.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + myDetector = new KLFitter::DetectorAtlas_7TeV("../../data/transferfunctions/7TeV/ttbar/mc11c"); + else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + myDetector = new KLFitter::DetectorAtlas_10TeV("../../data/transferfunctions/10TeV/ttbar"); + else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + + // create likelihood for ttbar->allhadronic channel + KLFitter::LikelihoodTopAllHadronic * myLikelihood = new KLFitter::LikelihoodTopAllHadronic(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput_Allhadronic * myInterfaceOutput = new KLFitter::InterfaceOutput_Allhadronic(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 6, -1); + + mySelectionTool -> SetMaxNJetsForFit(6); + mySelectionTool -> RequireNElectronsPt(20.0, 0); + mySelectionTool -> RequireNMuonsPt(20.0, 0); +// mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles)) + continue; + + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // check if there are more than two b-tagged jets if we're running in the kVetoNoFit mode + if(Btagmethod == KLFitter::LikelihoodTopAllHadronic::kVetoNoFit) + { + int nPartons = particles->NPartons(); + int nbTags = 0; + for (int iParton(0); iParton < nPartons; ++iParton) + { + if (particles->IsBTagged(iParton)) nbTags++; + } + //std::cout << nbTags << std::endl; + if (nbTags > 2 ) + continue; + } + + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + + + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + std::vector<int> v4 = myMatchingTool->ListMatchedTruth(4, KLFitter::Particles::kParton); + std::vector<int> v5 = myMatchingTool->ListMatchedTruth(5, KLFitter::Particles::kParton); + } + + + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) + { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark1| hadronic b quark2 | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | light quark 3 | light quark 4 | light quark | light quark |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E(), + InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E(), + OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | parBhad1E |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopAllHadronic::parTopM],ParErrors[KLFitter::LikelihoodTopAllHadronic::parTopM], + Par[KLFitter::LikelihoodTopAllHadronic::parBhad1E],ParErrors[KLFitter::LikelihoodTopAllHadronic::parBhad1E]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) + { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + countJMatch++; + } + } + + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + if (FlagWriteSignalMCTruth) + { + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (nTruthElectrons != 0) + return false; + if (nTruthMuons != 0) + return false; + if (nTruthTaus != 0) + return false; + + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=8) return false; + + return true; + +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/config.conf b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/config.conf new file mode 100644 index 0000000000000000000000000000000000000000..eedb0f03bcd65a0edb235f86dfa96cf8923ac205 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/config.conf @@ -0,0 +1,22 @@ +## electron or muon (dilepton) +LeptonType1 electron +LeptonType2 electron + +## Notag,Veto,VetoLight,VetoBoth,VetoNoFit,VetoNoFitLight,VetoNoFitBoth,WorkingPoint +BTaggingMethod WorkingPoint +CutBTagging 0.601713 + +FlagTopMassFixed 0 +TopPoleMass 172.5 + +## 7 or 10 +BeamCMEnergy 7 + +FlagIntegrate 0 +FlagWriteSignalMCTruth 1 +FlagTruthSel 1 +FlagSumloglik 0 + +PathToInputFile input_ee.txt +PathToOutputFile output.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_ee.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_ee.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bf649a5002a45f95be37d4e0c5311fa4e56785 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_ee.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/ee.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_em.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_em.txt new file mode 100644 index 0000000000000000000000000000000000000000..71bbb41b4b47a6f80b050b3f4389a4e593fd212b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_em.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/em.root \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_mm.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_mm.txt new file mode 100644 index 0000000000000000000000000000000000000000..405a3e5b3e499dac0f9f76081e4bb11a13c92272 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/input_mm.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/t/tvazquez/public/KLFitter/dilepton_example/mm.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/loader.C b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/loader.C new file mode 100644 index 0000000000000000000000000000000000000000..268d9e73cc815ba2ba7552b1d57d61b2d8d89b57 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/loader.C @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// File loader.C +#include <vector> +#ifdef __MAKECINT__ +#pragma link C++ class vector<vector<double> >+; +#pragma link C++ class vector<vector<int> >+; +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/runKLFitter.cxx b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/runKLFitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9275bf48f2aef17da9bfe413f450627921e5be9c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_dilepton/runKLFitter.cxx @@ -0,0 +1,637 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include <exception> + + +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_dilepton.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput_dilepton.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopDilepton.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/readparameters.h" + +#include "BAT/BCModel.h" +#include "BAT/BCH1D.h" +#include "BAT/BCParameter.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopDilepton::LeptonType Lepton1, KLFitter::LikelihoodTopDilepton::LeptonType Lepton2); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + char* paramfile = argv[1]; + // parameters (1st: config_file, 2nd: 'first event', 3rd: 'last event - 1' + if (argc!=4) { // i.e. 3 parameters ... + std::cout << "number of parameters is unequal 3. Usage: ./runKLFitter.exe [config] [first-event] [last-event]" << std::endl; + return 1; + } + + ///// read configurating + + //auxiliar parameters + std::string tmp_Lepton1, tmp_Lepton2, tmp_Btagmethod; + int tmp_BeamEnergy; + + // parameters to read + KLFitter::LikelihoodTopDilepton::LeptonType Lepton1(KLFitter::LikelihoodTopDilepton::kElectron); + KLFitter::LikelihoodTopDilepton::LeptonType Lepton2(KLFitter::LikelihoodTopDilepton::kElectron); + bool FlagIntegrate; + bool FlagTopMassFixed; + bool FlagWriteSignalMCTruth; + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy; + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod; + double CutBTagging; + double MassTop; + std::string input_file; + std::string output_file; + bool FlagTruthSel; + bool FlagSumloglik; + + try { + readparameters rp(paramfile); + + tmp_Lepton1 = rp.get<std::string>("LeptonType1"); + tmp_Lepton2 = rp.get<std::string>("LeptonType2"); + FlagIntegrate = rp.get<bool>("FlagIntegrate"); + FlagTopMassFixed = rp.get<bool>("FlagTopMassFixed"); + FlagWriteSignalMCTruth = rp.get<bool>("FlagWriteSignalMCTruth"); + tmp_BeamEnergy = rp.get<int>("BeamCMEnergy"); + tmp_Btagmethod = rp.get<std::string>("BTaggingMethod"); + CutBTagging = rp.get<double>("CutBTagging"); + MassTop = rp.get<double>("TopPoleMass"); + input_file = rp.get<std::string>("PathToInputFile"); + output_file = rp.get<std::string>("PathToOutputFile"); + FlagTruthSel = rp.get<bool>("FlagTruthSel"); + FlagSumloglik = rp.get<bool>("FlagSumloglik"); + } + catch (std::exception& e) { + std::cerr<<e.what()<<std::endl; + return 0; + } + + // LeptonTypes 1 & 2 + if (tmp_Lepton1 == "electron") + Lepton1 = KLFitter::LikelihoodTopDilepton::kElectron; + else if (tmp_Lepton1 == "muon") + Lepton1 = KLFitter::LikelihoodTopDilepton::kMuon; + + if (tmp_Lepton2 == "electron") + Lepton2 = KLFitter::LikelihoodTopDilepton::kElectron; + else if (tmp_Lepton2 == "muon") + Lepton2 = KLFitter::LikelihoodTopDilepton::kMuon; + + // BeamEnergy + if(tmp_BeamEnergy==7) + BeamEnergy=KLFitter::DetectorBase::k7TeV; + if(tmp_BeamEnergy==10) + BeamEnergy=KLFitter::DetectorBase::k10TeV; + + // Btagmethod + if(tmp_Btagmethod == "Notag") + Btagmethod=KLFitter::LikelihoodBase::kNotag; + if(tmp_Btagmethod == "Veto") + Btagmethod=KLFitter::LikelihoodBase::kVeto; + if(tmp_Btagmethod == "VetoNoFit") + Btagmethod=KLFitter::LikelihoodBase::kVetoNoFit; + if(tmp_Btagmethod == "WorkingPoint") + Btagmethod=KLFitter::LikelihoodBase::kWorkingPoint; + + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // set minimization method to MCMC + myFitter->SetMinimizationMethod(KLFitter::Fitter::kSimulatedAnnealing); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_dilepton(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + myDetector = new KLFitter::DetectorAtlas_7TeV("../../transferfunctions/7TeV/ttbar/mc11c"); + else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + myDetector = new KLFitter::DetectorAtlas_10TeV("../../transferfunctions/10TeV/ttbar"); + else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + + /////////////////////////////////////////////////////////// + // sigma_nueta dependency on mtop (a + b*mtop) => push_back (a,b) + + std::vector<double> m_nu_params_ee; + std::vector<double> m_nu_params_emu; + std::vector<double> m_nu_params_mumu; + + m_nu_params_ee.push_back(1.207); + m_nu_params_ee.push_back(-2.4e-04); + + m_nu_params_emu.push_back(1.438); + m_nu_params_emu.push_back(-8.55e-04); + + m_nu_params_mumu.push_back(1.295); + m_nu_params_mumu.push_back(-4.00e-04); + /////////////////////////////////////////////////////////// + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopDilepton * myLikelihood = new KLFitter::LikelihoodTopDilepton(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << "in the ee channel" << std::endl; + myLikelihood -> SetLeptonType(1,1); // ee channel + myLikelihood -> SetEtaNuParams(m_nu_params_ee); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << "in the emu channel" << std::endl; + myLikelihood -> SetLeptonType(1,2); // emu channel + myLikelihood -> SetEtaNuParams(m_nu_params_emu); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << "in the mumu channel" << std::endl; + myLikelihood -> SetLeptonType(2,2); // mumu channel + myLikelihood -> SetEtaNuParams(m_nu_params_mumu); + } + else + std::cout << "Error: SetLeptonType1/2 wrong! check lepton types in config..." << std::endl; + + //if flag true, set "sumloglikelihood" option, instead of the default "bestpermutation" one + myLikelihood -> SetDoSumLogLik(FlagSumloglik); + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput_dilepton * myInterfaceOutput = new KLFitter::InterfaceOutput_dilepton(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 2, -1); // dilepton case +// mySelectionTool -> RequireNBJets(0.601713, 2, 0); // optional + + + mySelectionTool -> SetMaxNJetsForFit(2); // dilepton case (can be set to >2) + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + mySelectionTool -> RequireNElectronsPt(20.0, 2); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + mySelectionTool -> RequireNElectronsPt(20.0, 1); + mySelectionTool -> RequireNMuonsPt(20.0, 1); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + mySelectionTool -> RequireNMuonsPt(20.0, 2); + } + + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[2]).Atoi(); + int maxEv = TString(argv[3]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton1, Lepton2)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())){ + //std::cout << "*** event did not pass selection -> check! ***" << std::endl; + continue; + } + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add truth particles to fitter + if (FlagWriteSignalMCTruth) + if (!myFitter -> SetMyParticlesTruth(truthparticles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + } + + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + double inputE_lep1(0.); + double inputE_lep2(0.); + double outputE_lep1(0.); + double outputE_lep2(0.); + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + inputE_lep1 = InputParticles->Electron(0)->E(); + inputE_lep2 = InputParticles->Electron(1)->E(); + outputE_lep1 = OutputParticles->Electron(0)->E(); + outputE_lep2 = OutputParticles->Electron(1)->E(); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + inputE_lep1 = InputParticles->Electron(0)->E(); + inputE_lep2 = InputParticles->Muon(0)->E(); + outputE_lep1 = OutputParticles->Electron(0)->E(); + outputE_lep2 = OutputParticles->Muon(0)->E(); + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + inputE_lep1 = InputParticles->Muon(0)->E(); + inputE_lep2 = InputParticles->Muon(1)->E(); + outputE_lep1 = OutputParticles->Muon(0)->E(); + outputE_lep2 = OutputParticles->Muon(1)->E(); + } + + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | b1 quark | b2 quark | lepton 1 | lepton 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + inputE_lep1, inputE_lep2); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + outputE_lep1, outputE_lep2); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability |\n"); + printf("Fitting Variables | %16.2f | %17.2E |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()) ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Top Pole Mass | Nu Eta | AntiNu Eta |\n"); + printf("Fitting Variables | %16.2f | %16.2f | %16.2f |\n", + Par[KLFitter::LikelihoodTopDilepton::parTopM],Par[KLFitter::LikelihoodTopDilepton::parNuEta],Par[KLFitter::LikelihoodTopDilepton::parAntiNuEta]); + printf("----------------------------------------------------------------------------------------------\n"); + + std::vector<double> LHCompVec = myFitter->Likelihood()->LogLikelihoodComponents( myFitter->Likelihood()->GetBestFitParameters() ); + + std::cout << "LHComp(0)= " << LHCompVec.at(0) << " LHComp(1)= " << LHCompVec.at(1) << " LHComp(2)= " << LHCompVec.at(2) << + " LHComp(3)= " << LHCompVec.at(3) << " LHComp(4)= " << LHCompVec.at(4) << std::endl; + std::cout << "LHComp(5)= " << LHCompVec.at(5) << " LHComp(6)= " << LHCompVec.at(6) <<" LHComp(7)= " << LHCompVec.at(7) << std::endl; + + } + + // // example: get marginalized histogram wrt Par(0)==mtop if using kMarkovChainMC!! +// BCParameter * a = myFitter->Likelihood()->GetParameter(0); + +// if(myFitter->Likelihood()->GetMarginalized(a)){ +// if(myFitter->Likelihood()->GetMarginalized(a)->GetHistogram()->Integral() > 0){ +// TH1D* h_mtop_marginalized = (TH1D *)myFitter->Likelihood()->GetMarginalized(a)->GetHistogram(); +// } +// }//get marginalized + + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { // considering tops in Partons + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (muons) : " << mySelectionTool -> CounterMuons() << std::endl; + } + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + std::cout << " N (e matched) : " << countLMatch << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (e&mu matched) : " << countLMatch << std::endl; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + std::cout << " N (mu matched) : " << countLMatch << std::endl; + } + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopDilepton::LeptonType Lepton1, KLFitter::LikelihoodTopDilepton::LeptonType Lepton2) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kElectron){ + + // require exactly 2 truth electron + if (nTruthElectrons != 2) return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kElectron && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + // require exactly 1 truth electron + if (nTruthElectrons != 1) return false; + // require exactly 1 truth muon + if (nTruthMuons != 1) return false; + + // require no truth tau + if (nTruthTaus != 0) return false; + } + else if (Lepton1==KLFitter::LikelihoodTopDilepton::kMuon && Lepton2==KLFitter::LikelihoodTopDilepton::kMuon){ + // require exactly 2 truth muon + if (nTruthMuons != 2) return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 4 truth quarks (including the 2 tops) + if (nTruthPartons !=4) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchB1, int matchB2 + + // Match String to KLFitter Combinatorics + if (s == "0 1") return 0; + if (s == "1 0") return 1; + + return -1; + +} +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + + return s; +} +/////////////////////////////////////////////////////////// diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/config.conf b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/config.conf new file mode 100644 index 0000000000000000000000000000000000000000..1830db4224c3bd86dd10693064c1e03bd080a13a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/config.conf @@ -0,0 +1,12 @@ +LeptonType = electron # electron or muon +BTaggingMethod = WorkingPoint # Notag,Veto,VetoLight,VetoBoth,VetoNoFit,VetoNoFitLight,VetoNoFitBoth,WorkingPoint +CutBTagging = 0.601713 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = false +FlagTruthSel = false +PathToInputFile = input.txt +PathToOutputFile = output.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed59c579e007ea011e8381bcfa2742ec8f49cd50 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/el.root +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/mu.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input_full_el.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input_full_el.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/input_full_el.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/loader.C b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/loader.C new file mode 100644 index 0000000000000000000000000000000000000000..268d9e73cc815ba2ba7552b1d57d61b2d8d89b57 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/loader.C @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// File loader.C +#include <vector> +#ifdef __MAKECINT__ +#pragma link C++ class vector<vector<double> >+; +#pragma link C++ class vector<vector<int> >+; +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/runKLFitter.cxx b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/runKLFitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f037f01acf36a88ccd97dcac5ce885553add68ee --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets/runKLFitter.cxx @@ -0,0 +1,484 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_ljets.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("config.conf", &valid); + KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton = configReader->GetLeptonType(); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_ljets(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + myDetector = new KLFitter::DetectorAtlas_7TeV("../../data/transferfunctions/7TeV/ttbar/mc11c"); + else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + myDetector = new KLFitter::DetectorAtlas_10TeV("../../data/transferfunctions/10TeV/ttbar"); + else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopLeptonJets * myLikelihood = new KLFitter::LikelihoodTopLeptonJets(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 4, -1); +// mySelectionTool -> RequireNBJets(0.601713, 2, 0); + + + mySelectionTool -> SetMaxNJetsForFit(4); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + mySelectionTool -> RequireNElectronsPt(20.0, 1); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTopLeptonJets::parTopM], + Par[KLFitter::LikelihoodTopLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTopLeptonJets::parNuPz]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (muons ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (e matched) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (mu matched) : " << countLMatch << std::endl; + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + return s; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/config.conf b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/config.conf new file mode 100644 index 0000000000000000000000000000000000000000..4799cc91ad515d31cc4fe1233d990021e8f95cba --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/config.conf @@ -0,0 +1,13 @@ +LeptonType = electron # electron or muon +BTaggingMethod = WorkingPoint # Notag,Veto,WorkingPoint +CutBTagging = 3.00 +FlagTopMassFixed = false +TopPoleMass = 172.5 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input.txt +PathToOutputFile = output.root +LJetSeparationMethod = PermReweight # None, PermReweight + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input_full_el.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input_full_el.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e83b944e9e338120029dce70ad3caf3862c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/input_full_el.txt @@ -0,0 +1,2 @@ +/afs/cern.ch/user/b/blemmer/public/KLFitter/ljets_example/105200_el.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/loader.C b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/loader.C new file mode 100644 index 0000000000000000000000000000000000000000..268d9e73cc815ba2ba7552b1d57d61b2d8d89b57 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/loader.C @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// File loader.C +#include <vector> +#ifdef __MAKECINT__ +#pragma link C++ class vector<vector<double> >+; +#pragma link C++ class vector<vector<int> >+; +#endif diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/runKLFitter.cxx b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/runKLFitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7f57213d8d90e614085d299901e2b1d2c4da6219 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/top_ljets_udsep/runKLFitter.cxx @@ -0,0 +1,515 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_udsep.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTopLeptonJetsUDSep.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" +#include "TH1F.h" + + + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s);//int matchHadB, int matchLepB, int matchLJ1, int matchLJ2); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + + + + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1', 3rd: output file + if (argc!=4) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 3" << std::endl; + return 1; + } + + // read configurating + // KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("examples/top_ljets/config.conf"); + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("config.conf", &valid); + KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton = configReader->GetLeptonType(); + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + std::string input_file=configReader->GetInputPath(); +// std::string output_file=configReader->GetOutputPath(); + std::string output_file=argv[3]; + bool FlagTruthSel = configReader->GetFlagTruthSel(); + KLFitter::LikelihoodTopLeptonJetsUDSep::LJetSeparationMethod LJetSeparationMethod = configReader->GetLJetSeparationMethod(); + std::string dir_cache; //caching current root directory. Enables to read another root file for the histos in between + + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_udsep(); + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + myDetector = new KLFitter::DetectorAtlas_7TeV("../../data/transferfunctions/7TeV/ttbar/mc11b"); + else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + myDetector = new KLFitter::DetectorAtlas_10TeV("../../data/transferfunctions/10TeV/ttbar"); + else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbar->e+jets channel + KLFitter::LikelihoodTopLeptonJetsUDSep * myLikelihood = new KLFitter::LikelihoodTopLeptonJetsUDSep(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + // next block: u/d separation histograms + myLikelihood -> SetLJetSeparationMethod(LJetSeparationMethod); + TFile *udhistos = 0x0; + if (LJetSeparationMethod != KLFitter::LikelihoodTopLeptonJetsUDSep::kNone){ + dir_cache = gDirectory->GetPath(); + udhistos = new TFile("udhistos.root"); + gDirectory->cd(dir_cache.c_str()); + gDirectory->pwd(); + myLikelihood -> SetUpJetPtHisto((TH1F*)udhistos->Get("up_pt")->Clone()); + myLikelihood -> SetDownJetPtHisto((TH1F*)udhistos->Get("down_pt")->Clone()); + myLikelihood -> SetUpJetTagWeightHisto((TH1F*)udhistos->Get("up_MV1")->Clone()); + myLikelihood -> SetDownJetTagWeightHisto((TH1F*)udhistos->Get("down_MV1")->Clone()); + myLikelihood -> SetBJetPtHisto((TH1F*)udhistos->Get("b_pt")->Clone()); + myLikelihood -> SetBJetTagWeightHisto((TH1F*)udhistos->Get("b_MV1")->Clone()); + } + + // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kHerwig); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 4, -1); + + mySelectionTool -> SetMaxNJetsForFit(4); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + mySelectionTool -> RequireNElectronsPt(20.0, 1); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireMET(20.); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%1000 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); + // int trueCombi = GetCombinationNo(GetTrueCombinationString(v0, v1, v2, v3)); + + // // require the event to be matched + // if (trueCombi==-1) + // continue; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + myInterfaceOutput -> FillTreeModelPermutation(); + + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 |\n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), + InputParticles->Parton(2)->E(), InputParticles->Parton(3)->E() ); + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f |\n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), + OutputParticles->Parton(2)->E(), OutputParticles->Parton(3)->E() ); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz |\n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f |\n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTopLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTopLeptonJets::parTopM], + Par[KLFitter::LikelihoodTopLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTopLeptonJets::parNuPz]); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + + + } + + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + // check if the particles have been matched + if (myMatchingTool) + { + bool leptonsMatched = true; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron == 0) + leptonsMatched = false; + } + } + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon == 0) + leptonsMatched = false; + } + } + + if (!leptonsMatched) + continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 0; iQuark < truthparticles -> NPartons()-2; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " N (all) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (electrons) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (muons ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (jets) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (MET) : " << mySelectionTool -> CounterMET() << std::endl; + if (FlagWriteSignalMCTruth) + { + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) + std::cout << " N (e matched) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) + std::cout << " N (mu matched) : " << countLMatch << std::endl; + std::cout << " N (j matched) : " << countJMatch << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (udhistos) + delete udhistos; + if (myMatchingTool) + delete myMatchingTool; + + + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTopLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTopLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 6 truth quarks (including the 2 tops) + if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + return s; +} diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/config_ttH.conf b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/config_ttH.conf new file mode 100755 index 0000000000000000000000000000000000000000..8a385417633ff9702dfce859b7f114ee3b422dfd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/config_ttH.conf @@ -0,0 +1,14 @@ +LeptonType = electron # electron or muon +BTaggingMethod = Veto # Notag,Veto,WorkingPoint, kVetoBoth +CutBTagging = 0.601713 +FlagTopMassFixed = true +FlagHiggsMassFixed = false +TopPoleMass = 172.5 +HiggsMass = 125.0 +BeamCMEnergy = 7 # 7 or 10 +FlagIntegrate = false +FlagWriteSignalMCTruth = true +FlagTruthSel = true +PathToInputFile = input_ttH.txt +PathToOutputFile = output_ttH.root + diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/input_ttH.txt b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/input_ttH.txt new file mode 100755 index 0000000000000000000000000000000000000000..b9b15869fb6492de90b3a1007d4aa458ea1c7f2b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/input_ttH.txt @@ -0,0 +1 @@ +/afs/cern.ch/user/l/lserkin/public/KLFitter_files/el_ttH125.root diff --git a/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/runKLFitter_ttH.cxx b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/runKLFitter_ttH.cxx new file mode 100755 index 0000000000000000000000000000000000000000..8000aed968e1f36b006e24a8982f570bbfb5719a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/KLFitter/examples/ttH/runKLFitter_ttH.cxx @@ -0,0 +1,617 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <vector> +#include <set> +#include "KLFitter/Fitter.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/DetectorAtlas_7TeV.h" +#include "KLFitterExtras/DetectorAtlas_10TeV.h" +#include "KLFitterExtras/DetectorDummy.h" +#include "KLFitterExtras/InterfaceRoot.h" +#include "KLFitterExtras/InterfaceDummy.h" +#include "KLFitterExtras/InterfaceD3PD_ttH.h" +#include "KLFitter/Particles.h" +#include "KLFitter/Permutations.h" +#include "KLFitterExtras/InterfaceOutput.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/LikelihoodTTHLeptonJets.h" +#include "KLFitterExtras/MatchingTool.h" +#include "KLFitterExtras/SelectionTool.h" +#include "TString.h" +#include "TSystem.h" +#include "KLFitterExtras/ReadConfigFile.h" + +#include "TFile.h" + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton); +int GetCombinationNo(TString s); +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3); + + +int main(int argc, char **argv) +{ + bool valid=false; + // parameters (1st: 'first event', 2nd: 'last event - 1' + if (argc!=3) { // i.e. 2 parameters ... + std::cout << "number of parameters is unequal 2" << std::endl; + return 1; + } + + // read configurating + KLFitter::ReadConfigFile * configReader = new KLFitter::ReadConfigFile("config_ttH.conf", &valid); + KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton = (KLFitter::LikelihoodTTHLeptonJets::LeptonType) configReader->GetLeptonType(); + + bool FlagIntegrate = configReader->GetFlagIntegrate(); + bool FlagTopMassFixed = configReader->GetFlagTopMassFixed(); + bool FlagHiggsMassFixed = configReader->GetFlagHiggsMassFixed(); + bool FlagWriteSignalMCTruth = configReader->GetFlagWriteSignalMCTruth(); + KLFitter::DetectorBase::BeamCMEnergy BeamEnergy = configReader->GetBeamCMEnergy(); + KLFitter::LikelihoodBase::BtaggingMethod Btagmethod = configReader->GetBTaggingMethod(); + double CutBTagging = configReader->GetCutBTagging(); + double MassTop = configReader->GetTopMass(); + double MassHiggs = configReader->GetHiggsMass(); + std::string input_file=configReader->GetInputPath(); + std::string output_file=configReader->GetOutputPath(); + bool FlagTruthSel = configReader->GetFlagTruthSel(); + + delete configReader; + if(!valid){ return 0;}//std::cout<<"Error: InputPath=OutputPath. Will not overwrite InputFile!"<<std::endl;return 0;} + + //counters + unsigned int countLMatch = 0; + unsigned int countJMatch = 0; + unsigned int count_bfromH = 0; + unsigned int count_bbarfromH = 0; + unsigned int count_0bsfromH = 0; + unsigned int count_1bsfromH = 0; + unsigned int count_2bsfromH = 0; + unsigned int count_b_overlap = 0; + unsigned int count_bbar_overlap = 0; + unsigned int count_both_overlap = 0; + + // create new fitter + KLFitter::Fitter * myFitter = new KLFitter::Fitter(); + + // open Root file + KLFitter::InterfaceRoot * myInterfaceRoot = new KLFitter::InterfaceD3PD_ttH(); + + std::vector<std::string> inputfiles = myInterfaceRoot->ReadInputFiles(input_file.c_str()); + std::cout << "Input Files: " << std::endl; + for(unsigned int i=0; i<inputfiles.size(); i++) + std::cout << inputfiles.at(i) << std::endl; + myInterfaceRoot -> OpenRootFiles(inputfiles); + myInterfaceRoot -> SetBtaggingInformation(CutBTagging, 0.696, 134.); + + // create detector + KLFitter::DetectorBase * myDetector; + if (BeamEnergy==KLFitter::DetectorBase::k7TeV) + myDetector = new KLFitter::DetectorAtlas_7TeV("../../transferfunctions/7TeV/ttbar/mc11c"); // mc11c transfer functions + else if (BeamEnergy==KLFitter::DetectorBase::k10TeV) + myDetector = new KLFitter::DetectorAtlas_10TeV("../../transferfunctions/10TeV/ttbar"); + else{std::cout<<"Error: Detector could not be created, please check the transferfunction flags"<<std::endl;return 1;} + + if (!myFitter -> SetDetector(myDetector)) + return 0; + + // create likelihood for ttbarH->e+jets channel + KLFitter::LikelihoodTTHLeptonJets * myLikelihood = new KLFitter::LikelihoodTTHLeptonJets(); + myLikelihood -> PhysicsConstants() -> SetMassTop(MassTop); + myLikelihood -> PhysicsConstants() -> SetMassHiggs(MassHiggs); + + // Make sure to set btag rejection and efficiency if btagging set to a working + myLikelihood -> SetBTagging(Btagmethod); // b-tagging settings: (kNotag/kVeto/kWorkingPoint, TaggerCutValue, efficiency[0,1], rejection[>1]) + + myLikelihood -> SetFlagIntegrate(FlagIntegrate); + myLikelihood -> SetFlagTopMassFixed(FlagTopMassFixed); + myLikelihood -> SetFlagHiggsMassFixed(FlagHiggsMassFixed); + + myInterfaceRoot -> WriteSignalMCTruth(FlagWriteSignalMCTruth, KLFitter::InterfaceRoot::kAcer); // hack to pick Pythia mathing + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + myLikelihood -> SetLeptonType(1); // set lepton type to electron + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + myLikelihood -> SetLeptonType(2); // set lepton type to muon + + if (!myFitter -> SetLikelihood(myLikelihood)) + return 0; + + // create interface for output + KLFitter::InterfaceOutput * myInterfaceOutput = new KLFitter::InterfaceOutput(); + + // open Root file + if (!myInterfaceOutput -> OpenRootFile(output_file.c_str())) + return 0; + + // create selection tool + KLFitter::SelectionTool * mySelectionTool = new KLFitter::SelectionTool(); + mySelectionTool -> SelectElectronEta(2.5); + mySelectionTool -> SelectMuonEta(2.5); + mySelectionTool -> SelectPhotonEta(2.5); + mySelectionTool -> SelectJetEta(2.5); + mySelectionTool -> RequireNJetsPt(25.0, 6, -1); + + // Require NBjets + mySelectionTool -> RequireNBJets(0.601713, 4, 0); + + // lepton selection + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + mySelectionTool -> RequireNElectronsPt(25.0, 1); + mySelectionTool -> RequireMET(30.); + mySelectionTool -> RequireMWT(30.); + } + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + mySelectionTool -> RequireNMuonsPt(20.0, 1); + mySelectionTool -> RequireTriangular(60.); + } + + // NJets to fit + mySelectionTool -> SetMaxNJetsForFit(6); + + // create matching tool + KLFitter::MatchingTool * myMatchingTool = 0x0; + if (FlagWriteSignalMCTruth) + if (FlagTruthSel && FlagWriteSignalMCTruth) + myMatchingTool = new KLFitter::MatchingTool( myFitter -> PParticles(), myInterfaceRoot -> PParticlesTruth() ); + + // set fitter and truth particles + myInterfaceOutput -> SetFitter(myFitter); + if (FlagWriteSignalMCTruth) + myInterfaceOutput -> SetParticlesTruth( myInterfaceRoot -> PParticlesTruth() ); + myInterfaceOutput -> SetParticlesMeasured( myInterfaceRoot -> PParticles() ); + if (myMatchingTool) + myInterfaceOutput -> SetMatchingTool(myMatchingTool); + myInterfaceOutput -> SetSelectionTool(mySelectionTool); + + // switch off filling of histograms + //myFitter -> Likelihood() -> MCMCSetFlagFillHistograms(false); + + int nevents = myInterfaceRoot -> NEvents(); + int minEv = TString(argv[1]).Atoi(); + int maxEv = TString(argv[2]).Atoi(); + if (maxEv>nevents) { + maxEv = nevents; + std::cout << "parameter warning: last event parameter reset to maximum event number available (" << nevents << ")" << std::endl; + } + if (minEv>=maxEv) { + std::cout << "parameter error: first event larger than last event --> exiting" << std::endl; + return 1; + } + + // for print-out for first fitted event + bool firstevent(true); + + // loop over events + for (int ievent = minEv; ievent < maxEv; ++ievent) + { + if ((ievent-minEv+1)%100 == 0) + std::cout << " event " << (ievent+1) << std::endl; + + // get first event + if (!myInterfaceRoot -> Event(ievent)) + return 0; + + // get the event weight + double weight = myInterfaceRoot->Weight(); + + // read single event from root file and get particles + KLFitter::Particles * measuredparticles = myInterfaceRoot -> Particles(); + KLFitter::Particles * truthparticles = 0x0; + if (FlagWriteSignalMCTruth) + truthparticles = myInterfaceRoot -> ParticlesTruth(); + + // truth event selection + if (FlagWriteSignalMCTruth) + if (FlagTruthSel) + if (!EventTruthSelection(truthparticles, Lepton)) + continue; + + // select event + if (!mySelectionTool -> SelectEvent(measuredparticles, myInterfaceRoot -> ET_miss(), myInterfaceRoot->MWT())) + continue; + + // get particles from selection tool + KLFitter::Particles * particles = mySelectionTool -> ParticlesSelected(); + + // add particles to fitter + if (!myFitter -> SetParticles(particles)) + return 0; + + // add ETmiss and sumET to fitter + if (!myFitter -> SetET_miss_XY_SumET( myInterfaceRoot -> ET_miss_x(), myInterfaceRoot -> ET_miss_y(), myInterfaceRoot -> Sum_ET() ) ) + return 0; + + + if (myMatchingTool) + { + // perform matching + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kParton); + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kElectron); + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + myMatchingTool -> MatchTruthAll(KLFitter::Particles::kMuon); + + // identify true permutation + std::vector<int> v0 = myMatchingTool->ListMatchedTruth(0, KLFitter::Particles::kParton); // b from H + std::vector<int> v1 = myMatchingTool->ListMatchedTruth(1, KLFitter::Particles::kParton); // bbar from H + std::vector<int> v2 = myMatchingTool->ListMatchedTruth(2, KLFitter::Particles::kParton); // hadronic b quark + std::vector<int> v3 = myMatchingTool->ListMatchedTruth(3, KLFitter::Particles::kParton); // leptonic b quark + std::vector<int> v4 = myMatchingTool->ListMatchedTruth(4, KLFitter::Particles::kParton); // light quark 1 + std::vector<int> v5 = myMatchingTool->ListMatchedTruth(5, KLFitter::Particles::kParton); // light quark 2 + + // std::cout << "True combination: " << GetTrueCombinationString(v0, v1, v2, v3, v4, v5) << std::endl; + } + + // copy information into output class + myInterfaceOutput -> SetEventWeight(weight); + myInterfaceOutput -> FillTreeMeasured(); + myInterfaceOutput -> FillTreeSelected(); + if (FlagWriteSignalMCTruth) + { + myInterfaceOutput -> FillTreeTruth(); + myInterfaceOutput -> FillTreeMatching(); + } + myInterfaceOutput -> FillTreeMap(); + + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + printf("--------------------------------FIT RESULTS FOR THE FIRST EVENT-------------------------------\n"); + } + + // loop over all permutations + for (int iperm = 0; iperm < myFitter -> Permutations() -> NPermutations(); ++iperm) + { + // fit the first permutation + myFitter -> Fit(iperm); + // copy information into output class + + myInterfaceOutput -> FillTreeModelPermutation(); + + + + if (firstevent) { + KLFitter::Particles * OutputParticles = myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles * InputParticles = *myFitter->Likelihood()->PParticlesPermuted(); + std::vector<double> Par = myFitter->Likelihood()->GetBestFitParameters(); + std::vector<double> ParErrors = myFitter->Likelihood()->GetBestFitParameterErrors(); + unsigned int ConvergenceStatusBitWord = myFitter->ConvergenceStatus(); + printf("----------------------------------------------------------------------------------------------\n"); + printf("----------------------------------------Permutation %2i----------------------------------------\n",iperm); + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | hadronic b quark | leptonic b quark | light quark 1 | light quark 2 | Higgs b 1 | Higgs b 2 | \n"); + printf("Input Energies | %16.2f | %17.2f | %16.2f | %15.2f | %15.2f | %15.2f | \n", + InputParticles->Parton(0)->E(), InputParticles->Parton(1)->E(), InputParticles->Parton(2)->E(), + InputParticles->Parton(3)->E(), InputParticles->Parton(4)->E(), InputParticles->Parton(5)->E() ); + + printf("Output Energies | %16.2f | %17.2f | %16.2f | %15.2f | %15.2f | %15.2f | \n", + OutputParticles->Parton(0)->E(), OutputParticles->Parton(1)->E(), OutputParticles->Parton(2)->E(), + OutputParticles->Parton(3)->E(), OutputParticles->Parton(4)->E(), OutputParticles->Parton(5)->E() ); + + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Log(Likelihood) | Event Probability | Top Pole Mass | Neutrino pz | Higgs Mass | \n"); + printf("Fitting Variables | %16.2f | %17.2E | %6.2f +- %6.2f | %6.2f +- %5.2f | %6.2f +- %5.2f | \n", + myFitter->Likelihood()->LogLikelihood(myFitter->Likelihood()->GetBestFitParameters()), + exp(myFitter->Likelihood()->LogEventProbability()), + Par[KLFitter::LikelihoodTTHLeptonJets::parTopM],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parTopM], + Par[KLFitter::LikelihoodTTHLeptonJets::parNuPz],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parNuPz], + Par[KLFitter::LikelihoodTTHLeptonJets::parHiggsM],ParErrors[KLFitter::LikelihoodTTHLeptonJets::parHiggsM] ); + + + printf("----------------------------------------------------------------------------------------------\n"); + printf(" | Minuit Not Conv. | Fit Aborted: NaN | >=1 Par at Limit | Invalid TF@Conv.|\n"); + printf("Status Code | %16i | %17i | %16i | %15i |\n", + bool((ConvergenceStatusBitWord & KLFitter::Fitter::MinuitDidNotConvergeMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::FitAbortedDueToNaNMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::AtLeastOneFitParameterAtItsLimitMask) != 0), + bool((ConvergenceStatusBitWord & KLFitter::Fitter::InvalidTransferFunctionAtConvergenceMask) != 0)); + } + } + + // fill tree + myInterfaceOutput -> FillTrees(); + + // do not print following events + if (firstevent) { + printf("----------------------------------------------------------------------------------------------\n"); + firstevent = false; + } + + + // check if the particles have been matched + if (myMatchingTool) + { + // check if b and bbar from H overlap + std::vector<int> BfromH_list = myMatchingTool -> ListMatchedTruth(0, KLFitter::Particles::kParton); + std::vector<int> BbarfromH_list = myMatchingTool -> ListMatchedTruth(1, KLFitter::Particles::kParton); + + int ntruth = truthparticles->NPartons(); + int nmeasured = particles->NPartons(); + int nmatches_jets_bfromH = 0; + int nmatches_partons_bfromH = 0; + int nmatches_jets_bbarfromH = 0; + int nmatches_partons_bbarfromH = 0; + int index_bfromH = -1; + int index_bbarfromH = -1; + + for (int i = 0; i < nmeasured; ++i) { + int temp_b = myMatchingTool->MatchVectors(i, 0, KLFitter::Particles::kParton); + int temp_bbar = myMatchingTool->MatchVectors(i, 1, KLFitter::Particles::kParton); + nmatches_jets_bfromH += temp_b; + nmatches_jets_bbarfromH += temp_bbar; + if (temp_b > 0) + index_bfromH = i; + if (temp_bbar > 0) + index_bbarfromH = i; + } + + if (nmatches_jets_bfromH > 0) { + for (int j = 0; j < ntruth; ++j) { + int temp = myMatchingTool->MatchVectors(index_bfromH, j, KLFitter::Particles::kParton); + nmatches_partons_bfromH+=temp; + } + } + + if (nmatches_jets_bbarfromH > 0) { + for (int j = 0; j < ntruth; ++j) { + int temp = myMatchingTool->MatchVectors(index_bbarfromH, j, KLFitter::Particles::kParton); + nmatches_partons_bbarfromH+=temp; + } + } + + int nMatchedBfromH = myMatchingTool->NMatchedTruth(0, KLFitter::Particles::kParton); + int nMatchedBbarfromH = myMatchingTool->NMatchedTruth(1, KLFitter::Particles::kParton); + + // veto if overlap + if (nmatches_jets_bfromH == 1 && nmatches_partons_bfromH == 1) + nMatchedBfromH = 1; + else + nMatchedBfromH = 0; + + if (nmatches_jets_bbarfromH == 1 && nmatches_partons_bbarfromH == 1) + nMatchedBbarfromH = 1; + else + nMatchedBbarfromH = 0; + + if ( (nmatches_jets_bfromH > 1) || (nmatches_partons_bfromH > 1)) + count_b_overlap++; + if ( (nmatches_jets_bbarfromH > 1) || (nmatches_partons_bbarfromH > 1)) + count_bbar_overlap++; + if ( ((nmatches_jets_bfromH > 1) || (nmatches_partons_bfromH > 1)) + && ((nmatches_jets_bbarfromH > 1) || (nmatches_partons_bbarfromH > 1))) + count_both_overlap++; + + + // increase counter + if (nMatchedBfromH > 0) + count_bfromH++; + if (nMatchedBbarfromH > 0) + count_bbarfromH++; + + if (nMatchedBfromH == 0 && nMatchedBbarfromH == 0) + count_0bsfromH++; + else if ((nMatchedBfromH > 0 && nMatchedBbarfromH == 0) || (nMatchedBfromH == 0 && nMatchedBbarfromH > 0)) + count_1bsfromH++; + else if (nMatchedBfromH > 0 && nMatchedBbarfromH > 0) + count_2bsfromH++; + + bool leptonsMatched = false; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + for (int iElec = 0; iElec < truthparticles -> NElectrons(); iElec++) { + int nMatchedElectron = myMatchingTool -> NMatchedTruth(iElec, KLFitter::Particles::kElectron); + if (nMatchedElectron > 0) + leptonsMatched = true; + } + } + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + for (int iMu = 0; iMu < truthparticles -> NMuons(); iMu++) { + int nMatchedMuon = myMatchingTool -> NMatchedTruth(iMu, KLFitter::Particles::kMuon); + if (nMatchedMuon > 0) + leptonsMatched = true; + } + } + + // if (!leptonsMatched) + // continue; + + countLMatch++; + + bool jetsMatched = true; + std::set<TString> set_listOfMatches; + set_listOfMatches.clear(); + + for (int iQuark = 2; iQuark < truthparticles -> NPartons()-3; iQuark++) { + int nMatchedJet = myMatchingTool -> NMatchedTruth(iQuark, KLFitter::Particles::kParton); + std::vector<int> listOfMatches = myMatchingTool -> ListMatchedTruth(iQuark, KLFitter::Particles::kParton); + + // check if quark is matched is to exactly one jet + if (nMatchedJet != 1) + jetsMatched = false; + + // check if another quark has already been matched to that jet + TString string_listOfMatches = ""; + for (unsigned int j=0; j<listOfMatches.size(); j++) + string_listOfMatches += listOfMatches.at(j); + + if (set_listOfMatches.find(string_listOfMatches) != set_listOfMatches.end()) + jetsMatched = false; + else + set_listOfMatches.insert(string_listOfMatches); + + } + + set_listOfMatches.clear(); + + if (!jetsMatched) + continue; + + countJMatch++; + } + } + + // output cut flow + std::cout << " Selection: " << std::endl; + std::cout << " ---------- " << std::endl; + std::cout << " N (after preselection) : " << mySelectionTool -> CounterEvents() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + std::cout << " N (after electron cuts) : " << mySelectionTool -> CounterElectrons() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + std::cout << " N (after muon cuts ) : " << mySelectionTool -> CounterMuons() << std::endl; + std::cout << " N (after jet cuts) : " << mySelectionTool -> CounterJets() << std::endl; + std::cout << " N (after MET cuts) : " << mySelectionTool -> CounterMET() << std::endl; + std::cout << " N (after MWT cuts) : " << mySelectionTool -> CounterMWT() << std::endl; + std::cout << " N (after triangular cuts) : " << mySelectionTool -> CounterTriangular() << std::endl; + std::cout << " N (after b-jet cuts) : " << mySelectionTool -> CounterBJets() << std::endl; + std::cout << " N (after all cuts) : " << mySelectionTool -> CounterSelected() << std::endl; + + if (FlagWriteSignalMCTruth) + { + std::cout << std::endl; + std::cout << " Matching: " << std::endl; + std::cout << " --------- " << std::endl; + std::cout << " N (selected) : " << mySelectionTool -> CounterSelected() << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) + std::cout << " N (with matched e ) : " << countLMatch << std::endl; + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) + std::cout << " N (with matched muon) : " << countLMatch << std::endl; + std::cout << " N (with b from H matched) : " << count_bfromH << std::endl; + std::cout << " N (with bbar from H matched) : " << count_bbarfromH << std::endl; + std::cout << " N (with 0 b's from H matched) : " << count_0bsfromH << std::endl; + std::cout << " N (with 1 b's from H matched) : " << count_1bsfromH << std::endl; + std::cout << " N (with 2 b's from H matched) : " << count_2bsfromH << std::endl; + std::cout << " N (with b overlap) : " << count_b_overlap << std::endl; + std::cout << " N (with bbar overlap) : " << count_bbar_overlap << std::endl; + std::cout << " N (with both overlap) : " << count_both_overlap << std::endl; + } + + // close input file + if (!myInterfaceRoot -> CloseRootFile()) + return 0; + + // close output file + if (!myInterfaceOutput -> CloseRootFile()) + return 0; + + // free memory + + delete myInterfaceOutput; + delete myInterfaceRoot; + delete myDetector; + delete myFitter; + delete myLikelihood; + delete mySelectionTool; + if (myMatchingTool) + delete myMatchingTool; + + // no error + return 1; + +} + +// ----------------------------------------------------------------------------------------------------------- + +bool EventTruthSelection(KLFitter::Particles * particles, KLFitter::LikelihoodTTHLeptonJets::LeptonType Lepton) +{ + // --------------------------------------------------------- + // truth selection + // --------------------------------------------------------- + + int nTruthElectrons = particles -> NElectrons(); + int nTruthMuons = particles -> NMuons(); + int nTruthTaus = particles -> NTaus(); + //int nTruthPartons = particles -> NPartons(); + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kElectron) { + // require exactly 1 truth electron + if (nTruthElectrons != 1) + return false; + + // require no truth muon or tau + if (nTruthMuons != 0) return false; + if (nTruthTaus != 0) return false; + } + + if (Lepton==KLFitter::LikelihoodTTHLeptonJets::kMuon) { + // require exactly 1 truth muon + if (nTruthMuons != 1) + return false; + + // require no truth electron or tau + if (nTruthElectrons != 0) return false; + if (nTruthTaus != 0) return false; + } + + // require exactly 8 truth quarks (including the 2 tops) + // if (nTruthPartons !=6) return false; + + return true; + +} + +/////////////////////////////////////////////////////////// +int GetCombinationNo(TString s) { // int matchHadB, int matchLepB, int matchLJ1, int matchLJ2){ + + // Match String to KLFitter Combinatorics + if (s == "0 1 2 3") return 0; + if (s == "0 2 1 3") return 1; + if (s == "0 3 1 2") return 2; + if (s == "3 0 1 2") return 3; + if (s == "3 2 0 1") return 4; + if (s == "3 1 0 2") return 5; + if (s == "2 1 0 3") return 6; + if (s == "2 3 0 1") return 7; + if (s == "2 0 1 3") return 8; + if (s == "1 0 2 3") return 9; + if (s == "1 3 0 2") return 10; + if (s == "1 2 0 3") return 11; + // return permutation n+1000 if the two light quarks are reversed + if (s == "0 1 3 2") return 1000; + if (s == "0 2 3 1") return 1001; + if (s == "0 3 2 1") return 1002; + if (s == "3 0 2 1") return 1003; + if (s == "3 2 1 0") return 1004; + if (s == "3 1 2 0") return 1005; + if (s == "2 1 3 0") return 1006; + if (s == "2 3 1 0") return 1007; + if (s == "2 0 3 1") return 1008; + if (s == "1 0 3 2") return 1009; + if (s == "1 3 2 0") return 1010; + if (s == "1 2 3 0") return 1011; + + return -1; + +} + +/////////////////////////////////////////////////////////// +TString GetTrueCombinationString(std::vector<int> v0, std::vector<int> v1, std::vector<int> v2, std::vector<int> v3, std::vector<int> v4, std::vector<int> v5) { + // combination string + TString s = ""; + for (unsigned int i = 0; i < v0.size(); i++) + if (v0.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v1.size(); i++) + if (v1.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v2.size(); i++) + if (v2.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v3.size(); i++) + if (v3.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v4.size(); i++) + if (v4.at(i) == 1) + s += i; + s += " "; + for (unsigned int i = 0; i < v5.size(); i++) + if (v5.at(i) == 1) + s += i; + return s; +} + diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..006d0fda5b55af5a8e348294bfeb9419ac281c68 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt @@ -0,0 +1,26 @@ +# Auto-generated on: 2017-03-09 17:44:33.125987 + +# Declare the name of this package: +atlas_subdir( TopDataPreparation None ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopDataPreparation _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopDataPreparation Root/*.cxx Root/*.h Root/*.icc + TopDataPreparation/*.h TopDataPreparation/*.icc TopDataPreparation/*/*.h + TopDataPreparation/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopDataPreparation + LINK_LIBRARIES ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install the Python modules of the package: +atlas_install_python_modules( python/*.py ) + +# Install data files from the package: +atlas_install_data( data/* ) diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..287a5ea504c181aded18fee120700fe53278c8bf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/LinkDef.h @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifdef __CINT__ +#pragma extra_include "TopDataPreparation/SampleXsection.h"; +#pragma extra_include "TopDataPreparation/SampleXsectionSvc.h"; +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; +#pragma link C++ class SampleXsection+; +#pragma link C++ class SampleXsectionSvc+; +#endif diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SamplePDF.cxx b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SamplePDF.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8536dec6b3f4b2ebc25b7ca59d5674d6455400aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SamplePDF.cxx @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <fstream> +#include <sstream> +#include <string> + +#include "TopDataPreparation/SamplePDF.h" +#include <iostream> +#include <stdlib.h> + +using namespace std; + +SamplePDF &SamplePDF::operator=(const SamplePDF &xs) +{ + if (this!=&xs) { + m_PDFs=xs.m_PDFs; + } + return *this; +} + +bool SamplePDF::readFromFile(const char *fName) +{ + ifstream in(fName); + if (!in) {cerr << "SamplePDF::readFromFile : issue with " << fName << endl; return false;} + + for( ; !in.eof() ; ) { + string line; + if (!getline(in,line)) break; + if (!line.empty() && line[0]!='#') { + istringstream istr(line); + int dsid, PDFid=-1; + istr >> dsid >> PDFid; + //cout << dsid << "\t" << PDFid << endl; + setSample(dsid,PDFid); + } + } + + in.close(); + return true; +} + +void SamplePDF::setSample(const int dsid, const int PDFid) +{ + if (dsid<0) return; + map<int, int >::const_iterator it=m_PDFs.find(dsid); + if (it!=m_PDFs.end()) { + cerr << "ERROR!! SamplePDF::setSample: duplicate entry ! DSID= " << dsid <<endl; + //cerr << "ERROR!! SamplePDF::setSample: xSect=" << xSect << "\told xSect=" << it->second.first <<endl; + } + m_PDFs[dsid]=PDFid; +} + + +int SamplePDF::getPDFid(const int dsid) const +{ + map<int,int >::const_iterator it=m_PDFs.find(dsid); + if (it!=m_PDFs.end()) return it->second; + return unknown; +} diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsection.cxx b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..92c97f4ca9e704601af6a85d091abf0cb30e8398 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsection.cxx @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <fstream> +#include <sstream> +#include <string> + +#include "TopDataPreparation/SampleXsection.h" +#include <iostream> +#include <stdlib.h> + +using namespace std; + +SampleXsection &SampleXsection::operator=(const SampleXsection &xs) +{ + if (this!=&xs) { + m_Xsects=xs.m_Xsects; + m_Uncert=xs.m_Uncert; + } + return *this; +} + +bool SampleXsection::readFromFile(const char *fName) +{ + ifstream in(fName); + if (!in) return false; + + for( ; !in.eof() ; ) { + string line; + if (!getline(in,line)) break; + if (!line.empty() && line[0]!='#') { + istringstream istr(line); + int dsid=-1; + double xSect,kFact,xSectDw,xSectUp; + string s_shower, s_xSectDw, s_xSectUp; + showering shower; + istr >> dsid >> xSect >> kFact >> s_shower >> s_xSectDw >> s_xSectUp; + if(!s_shower.empty() && s_shower[0]!='#') { + if (s_shower=="pythia") shower=pythia; + else if (s_shower=="herwig") shower=herwig; + else if (s_shower=="sherpa") shower=sherpa; + else if (s_shower=="sherpa21") shower=sherpa21; + else if (s_shower=="pythia8") shower=pythia8; + else if (s_shower=="herwigpp") shower=herwigpp; + else { + cerr << "ERROR!! TopDataPreparation::SampleXsection::readFromFile: unknown showering (which is needed for btagging SF!!!) : " << s_shower << " for DSID= " << dsid <<endl; + shower=unknown; + } + //cout << "INFO SampleXsection::readFromFile: showering : " << s_shower << " -> " << shower << " for DSIS= " <<dsid <<endl; + + if(!s_xSectDw.empty() && s_xSectDw[0]!='#') { + xSectDw = atof(s_xSectDw.c_str()); + if(!s_xSectUp.empty()){ + xSectUp = atof(s_xSectUp.c_str()); + }else{ + cerr << "ERROR!! SampleXsection::readFromFile: xSectDw of "<<dsid<<" is defined ( "<<s_xSectDw<<" ), but not xSectUp" <<endl; + xSectUp=-1.; + } + //cout << " xSectDw= " << xSectDw << "\txSectUp= " << xSectUp << endl; + } + else { + xSectDw=-1.; + xSectUp=-1.; + } + }// !s_showering.empty() + else{ + xSectDw=-1.; + xSectUp=-1.; + shower = unknown; + } + setSample(dsid,xSect,kFact,shower,xSectDw,xSectUp); + } + } + + in.close(); + return true; +} + +void SampleXsection::setSample(const int dsid,const double xSect,const double kFact, const showering shower, const double xSectDw, const double xSectUp) +{ + if (dsid<0) return; + map<int,pair<double,double> >::const_iterator it=m_Xsects.find(dsid); + if (it!=m_Xsects.end()) { + cerr << "ERROR!! SampleXsection::setSample: duplicate entry ! DSID= " << dsid <<endl; + //cerr << "ERROR!! SampleXsection::setSample: xSect=" << xSect << "\told xSect=" << it->second.first <<endl; + } + m_Xsects[dsid]=pair<double,double>(xSect,kFact); + m_Uncert[dsid]=pair<double,double>(xSectDw,xSectUp); + m_Showering[dsid]=shower; +} + +double SampleXsection::getRawXsection(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Xsects.find(dsid); + if (it!=m_Xsects.end()) return it->second.first; + return -1; +} + +double SampleXsection::getKfactor(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Xsects.find(dsid); + if (it!=m_Xsects.end()) return it->second.second; + return -1; +} + +double SampleXsection::getXsection(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Xsects.find(dsid); + if (it!=m_Xsects.end()) return (it->second.first)*(it->second.second); + return -1; +} + +double SampleXsection::getXsectionDown(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Uncert.find(dsid); + if (it!=m_Uncert.end()) return it->second.first; + return -1; +} + +double SampleXsection::getXsectionUp(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Uncert.find(dsid); + if (it!=m_Uncert.end()) return it->second.second; + return -1; +} + +pair<double,double> SampleXsection::getXsectionDownUp(const int dsid) const +{ + map<int,pair<double,double> >::const_iterator it=m_Uncert.find(dsid); + if (it!=m_Uncert.end()) return it->second; + pair<double,double> temp=pair<double,double>(-1,-1); + return temp; +} + +SampleXsection::showering SampleXsection::getShowering(const int dsid) const +{ + map<int,showering >::const_iterator it=m_Showering.find(dsid); + if (it!=m_Showering.end()) return it->second; + return unknown; +} + +int SampleXsection::getShoweringIndex(const int dsid) const +{ + + // A.Knue: labelling taken from here: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalib2015#Pre_Recommendations_for_MC15_Bas + + showering shower = getShowering(dsid); + + if(shower == showering::pythia) + return 0; + else if (shower == showering::herwigpp || shower == showering::herwig)// use the herwig++ maps for the few fortran herwig samples we may have + return 1; + else if (shower == showering::pythia8) + return 2; + else if (shower == showering::sherpa) + return 3; + else if (shower == showering::sherpa21) + return 4; + else{ + + std::cout << "===========================================================================================================================================" << std::endl; + std::cout << "ERROR:TopDataPreparation: The DSID " << dsid << " does not have a showering algorithm defined!!! This is needed for MC/MC SF!!! ---> EXIT." << std::endl; + std::cout << "\t" << std::endl; + exit(1); + + } + + return 0; + +} diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsectionSvc.cxx b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsectionSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..579bf401cd9e79a2368dee991340003ce1620673 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/Root/SampleXsectionSvc.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopDataPreparation/SampleXsectionSvc.h" +#include <iostream> +#include <cstdlib> + +SampleXsectionSvc *SampleXsectionSvc::s_instance = 0; + +SampleXsectionSvc::SampleXsectionSvc(std::string inputFile): + m_inputFile(inputFile), + m_sampleXsection(0) { +} + +//------------------------------------------------------------------------------- + +SampleXsectionSvc::~SampleXsectionSvc(){ + if(m_sampleXsection) delete m_sampleXsection; +} + +//------------------------------------------------------------------------------- + +int SampleXsectionSvc::initialize() { + m_sampleXsection = new SampleXsection(); + + char *rootcoreDir = getenv("ROOTCOREBIN"); + + if (!m_sampleXsection->readFromFile(m_inputFile.c_str())) { + if(rootcoreDir) {// if file can't be read, maybe it's in the common directory + std::string fullpath = std::string(rootcoreDir) + "/data/TopDataPreparation/"; + fullpath += m_inputFile; + if (!m_sampleXsection->readFromFile(fullpath.c_str())) { + std::cerr << "SampleXsection::unable to read input file " << fullpath << std::endl; + return 1; + } + else return 0;//all OK + } + else {// if common directory can't be found, then surrender + std::cerr << "SampleXsection::unable to read input file " << m_inputFile << std::endl; + return 1; + } + } + + return 0; +} + +//---------------------------------------------------------------- + +SampleXsectionSvc *SampleXsectionSvc::svc(std::string inputFile) { + if(s_instance == 0) { + s_instance = new SampleXsectionSvc(inputFile); + + if(s_instance->initialize() != 0) { + std::cerr << "Error: initialize failed. Could not create SampleXsectionSvc." << std::endl; + delete s_instance; + s_instance = 0; + } + } + + return s_instance; +} diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SamplePDF.h b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SamplePDF.h new file mode 100644 index 0000000000000000000000000000000000000000..5f43a4be67aa5658f31aac2c1b086c43ddd0b7f7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SamplePDF.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SAMPLEPDF_H +#define SAMPLEPDF_H + +#include <map> + +/** @class SamplePDFSvc + ** + ** @author David Calvet <calvet@in2p3.fr> + ** + ** @brief A class to provide access to Monte Carlo sample luminosity information. + ** +*/ +class SamplePDF { + +public: + + enum showering{ pythia=0, herwig=1, sherpa=2, pythia8=4, herwigpp=5, sherpa21=6, unknown=10}; + + inline SamplePDF() : m_PDFs() {} + inline SamplePDF(const SamplePDF &xs) : m_PDFs(xs.m_PDFs) {} + inline ~SamplePDF() {} + + SamplePDF &operator=(const SamplePDF &xs); + + bool readFromFile(const char *fName); + void setSample(const int dsid,const int PDFid); + + int getPDFid(const int dsid) const; + +private: + + std::map<int, int > m_PDFs; +}; + +#endif // SAMPLEPDF_H diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsection.h b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsection.h new file mode 100644 index 0000000000000000000000000000000000000000..97a3cc91981a4628a177e06c588b22cdd9f05df8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsection.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SAMPLEXSECTION_H +#define SAMPLEXSECTION_H + +#include <map> + +/** @class SampleXsectionSvc + ** + ** @author David Calvet <calvet@in2p3.fr> + ** + ** @brief A class to provide access to Monte Carlo sample luminosity information. + ** +*/ +class SampleXsection { + +public: + + enum showering{ pythia=0, herwig=1, sherpa=2, pythia8=4, herwigpp=5, sherpa21=6, unknown=10}; + + inline SampleXsection() : m_Xsects() {} + inline SampleXsection(const SampleXsection &xs) : m_Xsects(xs.m_Xsects) {} + inline ~SampleXsection() {} + + SampleXsection &operator=(const SampleXsection &xs); + + bool readFromFile(const char *fName); + void setSample(const int dsid,const double xSect,const double kFact,const showering shower, const double xSectDw, const double xSectUp); + + double getRawXsection(const int dsid) const; + double getKfactor(const int dsid) const; + double getXsection(const int dsid) const; + double getXsectionUp(const int dsid) const; + double getXsectionDown(const int dsid) const; + std::pair<double,double> getXsectionDownUp(const int dsid) const; + showering getShowering(const int dsid) const; + int getShoweringIndex(const int dsid) const; + +private: + + std::map<int,std::pair<double,double> > m_Xsects; + std::map<int,std::pair<double,double> > m_Uncert; + std::map<int,showering > m_Showering; + +}; + +#endif // SAMPLEXSECTION_H diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsectionSvc.h b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsectionSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..6ebb586dcfe52ab5b67044a3dccf998929c0e19d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/TopDataPreparation/SampleXsectionSvc.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SAMPLEXSECTIONSVC_H +#define SAMPLEXSECTIONSVC_H + +#include <string> + +#include "TopDataPreparation/SampleXsection.h" + +/** @class SampleXsectionSvc + ** + ** @author W. H. Bell <W.Bell@cern.ch> + ** + ** @brief Singleton class providing access to SampleXsection + ** + ** The files associated with SampleXsection are read once when the unique instance is created. + ** This happens on the first call to + ** SampleXsection::svc(std::string inputFile), + ** which also return a pointer to the instance. Subsequently it is sufficient + ** to call SampleXsectionSvc::svc() without any arguments. + */ +class SampleXsectionSvc { + public: + /** Return a pointer to the unique instance, initialize if necessary. + * @param inputFile name of the input file. + * @return pointer to SampleXsectionSvc instance, NULL on failure. + */ + static SampleXsectionSvc *svc(std::string inputFile); + + /** Return a pointer to the unique instance, or NULL if not initialized. + * @return pointer to SampleXsectionSvc instance. */ + static SampleXsectionSvc *svc() { return s_instance; } + + /** Provide access to the WhichPeriod object held by the instance. + * @return pointer to the initialized WhichPeriod object. */ + const SampleXsection* sampleXsection() const { return m_sampleXsection; } + + + private: + + /** Singleton pattern: Private constructor. */ + SampleXsectionSvc(std::string inputFile=""); + + /** Singleton pattern: Private destructor. */ + ~SampleXsectionSvc(); + + /** Singleton pattern: Copy constructor is private and undefined. */ + SampleXsectionSvc(const SampleXsectionSvc &); + + /** Singleton pattern: Assignment operator is private and undefined. */ + SampleXsectionSvc &operator=(const SampleXsectionSvc &); + + /** A pointer to carry the address of the unique instance. */ + static SampleXsectionSvc *s_instance; + + /** A member function to setup the WhichPeriod object. */ + int initialize(void); + + /** Input file. */ + std::string m_inputFile; + + /** The SampleXsection instance. */ + SampleXsection *m_sampleXsection; +}; + +#endif + + diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..cbb4e3f81d035e41d7fb84cabc6524895415513d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.RootCore @@ -0,0 +1,14 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +PACKAGE = TopDataPreparation +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_DEP = +PACKAGE_NOOPT = 0 +PACKAGE_PEDANTIC = 1 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.Standalone b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.Standalone new file mode 100644 index 0000000000000000000000000000000000000000..9c7f15a26c45c0fb99b3635a8473b06deff70616 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/cmt/Makefile.Standalone @@ -0,0 +1,127 @@ +# This make file is for building a standalone version of the +# TopDataPreparation package. +# (The make file is a modified version of the GoodRunsLists Makefile.) +# + +# --- External configuration ---------------------------------- +#include $(ROOTSYS)/test/Makefile.arch +include $(ROOTSYS)/etc/Makefile.arch + +# ------------------------------------------------------------- +# General flags +# ------------------------------------------------------------- +PACKAGE = TopDataPreparation +OUTPUTDIR = ../lib + +MFLAGS = -MM -Wall -W -Woverloaded-virtual +INCLUDES += -I$(shell root-config --incdir) -I.. + +# For debugging +CXXFLAGS += -g + +# Need these to avoid loading dependent libraries when ROOT starts +LINKLIBS = -L$(shell root-config --libdir) -lHist + +# Library list for applications +#EXELIBS = -L../lib -l$(PACKAGE) +#EXELIBS += $(shell root-config --libs) -lTreePlayer -lHistPainter + +# ------------------------------------------------------------- +# ROOT CINT files +# ------------------------------------------------------------- +LDEFFILE = ../Root/LinkDef.h +CINTFILE = ../Root/$(PACKAGE)Dict.cxx +CINTFILEH = ../Root/$(PACKAGE)Dict.h +CINTOBJ = ../Root/$(PACKAGE)Dict.o + +# ------------------------------------------------------------- +# C++ source and header files +# ------------------------------------------------------------- + +CCLIST = $(patsubst ../Root/%cxx, %cxx, $(filter-out $(CINTFILE), $(wildcard ../Root/*.cxx))) +CCLISTC = $(addprefix ../Root/,$(CCLIST)) $(CINTFILE) +HHEXCLUDE = $(CINTFILEH) $(LDEFFILE) +HHLIST = $(patsubst ../$(PACKAGE)/%h, %h, $(filter-out $(HHEXCLUDE), $(wildcard ../$(PACKAGE)/*.h))) +HHLISTC = $(addprefix ../$(PACKAGE)/,$(HHLIST)) +OLISTC = $(patsubst %.cxx,%.o,$(CCLISTC)) + +#APPCCLIST = $(patsubst ../src/apps/%cxx, %cxx, $(wildcard ../src/apps/*.cxx)) +#APPCCLISTC = $(addprefix ../src/apps/,$(APPCCLIST)) +#APPOLISTC = $(patsubst %.cxx,%.o,$(APPCCLISTC)) +#APPEXELIST = $(addprefix ../bin/, $(patsubst %cxx, %exe, $(APPCCLIST))) + +# ------------------------------------------------------------- +# Libraries +# ------------------------------------------------------------- +SHLIBFILE = $(OUTPUTDIR)/lib$(PACKAGE).so + +ifeq ($(PLATFORM),macosx) +EXTRALDFLAGS = -install_name @rpath/$(SHLIBFILE) +endif + +# get libraries of ROOT +define ldlinksuffixROOT + $(addsuffix $(LDLINKSUFFIX),$(Lib)) $(shell if [ "$(findstring -Ldlink2,$(OPTIONS))" ]; then echo $(addsuffix _pkgid_$(ROOTVER),$(Lib)); fi) +endef + +# ------------------------------------------------------------- +# Compilation +# ------------------------------------------------------------- + +#all: shlib apps +all: shlib + +# Implicit rule making all dependency Makefiles included at the end of this makefile +%.d: %.cxx $(HLIST) + @echo "Making $@" + @set -e; $(CC) $(MFLAGS) $(CXXFLAGS) $< \ + | awk '{ sub("^$(notdir $*).o:","$*.o $@:") ; print }' > $@ ;\ + [ -s $@ ] || rm -f $@ + +# Implicit rule to compile all classes +%.o : %.cxx + @echo "Compiling $<" + @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $*.o + +# Rule to make ROOTCINT output file +$(CINTOBJ) : $(HHLISTC) $(LDEFFILE) + @echo "Running rootcint" + @$(ROOTSYS)/bin/rootcint -f $(CINTFILE) -c -p $(CXXFLAGS) $(INCLUDES) $(HHLISTC) $(LDEFFILE) + @echo "Compiling $(CINTFILE)" + @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(CINTFILE) -o $@ + +rootcint : $(HHLISTC) $(LDEFFILE) + @echo "Running rootcint" + $(ROOTSYS)/bin/rootcint -f $(CINTFILE) -c -p $(CXXFLAGS) $(INCLUDES) $(HHLISTC) $(LDEFFILE) + +# Rule to combine objects into a shared library +$(SHLIBFILE): $(OLISTC) + @echo "Linking $(SHLIBFILE)" + @mkdir -p $(OUTPUTDIR) + @rm -f $(SHLIBFILE) + @$(LD) $(CXXFLAGS) $(SOFLAGS) $(LINKLIBS) $(EXTRALDFLAGS) $(OLISTC) -o $(SHLIBFILE) + +# Rule to build test applications +#../bin/test.exe : ../src/apps/test.o +# @echo "Building $@" +# @$(LD) $(CXXFLAGS) $(EXELIBS) $< -o ../bin/test.exe +# +#../bin: +# @mkdir -p ../bin + +-include $(DLIST) + +cint: $(CINTOBJ) +shlib: $(SHLIBFILE) + +#apps: shlib ../bin $(APPEXELIST) + +clean: + @rm -f ../*/*~ + @rm -f ../*/*.o ../*/*.d ../*/*.pcm + @rm -f ../*/*/*.o ../*/*/*.d ../*/*/*.pcm + +veryclean: clean + @rm -f ../Root/$(CINTFILE) ../Root/$(CINTFILEH) + @rm -rf $(OUTPUTDIR) + @rm -rf ../bin diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/AMIXSection-MC11.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/AMIXSection-MC11.data new file mode 100644 index 0000000000000000000000000000000000000000..5e901f3733b5ee3e5217d1f06cab59c45829d2dc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/AMIXSection-MC11.data @@ -0,0 +1,893 @@ +# ttbar baseline samples +105860 80.85 1.191 +105861 80.07 1.202 +117049 67.36 1.203 # TTbar_FullHad_PowHeg_Pythia_P2011C +110198 15.23 1.222 # McAtNloHerwigpp_UEEE4_MRSTMCal_CT10ME_ttbar_lnulnu +110199 63.83 1.217 # McAtNloHerwigpp_UEEE4_MRSTMCal_CT10ME_ttbar_lnuqq +117050 80.07 1.202 +105200 79.01 1.219 +117200 80.98 1.189 # T1_McAtNlo_Jimmy no spincorr +117494 14.09 1.938 # AlpgenJimmyttbarqqqqNp0_baseline +117495 13.91 1.938 # AlpgenJimmyttbarqqqqNp1_baseline +117496 8.50 1.938 # AlpgenJimmyttbarqqqqNp2_baseline +117497 5.30 1.938 # AlpgenJimmyttbarqqqqNp3inc_baseline +105205 58.228 1.53 # not in TWiki +105204 66.48 1.219 +107940 66.58 1.217 +107941 67.34 1.203 +105890 3.47 1.793 +105891 3.40 1.793 +105892 2.11 1.793 +117897 0.94 1.793 +117898 0.33 1.793 +117899 0.13 1.793 +105893 1.348 1.67 # replaced by 117897 ? +105894 13.86 1.865 +105895 13.69 1.865 +105896 8.47 1.865 +117887 3.78 1.865 +117888 1.34 1.865 +117889 0.50 1.865 +105897 5.364 1.75 # replaced by 117887 ? +117001 73.10 1.317 # PowHeg_Pythia_P2011C_HERAPDF15NLO + +# ttbar Sherpa samples +117800 3.41 2.283 +117801 1.20 2.286 +117802 0.10 2.361 +117803 19.87 2.451 +117804 2.20 2.292 +117805 3.48 2.467 +117806 0.38 2.351 +117807 28.15 2.708 +117808 6.41 2.462 +117809 0.34 2.393 + +# ttbar ISR/FSR variation +117209 61.96 1.553 +117210 61.65 1.553 +117211 52.03 1.557 +117212 51.76 1.556 +# ttbar ISR/FSR variation. Updated P2011C centered samples +117862 41.01 2.348 +117863 41.01 2.348 +117864 41.01 2.348 +117865 41.01 2.348 +117866 34.44 2.352 +117867 34.44 2.352 + +# ttbar colour reconnection +117240 41.88 2.299 +117241 41.88 2.299 +117242 41.89 2.162 # no more on the wiki +117243 41.89 2.162 # no more on the wiki +117406 35.17 2.304 +117407 35.17 2.304 +117408 35.18 2.167 # no more on the wiki +117409 35.18 2.166 # no more on the wiki + +# ttbar mass variation +117207 230.46 1.12 # not in TWiki +117208 163.21 1.12 # not in TWiki +106203 117.32 1.12 # not in TWiki +106223 94.38 1.17 # not in TWiki +106208 100.53 1.12 # not in TWiki +106205 92.91 1.12 # not in TWiki +106201 85.99 1.12 # not in TWiki +106221 69.29 1.17 # not in TWiki +106206 74.30 1.12 # not in TWiki +106207 68.83 1.12 # not in TWiki +106202 63.34 1.145 +106222 53.41 1.143 +106204 48.23 1.12 # not in TWiki +106224 38.60 1.18 # not in TWiki +117205 36.87 1.12 +117206 28.29 1.12 + +# ttbar invariant mass variation +117300 52.032 1.219 # 300-500 GeV +117301 21.548 1.219 # 500-700 GeV +117302 4.536 1.219 # 700-900 GeV +117303 1.145 1.219 # 900-1100 GeV +117304 0.334 1.219 # 1100-1300 GeV +117305 0.110 1.219 # 1300-1500 GeV +117306 0.039 1.219 # 1500-1700 GeV +117307 0.025 1.219 # 1700- GeV + +# ttbar systematics +110006 89.47 1.076 # McAtNloJimmy_CT10_ttbar_mudown +110007 68.51 1.405 # McAtNloJimmy_CT10_ttbar_muup +117851 51.45 1.871 # MadGraphPythia_Z2CTEQ6L1_ttbar_lept +110010 64.99 1.195 # Sherpa_CT10_ttbar_singlelepton +110011 16.29 1.143 # Sherpa_CT10_ttbar_dilepton +110201 79.98 1.204 # PowhegPythia_P2011C_ttbar_notauolanophotos +110204 80.05 1.203 # TTbar_PowhegPythia_P2011CfragBowler +129476 78.98 1.219 # T1_McAtNlo_Jimmy_EvtGen + +# ttbar+gamma +117400 0.42 1 # not in TWiki +117401 0.84 1 +117405 0.46 1 + +# ttbar Rb +117197 40. 1 +117198 10. 1 + +# ttbar Alpgen+Pythia semi-leptonic +117083 11.44 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp0 +117084 11.10 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp1 +117085 7.01 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp2 +117086 3.19 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp3 +117087 1.15 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp4 +117088 0.51 2.258 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp5 +117089 1.75 2.252 # AlpGenPythia_P2011_CTEQ5L_ttbarlnqqNp4INC +# ttbar Alpgen+Pythia semi-leptonic ktfac0.5 +117093 11.43 1.864 +117094 12.89 1.864 +117095 9.38 1.864 +117096 4.90 1.864 +117099 3.06 1.864 +# ttbar Alpgen+Pythia semi-leptonic ktfac2 +117183 11.41 2.600 +117184 9.75 2.600 +117185 5.44 2.600 +117186 2.20 2.600 +117189 1.07 2.600 +# ttbar Alpgen+Pythia di-leptonic +117113 2.86 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp0 +117114 2.77 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp1 +117115 1.75 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp2 +117116 0.80 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp3 +117117 0.29 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp4 +117118 0.12 2.165 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp5 +117119 0.44 2.160 # AlpGenPythia_P2011_CTEQ5L_ttbarlnlnNp4INC +# ttbar Alpgen+Pythia di-leptonic ktfac0.5 +117123 2.85 1.791 +117124 3.22 1.791 +117125 2.34 1.791 +117126 1.22 1.791 +117129 0.76 1.791 +# ttbar Alpgen+Pythia di-leptonic ktfac2 +117133 2.86 2.492 +117134 2.43 2.492 +117135 1.36 2.492 +117136 0.55 2.492 +117139 0.27 2.492 + +116108 0.92 1.793 # AlpgenJimmyttbbinclNp0_baseline +116109 1.76 1.793 # AlpgenJimmyttccinclNp0_baseline + +# ttbar Underlying Event Samples +117403 61.65 1.562 +117404 62.14 1.549 + +117520 9.97 2.215 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnqqNp0 +117521 10.83 2.215 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnqqNp1 +117522 7.72 2.215 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnqqNp2 +117523 3.95 2.215 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnqqNp3 +117524 2.58 2.215 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnqqNp4INC +117525 2.50 2.120 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnlnNp0 +117526 2.71 2.120 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnlnNp1 +117527 1.93 2.120 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnlnNp2 +117528 0.99 2.120 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnlnNp3 +117529 0.65 2.120 # AlpGenPythia_P2011radHi_KTFac05CTEQ5L_ttbarlnlnNp4INC +117530 12.65 2.284 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnqqNp0 +117531 11.17 2.284 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnqqNp1 +117532 6.35 2.284 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnqqNp2 +117533 2.60 2.284 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnqqNp3 +117534 1.24 2.284 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnqqNp4INC +117535 3.16 2.190 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnlnNp0 +117536 2.79 2.190 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnlnNp1 +117537 1.58 2.190 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnlnNp2 +117538 0.65 2.190 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnlnNp3 +117539 0.31 2.190 # AlpGenPythia_P2011radLo_KTFac2CTEQ5L_ttbarlnlnNp4INC +117835 84.71 1.132 # TTbar_FullHad_MT1650_PowHeg_Pythia_P2011C +117836 100.75 1.131 # TTbar_MT1650_PowHeg_Pythia_P2011C +117837 78.39 1.132 # TTbar_FullHad_MT1675_PowHeg_Pythia_P2011C +117838 93.23 1.131 # TTbar_MT1675_PowHeg_Pythia_P2011C +117839 72.72 1.130 # TTbar_FullHad_MT1700_PowHeg_Pythia_P2011C +117840 86.34 1.131 # TTbar_MT1700_PowHeg_Pythia_P2011C +117841 62.51 1.131 # TTbar_FullHad_MT1750_PowHeg_Pythia_P2011C +117842 74.33 1.131 # TTbar_MT1750_PowHeg_Pythia_P2011C +117843 58.11 1.130 # TTbar_FullHad_MT1775_PowHeg_Pythia_P2011C +117844 69.01 1.131 # TTbar_MT1775_PowHeg_Pythia_P2011C +117845 53.98 1.131 # TTbar_FullHad_MT1800_PowHeg_Pythia_P2011C +117846 64.17 1.130 # TTbar_MT1800_PowHeg_Pythia_P2011C + +# Powheg+Pythia NP systematics : +117418 67.33 1.203 # TTbar_FullHad_PowHeg_Pythia_P2011mpiHi +117419 67.33 1.203 # TTbar_FullHad_PowHeg_Pythia_P2011noCR +117427 67.33 1.203 # TTbar_FullHad_PowHeg_Pythia_P2011 +117429 80.06 1.203 # TTbar_PowHeg_Pythia_P2011mpiHi +117430 80.07 1.202 # TTbar_PowHeg_Pythia_P2011noCR +117428 80.07 1.202 # TTbar_PowHeg_Pythia_P2011 + +110101 19.24 1.087 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept +110102 0.90 1.669 # AcerMCPythia_P2011CCTEQ6L1_singletop_schan_lept +110103 10.08 1.561 # AcerMCPythia_P2011CCTEQ6L1_singletop_Wtchan_inc +110104 1.06 1.557 # AcerMCPythia_P2011CCTEQ6L1_singletop_Wtchan_dil +110105 19.24 1.087 # AcerMCPythia_P2011CMorePSCTEQ6L1_singletop_tchan_lept +110106 19.24 1.088 # AcerMCPythia_P2011CLessPSCTEQ6L1_singletop_tchan_lept +110107 0.90 1.669 # AcerMCPythia_P2011CMorePSCTEQ6L1_singletop_schan_lept +110108 0.90 1.669 # AcerMCPythia_P2011CLessPSCTEQ6L1_singletop_schan_lept +110109 10.08 1.561 # AcerMCPythia_P2011CMorePSCTEQ6L1_singletop_Wtchan_inc +110110 10.08 1.561 # AcerMCPythia_P2011CLessPSCTEQ6L1_singletop_Wtchan_inc +110111 1.06 1.557 # AcerMCPythia_P2011CMorePSCTEQ6L1_singletop_Wtchan_dil +110112 1.06 1.557 # AcerMCPythia_P2011CLessPSCTEQ6L1_singletop_Wtchan_dil +110113 20.83 1.082 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt165GeV +110114 20.28 1.083 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt167p5GeV +110115 19.75 1.085 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt170GeV +110116 18.74 1.089 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt175GeV +110117 18.26 1.091 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt177p5GeV +110118 17.80 1.094 # AcerMCPythia_P2011CCTEQ6L1_singletop_tchan_lept_mt180GeV +110119 1.349 1.112 +110123 1.608 1.114 +110124 16.414 1.097 +110125 1.515 1.114 +110126 15.686 1.097 +110127 1.429 1.113 +110128 14.998 1.097 +110129 1.275 1.110 +110130 13.724 1.096 +110131 1.206 1.110 +110132 13.138 1.095 +110133 1.141 1.108 +110134 12.580 1.095 +110140 14.343 1.097 +110141 1.506 1.092 +110142 6.868 2.292 + +# single top Powheg+Pythia +117314 1.39 1.079 +117315 20.21 1.035 +117316 14.53 1.083 + +# single top baseline samples +108340 7.12 0.979 +108341 7.12 0.979 +108342 7.10 0.982 +108343 0.47 1.064 +108344 0.47 1.064 +108345 0.47 1.064 +108346 14.59 1.079 +117360 8.06 0.865 +117361 8.06 0.865 +117362 8.05 0.865 +105500 14.79 1.064 + +# single top ISR/FSR variation. Use baseline cross-sections +117213 0.47 1.064 +117214 0.47 1.064 +117215 0.47 1.064 +117216 0.47 1.064 +117217 0.47 1.064 +117218 0.47 1.064 +117219 8.06 0.865 +117220 8.06 0.865 +117221 8.06 0.865 +117222 8.06 0.865 +117223 8.05 0.865 +117224 8.05 0.865 +117245 14.79 1.064 +117246 14.79 1.064 + +# single top ISR/FSR variation +117320 8.06 0.88 +117321 8.06 0.88 +117322 8.05 0.88 +117326 14.79 0.99 +117330 8.06 0.88 +117331 8.06 0.88 +117332 8.05 0.88 +117336 14.79 0.99 +117340 8.06 0.88 +117341 8.06 0.88 +117342 8.05 0.88 +117346 14.79 0.99 +117350 8.06 0.88 +117351 8.06 0.88 +117352 8.05 0.88 +117356 14.79 0.99 +117370 8.06 0.88 +117371 8.06 0.88 +117372 8.05 0.88 +117376 14.79 0.99 +117380 8.06 0.88 +117381 8.06 0.88 +117382 8.05 0.88 +117386 14.79 0.99 + +# single top mass variation +117080 8.48 0.886 +117081 8.48 0.887 +117082 8.48 0.887 +117883 0.55 1.085 +117884 0.55 1.083 +117885 0.55 1.084 +117886 16.45 1.095 +117940 9.91 1.00 +117941 9.75 1.00 +117942 9.82 1.00 +117943 1.10 1.00 +117944 1.11 1.00 +117945 1.09 1.00 +117946 26.86 1.00 +117950 9.05 1.00 +117951 8.76 1.00 +117952 8.94 1.00 +117953 0.82 1.00 +117954 0.82 1.00 +117955 0.82 1.00 +117956 22.05 1.00 +107960 8.27 1.00 +107961 7.94 1.00 +107962 7.95 1.00 +107963 0.63 1.00 +107964 0.64 1.00 +107965 0.62 1.00 +107966 18.43 1.00 +117090 8.26 0.887 +117091 7.84 0.935 +117092 7.84 0.935 +107970 7.23 1.00 +107971 7.27 1.00 +107972 7.32 1.00 +107973 0.50 1.00 +107974 0.50 1.00 +107975 0.50 1.00 +107976 15.37 1.00 +117910 6.90 1.00 +117911 6.87 1.00 +117912 7.06 1.00 +117913 0.45 1.00 +117914 0.44 1.00 +117915 0.44 1.00 +117916 13.94 1.00 +107980 6.61 1.00 +107981 6.55 1.00 +107982 6.65 1.00 +107983 0.40 1.00 +107984 0.40 1.00 +107985 0.40 1.00 +107986 12.81 1.00 +107990 6.01 1.00 +107991 6.03 1.00 +107992 6.06 1.00 +107993 0.32 1.00 +107994 0.32 1.00 +107995 0.32 1.00 +107996 10.79 1.00 +117920 5.37 1.00 +117921 5.48 1.00 +117922 5.55 1.00 +117923 0.26 1.00 +117924 0.26 1.00 +117925 0.26 1.00 +117926 9.18 1.00 +117930 4.97 1.00 +117931 4.92 1.00 +117932 5.04 1.00 +117933 0.22 1.00 +117934 0.22 1.00 +117935 0.21 1.00 +117936 7.85 1.00 + +117140 11.16 0.881 +117141 11.16 0.881 +117142 11.15 0.882 +117150 9.97 0.885 +117151 9.97 0.884 +117152 9.97 0.885 +117160 8.94 0.886 +117161 8.95 0.885 +117162 8.94 0.885 +117893 0.52 1.082 +117894 0.52 1.086 +117895 0.52 1.086 +117896 15.72 1.095 +117170 8.04 0.888 +117171 8.04 0.888 +117172 8.04 0.889 +117110 7.64 0.890 +117111 7.64 0.890 +117112 7.63 0.891 +117100 7.84 0.848 +117101 7.84 0.848 +117102 7.83 0.848 +117903 0.41 1.083 +117904 0.41 1.081 +117905 0.41 1.081 +117906 13.17 1.093 +117180 7.26 0.894 +117181 7.26 0.894 +117182 7.25 0.895 +117190 6.57 0.905 +117191 6.56 0.906 +117192 6.56 0.907 +117120 5.95 0.922 +117121 5.95 0.923 +117122 5.95 0.923 +117130 5.41 0.940 +117131 5.41 0.940 +117132 5.40 0.941 + +# single-top Protos+Pythia +117500 6.412 1.087 +117501 6.412 1.087 +117502 6.412 1.087 +117503 6.412 1.087 +117504 6.412 1.087 +117505 6.412 1.087 +117506 6.412 1.087 +117507 6.412 1.087 +117508 6.412 1.087 +117509 6.412 1.087 +117510 6.412 1.087 +117511 6.412 1.087 + +117773 6.412 1.087 +117774 6.412 1.087 +117775 6.412 1.087 +117776 6.412 1.087 +117777 6.412 1.087 +117778 6.412 1.087 +117779 6.412 1.087 +117780 6.412 1.087 +117781 6.412 1.087 +117782 6.412 1.087 +117783 6.412 1.087 +117784 6.412 1.087 +117785 6.412 1.087 +117786 6.412 1.087 +117787 6.412 1.087 + +117755 6.412 1.087 +117756 6.412 1.087 +117757 6.412 1.087 +117758 6.412 1.087 +117759 6.412 1.087 +117760 6.412 1.087 +117761 6.412 1.087 +117762 6.412 1.087 +117763 6.412 1.087 + +# Alpgen W+jets unfiltered samples +107680 6930.50 1.196 +107681 1305.30 1.196 +107682 378.13 1.196 +107683 101.86 1.196 +107684 25.68 1.196 +107685 6.99 1.196 +107690 6932.40 1.195 +107691 1305.90 1.195 +107692 378.07 1.195 +107693 101.85 1.195 +107694 25.72 1.195 +107695 7.00 1.195 +107700 6931.80 1.195 +107701 1304.90 1.195 +107702 377.93 1.195 +107703 101.96 1.195 +107704 25.71 1.195 +107705 7.00 1.195 + +# Alpgen W+bb+jets +107280 47.35 1.2 +107281 35.76 1.2 +107282 17.33 1.2 +107283 7.61 1.2 + +# Alpgen W+c+jets +117293 644.4 1.52 +117294 205.0 1.52 +117295 50.8 1.52 +117296 11.4 1.52 +117297 2.8 1.52 + +# Alpgen W+cc+jets +117284 127.53 1.2 +117285 104.68 1.2 +117286 52.08 1.2 +117287 16.96 1.2 + +# Sherpa W+jets +104990 8791.7 1.2 # not in TWiki +104991 8794.2 1.2 # not in TWiki +104992 8794.4 1.2 # not in TWiki +119128 8755.5 1.19 +119129 8752.8 1.20 +119930 9223.3 1.13 + +# Alpgen Z+jets unfiltered samples +107650 668.32 1.25 +107651 134.36 1.25 +107652 40.54 1.25 +107653 11.16 1.25 +107654 2.88 1.25 +107655 0.83 1.25 +107660 668.68 1.25 +107661 134.14 1.25 +107662 40.33 1.25 +107663 11.19 1.25 +107664 2.75 1.25 +107665 0.77 1.25 +107670 668.40 1.25 +107671 134.81 1.25 +107672 40.36 1.25 +107673 11.25 1.25 +107674 2.79 1.25 +107675 0.77 1.25 + +# low iMass Z+jets samples +116250 3055.20 1.25 +116251 84.92 1.25 +116252 41.40 1.25 +116253 8.38 1.25 +116254 1.85 1.25 +116255 0.46 1.25 +116260 3054.90 1.25 +116261 84.87 1.25 +116262 41.45 1.25 +116263 8.38 1.25 +116264 1.85 1.25 +116265 0.46 1.25 +116270 3055.10 1.25 +116271 84.93 1.25 +116272 41.47 1.25 +116273 8.36 1.25 +116274 1.85 1.25 +116275 0.46 1.25 + +# Alpgen Z+bb+jets +109300 6.57 1.25 +109301 2.48 1.25 +109302 0.89 1.25 +109303 0.39 1.25 +109305 6.56 1.25 +109306 2.47 1.25 +109307 0.89 1.25 +109308 0.39 1.25 +109310 6.57 1.25 +109311 2.49 1.25 +109312 0.89 1.25 +109313 0.39 1.25 + +# Sherpa Z+jets samples +104993 830.37 1 # not in TWiki +104994 878.94 1 # not in TWiki +104995 860.21 1 # not in TWiki +119126 925.29 1.16 +119127 925.00 1.16 +119931 985.00 1.09 + +# Alpgen+Herwig diboson samples +107100 2.0950 1.26 +107101 0.9962 1.26 +107102 0.4547 1.26 +107103 0.1758 1.26 +107104 0.6718 1.28 +107105 0.4138 1.28 +107106 0.2249 1.28 +107107 0.0950 1.28 +107108 0.5086 1.3 +107109 0.2342 1.3 +107110 0.0886 1.3 +107111 0.0314 1.3 + +# Herwig diboson (SM group) +105985 11.5003 1.48 +105986 0.9722 1.3 +105987 3.4641 1.6 + +# MC@NLO+Herwig diboson (SM group) +105921 0.5072 1 +105922 0.5062 1 +105923 0.5049 1 +105924 0.5059 1 +105925 0.5043 1 +105926 0.5087 1 +105927 0.5063 1 +105928 0.5044 1 +105929 0.5049 1 + +# QCD dijet samples +105802 92033341.20 1 +105807 8066705.82 1 +105009 12032000000 1 +105010 807150000 1 +105011 48041000 1 +105012 2536200 1 +105013 99591 1 +105014 2594.1 1 +105015 35.46 1 +105016 0.13394 1 +105017 0.0000056775 1 + +117018 12017000000.00 1 +117019 810020000.00 1 +117020 48019000.00 1 +117021 2537600.00 1 +117022 99496.00 1 +117023 2591.60 1 +117024 35.62 1 +117025 0.134220 1 +117026 0.000005682 1 +117027 12039000000.00 1 +117028 807410000.00 1 +117029 47895000.00 1 +117030 2537900.00 1 +117031 99520.00 1 +117032 2593.70 1 +117033 35.481 1 +117034 0.13404 1 +117035 0.0000056815 1 +117036 12034000000.00 1 +117037 807160000.00 1 +117038 48106000.00 1 +117039 2535900.00 1 +117040 99654.00 1 +117041 2592.50 1 +117042 35.4340 1 +117043 0.133670 1 +117044 0.0000056884 1 + + +# QCD multijet samples +108362 15748.0 1 +108363 29461.0 1 +108364 20097.0 1 +108365 8696.7 1 +108366 3427.2 1 +108367 325.63 1 +108368 754.03 1 +108369 710.06 1 +108370 421.27 1 +108371 240.82 1 + + + +# 4j17_3j25 filtered samples +107914 111407.37 1 +107915 23369.58 1 +108382 75418.71 1 +108383 169593.94 1 +108384 266950.90 1 +108385 58737.08 1 +108386 9816.78 1 +108387 11520.22 1 +108388 117274.09 1 +108389 173797.72 1 +108390 54182.56 1 +108391 13755.49 1 + +# mu10 filtered samples +107912 27539.59 1 +107913 988.14 1 +108818 24949.30 1 +108819 7748.63 1 +108820 1369.01 1 +108821 213.72 1 +108822 35.23 1 +108823 3123.58 1 +108824 3380.82 1 +108825 1254.33 1 +108826 333.79 1 +108827 93.40 1 + +# QCD unfiltered Multijet samples by SM group +113129 294740000.0 1 +113130 13784000.0 1 +113131 426840.0 1 +113132 10806.0 1 +113133 220.96 1 +113134 3.15 1 +113135 17045000.0 1 +113136 10910000.0 1 +113137 765580.0 1 +113138 26988.0 1 +113139 664.01 1 +113140 9.27 1 +113141 1924300.0 1 +113142 2442600.0 1 +113143 445150.0 1 +113144 25643.0 1 +113145 810.86 1 +113146 13.14 1 +113147 190490.0 1 +113148 497320.0 1 +113149 166500.0 1 +113150 15626.0 1 +113151 634.13 1 +113152 11.08 1 +113153 19690.0 1 +113154 100190.0 1 +113155 60488.0 1 +113156 9499.20 1 +113157 539.43 1 +113158 10.12 1 + +# QCD bbbar unfiltered samples +107310 69.634 1 +107311 455.63 1 +107312 571.44 1 +107313 372.83 1 +107314 229.36 1 +107315 1.338 1 +107316 9.0434 1 +107317 16.234 1 +107318 14.619 1 +107319 14.13 1 + +# QCD bbbar 4j17_3j25 filtered samples +107330 543.0 1 +107331 588.1 1 +107320 283.0 1 +107321 2089.3 1 +107322 7525.7 1 +107323 2890.9 1 +107324 735.0 1 +107325 40.5 1 +107326 1649.1 1 +107327 4934.6 1 +107328 2572.7 1 +107329 971.1 1 + +# QCD bbbar mu10 filtered samples +107335 14250.6 1 +107336 900.0 1 +107340 5145.6 1 +107341 4163.7 1 +107342 1119.4 1 +107343 234.2 1 +107344 44.5 1 +107345 390.9 1 +107346 1199.4 1 +107347 682.4 1 +107348 245.8 1 +107349 79.9 1 + +# QCD bbbar unfiltered samples by SM group +113159 1727500 1 +113160 62201 1 +113161 2108.9 1 +113162 50.9 1 +113163 1.0 1 +113164 294760 1 +113165 200410 1 +113166 13213 1 +113167 397.7 1 +113168 7.3 1 +113169 70200 1 +113170 77746 1 +113171 13523 1 +113172 667.3 1 +113173 16.5 1 +113174 9706.9 1 +113175 23280 1 +113176 7267.8 1 +113177 600.3 1 +113178 19.4 1 +113179 1407.5 1 +113180 6743.1 1 +113181 3910.5 1 +113182 570.8 1 +113183 28.2 1 + +# SSM Zprime samples: Pythia +105590 3.52350 1 +105598 2.24270 1 +105591 1.36030 1 +105599 0.82389 1 +105592 0.31621 1 +105593 0.08571 1 +105594 0.02631 1 +105595 0.00627 1 +105597 0.00031 1 + +# SSM Zprime samples: Alpgen +117620 1.5463 1 # 500 GeV +117621 1.4218 1 +117622 0.59826 1 +117623 0.23060 1 +117624 0.86363 1 # 600 GeV +117625 1.0343 1 +117626 0.48002 1 +117627 0.20418 1 +117628 0.47841 1 # 700 GeV +117629 0.74565 1 +117630 0.38238 1 +117631 0.17190 1 +117632 0.27553 1 # 800 GeV +117633 0.56866 1 +117634 0.31118 1 +117635 0.14875 1 +117636 0.11820 1 # 900 GeV +117637 0.40492 1 +117638 0.233 1 +117639 0.11281 1 + +# KKgluon samples +115550 95.0 1 # not in TWiki +115551 46.4 1 # not in TWiki +115552 24.5 1 # not in TWiki +115553 13.6 1 # not in TWiki +119318 4.98 1 # not in TWiki +115554 4.9 1 # not in TWiki +119319 1.561 1 # not in TWiki +115555 1.3 1 # not in TWiki +115556 0.43 1 # not in TWiki +115799 0.22 1 # not in TWiki +119582 0.074514 1 # not in TWiki + +# Graviton samples +115436 6.32 1 # not in TWiki +115437 3.14 1 # not in TWiki +115438 1.53 1 # not in TWiki +115439 0.77 1 # not in TWiki +115440 0.39 1 # not in TWiki +115441 0.21 1 # not in TWiki +115442 0.0021 1 # not in TWiki +115443 0.040 1 # not in TWiki + +# FCNC in MC10 Production Round +117550 8.59 1 +117551 1.36 1 + +# W polarization samples +105362 40 1 +105363 40 1 +105364 40 1 +105365 40 1 +105366 10 1 +105367 10 1 +105368 10 1 +105369 10 1 + +# background samples for same-sign di-lepton +119353 0.081658 1.2 # ttW +119354 0.063409 1.2 # ttW+j +119355 0.049798 1.3 # ttZ +119356 0.054887 1.3 # ttZ+j +119357 0.21918 1 # WW+2j +119583 0.001249 1 # ttWW + +# 4 tops with new operators +145262 0.0126 1 + +# b' to Wt +119176 6.042 1 # 300 GeV +105319 2.457 1 # 350 GeV +119314 1.092 1 # 400 GeV +119315 0.5199 1 # 450 GeV +115114 0.2612 1 # 500 GeV +119316 0.1372 1 # 550 GeV +119317 0.07443 1 # 600 GeV +145770 0.04115 1 # 650 GeV +145771 0.02369 1 # 700 GeV +145772 0.01381 1 # 750 GeV +145773 0.008166 1 # 800 GeV + +# T5/3 +145238 0.345 1.0 # mT53 = 450 pair lambda = 1 +145239 0.0891 1.0 # mT53 = 550 pair lambda = 1 +145240 0.0262 1.0 # mT53 = 650 pair lambda = 1 +145241 0.0088 1.0 # mT53 = 750 pair lambda = 1 +145242 0.0124 1.0 # mT53 = 450 single lambda = 1 +145243 0.0058 1.0 # mT53 = 550 single lambda = 1 +145244 0.0029 1.0 # mT53 = 650 single lambda = 1 +145245 0.0015 1.0 # mT53 = 750 single lambda = 1 +145305 0.345 1.0 # mT53 = 450 pair lambda = 3 +145306 0.0891 1.0 # mT53 = 550 pair lambda = 3 +145307 0.0262 1.0 # mT53 = 650 pair lambda = 3 +145308 0.0088 1.0 # mT53 = 750 pair lambda = 3 +145309 0.1098 1.0 # mT53 = 450 single lambda = 3 +145310 0.0508 1.0 # mT53 = 550 single lambda = 3 +145311 0.0246 1.0 # mT53 = 650 single lambda = 3 +145312 0.0125 1.0 # mT53 = 750 single lambda = 3 + +#FCNC top quark decays +110600 0.0002792 1 pythia # tt_bWuZlep +110601 0.0002873 1 pythia # bWuZlep_mt170 +110602 0.0002709 1 pythia # tt_bWuZlep_mt175 +110603 0.0002792 1 pythia # LessPS_tt_bWuZlep +110604 0.0002792 1 pythia # MorePS_tt_bWuZlep diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/PDF-MC12-8TeV.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/PDF-MC12-8TeV.data new file mode 100644 index 0000000000000000000000000000000000000000..22edc6a9694b78f93127b961c731dd374a0f20e8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/PDF-MC12-8TeV.data @@ -0,0 +1,1661 @@ +159802 21000 +117050 10042 +117001 10042 +117049 10042 +164439 10042 +177998 10042 +174382 10042 +178384 10042 +178385 10042 +178386 10042 +178387 10042 +178388 10042 +178389 10042 +178390 10042 +178391 10042 +178392 10042 +178393 10042 +178394 10042 +178395 10042 +105921 10800 +105922 10800 +105923 10800 +105924 10800 +105925 10800 +105926 10800 +105927 10800 +105928 10800 +105929 10800 +119583 10042 +161705 10042 +161706 10042 +161707 10042 +161708 10042 +161709 10042 +161710 10042 +161711 10042 +161716 10042 +161717 10042 +161718 10042 +161719 10042 +161720 10042 +161721 10042 +161722 10042 +161727 10042 +161728 10042 +161729 10042 +161730 10042 +161731 10042 +161732 10042 +161733 10042 +117800 10800 +117801 10800 +117802 10800 +117803 10800 +117804 10800 +117805 10800 +117806 10800 +117807 10800 +117808 10800 +117809 10800 +117007 10042 +117008 10042 +117009 10042 +117010 10042 +167650 10800 +167651 10800 +167652 10800 +167653 10800 +167654 10800 +167655 10800 +167656 10800 +167657 10800 +167658 10800 +167659 10800 +167660 10800 +167661 10800 +167662 10800 +169695 10800 +181679 10800 +105985 10042 +105986 10042 +105987 10042 +200432 10042 +200433 10042 +200434 10042 +200435 10042 +200440 10042 +200441 10042 +200442 10042 +200443 10042 +200448 10042 +200449 10042 +200450 10042 +200451 10042 +110721 10042 +110722 10042 +110723 10042 +110724 10042 +110725 10042 +110726 10042 +110727 10042 +110728 10042 +110729 10042 +110730 10042 +110731 10042 +200056 10042 +200057 10042 +200058 10042 +200059 10042 +200060 10042 +119353 10042 +119354 10042 +174830 10042 +174831 10042 +119355 10042 +119356 10042 +174832 10042 +174833 10042 +200332 10042 +200333 10042 +200334 10042 +200335 10042 +200340 10042 +200341 10042 +200342 10042 +200343 10042 +200348 10042 +200349 10042 +200350 10042 +200351 10042 +167006 10042 +167007 10042 +167008 10042 +110605 10042 +185393 10800 +185394 10800 +185396 10800 +185397 10800 +161982 10800 +161983 10800 +161987 10800 +147191 10800 +147192 10800 +147193 10800 +147194 10800 +147195 10800 +147196 10800 +129800 10800 +158633 21000 +158639 21000 +158640 21000 +167767 10800 +167768 10800 +167769 10800 +167776 10800 +167777 10800 +167778 10800 +167779 10800 +167780 10800 +167781 10800 +167782 10800 +167783 10800 +167784 10800 +167785 10800 +167786 10800 +167787 10800 +167788 10800 +167789 10800 +167790 10800 +167791 10800 +167792 10800 +167793 10800 +167794 10800 +167795 10800 +167796 10800 +190050 10042 +190051 10042 +190052 10042 +190053 10042 +190040 10042 +190041 10042 +190042 10042 +190043 10042 +190030 10042 +190031 10042 +190032 10042 +190033 10042 +190034 10042 +145583 21000 +145584 21000 +145585 21000 +145586 21000 +158765 21000 +158766 21000 +158767 21000 +158770 21000 +158771 21000 +158772 21000 +158773 21000 +158774 21000 +158775 21000 +158776 21000 +180384 21000 +180385 21000 +180386 21000 +180387 21000 +180388 21000 +180389 21000 +180390 21000 +116108 10042 +116109 10042 +178354 10042 +178355 10042 +178356 10042 +178357 10042 +178358 10042 +178359 10042 +178360 10042 +178361 10042 +178362 10042 +178363 10042 +178364 10042 +178365 10042 +178366 10042 +178367 10042 +178368 10042 +110170 21000 +110179 21000 +110193 21000 +107100 10042 +107101 10042 +107102 10042 +107103 10042 +107104 10042 +107105 10042 +107106 10042 +107107 10042 +107108 10042 +107109 10042 +107110 10042 +107111 10042 +110829 10042 +110830 10042 +110831 10042 +110832 10042 +160155 10800 +161005 10800 +161055 10800 +160255 10042 +161155 10042 +161455 10042 +161105 10042 +161646 10042 +161505 10042 +161686 10042 +201020 10042 +201021 10042 +201022 10042 +201023 10042 +201024 10042 +201220 10042 +201221 10042 +201222 10042 +201223 10042 +201224 10042 +201420 10042 +201421 10042 +201422 10042 +201423 10042 +201424 10042 +117011 10042 +117012 10042 +117013 10800 +117014 10800 +129270 10800 +129271 10800 +129272 10800 +129273 10800 +129274 10800 +110754 10042 +110755 10042 +110756 10042 +110757 10042 +110758 10042 +110759 10042 +110760 10042 +110761 10042 +110762 10042 +110763 10042 +110764 10042 +110160 21000 +110169 21000 +110186 21000 +110921 10042 +110922 10042 +110923 10042 +110924 10042 +110925 10042 +110926 10042 +110927 10042 +110928 10042 +110929 10042 +110930 10042 +110931 10042 +182764 21000 +115550 21000 +115551 21000 +115552 21000 +115553 21000 +115554 21000 +115555 21000 +115556 21000 +115799 21000 +119318 21000 +119319 21000 +119582 21000 +158768 21000 +158769 21000 +180575 21000 +180576 21000 +117360 10042 +117361 10042 +117362 10042 +167824 10800 +167825 10800 +167826 10800 +167836 10800 +167837 10800 +167838 10800 +147105 10042 +147106 10042 +147107 10042 +147108 10042 +147109 10042 +147110 10042 +147113 10042 +147114 10042 +147115 10042 +147116 10042 +147117 10042 +147118 10042 +147121 10042 +147122 10042 +147123 10042 +147124 10042 +147125 10042 +147126 10042 +174248 10042 +174249 10042 +174250 10042 +174251 10042 +174252 10042 +158110 21000 +110855 10042 +110856 10042 +110857 10042 +110858 10042 +110859 10042 +110860 10042 +110861 10042 +110862 10042 +110863 10042 +110864 10042 +110865 10042 +110866 10042 +167803 10800 +167804 10800 +167805 10800 +167815 10800 +167816 10800 +167817 10800 +167827 10800 +167828 10800 +167829 10800 +167839 10800 +167840 10800 +167841 10800 +110095 10800 +110097 20651 +182948 21000 +182949 21000 +182950 21000 +182951 21000 +182952 21000 +182953 21000 +182954 21000 +182955 21000 +182956 21000 +182957 21000 +110678 10042 +117072 10042 +108343 10800 +108344 10800 +108345 10800 +108346 10800 +169071 10042 +178396 10042 +178397 10042 +178398 10042 +178399 10042 +178400 10042 +178401 10042 +178402 10042 +178403 10042 +178404 10042 +178405 10042 +178406 10042 +178407 10042 +188599 21000 +188600 21000 +188601 21000 +188602 21000 +188603 21000 +188604 21000 +188681 21000 +188682 21000 +188683 21000 +188684 21000 +188685 21000 +188686 21000 +188687 21000 +188688 21000 +110154 21000 +110159 21000 +167821 10800 +167822 10800 +167823 10800 +167833 10800 +167834 10800 +167835 10800 +169072 10042 +146830 10042 +146831 10042 +146832 10042 +146833 10042 +146834 10042 +146835 10042 +146840 10042 +146841 10042 +146842 10042 +146843 10042 +146844 10042 +146845 10042 +146850 10042 +146851 10042 +146852 10042 +146853 10042 +146854 10042 +146855 10042 +129523 10800 +129524 10800 +129525 10800 +129526 10800 +129527 10800 +129528 10800 +129529 10800 +129530 10800 +129531 10800 +129532 10800 +129533 10800 +129534 10800 +129535 10800 +129536 10800 +129537 10800 +129538 10800 +126601 10042 +126602 10042 +126603 10042 +126604 10042 +126605 10042 +110090 10042 +110091 10042 +110119 10042 +110140 10042 +110141 10042 +110142 10042 +110143 10042 +110817 10042 +110818 10042 +110819 10042 +110820 10042 +110821 10042 +110822 10042 +110823 10042 +110824 10042 +110825 10042 +110826 10042 +110827 10042 +110828 10042 +161869 10042 +161870 10042 +161871 10042 +161872 10042 +161873 10042 +161880 10042 +161881 10042 +161882 10042 +161883 10042 +161884 10042 +161891 10042 +161892 10042 +161893 10042 +161894 10042 +161895 10042 +110148 21000 +110153 21000 +156803 10042 +156804 10042 +156805 10042 +156806 10042 +156807 10042 +156808 10042 +156809 10042 +156810 10042 +156811 10042 +156812 10042 +156813 10042 +156814 10042 +156815 10042 +156816 10042 +156817 10042 +156818 10042 +156819 10042 +156820 10042 +156821 10042 +156822 10042 +156823 10042 +156824 10042 +156825 10042 +156826 10042 +156827 10042 +156828 10042 +110899 21000 +110901 21000 +110902 21000 +110903 21000 +110904 21000 +110905 21000 +110907 21000 +110908 21000 +110910 21000 +129477 10800 +129478 10800 +129479 10800 +129480 10800 +129481 10800 +129482 10800 +129483 10800 +129484 10800 +129485 10800 +129486 10800 +129487 10800 +129488 10800 +129489 10800 +129490 10800 +129491 10800 +129492 10800 +129493 10800 +129494 10800 +105200 10800 +110001 10800 +105204 10800 +167730 10042 +167731 10042 +167732 10042 +167733 10042 +167734 10042 +167735 10042 +167736 10042 +167737 10042 +169701 10042 +169702 10042 +169703 10042 +169704 10042 +169705 10042 +169706 10042 +147800 10800 +147801 10800 +147802 10800 +147803 10800 +147804 10800 +147805 10800 +147806 10800 +147807 10800 +147808 10800 +167830 10800 +167831 10800 +167832 10800 +167842 10800 +167843 10800 +167844 10800 +174233 10042 +174234 10042 +174235 10042 +174236 10042 +174237 10042 +110843 10042 +110844 10042 +110845 10042 +110846 10042 +110847 10042 +110848 10042 +110849 10042 +110850 10042 +110851 10042 +110852 10042 +110853 10042 +110854 10042 +159110 10042 +159111 10042 +159112 10042 +159113 10042 +159114 10042 +159115 10042 +159116 10042 +159117 10042 +147910 10800 +147911 10800 +147912 10800 +147913 10800 +147914 10800 +147915 10800 +147916 10800 +147917 10800 +110500 10042 +110501 10042 +110600 10042 +117293 10042 +117294 10042 +117295 10042 +117296 10042 +117297 10042 +167740 10800 +167741 10800 +167742 10800 +167743 10800 +167744 10800 +167745 10800 +167746 10800 +167747 10800 +167748 10800 +109300 10042 +109301 10042 +109302 10042 +109303 10042 +167103 10042 +109305 10042 +109306 10042 +109307 10042 +109308 10042 +167108 10042 +109310 10042 +109311 10042 +109312 10042 +109313 10042 +147281 10042 +190001 10042 +190002 10042 +190003 10042 +190004 10042 +190005 10042 +190011 10042 +190012 10042 +190013 10042 +190014 10042 +190015 10042 +190021 10042 +190022 10042 +190023 10042 +190024 10042 +190025 10042 +178369 10042 +178370 10042 +178371 10042 +178372 10042 +178373 10042 +178374 10042 +178375 10042 +178376 10042 +178377 10042 +178378 10042 +178379 10042 +178380 10042 +178381 10042 +178382 10042 +178383 10042 +110805 10042 +110806 10042 +110807 10042 +110808 10042 +110809 10042 +110810 10042 +110811 10042 +110812 10042 +110813 10042 +110814 10042 +110815 10042 +110816 10042 +181310 10042 +181311 10042 +181312 10042 +181313 10042 +181314 10042 +181315 10042 +181320 10042 +181321 10042 +181322 10042 +181323 10042 +181324 10042 +181325 10042 +169450 10042 +169451 10042 +169452 10042 +169453 10042 +169454 10042 +169455 10042 +160069 10042 +158936 21000 +180264 21000 +180266 21000 +201027 10042 +201028 10042 +117304 10800 +117305 10800 +117306 10800 +117307 10800 +177997 10800 +183734 10800 +183736 10800 +183738 10800 +177999 10800 +183586 10800 +183588 10800 +183590 10800 +183592 10800 +189608 10800 +179974 10800 +179975 10800 +183735 10800 +183737 10800 +183739 10800 +183585 10800 +183587 10800 +183589 10800 +183591 10800 +117650 10042 +117651 10042 +117652 10042 +117653 10042 +117654 10042 +117655 10042 +117660 10042 +117661 10042 +117662 10042 +117663 10042 +117664 10042 +117665 10042 +117670 10042 +117671 10042 +117672 10042 +117673 10042 +117674 10042 +117675 10042 +180552 21000 +126892 10800 +126893 10800 +126894 10800 +126895 10800 +126414 10042 +126415 10042 +126416 10042 +126417 10042 +126418 10042 +126419 10042 +126420 10042 +126421 10042 +117706 10042 +117707 10042 +117708 10042 +117709 10042 +147770 10800 +147771 10800 +147772 10800 +147773 10800 +110144 10800 +110145 10800 +110146 10800 +110147 10800 +110801 10042 +110802 10042 +110803 10042 +110804 10042 +181380 10800 +181381 10800 +181382 10800 +181383 10800 +181384 10800 +181385 10800 +181386 10800 +181388 10800 +181389 10800 +158937 21000 +180265 21000 +180267 21000 +179991 10042 +179992 10042 +146520 20651 +146521 20651 +146522 20651 +146523 20651 +146524 20651 +146525 20651 +146526 20651 +146527 20651 +146528 20651 +146529 20651 +146530 20651 +146531 20651 +146532 20651 +107650 10042 +107651 10042 +107652 10042 +107653 10042 +107654 10042 +107655 10042 +147078 10042 +107660 10042 +107661 10042 +107662 10042 +107663 10042 +107664 10042 +107665 10042 +147086 10042 +107670 10042 +107671 10042 +107672 10042 +107673 10042 +107674 10042 +107675 10042 +147094 10042 +161303 10042 +161304 10042 +161305 10042 +161306 10042 +161307 10042 +126928 10800 +126929 10800 +126930 10800 +126931 10800 +126932 10800 +126933 10800 +126934 10800 +126935 10800 +126936 10800 +126937 10800 +126938 10800 +126939 10800 +126940 10800 +126941 10800 +126942 10800 +126949 10800 +126950 10800 +126951 10800 +182865 10042 +182866 10042 +182867 10042 +182868 10042 +182869 10042 +182870 10042 +182871 10042 +182872 10042 +182873 10042 +182874 10042 +182875 10042 +182876 10042 +182877 10042 +169887 10800 +169888 10800 +169889 10800 +117680 10042 +117681 10042 +117682 10042 +117683 10042 +117684 10042 +117685 10042 +117690 10042 +117691 10042 +117692 10042 +117693 10042 +117694 10042 +117695 10042 +117700 10042 +117701 10042 +117702 10042 +117703 10042 +117704 10042 +117705 10042 +107280 10042 +107281 10042 +107282 10042 +107283 10042 +200256 10042 +200257 10042 +200258 10042 +200259 10042 +117275 10800 +117276 10800 +117277 10800 +117278 10800 +159800 21000 +159801 21000 +159803 21000 +157814 10800 +157815 10800 +157816 10800 +157817 10800 +157818 10800 +157819 10800 +129504 10800 +129505 10800 +129506 10800 +129507 10800 +129508 10800 +129509 10800 +129510 10800 +129511 10800 +129512 10800 +129513 10800 +129514 10800 +129515 10800 +129516 10800 +129517 10800 +129518 10800 +126606 10042 +126607 10042 +126608 10042 +126609 10042 +164440 10042 +164441 10042 +164442 10042 +164443 10042 +164444 10042 +164445 10042 +164450 10042 +164451 10042 +164452 10042 +164453 10042 +164454 10042 +164455 10042 +110595 10042 +107680 10042 +107681 10042 +107682 10042 +107683 10042 +107684 10042 +107685 10042 +107690 10042 +107691 10042 +107692 10042 +107693 10042 +107694 10042 +107695 10042 +107700 10042 +107701 10042 +107702 10042 +107703 10042 +107704 10042 +107705 10042 +147025 10042 +147026 10042 +147027 10042 +147028 10042 +147029 10042 +147030 10042 +147033 10042 +147034 10042 +147035 10042 +147036 10042 +147037 10042 +147038 10042 +147041 10042 +147042 10042 +147043 10042 +147044 10042 +147045 10042 +147046 10042 +169070 10042 +110987 10042 +110988 10042 +110989 10042 +110990 10042 +110991 10042 +110992 10042 +110993 10042 +110994 10042 +110995 10042 +110996 10042 +110997 10042 +117836 10042 +117838 10042 +117840 10042 +117842 10042 +117844 10042 +117846 10042 +110954 10042 +110955 10042 +110956 10042 +110957 10042 +110958 10042 +110959 10042 +110960 10042 +110961 10042 +110962 10042 +110963 10042 +110964 10042 +203060 10042 +203062 10042 +203064 10042 +203066 10042 +203068 10042 +203070 10042 +203072 10042 +203074 10042 +203076 10042 +129160 10042 +117284 10042 +117285 10042 +117286 10042 +117287 10042 +147774 10800 +147775 10800 +147776 10800 +200156 10042 +200157 10042 +200158 10042 +200159 10042 +180339 10042 +110101 10042 +117487 10042 +117488 10042 +117489 10042 +117490 10042 +117491 10042 +158818 10042 +158819 21000 +110098 10042 +180340 10042 +180341 10042 +180342 10042 +180343 10042 +180344 10042 +180345 10042 +180909 10042 +180346 10042 +180347 10042 +180348 10042 +180349 10042 +180350 10042 +180351 10042 +180910 10042 +158813 10042 +158814 21000 +110099 10042 +110113 10042 +110114 10042 +110115 10042 +110116 10042 +110117 10042 +110118 10042 +110100 10042 +180307 21000 +180309 21000 +180311 21000 +180313 21000 +180450 21000 +180315 21000 +180317 21000 +180319 21000 +180321 21000 +180667 21000 +180669 21000 +180671 21000 +180673 21000 +180675 21000 +106201 10800 +106206 10800 +110002 10800 +110003 10800 +110136 10042 +110124 10042 +110126 10042 +110128 10042 +110130 10042 +110132 10042 +110134 10042 +110138 10042 +180553 21000 +180554 21000 +110198 20651 +110199 20651 +110135 10042 +110123 10042 +110125 10042 +110127 10042 +110129 10042 +110131 10042 +110133 10042 +110137 10042 +180334 10042 +180335 10042 +180336 10042 +180337 10042 +180338 10042 +180908 10042 +110070 10042 +110071 10042 +180308 21000 +180310 21000 +180312 21000 +180314 21000 +180316 21000 +180318 21000 +180320 21000 +180322 21000 +180668 21000 +180670 21000 +180672 21000 +180674 21000 +180676 21000 +189440 10042 +110601 10042 +110602 10042 +110603 10042 +110604 10042 +166987 10042 +166988 10042 +166989 10042 +182603 10800 +182604 10800 +182606 10800 +182607 10800 +182609 10800 +182610 10800 +182612 10800 +182613 10800 +167797 10800 +167798 10800 +167799 10800 +167809 10800 +167810 10800 +167811 10800 +110171 21000 +110172 21000 +110173 21000 +110174 21000 +110175 21000 +110176 21000 +110177 21000 +110178 21000 +110187 21000 +110188 21000 +110189 21000 +110190 21000 +110191 21000 +110192 21000 +189288 10042 +189289 10042 +189290 10042 +189291 10042 +189292 10042 +189293 10042 +182600 10800 +182601 10800 +167749 10800 +167750 10800 +167751 10800 +167752 10800 +167753 10800 +167754 10800 +167755 10800 +167756 10800 +167757 10800 +167758 10800 +167759 10800 +167760 10800 +110608 10042 +110609 10042 +182678 10800 +182679 10800 +182681 10800 +182682 10800 +182684 10800 +182685 10800 +182687 10800 +182688 10800 +166990 10042 +166991 10042 +166992 10042 +166993 10042 +110161 21000 +110162 21000 +110163 21000 +110164 21000 +110165 21000 +110166 21000 +110167 21000 +110168 21000 +110180 21000 +110181 21000 +110182 21000 +110183 21000 +110184 21000 +110185 21000 +182926 21000 +182927 21000 +182928 21000 +182929 21000 +182930 21000 +182931 21000 +182932 21000 +182933 21000 +182934 21000 +182935 21000 +182675 10800 +182676 10800 +167806 10800 +167807 10800 +167808 10800 +167818 10800 +167819 10800 +167820 10800 +161995 10042 +161996 10042 +161997 10042 +105861 10800 +188565 10042 +188566 10042 +188567 10042 +188568 10042 +188569 10042 +188570 10042 +188571 10042 +188572 10042 +188573 10042 +188574 10042 +188575 10042 +188576 10042 +188577 10042 +188578 10042 +188579 10042 +188580 10042 +188581 10042 +188582 10042 +188583 10042 +188584 10042 +188585 10042 +188586 10042 +117200 10800 +117209 10042 +117210 10042 +182648 10800 +182649 10800 +182651 10800 +182652 10800 +182654 10800 +182655 10800 +182657 10800 +182658 10800 +182663 10800 +182664 10800 +182666 10800 +182667 10800 +182669 10800 +182670 10800 +182672 10800 +182673 10800 +201030 10042 +201031 10042 +201032 10042 +201033 10042 +201034 10042 +201040 10042 +201041 10042 +201042 10042 +201043 10042 +201044 10042 +201230 10042 +201231 10042 +201232 10042 +201233 10042 +201234 10042 +201240 10042 +201241 10042 +201242 10042 +201243 10042 +201244 10042 +201430 10042 +201431 10042 +201432 10042 +201433 10042 +201434 10042 +201440 10042 +201441 10042 +201442 10042 +201443 10042 +201444 10042 +167800 10800 +167801 10800 +167802 10800 +167812 10800 +167813 10800 +167814 10800 +105860 10800 +181088 10800 +110000 10800 +182618 10800 +182619 10800 +182621 10800 +182622 10800 +182624 10800 +182625 10800 +182627 10800 +182628 10800 +182633 10800 +182634 10800 +182636 10800 +182637 10800 +182639 10800 +182640 10800 +182642 10800 +182643 10800 +182645 10800 +182646 10800 +182660 10800 +182661 10800 +117835 10042 +117837 10042 +117839 10042 +117841 10042 +117843 10042 +117845 10042 +118494 10042 +118495 10042 +118496 10042 +118497 10042 +118498 10042 +118499 10042 +118500 10042 +118501 10042 +127770 10042 +127771 10042 +127772 10042 +127773 10042 +127774 10042 +127775 10042 +127776 10042 +127777 10042 +127778 10042 +127779 10042 +127780 10042 +127781 10042 +127782 10042 +127783 10042 +127784 10042 +127785 10042 +127786 10042 +127787 10042 +127788 10042 +127789 10042 +127790 10042 +127791 10042 +127792 10042 +127793 10042 +127794 10042 +127795 10042 +127796 10042 +127797 10042 +127798 10042 +127799 10042 +127800 10042 +127801 10042 +127802 10042 +127803 10042 +127804 10042 +127805 10042 +127806 10042 +127807 10042 +127808 10042 +127809 10042 +127810 10042 +127811 10042 +127812 10042 +127813 10042 +127814 10042 +127815 10042 +127816 10042 +127817 10042 +127818 10042 +127819 10042 +127820 10042 +127822 10042 +127823 10042 +127824 10042 +127825 10042 +127826 10042 +127827 10042 +127828 10042 +127829 10042 +127830 10042 +127832 10042 +127833 10042 +127834 10042 +127835 10042 +127836 10042 +127837 10042 +127838 10042 +127839 10042 +127840 10042 +127841 10042 +127842 10042 +127843 10042 +127844 10042 +127845 10042 +127846 10042 +127847 10042 +127848 10042 +127849 10042 +127850 10042 +127851 10042 +144208 10042 +144209 10042 +144210 10042 +144211 10042 +144212 10042 +144213 10042 +164241 10042 +164242 10042 +164243 10042 +164244 10042 +164245 10042 +164246 10042 +164247 10042 +164248 10042 +164249 10042 +164250 10042 +164251 10042 +164252 10042 +164253 10042 +164646 10042 +164647 10042 +164648 10042 +164649 10042 +180323 21000 +180325 21000 +110105 10042 +110106 10042 +110107 10042 +110108 10042 +110109 10042 +110110 10042 +110111 10042 +110112 10042 +110674 10042 +110675 10042 +110676 10042 +110677 10042 +167060 10042 +167061 10042 +167062 10042 +167063 10042 +167761 10800 +167762 10800 +167763 10800 +167764 10800 +167765 10800 +167766 10800 +167770 10800 +167771 10800 +167772 10800 +167773 10800 +167774 10800 +167775 10800 +158630 21000 +158631 21000 +158632 21000 +158634 21000 +158635 21000 +158636 21000 +158637 21000 +158638 21000 +117428 10042 +117427 10042 +181087 10042 +188554 10042 +188555 10042 +188556 10042 +188557 10042 +188558 10042 +188559 10042 +188560 10042 +188561 10042 +188562 10042 +188563 10042 +188564 10042 +110155 21000 +110156 21000 +110157 21000 +110158 21000 +182692 10042 +182693 10042 +181106 10042 +181107 10042 +181108 10042 +181109 10042 +180324 21000 +180326 21000 +110870 10800 +110871 10800 +110872 10800 +182615 10800 +182616 10800 +182630 10800 +182631 10800 +110086 10800 +110087 10800 +110102 10042 +110103 10042 +110104 10042 +110149 21000 +110150 21000 +110151 21000 +110152 21000 +110040 10042 +110041 10042 +110042 10042 +110043 10042 +110044 10042 +110045 10042 +110046 10042 +110047 10042 +110048 10042 +110049 10042 +110050 10042 +110051 10042 +110873 10800 +110874 10800 +110875 10800 +110876 10800 +110877 10800 +110878 10800 +110879 10800 +110880 10800 +110881 10800 +117856 10800 +117857 10800 +117858 10800 +117859 10800 +174763 10800 +174764 10800 +174765 10800 +174766 10800 +110885 10800 +110886 10800 +110887 10800 +110888 10800 +110889 10800 +110890 10800 +110891 10800 +110892 10800 +110893 10800 +110894 10800 +110895 10800 +110896 10800 +161805 10042 +188704 10042 +188703 10042 +188705 10042 +188706 10042 +117426 10042 +117429 10042 +117416 10042 +117418 10042 +110898 21000 +110194 21000 +110195 21000 +110196 21000 +110197 21000 +202332 10042 +202333 10042 +202334 10042 +202335 10042 +202336 10042 +202337 10042 +117788 10042 +117789 10042 +117790 10042 +117791 10042 +117792 10042 +189627 10800 +189628 10800 +189629 10800 +110401 10042 +110351 10042 +110402 10042 +110403 10042 +110352 10042 +110353 10042 +110072 10042 +110073 10042 +110074 10042 +110075 10042 +203061 10042 +203063 10042 +203065 10042 +203077 10042 +203078 10042 +203079 10042 +203080 10042 +203067 10042 +203069 10042 +203071 10042 +203073 10042 +203075 10042 +189200 10800 +189203 10800 +189204 10800 +189205 10800 +189208 10800 +189209 10800 +189465 10800 +189468 10800 +189469 10800 +117075 10042 +117076 10042 +117077 10042 +117078 10042 +117079 10042 +117175 10042 +117176 10042 +117177 10042 +117178 10042 +117179 10042 +187001 10800 +187005 10800 +187003 20651 +187007 20651 +110360 10800 +110906 21000 +110909 21000 +203307 10042 +203308 10042 +203309 10042 +203310 10042 +203311 10042 +203312 10042 +203313 10042 +203314 10042 +203315 10042 +203316 10042 +203317 10042 +203318 10042 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/README.txt b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..10a00afd92e6f23825e080d4c41237f009d3fb41 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/README.txt @@ -0,0 +1,8 @@ +The files, + +mu_mc10b.root +muhist_MC11a.root +muhist_MC11b.root + +were downloaded from, +http://atlas.web.cern.ch/Atlas/GROUPS/DATAPREPARATION/InteractionsperCrossing/ diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-4gt.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-4gt.data new file mode 100644 index 0000000000000000000000000000000000000000..7bf4d1d37bc10913886eafb9a62dc1c1b796a0be --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-4gt.data @@ -0,0 +1,495 @@ +# KKGluonTTbar MadGraphPythia8 +182764 112.15 1 pythia8 #400GeV +115550 81.930 1 pythia8 #500GeV +115551 45.040 1 pythia8 #600GeV +115552 25.190 1 pythia8 #700GeV +115553 14.630 1 pythia8 #800GeV +115554 5.4730 1 pythia8 #1000GeV +115555 1.5230 1 pythia8 #1300GeV +115556 0.50040 1 pythia8 #1600GeV +115799 0.25550 1 pythia8 #1800GeV +119318 8.8070 1 pythia8 #900GeV +119319 2.8160 1 pythia8 #1150GeV +119582 0.13690 1 pythia8 #2000GeV +158768 0.06696 1 pythia8 #2250GeV +158769 0.03505 1 pythia8 #2500GeV +180575 0.01961 1 pythia8 #2750GeV +180576 0.01169 1 pythia8 #3000GeV + +# KKGluonTTbar MadGraphpythia88, variable width +145583 3.605 1 pythia8 #1000GeV, w=10pc +145584 7.078 1 pythia8 #1000GeV, w=20pc +145585 8.717 1 pythia8 #1000GeV, w=25pc +145586 10.27 1 pythia8 #1000GeV, w=30pc +158765 5.368 1 pythia8 #1000GeV, w=15pc +158766 11.74 1 pythia8 #1000GeV, w=35pc +158767 13.11 1 pythia8 #1000GeV, w=40pc +158770 0.08035 1 pythia8 #2000GeV, w=10pc +158771 0.13350 1 pythia8 #2000GeV, w=15pc +158772 0.19300 1 pythia8 #2000GeV, w=20pc +158773 0.25700 1 pythia8 #2000GeV, w=25pc +158774 0.32420 1 pythia8 #2000GeV, w=30pc +158775 0.39350 1 pythia8 #2000GeV, w=35pc +158776 0.46130 1 pythia8 #2000GeV, w=40pc +180384 0.0057130 1 pythia8 #30000GeV, w=10pc +180385 0.011300 1 pythia8 #30000GeV, w=15pc +180386 0.018360 1 pythia8 #30000GeV, w=20pc +180387 0.026760 1 pythia8 #30000GeV, w=25pc +180388 0.036130 1 pythia8 #30000GeV, w=30pc +180389 0.052027 1 pythia8 #30000GeV, w=35pc +180390 0.063836 1 pythia8 #30000GeV, w=40pc + + +# Bulk RS Graviton Samples +182865 1.5010 1.2945 pythia8 +182866 1.0860 1.2357 pythia8 +182867 0.50850 1.2232 pythia8 +182868 0.23490 1.2171 pythia8 +182869 0.11260 1.2149 pythia8 +182870 0.056440 1.2116 pythia8 +182871 0.029440 1.2123 pythia8 +182872 0.0088570 1.2160 pythia8 +182873 0.0029550 1.2108 pythia8 +182874 0.0010650 1.2094 pythia8 +182875 0.00040830 1.2089 pythia8 +182876 0.00016370 1.2083 pythia8 +182877 0.000019400 1.2088 pythia8 + + +# Zprimettbar +110899 4.2589 1 pythia8 +110901 3.9325 1 pythia8 +110902 1.2433 1 pythia8 +110903 0.39360 1 pythia8 +110904 0.13872 1 pythia8 +110905 0.052433 1 pythia8 +110906 0.021172 1 pythia8 +110907 0.0089422 1 pythia8 +110908 0.0039337 1 pythia8 +110909 0.0018023 1 pythia8 +110910 0.0004340 1 pythia8 + +# Heavy Higgs to ttbar (dummy values) +203307 1.0 1 pythia8 +203308 1.0 1 pythia8 +203309 1.0 1 pythia8 +203310 1.0 1 pythia8 +203311 1.0 1 pythia8 +203312 1.0 1 pythia8 +203313 1.0 1 pythia8 +203314 1.0 1 pythia8 +203315 1.0 1 pythia8 +203316 1.0 1 pythia8 +203317 1.0 1 pythia8 +203318 1.0 1 pythia8 + +# b' +158102 1.2550 1.4226 pythia8 +158103 0.62927 1.3909 pythia8 +158104 0.33267 1.3565 pythia8 +158105 0.18312 1.3304 pythia8 +158106 0.10471 1.3040 pythia8 +158107 0.061503 1.2819 pythia8 +158108 0.036838 1.2614 pythia8 +158109 0.022551 1.2411 pythia8 +158110 0.014026 1.2229 pythia8 +158111 0.0088308 1.2093 pythia8 +158112 0.0056310 1.1939 pythia8 +158113 0.0036207 1.1838 pythia8 +158114 0.0023493 1.1696 pythia8 +158115 0.95281 1.4208 pythia8 +158116 0.47823 1.3960 pythia8 +158117 0.25681 1.3628 pythia8 +158118 0.14355 1.3335 pythia8 +158119 0.082432 1.3085 pythia8 +158120 0.048734 1.2834 pythia8 +158121 0.029277 1.2632 pythia8 +158122 0.017988 1.2438 pythia8 +158123 0.011201 1.2266 pythia8 +158124 0.0070960 1.2114 pythia8 +158125 0.0045279 1.1952 pythia8 +158126 0.0029111 1.1841 pythia8 +158127 0.0018916 1.1727 pythia8 + +# b* +182948 27.630 1.000 pythia8 +182949 10.310 1.000 pythia8 +182950 4.2020 1.000 pythia8 +182951 1.8360 1.000 pythia8 +182952 0.84380 1.000 pythia8 +182953 27.600 1.000 pythia8 +182954 10.280 1.000 pythia8 +182955 4.1950 1.000 pythia8 +182956 1.8340 1.000 pythia8 +182957 0.84320 1.000 pythia8 + + +# W'->tb right +110921 17.510 1.2906 pythia8 +110922 3.7174 1.2779 pythia8 +110923 1.0652 1.2796 pythia8 +110924 0.37278 1.2260 pythia8 +110925 0.13932 1.2183 pythia8 +110926 0.055667 1.2062 pythia8 +110927 0.023718 1.1740 pythia8 +110928 0.010283 1.1669 pythia8 +110929 0.0046794 1.1485 pythia8 +110930 0.0021970 1.1522 pythia8 +110931 0.0011035 1.1592 pythia8 + +# W'->tb left +110954 12.333 1.3684 pythia8 +110955 2.7223 1.3144 pythia8 +110956 0.81915 1.2564 pythia8 +110957 0.28025 1.2405 pythia8 +110958 0.10618 1.2202 pythia8 +110959 0.043693 1.1893 pythia8 +110960 0.018551 1.1774 pythia8 +110961 0.0082073 1.1638 pythia8 +110962 0.0038171 1.1512 pythia8 +110963 0.0018512 1.1529 pythia8 +110964 0.00095811 1.1687 pythia8 + +# W'->tb ST left +110987 12.573 1.3684 pythia8 +110988 3.4404 1.3144 pythia8 +110989 1.7639 1.2564 pythia8 +110990 1.3349 1.2405 pythia8 +110991 1.2186 1.2202 pythia8 +110992 1.1895 1.1893 pythia8 +110993 1.1855 1.1774 pythia8 +110994 1.1892 1.1638 pythia8 +110995 1.1946 1.1512 pythia8 +110996 1.1999 1.1529 pythia8 +110997 1.2043 1.1687 pythia8 + +# W'->tb right - hadronic +110721 2.1670 1.3124 pythia8 +110722 0.75924 1.2559 pythia8 +110723 0.28404 1.2468 pythia8 +110724 0.11362 1.2330 pythia8 +110725 0.048428 1.1997 pythia8 +110726 0.021002 1.1920 pythia8 +110727 0.0095606 1.1728 pythia8 +110728 0.0044880 1.1768 pythia8 +110729 0.0022511 1.1856 pythia8 +110730 0.0012078 1.2134 pythia8 +110731 0.00071089 1.2362 pythia8 + +# W'->tb left - hadronic +110754 1.7351 1.2375 pythia8 +110755 0.60662 1.1957 pythia8 +110756 0.23560 1.1474 pythia8 +110757 0.099507 1.0895 pythia8 +110758 0.043188 1.0552 pythia8 +110759 0.019372 1.0288 pythia8 +110760 0.0090546 1.0126 pythia8 +110761 0.0043662 1.0198 pythia8 +110762 0.0022284 1.0484 pythia8 +110763 0.0012275 1.0855 pythia8 +110764 0.00073171 1.1271 pythia8 + +# W' with varied g'/g - Leptonic +110843 140.57 1.2906 pythia8 +110844 1.5401 1.2183 pythia8 +110845 0.10874 1.1485 pythia8 +110846 303.48 1.2906 pythia8 +110847 4.4181 1.2183 pythia8 +110848 0.45537 1.1485 pythia8 +110849 93.897 1.3684 pythia8 +110850 1.1980 1.2202 pythia8 +110851 0.095574 1.1512 pythia8 +110852 184.66 1.3684 pythia8 +110853 3.1071 1.2202 pythia8 +110854 0.34792 1.1512 pythia8 + +110732 0.26357 1.2062 pythia8 +110733 0.12229 1.1740 pythia8 +110734 0.059508 1.1669 pythia8 +110735 0.35528 1.1740 pythia8 +110736 0.18931 1.1669 pythia8 +110737 0.25667 1.1485 pythia8 +110738 0.16283 1.1522 pythia8 +110739 0.29591 1.1522 pythia8 +110740 0.20298 1.1522 pythia8 + +110741 0.21356 1.1893 pythia8 +110742 0.10045 1.1774 pythia8 +110743 0.050560 1.1638 pythia8 +110744 0.29422 1.1774 pythia8 +110745 0.16181 1.1638 pythia8 +110746 0.21351 1.1512 pythia8 +110747 0.13806 1.1529 pythia8 +110748 0.22950 1.1529 pythia8 +110749 0.15757 1.1687 pythia8 + +# W' with varied g'/g - hadronic +110855 284.15 1.3353 pythia8 +110856 3.1363 1.2468 pythia8 +110857 0.22101 1.1728 pythia8 +110858 613.14 1.3353 pythia8 +110859 8.9741 1.2468 pythia8 +110860 0.92395 1.1728 pythia8 +110861 191.76 1.3960 pythia8 +110862 2.5811 1.1474 pythia8 +110863 0.20826 1.0126 pythia8 +110864 377.74 1.3960 pythia8 +110865 6.5750 1.1474 pythia8 +110866 0.74246 1.0126 pythia8 + +# u4u4 +158630 1.9937 1.4588 pythia8 +158631 0.94208 1.4264 pythia8 +158632 0.47655 1.3918 pythia8 +158633 0.25388 1.3594 pythia8 +158634 0.13997 1.3334 pythia8 +158635 0.080339 1.3069 pythia8 +158636 0.047250 1.2838 pythia8 +158637 0.028483 1.2627 pythia8 +158638 0.017437 1.2450 pythia8 +158639 0.010883 1.2253 pythia8 +158640 0.0043819 1.1970 pythia8 + + +# 4top samples +158344 0.00068523 1 pythia8 # SM +158345 0.042238 1 pythia8 # DeGrande +159800 1.2845 1 pythia8 # 2UEDRPP600GeV +159801 0.11389 1 pythia8 # 2UEDRPP800GeV +159802 0.011719 1 pythia8 # 2UEDRPP1000GeV +159803 0.0012215 1 pythia8 # 2UEDRPP1200GeV + +#sgluon-sgluon +180334 8.2672 1.7946 pythia # 2ttbar 350GeV +180335 3.5299 1.8563 pythia # 2ttbar 400GeV +180336 0.78021 1.9826 pythia # 2ttbar 500GeV +180337 0.20709 2.1062 pythia # 2ttbar 600GeV +180338 0.020211 2.3735 pythia # 2ttbar 800GeV +180339 0.0025464 2.7127 pythia # 2ttbar 1000GeV +180908 0.00023293 3.1859 pythia # 2ttbar 1250GeV + +180340 8.2606 1.7961 pythia # 2ttbar 350GeV +180341 3.5228 1.8601 pythia # 2ttbar 400GeV +180342 0.77819 1.9878 pythia # 2ttbar 500GeV +180343 0.20733 2.1037 pythia # 2ttbar 600GeV +180344 0.020178 2.3773 pythia # 2ttbar 800GeV +180345 0.0025563 2.7022 pythia # 2ttbar 1000GeV +180909 0.00023425 3.1680 pythia # 2ttbar 1250GeV + +180346 8.2724 1.7935 pythia # 2ttbar 350GeV +180347 3.5308 1.8591 pythia # 2ttbar 400GeV +180348 0.77785 1.9886 pythia # 2ttbar 500GeV +180349 0.20627 2.1146 pythia # 2ttbar 600GeV +180350 0.020076 2.3894 pythia # 2ttbar 800GeV +180351 0.0025516 2.7072 pythia # 2ttbar 1000GeV +180910 0.00023240 3.1932 pythia # 2ttbar 1250GeV + +# VLQ B singlet +188599 0.060070 1.0000 pythia +188681 0.034170 1.0000 pythia +188682 0.025790 1.0000 pythia +188600 0.019960 1.0000 pythia +188683 0.015740 1.0000 pythia +188684 0.012430 1.0000 pythia +188685 0.0099890 1.0000 pythia +188601 0.0079160 1.0000 pythia +188604 0.19310 1.0000 pythia +188686 0.0063930 1.0000 pythia +188687 0.0053000 1.0000 pythia +188688 0.0042430 1.0000 pythia +188602 0.0034630 1.0000 pythia +188603 0.0016090 1.0000 pythia + +#VLQ quarks pair production PROTOS-pythia +# BBS +180308 3.6357 1.0000 pythia +180265 1.6808 1.0000 pythia +180310 0.82524 1.0000 pythia +180312 0.43140 1.0000 pythia +180314 0.23365 1.0000 pythia +158937 0.12551 1.0000 pythia +180316 0.075812 1.0000 pythia +180318 0.044844 1.0000 pythia +180320 0.027059 1.0000 pythia +180267 0.016549 1.0000 pythia +180322 0.010323 1.0000 pythia +180668 0.0067918 1.0000 pythia +180670 0.0039697 1.0000 pythia +180672 0.0025396 1.0000 pythia +180674 0.0016371 1.0000 pythia +180676 0.0010627 1.0000 pythia + +# VLQ T singlet (T-->Zt) +188704 0.12998 0.89613 pythia8 +188703 0.19519 1.1301 pythia8 +188705 0.086405 1.0413 pythia8 +188706 0.058032 1.2022 pythia8 + +#VLQ T singlet (T-->Wb) Samples +203060 1.6456 1.000 pythia8 +203061 0.95096 1.000 pythia8 +203062 0.57293 1.000 pythia8 +203063 0.35716 1.000 pythia8 +203064 0.23241 1.000 pythia8 +203065 0.15390 1.000 pythia8 +203066 0.10524 1.000 pythia8 +203077 0.026674 1.000 pythia8 +203078 0.22466 1.000 pythia8 +203079 0.37378 1.000 pythia8 +203080 0.54010 1.000 pythia8 +203067 0.071969 1.000 pythia8 +203068 0.050636 1.000 pythia8 +203069 0.036129 1.000 pythia8 +203070 0.025804 1.000 pythia8 +203071 0.018845 1.000 pythia8 +203072 0.013806 1.000 pythia8 +203073 0.010276 1.000 pythia8 +203074 0.0076407 1.000 pythia8 +203075 0.0057706 1.000 pythia8 +203076 0.0043321 1.000 pythia8 + +# TTS +Protos+Pythia with AUET2B tune (mc12a, AFII) +180307 3.8198 1.0000 pythia +180264 1.7554 1.0000 pythia +180309 0.85988 1.0000 pythia +180311 0.44873 1.0000 pythia +180313 0.24267 1.0000 pythia +158936 0.13013 1.0000 pythia +180450 0.13567 1.0000 pythia +180315 0.078522 1.0000 pythia +180317 0.046326 1.0000 pythia +180319 0.027988 1.0000 pythia +180266 0.017123 1.0000 pythia +180321 0.010642 1.0000 pythia +180667 0.0070076 1.0000 pythia +180669 0.0040868 1.0000 pythia +180671 0.0026151 1.0000 pythia +180673 0.0016876 1.0000 pythia +180675 0.0010928 1.0000 pythia + +# BBD +180324 3.6358 1.0000 pythia +180326 0.13077 1.0000 pythia + +# TTD +180323 3.8114 1.0000 pythia +180325 0.13531 1.0000 pythia + +#same-sign top +180552 2.223 1 pythia #LL +180553 0.275 1 pythia #LR +180554 2.173 1 pythia #RR + +#FCNC +182926 0.0056579 1 pythia8 #mH=125 +182927 0.0024763 1 pythia8 #mH=250 +182928 0.00071316 1 pythia8 #mH=500 +182929 0.00027500 1 pythia8 #mH=750 +182930 0.00070581 1 pythia8 #mH=250 +182931 0.00016655 1 pythia8 #mH=500 +182932 0.000054608 1 pythia8 #mH=750 +182933 0.000015699 1 pythia8 #mH=250 +182934 3.2599e-06 1 pythia8 #mH=500 +182935 9.709e-07 1 pythia8 #mH=750 + +#same-sign top ISR/FSR +182692 2.2230 1 pythia +182693 2.2230 1 pythia + +# Monotop, scalar resonant, not full-had +110148 1.1067 1 pythia8 +110149 1.1023 1 pythia8 +110150 1.0892 1 pythia8 +110151 1.0680 1 pythia8 +110152 1.0387 1 pythia8 +110153 1.0012 1 pythia8 + +# Monotop, scalar non-resonant, not full-had +110160 96.0340 1 pythia8 +110161 358.9900 1 pythia8 +110162 113.3500 1 pythia8 +110163 59.8660 1 pythia8 +110164 37.4460 1 pythia8 +110165 25.3540 1 pythia8 +110166 17.9990 1 pythia8 +110167 9.6617 1 pythia8 +110168 5.5062 1 pythia8 +110169 3.3281 1 pythia8 +110180 1.3731 1 pythia8 +110181 0.63605 1 pythia8 +110182 0.31887 1 pythia8 +110183 0.16980 1 pythia8 +110184 0.094625 1 pythia8 +110185 0.054732 1 pythia8 +110186 0.032584 1 pythia8 + +# Monotop, scalar resonant, full-had +110154 2.2140 1 pythia8 +110155 2.2052 1 pythia8 +110156 2.1796 1 pythia8 +110157 2.1366 1 pythia8 +110158 2.0784 1 pythia8 +110159 2.0033 1 pythia8 + +# Monotop, scalar non-resonant, full-had +110170 192.39 1 pythia8 +110171 717.88 1 pythia8 +110172 226.88 1 pythia8 +110173 119.54 1 pythia8 +110174 74.815 1 pythia8 +110175 50.682 1 pythia8 +110176 35.959 1 pythia8 +110177 19.281 1 pythia8 +110178 11.016 1 pythia8 +110179 6.6557 1 pythia8 +110187 2.7457 1 pythia8 +110188 1.2704 1 pythia8 +110189 0.63712 1 pythia8 +110190 0.33906 1 pythia8 +110191 0.18894 1 pythia8 +110192 0.10925 1 pythia8 +110193 0.065065 1 pythia8 + +# Monotop with Effective Coupling Variations Samples +110194 6.0862 1 pythia8 +110195 21.832 1 pythia8 +110196 12.170 1 pythia8 +110197 43.703 1 pythia8 + +# Pair production of heavy top quark partner (T5/3) +188554 0.15953 1.000 pythia8 +188555 0.095598 1.000 pythia8 +188556 0.058648 1.000 pythia8 +188557 0.036686 1.000 pythia8 +188558 0.023310 1.000 pythia8 +188559 0.015035 1.000 pythia8 +188560 0.0098129 1.000 pythia8 +188561 0.0064621 1.000 pythia8 +188562 0.0042793 1.000 pythia8 +188563 0.0028530 1.000 pythia8 +188564 0.0019121 1.000 pythia8 + +# Single production of heavy top quark partner (T5/3) +188565 0.021791 1.000 pythia8 +188566 0.014768 1.000 pythia8 +188567 0.010174 1.000 pythia8 +188568 0.0071104 1.000 pythia8 +188569 0.0050348 1.000 pythia8 +188570 0.0036116 1.000 pythia8 +188571 0.0026199 1.000 pythia8 +188572 0.0019170 1.000 pythia8 +188573 0.0014138 1.000 pythia8 +188574 0.0010494 1.000 pythia8 +188575 0.00078572 1.000 pythia8 +188576 0.0054542 1.000 pythia8 +188577 0.0036968 1.000 pythia8 +188578 0.0025442 1.000 pythia8 +188579 0.0017799 1.000 pythia8 +188580 0.0012611 1.000 pythia8 +188581 0.00090422 1.000 pythia8 +188582 0.00065514 1.000 pythia8 +188583 0.00047951 1.000 pythia8 +188584 0.00035363 1.000 pythia8 +188585 0.00026334 1.000 pythia8 +188586 0.00019659 1.000 pythia8 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-Higgs.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-Higgs.data new file mode 100644 index 0000000000000000000000000000000000000000..f8bd2be33092508e7a9bcc078613ac26332c61bd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV-Higgs.data @@ -0,0 +1,133 @@ +#ttH +169887 0.057971 1.0193 pythia8 #PowHelttH125inc AllHad +169888 0.055519 1.0201 pythia8 #PowHelttH125inc ljets +169889 0.013271 1.0230 pythia8 #PowHelttH125inc dil + +189627 0.059090 1.000 herwig #H-->incl. (all hadr.), mH = 125 GeV +189628 0.056633 1.000 herwig #H-->incl. (singlelept), mH = 125 GeV +189629 0.013576 1.000 herwig #H-->incl. (dilept), mH = 125 GeV + +#ttH(WW) +161303 0.0097039 1.4632 pythia8 # mH=115 +161304 0.014331 1.4355 pythia8 # mH=120 +161305 0.019499 1.4257 pythia8 # mH=125 +161306 0.024560 1.4175 pythia8 # mH=130 +161307 0.028993 1.4128 pythia8 # mH=135 + +# ttH(->bb) dilepton: +161869 0.0086632 1.4071 pythia8 # mH=115 +161870 0.0070759 1.4021 pythia8 # mH=120 +161871 0.0055716 1.4053 pythia8 # mH=125 +161872 0.0042262 1.4094 pythia8 # mH=130 +161873 0.0030747 1.4135 pythia8 # mH=135 +# ttH(->bb) semi-lepton: +161880 0.036250 1.4028 pythia8 # mH=115 +161881 0.029431 1.4062 pythia8 # mH=120 +161882 0.023268 1.4036 pythia8 # mH=125 +161883 0.024846 1 pythia8 # mH=130 +161884 0.012902 1.4052 pythia8 # mH=135 +# ttH(->bb) full-had: +161891 0.037874 1.4009 pythia8 # mH=115 +161892 0.030805 1.4017 pythia8 # mH=120 +161893 0.024336 1.4003 pythia8 # mH=125 +161894 0.018454 1.4048 pythia8 # mH=130 +161895 0.013434 1.4080 pythia8 # mH=135 + +# ttH(gamgam) +160069 0.00025687 1.1477 pythia8 # mH=125 + +# ttH(tautau) +161705 0.0014351 1.2852 pythia8 # mH= +161706 0.0011883 1.3059 pythia8 # mH= +161707 0.00097615 1.3048 pythia8 # mH= +161708 0.00077024 1.3156 pythia8 # mH= 125 tautaull +161709 0.00058702 1.3228 pythia8 # mH= +161710 0.00043017 1.3253 pythia8 # mH= +161711 0.00030095 1.3270 pythia8 # mH= +161716 0.0052111 1.3016 pythia8 # mH= +161717 0.0043948 1.2985 pythia8 # mH= +161718 0.0036005 1.3009 pythia8 # mH= +161719 0.0028600 1.3029 pythia8 # mH= 125 tautaulh +161720 0.0021656 1.3186 pythia8 # mH= +161721 0.0015877 1.3205 pythia8 # mH= +161722 0.0011187 1.3129 pythia8 # mH= +161727 0.0048070 1.2996 pythia8 # mH= +161728 0.0039865 1.3185 pythia8 # mH= +161729 0.0033272 1.2966 pythia8 # mH= +161730 0.0026259 1.3070 pythia8 # mH= 125 tautauhh +161731 0.0019943 1.3188 pythia8 # mH= +161732 0.0014615 1.3213 pythia8 # mH= +161733 0.0010082 1.3418 pythia8 # mH= + +# ttH(ZZ) +169072 0.0023465 1.4547 pythia8 + +# ttH(cc) +169071 0.0030317 1.2411 pythia8 + +# ttH(gg) +169070 0.0056990 1.9444 pythia8 + +# tbH+ +109745 0.080856 1 pythia #mH=250 +109748 0.0097033 1 pythia #mH=400 + +167650 0.89316 1 pythia8 +167651 0.79360 1 pythia8 +167652 0.71063 1 pythia8 +167653 0.54583 1 pythia8 +167654 0.42375 1 pythia8 +167655 0.33133 1 pythia8 +167656 0.26089 1 pythia8 +167657 0.16487 1 pythia8 +167658 0.10658 1 pythia8 +167659 0.070374 1 pythia8 +167660 0.047289 1 pythia8 +167661 0.032312 1 pythia8 +167662 0.022410 1 pythia8 +169695 0.0080434 1 pythia8 +181679 0.0017616 1 pythia8 + +# H+tb +146520 2.2263 1 pythia # +146521 1.9767 1 pythia # +146522 1.7665 1 pythia # +146523 1.3579 1 pythia # +146524 1.0543 1 pythia # +146525 0.82642 1 pythia # +146526 0.65171 1 pythia # +146527 0.41153 1 pythia # +146528 0.26689 1 pythia # +146529 0.17634 1 pythia # +146530 0.11864 1 pythia # +146531 0.081053 1 pythia # +146532 0.056191 1 pythia # + +110674 1.1001 1 pythia +110675 1.3801 1 pythia +110676 0.36962 1 pythia +110677 0.11089 1 pythia +110678 0.037305 1 pythia + +189288 0.19599 1 pythia8 # +189289 0.028132 1 pythia8 # +189290 0.0055760 1 pythia8 # +189291 0.10096 1 pythia8 # +189292 0.013193 1 pythia8 # +189293 0.0025473 1 pythia8 # + +#VH (H->bb) +161805 0.10672 1.2343 pythia8 #WH + +# H+ -> tb +189817 2.8822e-07 1.000 pythia8 +189818 9.7397e-08 1.000 pythia8 +189819 3.3567e-08 1.000 pythia8 +189820 1.1743e-08 1.000 pythia8 +189821 4.1178e-09 1.000 pythia8 +189822 1.4479e-09 1.000 pythia8 +189823 1.0378e-06 1.000 pythia8 +189824 2.8341e-07 1.000 pythia8 +189825 2.3823e-08 1.000 pythia8 +189826 2.1901e-09 1.000 pythia8 +189827 6.7395e-10 1.000 pythia8 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV.data new file mode 100644 index 0000000000000000000000000000000000000000..1caa2c5265941be385516fb39dbe785e4ec48f69 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC12-8TeV.data @@ -0,0 +1,1554 @@ +# ttbar Powheg+Pythia +117050 114.51 1.1992 pythia +110340 105.86 1.2971 pythia +117001 105.85 1.2973 pythia +117049 96.346 1.1995 pythia +117046 114.53 1.1994 pythia8 + +# ttbar MC@NLO+Herwig +105200 112.94 1.2158 herwig +110001 21.806 1.2177 herwig +105204 95.125 1.2149 herwig + +# ttbar Sherpa samples +117800 9.1637 1.2876 sherpa +117801 3.2296 1.2860 sherpa +117802 0.2800 1.3053 sherpa +117803 55.8120 1.9846 sherpa +117804 6.0007 1.2741 sherpa +117805 9.7764 1.3295 sherpa +117806 1.0546 1.2759 sherpa +117807 83.578 1.3827 sherpa +117808 18.001 1.3293 sherpa +117809 0.96733 1.2804 sherpa + +# ttbar Powheg+Pythia +181087 22.134 1.1997 pythia +105861 114.46 1.1997 pythia +110401 114.47 1.1997 pythia +110404 114.47 1.1996 pythia #hdamp=mt +110351 96.343 1.1996 pythia +110352 96.333 1.1997 pythia +110353 96.335 1.1997 pythia + +110407 114.47 1.1996 pythia +110408 114.47 1.1996 pythia +110423 96.343 1.1996 pythia +110424 96.343 1.1996 pythia + +# ttbar aMCatNLO+Herwig++ + +110082 96.62 1.1962 herwigpp +110083 114.87 1.1954 herwigpp + +# ttbar Powheg+Herwig +181088 22.134 1.1997 herwig +105860 115.56 1.1883 herwig +110000 96.346 1.1995 herwig +110360 96.358 1.1994 herwig + +# ttbar Powheg+Pythia8 +187001 114.47 1.1996 pythia8 +187005 114.47 1.1996 pythia8 + +# ttbar Powheg+Herwig++ +187003 114.24 1.2020 herwigpp +187007 114.24 1.2020 herwigpp + +# ttbar MC@NLO+Herwig++ +110198 21.886 1.2133 herwigpp +110199 91.192 1.2146 herwigpp + +# ttbar MadGraph+Pythia +110870 57.120 2.0233 pythia +110871 54.831 2.0201 pythia +110872 13.153 2.0188 pythia + +# ttbar + LF - Alpgen+Pythia (On-The-Fly) +201020 4.2869 1.9655 pythia +201021 4.3844 1.9655 pythia +201022 2.7985 1.9655 pythia +201023 1.2939 1.9655 pythia +201024 0.74637 1.9655 pythia +201220 17.151 2.0491 pythia +201221 17.532 2.0491 pythia +201222 11.209 2.0491 pythia +201223 5.1767 2.0491 pythia +201224 2.9869 2.0491 pythia +201420 17.164 2.1385 pythia +201421 17.521 2.1385 pythia +201422 11.204 2.1385 pythia +201423 5.1704 2.1385 pythia +201424 2.9829 2.1385 pythia + +# ttbar + LF Alpgen+herwig +164440 4.7977 1.736 herwig # ttbarlnlnNp0 +164441 5.0677 1.736 herwig # ttbarlnlnNp1 +164442 3.2547 1.736 herwig # ttbarlnlnNp2 +164443 2.1749 1.736 herwig # ttbarlnlnNp3+ +164444 1.5226 1.736 herwig # ttbarlnlnNp3 +164445 0.76980 1.736 herwig # ttbarlnlnNp4+ +164450 19.186 1.808 herwig # ttbarlnqqNp0 +164451 20.282 1.808 herwig # ttbarlnqqNp1 +164452 13.084 1.808 herwig # ttbarlnqqNp2 +164453 8.7001 1.808 herwig # ttbarlnqqNp3+ +164454 6.0821 1.808 herwig # ttbarlnqqNp3 +164455 3.0842 1.808 herwig # ttbarlnqqNp4+ + +# ttbar + HF - Alpgen+Pythia (On-The-Fly) +201027 2.7165 1.7914 pythia +201028 1.4375 1.7910 pythia + +# ttbar + HF Alpgen+herwig +116108 1.4353 1.7937 herwig # ttbbincl +116109 2.7130 1.7937 herwig # ttccincl +181106 0.16020 1.5889 herwig # ttbbinclNp0 dilep +181107 0.63725 1.6662 herwig # ttbbinclNp0 lepjets +181108 0.30210 1.5926 herwig # ttccinclNp0 dilep +181109 1.2058 1.6645 herwig # ttccinclNp0 lepjets + +# ttbar ISR/FSR variation +117209 59.624 2.3031 pythia +117210 59.622 2.3032 pythia +117211 50.066 2.3084 pythia +117212 50.065 2.3084 pythia + + +# ttbar Non Perturbative Samples +117426 114.51 1.1992 pythia +117429 114.51 1.1992 pythia +117416 96.346 1.1995 pythia +117418 96.337 1.1997 pythia +110402 114.46 1.1997 pythia +110403 114.47 1.1997 pythia + +# ttbar Scale Variation Samples +201030 3.7532 1.9180 pythia +201031 4.2892 1.9180 pythia +201032 3.0905 1.9180 pythia +201033 1.6044 1.9180 pythia +201034 1.1071 1.9180 pythia +201040 4.7494 1.9986 pythia +201041 4.4065 1.9986 pythia +201042 2.5387 1.9986 pythia +201043 1.0610 1.9986 pythia +201044 0.53059 1.9986 pythia +201230 15.017 2.0010 pythia +201231 17.162 2.0010 pythia +201232 12.372 2.0010 pythia +201233 6.4212 2.0010 pythia +201234 4.3842 2.0010 pythia +201240 18.995 2.0841 pythia +201241 17.622 2.0841 pythia +201242 10.161 2.0841 pythia +201243 4.2490 2.0841 pythia +201244 2.1198 2.0841 pythia +201430 15.018 2.0862 pythia +201431 17.155 2.0862 pythia +201432 12.370 2.0862 pythia +201433 6.4134 2.0862 pythia +201434 4.4404 2.0862 pythia +201440 18.989 2.1761 pythia +201441 17.612 2.1761 pythia +201442 10.157 2.1761 pythia +201443 4.2326 2.1761 pythia +201444 2.1188 2.1761 pythia + +# ttbar MadGraph+Pythia +110873 42.365 2.7280 pythia +110874 40.647 2.7251 pythia +110875 9.7585 2.7211 pythia +110876 91.473 1.2634 pythia +110877 87.847 1.2609 pythia +110878 21.049 1.2615 pythia +110879 63.046 1.8331 pythia +110880 60.505 1.8307 pythia +110881 14.530 1.8274 pythia + +110885 57.119 2.0233 pythia +110886 54.843 1.3466 pythia +110887 13.158 2.0180 pythia +110888 57.099 2.0241 pythia +110889 54.835 1.3468 pythia +110890 13.157 2.0183 pythia +110891 57.136 2.0227 pythia +110892 54.856 1.3463 pythia +110893 13.150 2.0192 pythia +110894 57.092 2.0243 pythia +110895 54.779 1.3482 pythia +110896 13.148 2.0196 pythia + +# ttbar Renormalisation/factorisation scale variation +174763 126.78 1.0831 pythia +174764 103.01 1.3330 pythia +174765 118.53 1.1585 pythia +174766 111.18 1.2351 pythia + +117856 115.56 1.1883 herwig +117857 115.56 1.1883 herwig +117858 115.56 1.1883 herwig +117859 115.56 1.1883 herwig + +# ttbar Massive B/C +181380 9.3494 1.2713 sherpa # TTbarLeptLeptMassiveCB +181381 3.2607 1.2737 sherpa # +181382 0.28350 1.2892 sherpa +181383 47.153 1.5660 sherpa # TTbarLeptHadMassiveCB +181384 6.0329 1.2673 sherpa +181385 9.8229 1.3232 sherpa +181386 1.0466 1.2857 sherpa +181388 18.036 1.3267 sherpa +181389 0.96234 1.2871 sherpa + +# ttbar without Spin Correlation +117072 22.174 1.1975 pythia +117200 23.115 1.1488 herwig + +# ttbar with modified branching ratios for top quarks +110606 26.550 1. pythia +110608 110.77 1 pythia +110609 110.77 1 pythia + +# ttbar Mass Variation not all had +117836 143.21 1.2008 pythia +117838 132.87 1.1997 pythia +117840 123.27 1.1998 pythia +117842 106.46 1.1988 pythia +117844 99.045 1.1984 pythia +117846 92.214 1.1981 pythia + +# Mass Variation all had +117835 120.64 1.1197 pythia +117837 111.71 1.2010 pythia +117839 103.74 1.1998 pythia +117841 89.550 1.1988 pythia +117843 83.336 1.1984 pythia +117845 77.604 1.1981 pythia + +# ttbar mass variation +106201 121.61 1.2161 herwig +106206 105.06 1.2148 herwig +110002 23.475 1.2182 herwig +110003 20.276 1.2171 herwig + +# ttbar mass slices +117075 0.61073 1.1994 pythia +117076 0.21459 1.1994 pythia +117077 0.081171 1.1994 pythia +117078 0.041004 1.1994 pythia +117079 0.016542 1.1994 pythia + +117175 0.51317 1.1995 pythia +117176 0.18043 1.1995 pythia +117177 0.068411 1.1995 pythia +117178 0.034629 1.1995 pythia +117179 0.014018 1.1995 pythia + + +117304 0.57116 1.2158 herwig # 1100 < m_tt < 1300 +117305 0.19707 1.2158 herwig # 1300 < m_tt < 1500 +117306 0.072728 1.2158 herwig # 1500 < m_tt < 1700 +117307 0.050686 1.2158 herwig # 1700 < m_tt < 10000 + +117275 0.47862 1.2149 herwig # 1100 < m_tt < 1300 +117276 0.16610 1.2149 herwig # 1300 < m_tt < 1500 +117277 0.061740 1.2149 herwig # 1500 < m_tt < 1700 +117278 0.042332 1.2149 herwig # 1700 < m_tt < 10000 + +110395 0.61653 1.1995 pythia #hdamp=mt +110396 0.21613 1.1995 pythia #hdamp=mt +110397 0.081813 1.1995 pythia #hdamp=mt +110398 0.041373 1.1995 pythia #hdamp=mt +110399 0.016888 1.1995 pythia #hdamp=mt + +# ttbar EW production +110898 0.18229 1.000 pythia8 + +# ttbar+W +410066 0.17656 1.247 pythia8 +410067 0.14062 1.247 pythia8 +410068 0.13680 1.247 pythia8 + +# ttbar+Z +410069 0.018103 1 pythia8 +410070 0.030629 1 pythia8 +410073 0.11122 1 pythia8 +410074 0.095466 1 pythia8 +410075 0.10512 1 pythia8 + +# SM 3 tops +304014 0.0016398 1 pythia8 + +# SM 4 tops +410080 0.0091622 1.00423479077 pythia8 + +# ttbar+WW +410081 0.0080975 1.22309354739 pythia8 + +# ttbar+X +410111 0.0088155 1.1025 pythia8 +410112 0.01438 1.1025 pythia8 +410113 0.0088422 1.1015 pythia8 +410114 0.014375 1.1015 pythia8 +410115 0.0090148 1.0813 pythia8 +410116 0.014636 1.0813 pythia8 + + +# Single-Top Pythia(P2011C) Baseline Samples +110069 27.337 1.0401 pythia +110101 25.750 1.1042 pythia +110102 1.0988 1.6542 pythia +110103 14.683 1.5235 pythia +110104 1.5455 1.5198 pythia +189440 43.749 1.3560 pythia + +# Single-Top Powheg+Pythia +110090 17.519 1.0501 pythia +110091 9.3964 1.0613 pythia +110070 17.520 1.0500 pythia +110071 9.3935 1.0616 pythia +110119 1.6424 1.1067 pythia +110140 20.461 1.0933 pythia +110141 2.1478 1.0936 pythia +110142 9.7738 2.2888 pythia +110143 1.0301 2.2802 pythia + +# Single-Top Powheg+herwig +110144 20.461 1.0933 herwig +110145 2.1478 1.0936 herwig +110146 9.8007 2.2825 herwig +110147 1.0331 2.2736 herwig + +# Single-Top aMC@NLO+Herwig +110095 27.446 1.0360 herwig +110097 27.243 1.0437 herwig + +# single top baseline samples +108343 0.56395 1.0744 herwig 0.582 0.630 +108344 0.56430 1.0737 herwig 0.582 0.630 +108345 0.56434 1.0736 herwig 0.582 0.630 +108346 20.666 1.0825 herwig 20.853 23.918 +117360 8.5878 1.1037 pythia 9.220 9.851 +117361 8.5889 1.1035 pythia 9.220 9.851 +117362 8.5810 1.1045 pythia 9.220 9.851 + +# single top Powheg+Herwig +110086 17.528 1.0495 herwig +110087 9.3986 1.0610 herwig + +#Singletop Non Perturbative Samples +110072 17.520 1.0500 pythia +110073 9.3932 1.0616 pythia +110074 17.520 1.0500 pythia +110075 9.3935 1.0616 pythia + +# Singletop Scale Variation Samples +110040 1.6931 1.0736 pythia +110041 1.6974 1.0708 pythia +110042 1.6928 1.0737 pythia +110043 1.6976 1.0707 pythia +110044 1.6976 1.0707 pythia +110045 1.6973 1.0709 pythia +110046 20.099 1.1130 pythia +110047 21.132 1.0586 pythia +110048 19.589 1.1420 pythia +110049 20.135 1.1110 pythia +110050 21.580 1.0366 pythia +110051 21.203 1.0550 pythia + +# single top ISR/FSR variation. Use baseline cross-sections +110105 25.753 1.1041 pythia +110106 25.748 1.1043 pythia +110107 1.0988 1.6542 pythia +110108 1.0985 1.6547 pythia +110109 14.683 1.5235 pythia +110110 14.681 1.5237 pythia +110111 1.5455 1.5198 pythia +110112 1.5452 1.5201 pythia + +117213 0.36651 1.6531 pythia +117214 0.36647 1.6533 pythia +117215 0.36650 1.6532 pythia +117216 0.36649 1.6532 pythia +117217 0.36637 1.6537 pythia +117218 0.36632 1.6540 pythia +117219 8.5887 1.1036 pythia +117220 8.5883 1.1036 pythia +117221 8.5852 1.1040 pythia +117222 8.5850 1.1040 pythia +117223 8.5818 1.1044 pythia +117224 8.5814 1.1045 pythia +117245 14.691 1.5227 pythia +117246 14.691 1.5227 pythia + +# Single Top mass variation Samples +110099 29.250 1.0962 pythia +110113 27.798 1.0986 pythia +110114 27.081 1.1011 pythia +110115 26.404 1.1027 pythia +110116 25.117 1.1059 pythia +110117 24.506 1.1074 pythia +110118 23.901 1.1109 pythia +110100 22.768 1.1128 pythia + +110268 18.315 1.0044 pythia +110269 9.8589 1.0115 pythia +110270 17.885 1.0286 pythia +110271 9.6180 1.0368 pythia +110272 17.476 1.0527 pythia +110273 9.3853 1.0625 pythia +110274 16.693 1.1020 pythia +110275 8.9322 1.1164 pythia +110276 16.305 1.1283 pythia +110277 8.7227 1.1432 pythia +110278 15.937 1.1543 pythia +110279 8.5140 1.1713 pythia + +110136 25.672 1.0856 pythia +110124 23.483 1.0855 pythia +110126 22.475 1.0857 pythia +110128 21.515 1.0858 pythia +110130 19.747 1.0852 pythia +110132 18.929 1.0851 pythia +110134 18.150 1.0848 pythia +110138 16.709 1.0844 pythia + +110135 2.2806 1.0740 pythia +110123 2.0208 1.0726 pythia +110125 1.9053 1.0713 pythia +110127 1.7975 1.0707 pythia +110129 1.6050 1.0699 pythia +110131 1.5182 1.0713 pythia +110133 1.4380 1.0702 pythia +110137 1.2924 1.0705 pythia + +# Singletop with Anomalous Couplings Samples +117788 28.434 1.000 pythia +117789 28.434 1.000 pythia +117790 28.434 1.000 pythia +117791 28.434 1.000 pythia +117792 28.434 1.000 pythia + + +# Singletop with Modified CKM Samples +110098 77.161 0.36851 pythia + + +#single top - FCNC (FS) +117011 2.8171 1 pythia +117012 0.4772 1 pythia +117013 4.1642 1 pythia +117014 0.9274 1 pythia + +#single top - FCNC (ISR/FSR) +117007 2.817 1 pythia +117008 2.817 1 pythia +117009 0.47723 1 pythia +117010 0.47713 1 pythia + +# tZ +179991 0.0041303 1 pythia +179992 0.031161 1.2200 pythia + +# Alpgen+pythia W+jets unfiltered samples (auto) +147025 8127.3 1.1330 pythia +147026 1792.7 1.1330 pythia +147027 542.18 1.1330 pythia +147028 147.65 1.1330 pythia +147029 37.736 1.1330 pythia +147030 11.962 1.1330 pythia +147033 8127.1 1.1330 pythia +147034 1792.9 1.1330 pythia +147035 542.24 1.1330 pythia +147036 147.66 1.1330 pythia +147037 37.745 1.1330 pythia +147038 11.970 1.1330 pythia +147041 8127.1 1.1330 pythia +147042 1792.2 1.1330 pythia +147043 542.27 1.1330 pythia +147044 147.64 1.1330 pythia +147045 37.781 1.1330 pythia +147046 11.959 1.1330 pythia + + +# Alpgen+pythia W+jets unfiltered samples +117680 8136.8 1.133 pythia +117681 1791.5 1.133 pythia +117682 541.60 1.133 pythia +117683 146.65 1.133 pythia +117684 37.334 1.133 pythia +117685 11.355 1.133 pythia +117690 8133.4 1.133 pythia +117691 1792.7 1.133 pythia +117692 541.27 1.133 pythia +117693 146.49 1.133 pythia +117694 37.341 1.133 pythia +117695 11.364 1.133 pythia +117700 8135.7 1.133 pythia +117701 1793.7 1.133 pythia +117702 541.24 1.133 pythia +117703 146.48 1.133 pythia +117704 37.344 1.133 pythia +117705 11.477 1.133 pythia + +# Alpgen+herwig/jimmy W+jets unfiltered samples +107680 8037.8 1.176 herwig +107681 1579.5 1.176 herwig +107682 477.31 1.176 herwig +107683 133.89 1.176 herwig +107684 35.614 1.176 herwig +107685 10.545 1.176 herwig +107690 8040.9 1.176 herwig +107691 1581.0 1.176 herwig +107692 477.53 1.176 herwig +107693 133.83 1.176 herwig +107694 35.579 1.176 herwig +107695 10.561 1.176 herwig +107700 8036.2 1.176 herwig +107701 1579.5 1.176 herwig +107702 477.50 1.176 herwig +107703 133.78 1.176 herwig +107704 35.593 1.176 herwig +107705 10.534 1.176 herwig + +# Alpgen+pythia W+cc+jets (auto) +200156 149.39 1.1330 pythia +200157 143.90 1.1330 pythia +200158 84.227 1.1330 pythia +200159 44.277 1.1330 pythia + +# Alpgen+pythia W+cc+jets +126606 143.07 1.133 pythia +126607 143.68 1.133 pythia +126608 80.762 1.133 pythia +126609 35.932 1.133 pythia + +# Alpgen W+cc+jets +117284 150.17 1.176 herwig +117285 132.69 1.176 herwig +117286 71.838 1.176 herwig +117287 30.256 1.176 herwig + +# Alpgen+pythia W+c+jets (auto) +200056 758.93 1.5200 pythia +200057 274.47 1.5200 pythia +200058 71.643 1.5200 pythia +200059 16.482 1.5200 pythia +200060 4.7824 1.5200 pythia + +# Alpgen+pythia W+c+jets +126601 758.93 1.52 pythia +126602 274.24 1.52 pythia +126603 71.634 1.52 pythia +126604 16.425 1.52 pythia +126605 4.7468 1.52 pythia + +# Alpgen W+c+jets +117293 807.98 1.52 herwig +117294 267.66 1.52 herwig +117295 69.891 1.52 herwig +117296 20.564 1.52 herwig +117297 4.3082 1.52 herwig + +# Alpgen+pythia W+bb+jets (auto) +200256 52.237 1.1330 pythia +200257 45.628 1.1330 pythia +200258 23.955 1.1330 pythia +200259 13.633 1.1330 pythia + +# Alpgen+pythia W+bb+jets +110801 52.255 1.133 pythia +110802 45.540 1.133 pythia +110803 23.671 1.133 pythia +110804 12.525 1.133 pythia + +# Alpgen W+bb+jets +107280 55.664 1.176 herwig +107281 45.254 1.176 herwig +107282 23.157 1.176 herwig +107283 11.197 1.176 herwig + +# W+jets with Akt10 filtered Samples +190001 0.71565 1.1330 pythia +190002 1.9920 1.1330 pythia +190003 2.2144 1.1330 pythia +190004 1.4867 1.1330 pythia +190005 1.1185 1.1330 pythia +190011 0.70640 1.1330 pythia +190012 1.9221 1.1330 pythia +190013 2.1249 1.1330 pythia +190014 1.4169 1.1330 pythia +190015 1.0612 1.1330 pythia +190021 0.70468 1.1330 pythia +190022 1.9309 1.1330 pythia +190023 2.1416 1.1330 pythia +190024 1.4297 1.1330 pythia +190025 1.0705 1.1330 pythia + +# W+jets with Akt10 filtered Samples / HF +190050 0.012462 1.1330 pythia +190051 0.11981 1.1330 pythia +190052 0.28254 1.1330 pythia +190053 0.73213 1.1330 pythia +190040 0.013282 1.1330 pythia +190041 0.22439 1.1330 pythia +190042 0.69188 1.1330 pythia +190043 1.7859 1.1330 pythia +190030 0.087468 1.5200 pythia +190031 0.47215 1.5200 pythia +190032 0.56999 1.5200 pythia +190033 0.37909 1.5200 pythia +190034 0.29910 1.5200 pythia + +#Sherpa Massive B/C W+jets +167740 140.34 1.1 sherpa #WenuMassiveCBPt0 BFilter +167741 537.84 1.1 sherpa #WenuMassiveCBPt0 CJetFilterBVeto +167742 10295.0 1.1 sherpa #WenuMassiveCBPt0 CJetVetoBVeto +167743 140.39 1.1 sherpa #WmunuMassiveCBPt0 BFilter +167744 466.47 1.1 sherpa # +167745 10368.0 1.1 sherpa # +167746 140.34 1.1 sherpa # +167747 506.45 1.1 sherpa # +167748 10327.0 1.1 sherpa # + +# Boosted W+jets +167767 11.512 1.1 sherpa # Pt=70-140 GeV BFilter +167768 49.844 1.1 sherpa # Pt=70-140 GeV CJetFilterBVeto +167769 189.11 1.1 sherpa # Pt=70-140 GeV CJetVetoBVeto +167776 1.9685 1.1 sherpa # Pt=140-280 GeV BFilter +167777 6.8579 1.1 sherpa # Pt=140-280 GeV CJetFilterBVet +167778 22.325 1.1 sherpa # Pt=140-280 GeV CJetVetoBVeto +167779 0.15269 1.1 sherpa # Pt=280-500 GeV BFilter +167780 0.43085 1.1 sherpa # Pt=280-500 GeV CJetFilterBVeto +167781 1.2567 1.1 sherpa # Pt=280-500 GeV CJetVetoBVeto +167782 0.15282 1.1 sherpa # Pt=280-500 GeV BFilter +167783 0.42023 1.1 sherpa # Pt=280-500 GeV CJetFilterBVeto +167784 1.2677 1.1 sherpa # Pt=280-500 GeV CJetVetoBVeto +167785 0.15270 1.1 sherpa # Pt=280-500 GeV BFilter +167786 0.42807 1.1 sherpa # Pt=280-500 GeV CJetFilterBVeto +167787 1.2563 1.1 sherpa # Pt=280-500 GeV CJetVetoBVeto +167788 0.010126 1.1 sherpa +167789 0.024687 1.1 sherpa +167790 0.066352 1.1 sherpa +167791 0.010127 1.1 sherpa # Pt=500 GeV BFilter +167792 0.024353 1.1 sherpa # Pt=500 GeV CJetFilterBVeto +167793 0.067062 1.1 sherpa # Pt=500 GeV CJetVetoBVeto +167794 0.010151 1.1 sherpa # Pt=500 GeV BFilter +167795 0.024558 1.1 sherpa # Pt=500 GeV CJetFilterBVeto +167796 0.067331 1.1 sherpa # Pt=500 GeV CJetVetoBVeto + +# W+jets Sherpa +167761 11.508 1.1 sherpa # +167762 50.390 1.1 sherpa # +167763 188.63 1.1 sherpa # +167764 11.505 1.1 sherpa # +167765 48.876 1.1 sherpa # +167766 190.26 1.1 sherpa # +167770 1.9679 1.1 sherpa # +167771 6.9227 1.1 sherpa # +167772 22.244 1.1 sherpa # +167773 1.9689 1.1 sherpa # +167774 6.7463 1.1 sherpa # +167775 22.454 1.1 sherpa # + +# W+jets Sherpa +147774 11866.0 1.0186 sherpa +147775 11867.0 1.0185 sherpa +147776 11858.0 1.0193 sherpa + +# Alpgen+pythia Z+jets unfiltered samples (auto) +147105 718.97 1.1800 pythia +147106 175.70 1.1800 pythia +147107 58.875 1.1800 pythia +147108 15.636 1.1800 pythia +147109 4.0116 1.1800 pythia +147110 1.2592 1.1800 pythia +147113 719.16 1.1800 pythia +147114 175.74 1.1800 pythia +147115 58.882 1.1800 pythia +147116 15.673 1.1800 pythia +147117 4.0057 1.1800 pythia +147118 1.2544 1.1800 pythia +147121 718.87 1.1800 pythia +147122 175.76 1.1800 pythia +147123 58.856 1.1800 pythia +147124 15.667 1.1800 pythia +147125 4.0121 1.1800 pythia +147126 1.2560 1.1800 pythia + +# Alpgen+pythia Z+jets unfiltered samples +117650 718.89 1.18 pythia +117651 175.60 1.18 pythia +117652 58.849 1.18 pythia +117653 15.560 1.18 pythia +117654 3.9322 1.18 pythia +117655 1.1994 1.18 pythia +117660 718.91 1.18 pythia +117661 175.81 1.18 pythia +117662 58.805 1.18 pythia +117663 15.589 1.18 pythia +117664 3.9072 1.18 pythia +117665 1.1933 1.18 pythia +117670 718.80 1.18 pythia +117671 175.83 1.18 pythia +117672 58.630 1.18 pythia +117673 15.508 1.18 pythia +117674 3.9526 1.18 pythia +117675 1.1805 1.18 pythia + +# Alpgen+herwig Z+jets unfiltered samples +107650 711.76 1.229 herwig +107651 155.20 1.229 herwig +107652 48.739 1.229 herwig +107653 14.222 1.229 herwig +107654 3.7471 1.229 herwig +107655 1.0942 1.229 herwig +107660 712.06 1.229 herwig +107661 154.78 1.229 herwig +107662 48.884 1.229 herwig +107663 14.196 1.229 herwig +107664 3.8024 1.229 herwig +107665 1.1094 1.229 herwig +107670 711.89 1.229 herwig +107671 155.09 1.229 herwig +107672 48.805 1.229 herwig +107673 14.140 1.229 herwig +107674 3.7711 1.229 herwig +107675 1.1122 1.229 herwig +147078 1.1330 1.229 herwig +147086 1.1348 1.229 herwig +147094 1.1365 1.229 herwig + +156803 26.885 1.2290 herwig +156804 407.35 1.2290 herwig +156805 6.0345 1.2290 herwig +156806 0.24338 1.2290 herwig +156807 0.0089265 1.2290 herwig +156808 69.185 1.2290 herwig +156809 214.78 1.2290 herwig +156810 8.0025 1.2290 herwig +156811 0.45901 1.2290 herwig +156812 0.022871 1.2290 herwig +156813 60.328 1.2290 herwig +156814 74.829 1.2290 herwig +156815 5.2419 1.2290 herwig +156816 0.39218 1.2290 herwig +156817 0.022754 1.2290 herwig +156818 27.209 1.2290 herwig +156819 20.733 1.2290 herwig +156820 2.3440 1.2290 herwig +156821 0.22156 1.2290 herwig +156822 0.014128 1.2290 herwig +156823 9.3664 1.2290 herwig +156824 6.5071 1.2290 herwig +156825 1.0412 1.2290 herwig +156826 0.12230 1.2290 herwig +156827 0.0087093 1.2290 herwig +156828 3.3542 1.2290 herwig + + +# Alpgen+pythia Z+jets+bb unfiltered samples (auto) +200332 6.5083 1.1800 pythia +200333 3.2927 1.1800 pythia +200334 1.2544 1.1800 pythia +200335 0.61711 1.1800 pythia +200340 6.5056 1.1800 pythia +200341 3.2904 1.1800 pythia +200342 1.2601 1.1800 pythia +200343 0.61882 1.1800 pythia +200348 6.5062 1.1800 pythia +200349 3.2935 1.1800 pythia +200350 1.2485 1.1800 pythia +200351 0.61363 1.1800 pythia + +# Alpgen+pythia Z+jets+bb unfiltered samples +110817 8.0397 1.18 pythia +110818 3.2353 1.18 pythia +110819 1.1388 1.18 pythia +110820 0.49066 1.18 pythia +110821 8.0422 1.18 pythia +110822 3.2155 1.18 pythia +110823 1.1400 1.18 pythia +110824 0.50943 1.18 pythia +110825 8.0358 1.18 pythia +110826 3.2299 1.18 pythia +110827 1.1445 1.18 pythia +110828 0.49266 1.18 pythia + +# Alpgen Z+bb+jets +109300 8.3858 1.229 herwig +109301 3.2574 1.229 herwig +109302 1.1981 1.229 herwig +109303 0.50935 1.229 herwig +109305 8.3786 1.229 herwig +109306 3.2665 1.229 herwig +109307 1.1874 1.229 herwig +109308 0.50538 1.229 herwig +109310 8.3888 1.229 herwig +109311 3.2532 1.229 herwig +109312 1.1956 1.229 herwig +109313 0.50820 1.229 herwig +167103 0.55878 1.229 herwig +167108 0.56046 1.229 herwig + +# Alpgen+herwig Znunu+bb/cc (auto) +167060 44.067 1.2290 herwig +167061 17.406 1.2290 herwig +167062 6.3954 1.2290 herwig +167063 2.2741 1.2290 herwig + +# Alpgen+pythia Z+jets+cc unfiltered samples (auto) +200432 11.763 1.1800 pythia +200433 7.1280 1.1800 pythia +200434 3.3603 1.1800 pythia +200435 1.7106 1.1800 pythia +200440 11.795 1.1800 pythia +200441 7.1123 1.1800 pythia +200442 3.3708 1.1800 pythia +200443 1.7059 1.1800 pythia +200448 11.760 1.1800 pythia +200449 7.1410 1.1800 pythia +200450 3.3582 1.1800 pythia +200451 1.7046 1.1800 pythia + +# Alpgen+pythia Z+jets+cc unfiltered samples +110805 15.107 1.18 pythia +110806 7.2131 1.18 pythia +110807 3.0320 1.18 pythia +110808 1.1767 1.18 pythia +110809 15.115 1.18 pythia +110810 7.1980 1.18 pythia +110811 3.0303 1.18 pythia +110812 1.1738 1.18 pythia +110813 15.119 1.18 pythia +110814 7.2016 1.18 pythia +110815 3.0385 1.18 pythia +110816 1.1677 1.18 pythia + +# Alpgen Z+cc+jets +126414 15.660 1.229 herwig +126415 6.8990 1.229 herwig +126416 2.9218 1.229 herwig +126417 1.1371 1.229 herwig +126418 15.647 1.229 herwig +126419 6.8955 1.229 herwig +126420 2.9124 1.229 herwig +126421 1.1357 1.229 herwig +117706 15.656 1.229 herwig +117707 6.8980 1.229 herwig +117708 2.9056 1.229 herwig +117709 1.1376 1.229 herwig + +# Alpgen Zvv+cc+jets +166990 70.773 1.2290 herwig +166991 33.822 1.2290 herwig +166992 15.043 1.2290 herwig +166993 7.1703 1.2290 herwig + +# Alpgen+herwig Z+jets low mass +146830 3477.9 1.195 herwig +146831 108.88 1.195 herwig +146832 52.651 1.195 herwig +146833 11.309 1.195 herwig +146834 2.5743 1.195 herwig +146835 0.69211 1.195 herwig +146840 3477.8 1.195 herwig +146841 108.63 1.195 herwig +146842 52.675 1.195 herwig +146843 11.283 1.195 herwig +146844 2.5690 1.195 herwig +146845 0.69425 1.195 herwig +146850 3478.1 1.195 herwig +146851 108.85 1.195 herwig +146852 52.777 1.195 herwig +146853 11.295 1.195 herwig +146854 2.5904 1.195 herwig +146855 0.69034 1.195 herwig + +# Alpgen+pythia Z+jets low mass (10<m<40) +178354 592.95 1.1800 pythia +178355 43.317 1.1800 pythia +178356 21.113 1.1800 pythia +178357 4.8806 1.1800 pythia +178358 1.5561 1.1800 pythia +178359 615.63 1.1800 pythia +178360 44.104 1.1800 pythia +178361 21.551 1.1800 pythia +178362 4.9449 1.1800 pythia +178363 1.5711 1.1800 pythia +178364 16.721 1.1800 pythia +178365 7.1698 1.1800 pythia +178366 3.3871 1.1800 pythia +178367 1.1250 1.1800 pythia +178368 0.44867 1.1800 pythia + +# Alpgen+pythia Z+jets low mass (40<m<60) +178369 30.809 1.1800 pythia +178370 5.3849 1.1800 pythia +178371 1.9000 1.1800 pythia +178372 0.48260 1.1800 pythia +178373 0.16075 1.1800 pythia +178374 31.073 1.1800 pythia +178375 5.4286 1.1800 pythia +178376 1.9158 1.1800 pythia +178377 0.48622 1.1800 pythia +178378 0.16184 1.1800 pythia +178379 12.327 1.1800 pythia +178380 2.2059 1.1800 pythia +178381 0.83903 1.1800 pythia +178382 0.23072 1.1800 pythia +178383 0.081829 1.1800 pythia + +# Z+jets Unfiltered with low mass DY with dilepton and VBF filters Samples +181310 1.0564 1.2290 herwig +181311 0.62000 1.2290 herwig +181312 0.67171 1.2290 herwig +181313 0.54547 1.2290 herwig +181314 0.29138 1.2290 herwig +181315 0.14287 1.2290 herwig +181320 0.39419 1.2290 herwig +181321 0.52556 1.2290 herwig +181322 0.54809 1.2290 herwig +181323 0.46121 1.2290 herwig +181324 0.25708 1.2290 herwig +181325 0.13358 1.2290 herwig +169450 0.37222 1.2290 herwig +169451 0.33247 1.2290 herwig +169452 0.41582 1.2290 herwig +169453 0.30684 1.2290 herwig +169454 0.14044 1.2290 herwig +169455 0.058745 1.2290 herwig + +# Alpgen+pythia Z+bb+jets low mass +178396 5.4030 1.1800 pythia +178397 1.4777 1.1800 pythia +178398 0.47058 1.1800 pythia +178399 0.21318 1.1800 pythia +178400 5.5527 1.1800 pythia +178401 1.5073 1.1800 pythia +178402 0.48013 1.1800 pythia +178403 0.20860 1.1800 pythia +178404 0.57824 1.1800 pythia +178405 0.36026 1.1800 pythia +178406 0.15363 1.1800 pythia +178407 0.082114 1.1800 pythia + +# Alpgen+pythia Z+cc+jets low mass +178384 50.119 1.1800 pythia +178385 7.4865 1.1800 pythia +178386 2.0331 1.1800 pythia +178387 0.74667 1.1800 pythia +178388 51.683 1.1800 pythia +178389 7.6350 1.1800 pythia +178390 2.0770 1.1800 pythia +178391 0.76824 1.1800 pythia +178392 2.6556 1.1800 pythia +178393 1.2344 1.1800 pythia +178394 0.47440 1.1800 pythia +178395 0.26090 1.1800 pythia + +# Z+jets sherpa, massive b,c +182600 31.047 1.1200 sherpa +182601 314.13 1.1200 sherpa +167749 31.046 1.12 sherpa +167750 314.26 1.12 sherpa +167751 764.41 1.12 sherpa +167752 31.036 1.12 sherpa +167753 314.80 1.12 sherpa +167754 764.48 1.12 sherpa +167755 31.008 1.12 sherpa +167756 314.49 1.12 sherpa +167757 764.57 1.12 sherpa +167758 176.02 1.12 sherpa +167759 1677.6 1.12 sherpa +167760 4137.2 1.12 sherpa + +# Boosted Z+jets sherpa, massive b,c +167821 0.025866 1.12 sherpa +167822 0.093482 1.12 sherpa +167823 0.12228 1.12 sherpa +167833 0.0015264 1.12 sherpa +167834 0.0053609 1.12 sherpa +167835 0.0064512 1.12 sherpa +167824 0.025972 1.12 sherpa +167825 0.093396 1.12 sherpa +167826 0.12269 1.12 sherpa +167836 0.0015398 1.12 sherpa +167837 0.0053727 1.12 sherpa +167838 0.0064581 1.12 sherpa +167803 2.4347 1.12 sherpa +167804 10.475 1.12 sherpa +167805 16.589 1.12 sherpa +167815 0.38075 1.12 sherpa +167816 1.4737 1.12 sherpa +167817 2.1262 1.12 sherpa +167827 0.025927 1.12 sherpa +167828 0.092747 1.12 sherpa +167829 0.12247 1.12 sherpa +167839 0.0015445 1.12 sherpa +167840 0.0052322 1.12 sherpa +167841 0.0064510 1.12 sherpa +167830 0.14681 1.12 sherpa +167831 0.52054 1.12 sherpa +167832 0.68537 1.12 sherpa +167842 0.0085711 1.12 sherpa +167843 0.029068 1.12 sherpa +167844 0.035493 1.12 sherpa + +# Z+jets, massive b,c Sherpa 1.4.3. +182603 2.4377 1.1200 sherpa +182604 10.458 1.1200 sherpa +182606 0.38161 1.1200 sherpa +182607 1.4751 1.1200 sherpa +182609 0.025865 1.1200 sherpa +182610 0.093209 1.1200 sherpa +182612 0.0015235 1.1200 sherpa +182613 0.0052878 1.1200 sherpa +167797 2.4338 1.12 sherpa +167798 10.467 1.12 sherpa +167799 16.592 1.12 sherpa +167809 0.37988 1.12 sherpa +167810 1.4698 1.12 sherpa +167811 2.1314 1.12 sherpa +167800 2.4355 1.12 sherpa +167801 10.450 1.12 sherpa +167802 16.590 1.12 sherpa +167812 0.38010 1.12 sherpa +167813 1.4767 1.12 sherpa +167814 2.1291 1.12 sherpa +167806 14.007 1.12 sherpa +167807 58.676 1.12 sherpa +167808 93.907 1.12 sherpa +167818 2.1807 1.12 sherpa +167819 8.2842 1.12 sherpa +167820 12.036 1.12 sherpa + +# Z+jets Inclusive with Massive B/C with Scale Variations Samples +182615 22.372 1.1200 sherpa +182616 117.20 1.1200 sherpa +182630 48.118 1.1200 sherpa +182631 464.32 1.1200 sherpa +182675 34.205 1.1200 sherpa +182676 318.87 1.1200 sherpa +182645 45.751 1.1200 sherpa +182646 404.59 1.1200 sherpa +182660 22.905 1.1200 sherpa +182661 168.41 1.1200 sherpa + +# Z+jets Boosted with Massive B/C with Scale Variations Samples +182618 2.3529 1.1200 sherpa +182619 6.4695 1.1200 sherpa +182621 0.39371 1.1200 sherpa +182622 1.0099 1.1200 sherpa +182624 0.028307 1.1200 sherpa +182625 0.069929 1.1200 sherpa +182627 0.0017398 1.1200 sherpa +182628 0.0043119 1.1200 sherpa +182633 2.8418 1.1200 sherpa +182634 12.650 1.1200 sherpa +182636 0.40939 1.1200 sherpa +182637 1.6871 1.1200 sherpa +182639 0.025511 1.1200 sherpa +182640 0.10048 1.1200 sherpa +182642 0.0014265 1.1200 sherpa +182643 0.0055023 1.1200 sherpa + +182678 2.7672 1.1200 sherpa +182679 10.841 1.1200 sherpa +182681 0.44312 1.1200 sherpa +182682 1.5402 1.1200 sherpa +182684 0.030424 1.1200 sherpa +182685 0.10039 1.1200 sherpa +182687 0.0018551 1.1200 sherpa +182688 0.0058565 1.1200 sherpa + +182648 3.6793 1.1200 sherpa +182649 14.246 1.1200 sherpa +182651 0.58394 1.1200 sherpa +182652 1.9767 1.1200 sherpa +182654 0.039404 1.1200 sherpa +182655 0.12178 1.1200 sherpa +182657 0.0023148 1.1200 sherpa +182658 0.0066846 1.1200 sherpa +182663 1.7134 1.1200 sherpa +182664 5.7610 1.1200 sherpa +182666 0.26336 1.1200 sherpa +182667 0.83028 1.1200 sherpa +182669 0.017556 1.1200 sherpa +182670 0.053223 1.1200 sherpa +182672 0.0010255 1.1200 sherpa +182673 0.0031060 1.1200 sherpa + +# Z+jets sherpa samples +147770 1207.4 1.0277 sherpa +147771 1207.4 1.0277 sherpa +147772 1207.1 1.0284 sherpa +147773 6520.4 1.0279 sherpa + +# Zee Powheg+Pythia8 (FS) +129504 9.8460 1 pythia8 +129505 1.5710 1 pythia8 +129506 0.54920 1 pythia8 +129507 0.089660 1 pythia8 +129508 0.015100 1 pythia8 +129509 0.0037500 1 pythia8 +129510 0.0012930 1 pythia8 +129511 0.00035770 1 pythia8 +129512 0.00011230 1 pythia8 +129513 0.000038380 1 pythia8 +129514 0.000013890 1 pythia8 +129515 5.226e-06 1 pythia8 +129516 2.017e-06 1 pythia8 +129517 7.891e-07 1 pythia8 +129518 5.039e-07 1 pythia8 + +# Zmm Powheg+Pythia8 (FS) +129523 7.8401 1 pythia8 +129524 9.8450 1 pythia8 +129525 1.5710 1 pythia8 +129526 0.54920 1 pythia8 +129527 0.089660 1 pythia8 +129528 0.015100 1 pythia8 +129529 0.0037500 1 pythia8 +129530 0.0012930 1 pythia8 +129531 0.00035770 1 pythia8 +129532 0.00011230 1 pythia8 +129533 0.000038380 1 pythia8 +129534 0.000013890 1 pythia8 +129535 5.226e-06 1 pythia8 +129536 2.017e-06 1 pythia8 +129537 7.891e-07 1 pythia8 +129538 5.039e-07 1 pythia8 + + + + +# PowhegPythia8 W+jets, Z+jets +147800 6891.0 1 pythia +147801 6891.0 1 pythia +147802 6889.8 1 pythia +147803 4790.2 1 pythia +147804 4790.2 1 pythia +147805 4790.9 1 pythia +147806 1109.9 1 pythia +147807 1109.8 1 pythia +147808 1109.9 1 pythia + +# Herwig diboson (SM group) +105985 12.416 1.6833 herwig +105986 0.99244 1.5496 herwig +105987 3.6666 1.9011 herwig + +161995 32.486 1.6833 herwig +161996 12.007 1.5496 herwig +161997 4.6891 1.9011 herwig + +# Alpgen+Herwig diboson +107100 2.4970 1.2307 herwig +107101 1.2491 1.2307 herwig +107102 0.59200 1.2307 herwig +107103 0.32847 1.2307 herwig +107104 0.80162 1.2785 herwig +107105 0.52407 1.2785 herwig +107106 0.29484 1.2785 herwig +107107 0.18258 1.2785 herwig +107108 0.60660 1.3718 herwig +107109 0.28893 1.3718 herwig +107110 0.11853 1.3718 herwig +107111 0.056223 1.3718 herwig +110829 9.9819 1.2832 herwig +110830 5.0144 1.2832 herwig +110831 2.3658 1.2832 herwig +110832 1.3139 1.2832 herwig + +# MC@NLO+Herwig diboson (SM group) +105921 0.62155 1.0267 herwig +105922 0.61952 1.0301 herwig +105923 0.62175 1.0264 herwig +105924 0.62084 1.0279 herwig +105925 0.62073 1.0280 herwig +105926 0.62037 1.0286 herwig +105927 0.62065 1.0282 herwig +105928 0.62077 1.0280 herwig +105929 0.61937 1.0303 herwig + +# Sherpa diboson +126892 5.4990 1.06 sherpa +126893 9.7508 1.05 sherpa +126894 8.7403 1.00 sherpa +126895 0.49601 1.05 sherpa +157814 1.7020 1.0000 sherpa +157815 1.6870 1.0000 sherpa +157816 1.7023 1.0000 sherpa +157817 9.5566 1.0000 sherpa +157818 9.5544 1.0000 sherpa +157819 9.5568 1.0000 sherpa + + +# Powheg+Pythia diboson +126928 0.59785 1.0676 pythia +126929 0.59726 1.0681 pythia +126930 0.59749 1.0680 pythia +126931 0.59757 1.0676 pythia +126932 0.59740 1.0685 pythia +126933 0.59744 1.0682 pythia +126934 0.59719 1.0689 pythia +126935 0.59767 1.0677 pythia +126936 0.59744 1.0679 pythia +126937 0.069778 1.0000 pythia +126938 0.14539 1.0000 pythia +126939 0.10212 1.0000 pythia +126940 0.070067 1.0000 pythia +126941 0.10319 1.0000 pythia +126942 0.0081492 1.0000 pythia +126949 0.054310 1.0000 pythia +126950 0.054310 1.0000 pythia +126951 0.054310 1.0000 pythia + +# Powheg+Pythia8 diboson +129477 0.41445 1.1220 pythia +129478 0.32676 1.1220 pythia +129479 0.029281 1.1220 pythia +129480 0.39963 1.1220 pythia +129481 0.33432 1.1220 pythia +129482 0.029467 1.1220 pythia +129483 0.19492 1.1220 pythia +129484 0.16961 1.1220 pythia +129485 0.010200 1.1220 pythia +129486 0.28505 1.1440 pythia +129487 0.22219 1.1440 pythia +129488 0.017950 1.1440 pythia +129489 0.27581 1.1440 pythia +129490 0.22818 1.1440 pythia +129491 0.018029 1.1440 pythia +129492 0.13722 1.1440 pythia +129493 0.11764 1.1440 pythia +129494 0.0063099 1.1440 pythia + +# Sherpa Di-Boson Massive B/C Samples +177997 5.2963 1.0600 sherpa +177999 0.49434 1.0500 sherpa +179974 9.7446 1.0500 sherpa +179975 1.4047 1.0500 sherpa +183585 1.4648 1.0500 sherpa +183586 0.24672 1.0000 sherpa +183587 1.4634 1.0500 sherpa +183588 0.24757 1.0000 sherpa +183589 1.4523 1.0500 sherpa +183590 0.24167 1.0000 sherpa +183591 2.6972 1.0500 sherpa +183592 1.7440 1.0000 sherpa +189608 8.6823 1.0000 sherpa +183734 7.2854 1.0600 sherpa +183735 1.9036 1.0500 sherpa +183736 7.2974 1.0600 sherpa +183737 1.9057 1.0500 sherpa +183738 7.2741 1.0600 sherpa +183739 1.9152 1.0500 sherpa + +# Di-Boson Vector-Boson Scattering (VBS) Samples +185393 0.027620 0.8356 sherpa +185394 0.016078 1.0354 sherpa +185396 0.082102 0.8944 sherpa +185397 2.3427 1.2704 sherpa +161982 0.0018166 1.0000 sherpa +161983 0.013215 1.0000 sherpa +161987 0.012559 1.0000 sherpa +147191 0.022536 1.0000 sherpa +147192 0.013813 1.0000 sherpa +147193 0.095881 1.0000 sherpa +147194 0.072962 1.0000 sherpa +147195 0.0029352 1.0000 sherpa +147196 0.0069137 1.0000 sherpa +129800 1.5837 1.0000 sherpa + +# Di-Boson Vector-Boson Fusion (VBF) Samples +160155 0.005388 1 pythia8 +160255 0.00014725 1.3207 pythia8 +161155 0.0068163 1.4257 pythia8 +161455 0.052934 1.2539 pythia8 +161105 0.012583 1.3103 pythia8 +161646 0.017655 1.1773 pythia8 +161505 0.028351 1.3799 pythia8 +161686 0.0094608 1.2950 pythia8 + +#MadGraph+Pythia same sign WWjj +158818 0.34442 1 pythia8 #AU2CTEQ6L1 +158819 0.36936 1 pythia8 #AU2 + +#Pythia8 DPI W +147281 0.0019402 1 pythia8 + +#QCD DiJet +147900 71790032500.0 1 pythia8 +147901 1053483850.0 1 pythia8 +147902 2836013.0 1 pythia8 +147903 34891.0 1 pythia8 +147904 199.29 1 pythia8 +147905 1.3711 1 pythia8 +147906 0.026164 1 pythia8 +147907 0.00059369 1 pythia8 + +# QCD DiJet Weighted +147910 71796589000.0 1 pythia8 +147911 9396193.0 1 pythia8 +147912 105175.0 1 pythia8 +147913 664.99 1 pythia8 +147914 4.5658 1 pythia8 +147915 0.085502 1 pythia8 +147916 0.0019462 1 pythia8 +147917 0.00059308 1 pythia8 + +# QCD diJet Herwig++ +159110 117777.0 1 herwigpp +159111 5260419.0 1 herwigpp +159112 48674.0 1 herwigpp +159113 309.26 1 herwigpp +159114 2.2622 1 herwigpp +159115 0.045668 1 herwigpp +159116 0.0011506 1 herwigpp +159117 0.00037003 1 herwigpp + +#QCD DiJet Pythia8*EvtGen (e1433) +129270 71790761000 1 pythia8 +129271 9385266 1 pythia8 +129272 105000 1 pythia8 +129273 667.07 1 pythia8 +129274 4.5680 1 pythia8 + +# JF17 +129160 93052540 1 pythia8 + +#Di-Top Pt Slice Samples +110911 0.19988 1 pythia8 +110912 0.064086 1 pythia8 +110913 0.022587 1 pythia8 +110914 0.008513 1 pythia8 +110915 0.003409 1 pythia8 + +# background samples for same-sign di-lepton +119353 0.10410 1.1700 pythia # ttW +119354 0.0933317 1.1700 pythia # ttW+j +174830 0.053372 1.1700 pythia #ttbarWjExcl +174831 0.041482 1.1700 pythia #ttbarWjjIncl +119355 0.067690 1.3500 pythia # ttZ +119356 0.087339 1.3500 pythia # ttZ+j +174832 0.045357 1.3500 pythia #ttbarZjExcl +174833 0.039772 1.3500 pythia #ttbarZjjIncl + +117487 0.071700 1.2900 pythia +117488 0.062022 1.2900 pythia +117489 0.048190 1.4000 pythia +117490 0.012548 1.4000 pythia +117491 0.048850 1.4000 pythia + +119583 0.00091901 2.0685 pythia # ttWW + +158813 0.0017974 1.0576 pythia # ttWW +158814 0.0021804 1.0581 pythia # ttWW + +174233 0.026953 1 herwig # ttW(->lv) Np0ex +174234 0.018401 1 herwig # ttW(->lv) Np1ex +174235 0.0094625 1 herwig # ttW(->lv) Np2ex +174236 0.0065303 1 herwig # ttW(->lv) Np3in +174237 0.014992 1 herwig # ttW(->lv) Np2in + +174248 0.0079686 1 herwig # ttZ(->ll) Np0ex +174249 0.0076970 1 herwig # ttZ(->ll) Np1ex +174250 0.0052547 1 herwig # ttZ(->ll) Np2ex +174251 0.0039436 1 herwig # ttZ(->ll) Np3in +174252 0.0084774 1 herwig # ttZ(->ll) Np2in + +# stop grid, Herwigpp +118494 0.85420 1 herwigpp +118495 0.85434 1 herwigpp +118496 0.035062 1 herwigpp +118497 0.035033 1 herwigpp +118498 0.035086 1 herwigpp +118499 0.0010430 1 herwigpp +118500 0.0010459 1 herwigpp +118501 0.0010450 1 herwigpp +127770 0.0010490 1 herwigpp +127771 0.0010466 1 herwigpp +127772 0.0010464 1 herwigpp +127773 0.0010536 1 herwigpp +127774 0.0010450 1 herwigpp +127775 0.0010495 1 herwigpp +127776 0.0010463 1 herwigpp +127777 0.0010476 1 herwigpp +127778 0.0010494 1 herwigpp +127779 0.0010454 1 herwigpp +127780 0.0017790 1 herwigpp +127781 0.0017785 1 herwigpp +127782 0.0017736 1 herwigpp +127783 0.0017787 1 herwigpp +127784 0.0017761 1 herwigpp +127785 0.0017829 1 herwigpp +127786 0.0017754 1 herwigpp +127787 0.0017684 1 herwigpp +127788 0.0017779 1 herwigpp +127789 0.0017813 1 herwigpp +127790 0.0017694 1 herwigpp +127791 0.0017808 1 herwigpp +127792 0.0030641 1 herwigpp +127793 0.0030701 1 herwigpp +127794 0.0030659 1 herwigpp +127795 0.0030538 1 herwigpp +127796 0.0030588 1 herwigpp +127797 0.0030505 1 herwigpp +127798 0.0030810 1 herwigpp +127799 0.0030796 1 herwigpp +127800 0.0030654 1 herwigpp +127801 0.0030623 1 herwigpp +127802 0.0030633 1 herwigpp +127803 0.0054080 1 herwigpp +127804 0.0053861 1 herwigpp +127805 0.0054016 1 herwigpp +127806 0.0054361 1 herwigpp +127807 0.0053818 1 herwigpp +127808 0.0054020 1 herwigpp +127809 0.0053906 1 herwigpp +127810 0.0053959 1 herwigpp +127811 0.0054127 1 herwigpp +127812 0.0054017 1 herwigpp +127813 0.0097439 1 herwigpp +127814 0.0097548 1 herwigpp +127815 0.0097724 1 herwigpp +127816 0.0097751 1 herwigpp +127817 0.0097619 1 herwigpp +127818 0.0097565 1 herwigpp +127819 0.0097674 1 herwigpp +127820 0.0097727 1 herwigpp +127822 0.018230 1 herwigpp +127823 0.018126 1 herwigpp +127824 0.018195 1 herwigpp +127825 0.018152 1 herwigpp +127826 0.018136 1 herwigpp +127827 0.018186 1 herwigpp +127828 0.018151 1 herwigpp +127829 0.018195 1 herwigpp +127830 0.035162 1 herwigpp +127832 0.035073 1 herwigpp +127833 0.035114 1 herwigpp +127834 0.070832 1 herwigpp +127835 0.070772 1 herwigpp +127836 0.070664 1 herwigpp +127837 0.070671 1 herwigpp +127838 0.070660 1 herwigpp +127839 0.070658 1 herwigpp +127840 0.15005 1 herwigpp +127841 0.15030 1 herwigpp +127842 0.15051 1 herwigpp +127843 0.14983 1 herwigpp +127844 0.15025 1 herwigpp +127845 0.34259 1 herwigpp +127846 0.34317 1 herwigpp +127847 0.34273 1 herwigpp +127848 0.34268 1 herwigpp +127849 0.85430 1 herwigpp +127850 2.4112 1 herwigpp +127851 2.4084 1 herwigpp +144208 4.3017 1 herwigpp +144209 1.4094 1 herwigpp +144210 4.3024 1 herwigpp +144211 2.4096 1 herwigpp +144212 1.4094 1 herwigpp +144213 1.4104 1 herwigpp +164241 8.1029 1 herwigpp +164242 2.4092 1 herwigpp +164243 0.85575 1 herwigpp +164244 0.34324 1 herwigpp +164245 0.15060 1 herwigpp +164246 0.070788 1 herwigpp +164247 0.035127 1 herwigpp +164248 0.018182 1 herwigpp +164249 0.0097983 1 herwigpp +164250 0.0054139 1 herwigpp +164251 0.0030691 1 herwigpp +164252 0.0017803 1 herwigpp +164253 0.0010505 1 herwigpp +164646 8.0957 1 herwigpp +164647 1.4065 1 herwigpp +164648 0.035084 1 herwigpp +164649 0.0097639 1 herwigpp + +#stop Madgraph + fPythia +166987 0.0041071 1 pythia +166988 0.12079 1 pythia +166989 1.3442 1 pythia + + +# Sherpa W/Z + Gamma + jets Samples +126739 162.88 1 sherpa +126742 162.89 1 sherpa +126856 162.96 1 sherpa +145161 32.298 1 sherpa +145162 32.326 1 sherpa +126854 32.317 1 sherpa + +#Alpgen+Herwig W + Gamma + jets Samples +146430 230.20 1 herwig +146431 59.213 1 herwig +146432 21.506 1 herwig +146433 7.1065 1 herwig +146434 2.1219 1 herwig +146435 0.46563 1 herwig + +#Alpgen+Herwig W + GammaGamma + jets Samples +129820 0.027036 1 herwig +129821 0.021605 1 herwig +129822 0.013953 1 herwig +129823 0.026986 1 herwig +129824 0.021595 1 herwig +129825 0.013910 1 herwig +129826 0.026971 1 herwig +129827 0.021552 1 herwig +129828 0.013965 1 herwig + +#FCNC top quark decays +110600 0.0004037 1 pythia # tt_bWuZlep +110601 0.0004147 1 pythia # bWuZlep_mt170 +110602 0.0003919 1 pythia # tt_bWuZlep_mt175 +110603 0.0004037 1 pythia # LessPS_tt_bWuZlep +110604 0.0004037 1 pythia # MorePS_tt_bWuZlep + + +#Triboson +167006 0.0050961 1.0000 pythia #WWWStar lnulnulnu +167007 0.0015546 1.0000 pythia #ZWWStar lllnulnu +167008 0.00033239 1.0000 pythia #ZZZStar nunullll + +# ttbar+gamma pythia +164439 0.092638 1 pythia +# ttbar + gamma MadGraph + Pythia no-all-had baseline sample +117478 1.1907 1.895 pythia + +# ttbar+gamma MG+pythia +167730 0.00038069 1 pythia +167731 0.00038029 1 pythia +167732 0.084932 1 pythia +167733 0.084667 1 pythia +167734 0.16851 1 pythia +167735 0.20413 1 pythia +167736 0.20370 1 pythia +167737 0.16850 1 pythia +169701 0.0020646 1 pythia +169702 0.0011898 1 pythia +169703 0.0030346 1 pythia +169704 0.36561 1 pythia +169705 0.17333 1 pythia +169706 0.52671 1 pythia + +# tH+X +189200 0.0036550 1.000 pythia8 +189201 0.0098090 1.000 pythia8 +189203 0.00044880 1.000 pythia8 +189204 0.0010744 1.000 pythia8 +189205 0.046655 1.000 pythia8 +189206 0.12521 1.000 pythia8 +189208 0.0057288 1.000 pythia8 +189209 0.013714 1.000 pythia8 +189465 0.013975 1.000 pythia8 +189466 0.037505 1.000 pythia8 +189468 0.0017160 1.000 pythia8 +189469 0.0041080 1.000 pythia8 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-dbl.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-dbl.data new file mode 100644 index 0000000000000000000000000000000000000000..32af91fa147d7b13aa51290cf544030c92606c65 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-dbl.data @@ -0,0 +1,42 @@ +# SM WH -> lnubb +# TODO +# check xsec, k-factor + +161805 1.380000 1.0 pythia8 +161849 0.869600 1.0 pythia8 +161827 0.869600 1.0 pythia8 + +# original madgraph cross sections have been scaled by 0.6296 to +# correct cross section (simulated: 0.891, actual: 0.561). +# 0.5, 1.0, 1.5, 2.0, 2.5 TeV HVT resonances +# yes, the DSIDs are out of order. +# the 500 GeV resonances come last. +203921 0.205684024 1 pythia8 +203917 0.0136642088 1 pythia8 +203918 0.00234834504 1 pythia8 +203919 0.00057602104 1 pythia8 +203920 0.00016885872 1 pythia8 +203926 1.234016 1 pythia8 +203922 0.086702216 1 pythia8 +203923 0.0154182744 1 pythia8 +203924 0.00386524032 1 pythia8 +203925 0.00113787608 1 pythia8 +203931 0.408163384 1 pythia8 +203927 0.0271930536 1 pythia8 +203928 0.00467559848 1 pythia8 +203929 0.00114184256 1 pythia8 +203930 0.00337673368 1 pythia8 +203936 3.82469408 1 pythia8 +203932 0.26358204 1 pythia8 +203933 0.046597325 1 pythia8 +203934 0.0115638632 1 pythia8 +203935 0.00341048024 1 pythia8 + +# QCD +147911 78420000000 1 pythia8 +147912 57312000 1 pythia8 +147913 1447800 1 pythia8 +147914 23093 1 pythia8 +147915 237.93 1 pythia8 +147916 5.4279 1 pythia8 +147917 0.94172 1 pythia8 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-fromSusyGrp.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-fromSusyGrp.data new file mode 100644 index 0000000000000000000000000000000000000000..ed23ef9f698dff74a8e203a7f1b12979f6b63ab6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-fromSusyGrp.data @@ -0,0 +1,251 @@ +# svn co $SVNOFF/PhysicsAnalysis/SUSYPhys/SUSYTools/branches/SUSYTools-00-05-00-branch +# cat susy_crosssections_13TeV.txt|awk '{if ($1 != "" && $1 != "#") { s=$3*$5 ; print $1 " " s " " $4 " "}else{print $0}}' + + +# ttbar + +110401 451.779 1.000000 + +184172 3.49228 1.000000 +184173 1.41272 1.000000 +184174 0.623517 1.000000 +184175 0.382718 1.000000 +184176 0.228931 1.000000 +184177 2.93786 1.000000 +184178 1.17614 1.000000 +184179 0.528861 1.000000 +184180 0.320086 1.000000 +184181 0.192049 1.000000 + +# single top + +110090 43.755 1.000000 +110091 25.778 1.000000 +110119 3.3513 1.000000 +110140 68.455 1.000000 + +110070 43.755 1.000000 +110071 25.778 1.000000 +110302 3.3514 1.000000 +110305 68.459 1.000000 + +# Pythia8 Higgs + +161105 0.0252528 1.000000 +161155 0.013996 1.000000 +161305 0.071416 1.000000 + +# Sherpa W + +167740 334.344 1.068000 +167741 1183.13 1.068000 +167742 17322.4 1.000000 +167743 334.384 1.068000 +167744 1048.92 1.068000 +167745 17415 1.068000 +167746 334.701 1.068000 +167747 1122.56 1.068000 +167748 17343.6 1.068000 + +180539 1021.74 1.068000 +180536 1006.53 1.068000 +180542 1010.91 1.068000 +180540 54.5958 1.068000 +180538 240.12 1.068000 +180537 0.054223 1.068000 +180534 54.4252 1.068000 +180535 252.088 1.068000 +180541 248.2 1.068000 + +167761 30.4859 1.068000 +167762 126.447 1.068000 +167763 401.066 1.068000 +167764 30.4709 1.068000 +167765 122.703 1.068000 +167766 403.638 1.068000 +167767 30.5366 1.068000 +167768 124.948 1.068000 +167769 402.14 1.068000 +167770 6.1037 1.068000 +167771 20.8735 1.068000 +167772 54.8546 1.068000 +167773 6.09036 1.068000 +167774 20.4377 1.068000 +167775 55.4141 1.068000 +167776 6.10433 1.068000 +167777 20.6513 1.068000 +167778 55.0487 1.068000 +167779 0.607784 1.000000 +167780 1.69324 1.068000 +167781 3.9283 1.068000 +167782 0.605475 1.068000 +167783 1.65931 1.068000 +167784 3.95545 1.068000 +167785 0.606449 1.068000 +167786 1.69125 1.068000 +167787 3.91698 1.068000 +167788 0.0606364 1.068000 +167789 0.150455 1.068000 +167790 0.306492 1.068000 +167791 0.0609242 1.068000 +167792 0.143459 1.068000 +167793 0.30923 1.068000 +167794 0.0613676 1.068000 +167795 0.149505 1.068000 +167796 0.308594 1.068000 + +# Sherpa Z + +167749 73.4429 1.093000 +167750 632.53 1.093000 +167751 1232.57 1.093000 +167752 73.8824 1.093000 +167753 629.108 1.093000 +167754 1231.07 1.093000 +167755 73.6972 1.093000 +167756 629.758 1.093000 +167757 1219.88 1.093000 +167758 417.615 1.087000 +167759 3392.22 1.087000 +167760 6652.46 1.087000 + + +167797 6.78971 1.093000 +167798 26.3131 1.093000 +167799 33.7149 1.093000 +167800 6.77452 1.093000 +167801 26.3023 1.093000 +167802 33.8312 1.093000 +167803 6.78647 1.093000 +167804 26.3127 1.093000 +167805 33.8888 1.093000 +167806 38.9563 1.087000 +167807 147.265 1.087000 +167808 191.108 1.087000 +167809 1.25324 1.093000 +167810 4.32742 1.093000 +167811 5.01951 1.093000 +167812 1.25614 1.093000 +167813 4.37396 1.093000 +167814 5.07639 1.093000 +167815 1.25642 1.093000 +167816 4.34963 1.093000 +167817 5.06393 1.093000 +167818 7.17659 1.087000 +167819 24.3817 1.087000 +167820 28.387 1.087000 +167821 0.110889 1.093000 +167822 0.353138 1.093000 +167823 0.370839 1.093000 +167824 0.1104 1.093000 +167825 0.35363 1.093000 +167826 0.37136 1.093000 +167827 0.110302 1.093000 +167828 0.353607 1.093000 +167829 0.367631 1.093000 +167830 0.629637 1.087000 +167831 1.97403 1.087000 +167832 2.0631 1.087000 +167833 0.00995536 1.093000 +167834 0.0297128 1.093000 +167835 0.0287056 1.093000 +167836 0.00982093 1.093000 +167837 0.0304306 1.093000 +167838 0.028657 1.093000 +167839 0.00984318 1.093000 +167840 0.030327 1.093000 +167841 0.0281613 1.093000 +167842 0.055687 1.087000 +167843 0.165283 1.087000 +167844 0.156664 1.087000 + +# ttV(V) + +119355 0.18575 1.000000 +174832 0.1663 1.000000 +174833 0.20756 1.000000 +119353 0.20145 1.000000 +174830 0.13129 1.000000 +174831 0.16274 1.000000 +119583 0.003 1.000000 + +# Sherpa ZZ + +200920 1.0467 1.000000 + +# Powheg ZZ + +187180 0.121722 1.000000 +187181 0.251389 1.000000 +187182 0.180369 1.000000 +187183 0.122187 1.000000 +187184 0.182294 1.000000 +187185 0.0149864 1.000000 +187186 0.10323 1.000000 +187187 0.10323 1.000000 +187188 0.10323 1.000000 + +# Powheg WZ + +187160 0.481705 1.000000 +187161 0.39823 1.000000 +187162 0.034879 1.000000 +187163 0.506801 1.000000 +187164 0.393285 1.000000 +187165 0.0350225 1.000000 +187166 0.25953 1.000000 +187167 0.216372 1.000000 +187168 0.0125611 1.000000 +187170 0.639252 1.000000 +187171 0.507844 1.000000 +187172 0.0512655 1.000000 +187173 0.645386 1.000000 +187174 0.519971 1.000000 +187175 0.0510934 1.000000 +187176 0.326819 1.000000 +187177 0.271297 1.000000 +187178 0.0186015 1.000000 + +# Powheg WW + +187150 0.0011792 1.000000 +187151 0.001179 1.000000 +187152 0.001179 1.000000 +187153 0.001179 1.000000 +187154 0.0011792 1.000000 +187155 0.001179 1.000000 +187156 0.001179 1.000000 +187157 0.001179 1.000000 +187158 0.0011792 1.000000 + +# Sherpa gamma+jet + +177575 150.623 1.000000 +177576 7.95316 1.000000 +177577 0.550088 1.000000 +177579 167.813 1.000000 +177580 9.09263 1.000000 +177581 0.64792 1.000000 +177583 35.6066 1.000000 +177584 2.32601 1.000000 +177585 0.193152 1.000000 + +# Herwig++ gamma+jet + +187040 161812 1.000000 +187041 16763.3 1.000000 +187042 1415.45 1.000000 +187043 130.029 1.000000 +187044 6.99702 1.000000 + +# Pythia8 gamma+jet + +129200 592725 1.000000 +129201 40521.7 1.000000 +129202 11643.6 1.000000 +129203 4669.2 1.000000 +129204 341.599 1.000000 +129205 18.6132 1.000000 +129206 1.15978 1.000000 +129207 0.071402 1.000000 +129208 0.0243212 1.000000 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-hqt.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-hqt.data new file mode 100644 index 0000000000000000000000000000000000000000..e1eacf00098aaac900b95c5cf347ae4aba4bf197 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC14-13TeV-hqt.data @@ -0,0 +1,41 @@ + +# Z' -> ttbar +110901 8.9259 1 pythia8 +110903 1.1959 1 pythia8 +110907 0.057796 1 pythia8 +110900 0.00014588 1 pythia8 +# from PhysicsAnalysis/TopPhys/xAOD/TopNtupleAnalysis/trunk/share/zp-012-13tev-40k.log +301322 70.287552945 1 pythia8 #400GeV +301323 40.1252717501 1 pythia8 #500GeV +301324 10.7025592052 1 pythia8 #750GeV +301325 3.69900238076 1 pythia8 #1000GeV +429009 3.69900238076 1 pythia8 #1000GeV +301326 1.50806798183 1 pythia8 #1250GeV +301327 0.684451508485 1 pythia8 #1500GeV +301328 0.334388285018 1 pythia8 #1750GeV +301329 0.172299333764 1 pythia8 #2000GeV +301330 0.0923739492669 1 pythia8 #2250GeV +301331 0.0510543839336 1 pythia8 #2500GeV +301332 0.0289022800871 1 pythia8 #2750GeV +110910 0.0166807659717 1 pythia8 #3000GeV +301334 0.00212729713173 1 pythia8 #4000GeV + + + +# Monotop samples: +110153 2.606 1 +110181 2.175 1 +110186 0.167780 1 +110867 0.195570 1 +110868 0.029617 1 +110869 0.025994 1 + +# Wprime->tb full-had +110723 0.98524 1.2 +110727 0.080190 1.2 +110731 0.0095093 1.2 + +# Wprime->tb l+jets +110921 38.951 1.2 +110925 0.57397 1.2 +110929 0.043876 1.2 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC15-13TeV.data b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC15-13TeV.data new file mode 100644 index 0000000000000000000000000000000000000000..1f7624850d64ba0c54160e75434146443c9e9bb9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/data/XSection-MC15-13TeV.data @@ -0,0 +1,2204 @@ +# svn co $SVNOFF/PhysicsAnalysis/SUSYPhys/SUSYTools/trunk, taken on 02.06.2015 +# cat susy_crosssections_13TeV.txt|awk '{if ($1 != "" && $1 != "#") { s=$3*$5 ; print $1 " " s " " $4 " "}else{print $0}}' +# cross-sections are in pb + +################################################################################################################ 0 +# ttbar: kfactor from here: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MC15TTbarSamplesPMG + +410000 377.9932 1.1949 pythia +410001 377.9932 1.1949 pythia +410002 377.9932 1.1949 pythia +410003 377.3090 1.1970 herwigpp +410004 378.7006 1.1926 herwigpp +410006 378.7169 1.1926 pythia8 +# allhad +410007 317.3591 1.1977 pythia +410008 317.3591 1.1977 herwigpp +# dilepton +410009 73.33 1.1949 pythia +# trilepton-filtered sample - see ANALYSISTO-136 +343637 18.2976 1.1949 pythia + +# non-allhad +410159 369.7419 1.2236 pythia8 +# allhad +410160 309.6040 1.2248 pythia8 +### warning: dummy cross-sections!! +410161 317.3591 1.1977 pythia +410162 317.3591 1.1977 pythia +410163 317.3591 1.1977 herwigpp +# non-allhad +410500 397.2431 1.13896 pythia8 + +# WARNING +## new Powheg+P8 samples +410501 397.11 1.1390 pythia8 +410503 76.93 1.1392 pythia8 +410504 22.90 1.1391 pythia8 +410505 4.30 1.1392 pythia8 +#colour flipped +410248 396.94 1.1390 pythia8 +# allhad samples, without noC W decays +410502 249.81 1.1390 pythia8 +410506 249.89 1.1390 pythia8 +410509 15.22 1.1390 pythia8 +# allhad samples, noC W decays +410531 83.270 1.1390 pythia8 +410532 83.261 1.1390 pythia8 +410533 5.035 1.1390 pythia8 +# nonallhad samples, C/B-filtered, boosted +# FIXME: cross-sections to be checked +410507 1.10865 1.1390 pythia8 +410508 2.34475 1.1390 pythia8 + +## Powheg+P8 samples, hdamp=1.5/3.0mt, A14 tune var 3c up/down +410511 448.3933 1.0088 pythia8 +410512 348.3145 1.2988 pythia8 +# allhad samples, without noC W decays +410521 281.98 1.0088 pythia8 +410522 219.10 1.2988 pythia8 +# allhad samples, noC W decays +410534 93.972 1.0088 pythia8 +410535 73.005 1.2988 pythia8 + +## Powheg+Herwig7, hdamp=1.5mt, H7UE tune +410525 397.105 1.1391 herwigpp +410527 76.93 1.1393 herwigpp +410528 28.09 1.1392 herwigpp +410529 5.37 1.1393 herwigpp +# allhad samples, without noC W decays +410526 249.81 1.1390 herwigpp +410530 249.88 1.1390 herwigpp +# allhad samples, noC W decays +410536 83.268 1.1390 herwigpp +410537 83.251 1.1390 herwigpp + +# new aMC@NLO+P8 samples - Xsec to be checked, only 410225 from PMG central page, others extrapolated from AMI +# same K-factor for all +410225 389.221 1.1693 pythia8 +410226 76.084 1.1693 pythia8 +410227 321.64 1.1693 pythia8 +410274 23.093 1.1693 pythia8 +410275 4.366 1.1693 pythia8 + + +# PowhegPythia8 mass-variation samples +410037 405.5373 1.1949 pythia +410038 389.0943 1.1949 pythia +410039 368.4626 1.1949 pythia +410040 353.8235 1.1949 pythia +410041 330.9295 1.1949 pythia +410042 340.1290 1.1947 pythia +410043 326.4065 1.1947 pythia +410044 309.0983 1.1947 pythia +410045 296.8128 1.1947 pythia +410046 277.6722 1.1947 pythia + +#mtt-sliced SM ttbar samples. Jiahang's emperical cross-sections +301528 3.3692 1.1949 pythia +301529 1.3992 1.1949 pythia +301530 0.6265 1.1949 pythia +301531 0.382866 1.1949 pythia +301532 0.229719 1.1949 pythia + +#mtt-sliced all-had SM ttbar samples [13 July 2016] +# xsection from: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/XsecSummaryTTbarSliced +303722 2.7557575 1.0 pythia +303723 1.13765616 1.0 pythia +303724 0.50336706 1.0 pythia +303725 0.30495312 1.0 pythia +303726 0.18032616 1.0 pythia + + +#ht-sliced SM ttbar samples PowhegPythia6 (l+jets) +407009 15.95806 1.1949 pythia +407010 2.23069 1.1949 pythia +407011 0.39337 1.1949 pythia + +# Sherpa samples +410021 78.73 1.17 sherpa21 +410022 157.54 1.17 sherpa21 +410023 157.35 1.17 sherpa21 +410024 315.99 1.17 sherpa21 +# new Sherpa samples +410186 330.19 1.1484 sherpa +410187 158.94 1.1484 sherpa +410188 158.82 1.1484 sherpa +410189 76.333 1.1484 sherpa +# new Sherpa 2.2.1 samples +410249 330.04 1.1484 sherpa +410250 158.94 1.1484 sherpa +410251 158.99 1.1484 sherpa +410252 76.317 1.1484 sherpa + +# Sherpa ttbar+bbbar +### warning: dummy cross-sections!! +410051 0.31505 1.10 sherpa21 + +# b-filter +410120 24.1063 1.1949 pythia +410121 4.4954 1.1949 pythia + +# Madgraph+Pythia8 SM ttbar+jets +407200 215.2902 1.8743 pythia8 +407201 15.02793 1.8743 pythia8 +407202 4.969761 1.8743 pythia8 +407203 4.076286 1.8743 pythia8 +407204 1.614472 1.8743 pythia8 + + +# First samples using Herwig7 - t-channel, ttbar, Wt +### warning: dummy cross-sections!! +410228 0 0 herwigpp +410229 0 0 herwigpp +410230 0 0 herwigpp +410232 0 0 herwigpp +410233 0 0 herwigpp +410234 0 0 pythia8 +410237 0 0 herwigpp +410238 0 0 herwigpp + + +## https://twiki.cern.ch/twiki/bin/view/AtlasProtected/CrossSectionNLOttV +## ttV, ttWW +410066 0.17656 1.32 pythia8 # ttW,0j +410067 0.14062 1.32 pythia8 # ttW,1j +410068 0.1368 1.32 pythia8 # ttW,2j +410069 0.018103 1.20 pythia8 # ttZ on-shell only +410070 0.030629 1.20 pythia8 # ttZ on-shell only +410081 0.0080975 1.2231 pythia8 # ttWW +# ttgamma - see ANALYSISTO-136 +410082 2.982 1.47 pythia8 +410083 0.8471 1.47 pythia8 +410084 0.3359 1.47 pythia8 + + +410111 0.0096235 1.51 pythia8 # ttee,0j +410112 0.017344 1.51 pythia8 # ttee,1j +410113 0.0096462 1.51 pythia8 # ttmumu,0j +410114 0.017361 1.51 pythia8 # ttmumu,1j +410115 0.0098874 1.51 pythia8 # tttautau,0j +410116 0.017790 1.51 pythia8 # tttautau,1j +410073 0.17321 1.47 pythia8 # ttZ, only for Z->nunu +410074 0.16533 1.47 pythia8 # ttZ, only for Z->nunu +410075 0.17427 1.47 pythia8 # ttZ, only for Z->nunu + +# ttV Sherpa +410142 0.11309 1.09 sherpa +410143 0.68810 1.10 sherpa +410144 0.6008 1.04 sherpa + + +# ttV aMcatNLO+Pythia8 - in agreement with YR4 https://twiki.cern.ch/twiki/bin/view/AtlasProtected/CrossSectionNLOttV +410155 0.54830 1.10 pythia8 +410156 0.15499 1.11 pythia8 +410157 0.52771 1.11 pythia8 +410218 0.036888 1.12 pythia8 +410219 0.036895 1.12 pythia8 +410220 0.036599 1.12 pythia8 + +# 4 tops, 3 tops SM +410080 0.0091622 1.0042 pythia8 +304014 0.0016398 1.0 pythia8 + +# tZ +## MG5+P6, inclusive +410050 0.24013 1.0 pythia +## MG5+P6, trilepton without taus +410049 0.0090636 1.0 pythia +## MG5+P8, inclusive +410560 0.24037 1.0 pythia8 +## MG5+P8, trilepton - Xsection value to be checked!! +410550 0.020738 1.0 pythia8 + +# ttbar Powheg+Pythia6 3D slices +### warning: dummy cross-sections!! +426072 0 0 pythia +426075 0 0 pythia +426076 0 0 pythia +426077 0 0 pythia +426078 0 0 pythia +426082 0 0 pythia +426085 0 0 pythia +426086 0 0 pythia +426087 0 0 pythia +426088 0 0 pythia + +# ttbar+jets Madgraph+Pythia8 +### warning: dummy cross-sections!! +343852 0 0 pythia8 +343853 0 0 pythia8 +343854 0 0 pythia8 + +################################################################################################################ 0 +# single top + +410011 43.739 1.0094 pythia +410012 25.778 1.0193 pythia +410013 34.009 1.054 pythia +410014 33.989 1.054 pythia +410015 3.5835 1.054 pythia +410016 3.5814 1.054 pythia +410025 2.0517 1.005 pythia +410026 1.2615 1.022 pythia + +# Powheg+Pythia t-channel single-top mass-variation samples +### warning: dummy cross-sections!! +410240 0 0 pythia +410241 0 0 pythia +410242 0 0 pythia +410243 0 0 pythia + +# Single Top +# taken from CentralMC15ProductionList +410065 3.409 1.054 pythia +410064 3.4133 1.054 pythia +410062 32.384 1.054 pythia +410063 32.357 1.054 pythia +410099 34.917 1.027 pythia +410100 33.407 1.073 pythia +410101 34.893 1.027 pythia +410102 33.388 1.073 pythia +410103 3.679 1.027 pythia +410104 3.5201 1.073 pythia +410105 3.6767 1.027 pythia +410106 3.5181 1.073 pythia +# FIXME Wt aMCatNLO+Hpp - K-factor may need to be checked.... +410165 73.588 1.0 herwigpp + + +410017 43.739 1.0094 pythia +410018 43.739 1.0094 pythia +410019 25.778 1.0193 pythia +410020 25.778 1.0193 pythia + +410047 43.614 1.0123 herwigpp +410048 25.744 1.0206 herwigpp + +410107 2.0755 0.9935 pythia +410108 2.0331 1.0142 pythia +410109 1.2753 1.0109 pythia +410110 1.2514 1.0302 pythia +410141 68.768 1.0241 herwigpp +410145 4.0 0.9443 herwigpp #exactly 4.0?? +410146 4.0 0.9437 herwigpp #exactly 4.0?? +410147 34.0 1.0543 herwigpp #exactly 34.0?? +410148 34.0 1.0537 herwigpp #exactly 34.0?? +410151 0.19748 1.2160 pythia # use 410050 cross-section +410152 0.29866 0.80402 pythia # use 410050 cross-section +410153 0.0074284 1.22012 pythia # use 410049 cross-section +410154 0.011252 0.80551 pythia # use 410049 cross-section +410164 7.8714 0.9594 herwigpp +410215 0.015558 1. pythia8 # no k-factor yet +410217 0.015483 1. herwigpp # no k-factor yet + + +# All-Had VJets +304307 29.504 1.0 sherpa21 +304308 2.1559 1.0 sherpa21 +304309 0.046461 1.0 sherpa21 +304707 12.575 1.0 sherpa21 +304708 0.9035 1.0 sherpa21 +304709 0.018584 1.0 sherpa21 +304824 197.94 1.0 pythia8 +304623 23.146 1.0 pythia8 +304624 1.4823 1.0 pythia8 +304625 0.27757 1.0 pythia8 +304626 0.035315 1.0 pythia8 +304627 0.0038008 1.0 pythia8 +304673 13.25 1.0 herwigpp +304674 0.92071 1.0 herwigpp +304675 0.1753 1.0 herwigpp +304676 0.02179 1.0 herwigpp +304677 0.0022739 1.0 herwigpp +304825 87.002 1.0 pythia8 +304628 10.455 1.0 pythia8 +304629 0.67488 1.0 pythia8 +304630 0.12507 1.0 pythia8 +304631 0.015797 1.0 pythia8 +304632 0.001705 1.0 pythia8 +304678 5.4723 1.0 pythia8 +304679 0.3703 1.0 pythia8 +304680 0.070598 1.0 pythia8 +304681 0.0088535 1.0 pythia8 +304682 0.00090013 1.0 pythia8 + + +################################################################################################################ 0 +# Powheg inclusive W https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MC15WjetsPowPy8InclSamplesPMG + +361100 11306.0 1.01724 pythia8 +361101 11306.0 1.01724 pythia8 +361102 11306.0 1.01724 pythia8 +361103 8282.6 1.03579 pythia8 +361104 8282.6 1.03579 pythia8 +361105 8282.6 1.03579 pythia8 + +################################################################################################################ 0 +# Powheg inclusive Z, k-factor from here: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MC15ZjetsPowPy8InclSamplesPMG + +361106 1901.2000 1.026 pythia8 +361107 1901.2000 1.026 pythia8 +361108 1901.2000 1.026 pythia8 + +################################################################################################################ 0 +# Sherpa 2.1 W + jets +# NLO xsec from Sherpa +# https://twiki.cern.ch/twiki/pub/AtlasProtected/CentralMC15ProductionList/XSections_13TeV_e3651_e4133.txt + +361300 19060.27 0.9083 sherpa21 +361301 1036.0748 0.9083 sherpa21 +361302 1277.0274 0.9083 sherpa21 +361303 460.55184 0.9083 sherpa21 +361304 111.3728 0.9083 sherpa21 +361305 60.982936 0.9083 sherpa21 +361306 61.569984 0.9083 sherpa21 +361307 18.456576 0.9083 sherpa21 +361308 10.147512 0.9083 sherpa21 +361309 3.7430211 0.9083 sherpa21 +361310 1.270087 0.9083 sherpa21 +361311 0.7551558 0.9083 sherpa21 +361312 0.21938574 0.9083 sherpa21 +361313 0.0828002 0.9083 sherpa21 +361314 0.05545526 0.9083 sherpa21 +361315 0.038058824 0.9083 sherpa21 +361316 0.013239976 0.9083 sherpa21 +361317 0.009862805 0.9083 sherpa21 +361318 0.0040615302 0.9083 sherpa21 +361319 0.0015777125 0.9083 sherpa21 +361320 0.0011266528 0.9083 sherpa21 +361321 0.00001597 0.9083 sherpa21 +361322 0.00000694 0.9083 sherpa21 +361323 4.911173E-006 0.9083 sherpa21 +361324 19060.27 0.9083 sherpa21 +361325 1036.0748 0.9083 sherpa21 +361326 1277.0274 0.9083 sherpa21 +361327 460.55184 0.9083 sherpa21 +361328 111.3728 0.9083 sherpa21 +361329 60.982936 0.9083 sherpa21 +361330 61.569984 0.9083 sherpa21 +361331 18.456576 0.9083 sherpa21 +361332 10.147512 0.9083 sherpa21 +361333 3.7430211 0.9083 sherpa21 +361334 1.270087 0.9083 sherpa21 +361335 0.7551558 0.9083 sherpa21 +361336 0.21938574 0.9083 sherpa21 +361337 0.0828002 0.9083 sherpa21 +361338 0.05545526 0.9083 sherpa21 +361339 0.038058824 0.9083 sherpa21 +361340 0.013239976 0.9083 sherpa21 +361341 0.009862805 0.9083 sherpa21 +361342 0.0040615302 0.9083 sherpa21 +361343 0.0015777125 0.9083 sherpa21 +361344 0.0011266528 0.9083 sherpa21 +361345 0.00001597 0.9083 sherpa21 +361346 0.00000694 0.9083 sherpa21 +361347 4.911173E-006 0.9083 sherpa21 +361348 19060.27 0.9083 sherpa21 +361349 1036.0748 0.9083 sherpa21 +361350 1277.0274 0.9083 sherpa21 +361351 460.55184 0.9083 sherpa21 +361352 111.3728 0.9083 sherpa21 +361353 60.982936 0.9083 sherpa21 +361354 61.569984 0.9083 sherpa21 +361355 18.456576 0.9083 sherpa21 +361356 10.147512 0.9083 sherpa21 +361357 3.7430211 0.9083 sherpa21 +361358 1.270087 0.9083 sherpa21 +361359 0.7551558 0.9083 sherpa21 +361360 0.21938574 0.9083 sherpa21 +361361 0.0828002 0.9083 sherpa21 +361362 0.05545526 0.9083 sherpa21 +361363 0.038058824 0.9083 sherpa21 +361364 0.013239976 0.9083 sherpa21 +361365 0.009862805 0.9083 sherpa21 +361366 0.0040615302 0.9083 sherpa21 +361367 0.0015777125 0.9083 sherpa21 +361368 0.0011266528 0.9083 sherpa21 +361369 0.00001597 0.9083 sherpa21 +361370 0.00000694 0.9083 sherpa21 +361371 4.911173E-006 0.9083 sherpa21 + +################################################################################################################ +## Sherpa W+jets systematic samples +### warning: dummy cross-sections!! + +362496 0 0 sherpa21 +362497 0 0 sherpa21 +362498 0 0 sherpa21 +362499 0 0 sherpa21 +362500 0 0 sherpa21 +362501 0 0 sherpa21 +362502 0 0 sherpa21 +362503 0 0 sherpa21 +362504 0 0 sherpa21 +362505 0 0 sherpa21 +362506 0 0 sherpa21 +362507 0 0 sherpa21 +362508 0 0 sherpa21 +362509 0 0 sherpa21 +362510 0 0 sherpa21 +362511 0 0 sherpa21 +362512 0 0 sherpa21 +362513 0 0 sherpa21 +362514 0 0 sherpa21 +362515 0 0 sherpa21 +362516 0 0 sherpa21 +362517 0 0 sherpa21 +362518 0 0 sherpa21 +362519 0 0 sherpa21 +362520 0 0 sherpa21 +362521 0 0 sherpa21 +362522 0 0 sherpa21 +362523 0 0 sherpa21 +362524 0 0 sherpa21 +362525 0 0 sherpa21 +362526 0 0 sherpa21 +362527 0 0 sherpa21 +362528 0 0 sherpa21 +362529 0 0 sherpa21 +362530 0 0 sherpa21 +362531 0 0 sherpa21 +362532 0 0 sherpa21 +362533 0 0 sherpa21 +362534 0 0 sherpa21 +362535 0 0 sherpa21 +362536 0 0 sherpa21 +362537 0 0 sherpa21 +362538 0 0 sherpa21 +362539 0 0 sherpa21 +362540 0 0 sherpa21 +362541 0 0 sherpa21 +362542 0 0 sherpa21 +362543 0 0 sherpa21 +362544 0 0 sherpa21 +362545 0 0 sherpa21 +362546 0 0 sherpa21 +362547 0 0 sherpa21 +362548 0 0 sherpa21 +362549 0 0 sherpa21 +362550 0 0 sherpa21 +362551 0 0 sherpa21 +362552 0 0 sherpa21 +362553 0 0 sherpa21 +362554 0 0 sherpa21 +362555 0 0 sherpa21 +362556 0 0 sherpa21 +362557 0 0 sherpa21 +362558 0 0 sherpa21 +362559 0 0 sherpa21 +362560 0 0 sherpa21 +362561 0 0 sherpa21 +362562 0 0 sherpa21 +362563 0 0 sherpa21 +362564 0 0 sherpa21 +362565 0 0 sherpa21 +362566 0 0 sherpa21 +362567 0 0 sherpa21 +362568 0 0 sherpa21 +362569 0 0 sherpa21 +362570 0 0 sherpa21 +362571 0 0 sherpa21 +362572 0 0 sherpa21 +362573 0 0 sherpa21 +362574 0 0 sherpa21 +362575 0 0 sherpa21 +362384 0 0 sherpa21 +362385 0 0 sherpa21 +362386 0 0 sherpa21 +362387 0 0 sherpa21 +362388 0 0 sherpa21 +362389 0 0 sherpa21 +362390 0 0 sherpa21 +362391 0 0 sherpa21 +362392 0 0 sherpa21 +362393 0 0 sherpa21 +362394 0 0 sherpa21 +362395 0 0 sherpa21 +362396 0 0 sherpa21 +362397 0 0 sherpa21 +362398 0 0 sherpa21 +362399 0 0 sherpa21 +362400 0 0 sherpa21 +362401 0 0 sherpa21 +362402 0 0 sherpa21 +362403 0 0 sherpa21 +362404 0 0 sherpa21 +362405 0 0 sherpa21 +362406 0 0 sherpa21 +362407 0 0 sherpa21 +362408 0 0 sherpa21 +362409 0 0 sherpa21 +362410 0 0 sherpa21 +362411 0 0 sherpa21 +362412 0 0 sherpa21 +362413 0 0 sherpa21 +362414 0 0 sherpa21 +362415 0 0 sherpa21 +362416 0 0 sherpa21 +362417 0 0 sherpa21 +362418 0 0 sherpa21 +362419 0 0 sherpa21 +362420 0 0 sherpa21 +362421 0 0 sherpa21 +362422 0 0 sherpa21 +362423 0 0 sherpa21 +362424 0 0 sherpa21 +362425 0 0 sherpa21 +362426 0 0 sherpa21 +362427 0 0 sherpa21 +362428 0 0 sherpa21 +362429 0 0 sherpa21 +362430 0 0 sherpa21 +362431 0 0 sherpa21 +362432 0 0 sherpa21 +362433 0 0 sherpa21 +362434 0 0 sherpa21 +362435 0 0 sherpa21 +362436 0 0 sherpa21 +362437 0 0 sherpa21 +362438 0 0 sherpa21 +362439 0 0 sherpa21 +362440 0 0 sherpa21 +362441 0 0 sherpa21 +362442 0 0 sherpa21 +362443 0 0 sherpa21 +362444 0 0 sherpa21 +362445 0 0 sherpa21 +362446 0 0 sherpa21 +362447 0 0 sherpa21 +362448 0 0 sherpa21 +362449 0 0 sherpa21 +362450 0 0 sherpa21 +362451 0 0 sherpa21 +362452 0 0 sherpa21 +362453 0 0 sherpa21 +362454 0 0 sherpa21 +362455 0 0 sherpa21 +362456 0 0 sherpa21 +362457 0 0 sherpa21 +362458 0 0 sherpa21 +362459 0 0 sherpa21 +362460 0 0 sherpa21 +362461 0 0 sherpa21 +362462 0 0 sherpa21 +362463 0 0 sherpa21 +362464 0 0 sherpa21 +362465 0 0 sherpa21 +362466 0 0 sherpa21 +362467 0 0 sherpa21 +362468 0 0 sherpa21 +362469 0 0 sherpa21 +362470 0 0 sherpa21 +362471 0 0 sherpa21 +362472 0 0 sherpa21 +362473 0 0 sherpa21 +362474 0 0 sherpa21 +362475 0 0 sherpa21 +362476 0 0 sherpa21 +362477 0 0 sherpa21 +362478 0 0 sherpa21 +362479 0 0 sherpa21 +362480 0 0 sherpa21 +362481 0 0 sherpa21 +362482 0 0 sherpa21 +362483 0 0 sherpa21 +362484 0 0 sherpa21 +362485 0 0 sherpa21 +362486 0 0 sherpa21 +362487 0 0 sherpa21 +362488 0 0 sherpa21 +362489 0 0 sherpa21 +362490 0 0 sherpa21 +362491 0 0 sherpa21 +362492 0 0 sherpa21 +362493 0 0 sherpa21 +362494 0 0 sherpa21 +362495 0 0 sherpa21 + +################################################################################################################ +# Sherpa 2.2 W+jets +363331 15821.9692868 1.0 sherpa +363332 2683.83259267 1.0 sherpa +363333 909.565023 1.0 sherpa +363334 375.759077047 1.0 sherpa +363335 144.539591316 1.0 sherpa +363336 49.107324606 1.0 sherpa +363337 50.173358226 1.0 sherpa +363338 22.558816959 1.0 sherpa +363339 8.611129318 1.0 sherpa +363340 3.450438494 1.0 sherpa +363341 1.687956502 1.0 sherpa +363342 0.711433732 1.0 sherpa +363343 0.209886778 1.0 sherpa +363344 0.108804181 1.0 sherpa +363345 0.048001365 1.0 sherpa +363346 0.039884689 1.0 sherpa +363347 0.01927425 1.0 sherpa +363348 0.009455976 1.0 sherpa +363349 0.004868065 1.0 sherpa +363350 0.00251029 1.0 sherpa +363351 0.001236195 1.0 sherpa +363352 1.4245e-05 1.0 sherpa +363353 8.707e-06 1.0 sherpa +363354 5.143e-06 1.0 sherpa +363436 15795.1948618 1.0 sherpa +363437 2675.17332482 1.0 sherpa +363438 907.616822112 1.0 sherpa +363439 377.749548487 1.0 sherpa +363440 145.131941493 1.0 sherpa +363441 49.820615432 1.0 sherpa +363442 50.117877494 1.0 sherpa +363443 22.617359448 1.0 sherpa +363444 8.646363179 1.0 sherpa +363445 3.691386319 1.0 sherpa +363446 1.688434939 1.0 sherpa +363447 0.730840739 1.0 sherpa +363448 0.213331248 1.0 sherpa +363449 0.107132134 1.0 sherpa +363450 0.050487154 1.0 sherpa +363451 0.037111165 1.0 sherpa +363452 0.018196255 1.0 sherpa +363453 0.009428206 1.0 sherpa +363454 0.00478857 1.0 sherpa +363455 0.002494854 1.0 sherpa +363456 0.001284408 1.0 sherpa +363457 1.2348e-05 1.0 sherpa +363458 9.812e-06 1.0 sherpa +363459 5.314e-06 1.0 sherpa +363460 15813.6777927 1.0 sherpa +363461 2684.61495225 1.0 sherpa +363462 912.150989719 1.0 sherpa +363463 376.41531567 1.0 sherpa +363464 146.400460335 1.0 sherpa +363465 49.551285758 1.0 sherpa +363466 50.212399035 1.0 sherpa +363467 22.595721591 1.0 sherpa +363468 8.658354152 1.0 sherpa +363469 3.438223853 1.0 sherpa +363470 1.69556209 1.0 sherpa +363471 0.732911329 1.0 sherpa +363472 0.211528021 1.0 sherpa +363473 0.107245951 1.0 sherpa +363474 0.051038517 1.0 sherpa +363475 0.036964172 1.0 sherpa +363476 0.019023648 1.0 sherpa +363477 0.00948474 1.0 sherpa +363478 0.004645048 1.0 sherpa +363479 0.002444187 1.0 sherpa +363480 0.001307192 1.0 sherpa +363481 1.2973e-05 1.0 sherpa +363482 2.364e-06 1.0 sherpa +363483 3.705e-06 1.0 sherpa + + +#################################################### +# Sherpa v2.2.1 Z +# cross-sections and K-factors stolen from SUSYTools - ANALYSISTO-190 +364100 1630.2243 0.9751 sherpa +364101 223.717472 0.9751 sherpa +364102 127.1799342 0.9751 sherpa +364103 75.0164716 0.9751 sherpa +364104 20.3477432 0.9751 sherpa +364105 12.3885125 0.9751 sherpa +364106 24.28530322 0.9751 sherpa +364107 9.2754186 0.9751 sherpa +364108 6.01361075 0.9751 sherpa +364109 4.77297475 0.9751 sherpa +364110 2.265570784 0.9751 sherpa +364111 1.491320988 0.9751 sherpa +364112 1.7881 0.9751 sherpa +364113 0.14769 0.9751 sherpa +364114 1627.176708 0.9751 sherpa +364115 223.73136 0.9751 sherpa +364116 126.4502953 0.9751 sherpa +364117 76.292515 0.9751 sherpa +364118 20.3360066 0.9751 sherpa +364119 12.6227733 0.9751 sherpa +364120 25.03001412 0.9751 sherpa +364121 9.3719948 0.9751 sherpa +364122 6.08263138 0.9751 sherpa +364123 4.869231562 0.9751 sherpa +364124 2.279979034 0.9751 sherpa +364125 1.494370818 0.9751 sherpa +364126 1.8081 0.9751 sherpa +364127 0.14857 0.9751 sherpa +364128 1627.725872 0.9751 sherpa +364129 223.881432 0.9751 sherpa +364130 127.7329554 0.9751 sherpa +364131 76.0261671 0.9751 sherpa +364132 20.212279 0.9751 sherpa +364133 12.29393 0.9751 sherpa +364134 24.80341201 0.9751 sherpa +364135 9.3282378 0.9751 sherpa +364136 5.47909362 0.9751 sherpa +364137 4.791190072 0.9751 sherpa +364138 2.275625215 0.9751 sherpa +364139 1.502837652 0.9751 sherpa +364140 1.8096 0.9751 sherpa +364141 0.14834 0.9751 sherpa +364142 8791.12 0.9728 sherpa +364143 1190.38346 0.9728 sherpa +364144 708.668075 0.9728 sherpa +364145 415.7702452 0.9728 sherpa +364146 110.9448045 0.9728 sherpa +364147 72.126906 0.9728 sherpa +364148 135.001758 0.9728 sherpa +364149 49.9829076 0.9728 sherpa +364150 33.7820695 0.9728 sherpa +364151 26.47646625 0.9728 sherpa +364152 12.41848797 0.9728 sherpa +364153 8.31494664 0.9728 sherpa +364154 9.9099 0.9728 sherpa +364155 0.81809 0.9728 sherpa + +#################################################### +# Sherpa v2.2.1 Z low mass - values extracted from PMG CentralPage (MC15ZjetsOtherSamplesPMG) +364198 2330.19 0.9751 sherpa +364199 82.25676 0.9751 sherpa +364200 44.87913 0.9751 sherpa +364201 5.114990 0.9751 sherpa +364202 2.759784 0.9751 sherpa +364203 0.4721560 0.9751 sherpa +364204 2331.223 0.9751 sherpa +364205 81.35769 0.9751 sherpa +364206 44.97143 0.9751 sherpa +364207 5.481415 0.9751 sherpa +364208 2.777411 0.9751 sherpa +364209 0.4730864 0.9751 sherpa +364210 2333.926 0.9751 sherpa +364211 81.10263 0.9751 sherpa +364212 44.83686 0.9751 sherpa +364213 5.540944 0.9751 sherpa +364214 2.793550 0.9751 sherpa +364215 0.4697209 0.9751 sherpa + + + +#################################################### +# Sherpa v2.2.1 W +# cross-sections and K-factors stolen from SUSYTools - ANALYSISTO-190 +364156 15770.0034 0.9702 sherpa +364157 2493.3784 0.9702 sherpa +364158 844.19793 0.9702 sherpa +364159 637.4241555 0.9702 sherpa +364160 219.9656768 0.9702 sherpa +364161 71.45937024 0.9702 sherpa +364162 212.5554354 0.9702 sherpa +364163 98.4371682 0.9702 sherpa +364164 36.9147888 0.9702 sherpa +364165 39.38245349 0.9702 sherpa +364166 22.91781114 0.9702 sherpa +364167 9.60864165 0.9702 sherpa +364168 15.01 0.9702 sherpa +364169 1.2344 0.9702 sherpa +364170 15769.63769 0.9702 sherpa +364171 2492.639 0.9702 sherpa +364172 844.638035 0.9702 sherpa +364173 630.3220976 0.9702 sherpa +364174 215.4898229 0.9702 sherpa +364175 97.7379615 0.9702 sherpa +364176 202.8359871 0.9702 sherpa +364177 98.4433455 0.9702 sherpa +364178 36.9965304 0.9702 sherpa +364179 39.24325044 0.9702 sherpa +364180 22.846544 0.9702 sherpa +364181 9.65665183 0.9702 sherpa +364182 15.224 0.9702 sherpa +364183 1.2334 0.9702 sherpa +364184 15799.4424 0.9702 sherpa +364185 2477.24902 0.9702 sherpa +364186 854.554822 0.9702 sherpa +364187 638.545523 0.9702 sherpa +364188 210.3823406 0.9702 sherpa +364189 98.018303 0.9702 sherpa +364190 202.3332192 0.9702 sherpa +364191 98.5776075 0.9702 sherpa +364192 40.0623246 0.9702 sherpa +364193 39.32514985 0.9702 sherpa +364194 22.77896448 0.9702 sherpa +364195 9.67021076 0.9702 sherpa +364196 15.046 0.9702 sherpa +364197 1.2339 0.9702 sherpa + + +################################################################################################################ +# Powheg+Pythia8 Z+jets mass slices +### values taken from this page on 2016.06.10 +### https://twiki.cern.ch/twiki/bin/view/AtlasProtected/XsecSummaryZjetsPowPy8Slice +301000 17.478 1.0 pythia8 +301001 2.9212 1.0 pythia8 +301002 1.082 1.0 pythia8 +301003 0.1955 1.0 pythia8 +301004 0.037401 1.0 pythia8 +301005 0.010607 1.0 pythia8 +301006 0.0042582 1.0 pythia8 +301007 0.0014219 1.0 pythia8 +301008 0.00054521 1.0 pythia8 +301009 0.00022992 1.0 pythia8 +301010 0.00010387 1.0 pythia8 +301011 4.94e-05 1.0 pythia8 +301012 2.4452e-05 1.0 pythia8 +301013 1.2487e-05 1.0 pythia8 +301014 1.0029e-05 1.0 pythia8 +301015 2.934e-06 1.0 pythia8 +301016 8.98e-07 1.0 pythia8 +301017 2.81e-07 1.0 pythia8 +301018 1.26e-07 1.0 pythia8 +301020 17.478 1.0 pythia8 +301021 2.9212 1.0 pythia8 +301022 1.082 1.0 pythia8 +301023 0.1955 1.0 pythia8 +301024 0.037399 1.0 pythia8 +301025 0.010607 1.0 pythia8 +301026 0.0042582 1.0 pythia8 +301027 0.0014219 1.0 pythia8 +301028 0.00054521 1.0 pythia8 +301029 0.00022991 1.0 pythia8 +301030 0.00010387 1.0 pythia8 +301031 4.94e-05 1.0 pythia8 +301032 2.4452e-05 1.0 pythia8 +301033 1.2487e-05 1.0 pythia8 +301034 1.0029e-05 1.0 pythia8 +301035 2.934e-06 1.0 pythia8 +301036 8.98e-07 1.0 pythia8 +301037 2.81e-07 1.0 pythia8 +301038 1.26e-07 1.0 pythia8 +301040 17.479 1.0 pythia8 +301041 2.9213 1.0 pythia8 +301042 1.082 1.0 pythia8 +301043 0.1955 1.0 pythia8 +301044 0.037401 1.0 pythia8 +301045 0.010607 1.0 pythia8 +301046 0.0042585 1.0 pythia8 +301047 0.001422 1.0 pythia8 +301048 0.00054524 1.0 pythia8 +301049 0.00022992 1.0 pythia8 +301050 0.00010386 1.0 pythia8 +301051 4.9403e-05 1.0 pythia8 +301052 2.4454e-05 1.0 pythia8 +301053 1.249e-05 1.0 pythia8 +301054 1.0031e-05 1.0 pythia8 +301055 2.934e-06 1.0 pythia8 +301056 8.98e-07 1.0 pythia8 +301057 2.81e-07 1.0 pythia8 +301058 1.26e-07 1.0 pythia8 + +################################################################################################################ +# MG+Pythia8 Z+jets HT slices +363123 1425.72677 1.141 pythia8 +363124 185.87443 1.141 pythia8 +363125 101.50424 1.141 pythia8 +363126 60.72887 1.141 pythia8 +363127 14.7217 1.141 pythia8 +363128 9.15661 1.141 pythia8 +363129 24.19662 1.141 pythia8 +363130 7.16401 1.141 pythia8 +363131 4.52427 1.141 pythia8 +363132 5.14166 1.141 pythia8 +363133 1.86679 1.141 pythia8 +363134 1.16536 1.141 pythia8 +363135 0.75907 1.141 pythia8 +363136 0.31619 1.141 pythia8 +363137 0.19419 1.141 pythia8 +363138 0.24904 1.141 pythia8 +363139 0.11579 1.141 pythia8 +363140 0.07115 1.141 pythia8 +363141 0.08181 1.141 pythia8 +363142 0.03973 1.141 pythia8 +363143 0.02544 1.141 pythia8 +363144 0.00312 1.141 pythia8 +363145 0.00162 1.141 pythia8 +363146 0.00092 1.141 pythia8 +363147 1432.37252 1.141 pythia8 +363148 185.26535 1.141 pythia8 +363149 101.71283 1.141 pythia8 +363150 61.06624 1.141 pythia8 +363151 14.77757 1.141 pythia8 +363152 9.16739 1.141 pythia8 +363153 24.2238 1.141 pythia8 +363154 7.20416 1.141 pythia8 +363155 4.50245 1.141 pythia8 +363156 5.15677 1.141 pythia8 +363157 1.8664 1.141 pythia8 +363158 1.17055 1.141 pythia8 +363159 0.75965 1.141 pythia8 +363160 0.3163 1.141 pythia8 +363161 0.19409 1.141 pythia8 +363162 0.25692 1.141 pythia8 +363163 0.1166 1.141 pythia8 +363164 0.07217 1.141 pythia8 +363165 0.08447 1.141 pythia8 +363166 0.0419 1.141 pythia8 +363167 0.02547 1.141 pythia8 +363168 0.00303 1.141 pythia8 +363169 0.00168 1.141 pythia8 +363170 0.001 1.141 pythia8 + +################################################################################################################ +#Powheg+Pythia8 W+jets mass slices +### values taken from this page on 2016.06.10 +### https://twiki.cern.ch/twiki/bin/view/AtlasProtected/XsecSummaryWjetsPowPy8Slice +301060 32.053 1.0 pythia8 +301061 5.0029 1.0 pythia8 +301062 1.7543 1.0 pythia8 +301063 0.31235 1.0 pythia8 +301064 0.060793 1.0 pythia8 +301065 0.017668 1.0 pythia8 +301066 0.0072895 1.0 pythia8 +301067 0.0025071 1.0 pythia8 +301068 0.00098628 1.0 pythia8 +301069 0.0004245 1.0 pythia8 +301070 0.00019463 1.0 pythia8 +301071 9.3349e-05 1.0 pythia8 +301072 4.6259e-05 1.0 pythia8 +301073 2.3476e-05 1.0 pythia8 +301074 1.845e-05 1.0 pythia8 +301075 5.097e-06 1.0 pythia8 +301076 1.431e-06 1.0 pythia8 +301077 4.01e-07 1.0 pythia8 +301078 1.53e-07 1.0 pythia8 +301080 22.198 1.0 pythia8 +301081 3.2852 1.0 pythia8 +301082 1.0832 1.0 pythia8 +301083 0.17541 1.0 pythia8 +301084 0.03098 1.0 pythia8 +301085 0.0082865 1.0 pythia8 +301086 0.0031594 1.0 pythia8 +301087 0.0010029 1.0 pythia8 +301088 0.00036812 1.0 pythia8 +301089 0.00014945 1.0 pythia8 +301090 6.5311e-05 1.0 pythia8 +301091 3.0167e-05 1.0 pythia8 +301092 1.4549e-05 1.0 pythia8 +301093 7.259e-06 1.0 pythia8 +301094 5.669e-06 1.0 pythia8 +301095 1.598e-06 1.0 pythia8 +301096 4.72e-07 1.0 pythia8 +301097 1.43e-07 1.0 pythia8 +301098 6.2e-08 1.0 pythia8 +301100 32.053 1.0 pythia8 +301101 5.0029 1.0 pythia8 +301102 1.7543 1.0 pythia8 +301103 0.31235 1.0 pythia8 +301104 0.060793 1.0 pythia8 +301105 0.017668 1.0 pythia8 +301106 0.0072895 1.0 pythia8 +301107 0.0025071 1.0 pythia8 +301108 0.00098628 1.0 pythia8 +301109 0.00042457 1.0 pythia8 +301110 0.00019463 1.0 pythia8 +301111 9.3349e-05 1.0 pythia8 +301112 4.6259e-05 1.0 pythia8 +301113 2.3476e-05 1.0 pythia8 +301114 1.845e-05 1.0 pythia8 +301115 5.097e-06 1.0 pythia8 +301116 1.431e-06 1.0 pythia8 +301117 4.01e-07 1.0 pythia8 +301118 1.53e-07 1.0 pythia8 +301120 22.198 1.0 pythia8 +301121 3.2853 1.0 pythia8 +301122 1.0832 1.0 pythia8 +301123 0.17541 1.0 pythia8 +301124 0.03098 1.0 pythia8 +301125 0.0082865 1.0 pythia8 +301126 0.0031594 1.0 pythia8 +301127 0.0010029 1.0 pythia8 +301128 0.00036812 1.0 pythia8 +301129 0.00014945 1.0 pythia8 +301130 6.5311e-05 1.0 pythia8 +301131 3.0167e-05 1.0 pythia8 +301132 1.4549e-05 1.0 pythia8 +301133 7.259e-06 1.0 pythia8 +301134 5.669e-06 1.0 pythia8 +301135 1.598e-06 1.0 pythia8 +301136 4.72e-07 1.0 pythia8 +301137 1.43e-07 1.0 pythia8 +301138 6.2e-08 1.0 pythia8 +301140 32.053 1.0 pythia8 +301141 5.0029 1.0 pythia8 +301142 1.7543 1.0 pythia8 +301143 0.31235 1.0 pythia8 +301144 0.060793 1.0 pythia8 +301145 0.017668 1.0 pythia8 +301146 0.0072895 1.0 pythia8 +301147 0.0025071 1.0 pythia8 +301148 0.00098628 1.0 pythia8 +301149 0.00042457 1.0 pythia8 +301150 0.00019463 1.0 pythia8 +301151 9.3349e-05 1.0 pythia8 +301152 4.6259e-05 1.0 pythia8 +301153 2.3476e-05 1.0 pythia8 +301154 1.845e-05 1.0 pythia8 +301155 5.097e-06 1.0 pythia8 +301156 1.431e-06 1.0 pythia8 +301157 4.01e-07 1.0 pythia8 +301158 1.53e-07 1.0 pythia8 +301160 22.198 1.0 pythia8 +301161 3.2852 1.0 pythia8 +301162 1.0832 1.0 pythia8 +301163 0.17541 1.0 pythia8 +301164 0.03098 1.0 pythia8 +301165 0.0082865 1.0 pythia8 +301166 0.0031594 1.0 pythia8 +301167 0.0010029 1.0 pythia8 +301168 0.00036812 1.0 pythia8 +301169 0.00014945 1.0 pythia8 +301170 6.5311e-05 1.0 pythia8 +301171 3.0167e-05 1.0 pythia8 +301172 1.4549e-05 1.0 pythia8 +301173 7.259e-06 1.0 pythia8 +301174 5.669e-06 1.0 pythia8 +301175 1.598e-06 1.0 pythia8 +301176 4.72e-07 1.0 pythia8 +301177 1.43e-07 1.0 pythia8 +301178 6.2e-08 1.0 pythia8 + +################################################################################################################ 0 +# Sherpa 2.2 Z+jets +363102 46.751851426 1.0 sherpa +363103 14.026868379 1.0 sherpa +363104 8.832529157 1.0 sherpa +363105 6.73378408 1.0 sherpa +363106 2.413076391 1.0 sherpa +363107 1.555402702 1.0 sherpa +363108 0.486837566 1.0 sherpa +363109 0.196832713 1.0 sherpa +363110 0.124324067 1.0 sherpa +363111 0.030084735 1.0 sherpa +363112 0.013210254 1.0 sherpa +363113 0.008163159 1.0 sherpa +363114 0.005386908 1.0 sherpa +363115 0.002395235 1.0 sherpa +363116 0.001473957 1.0 sherpa +363117 0.0006955 1.0 sherpa +363118 0.000317704 1.0 sherpa +363119 0.000144828 1.0 sherpa +363120 2.416e-06 1.0 sherpa +363121 1.285e-06 1.0 sherpa +### 363122 cross-section calculated "by hand" +363122 6.615688e-07 1.0 sherpa +363361 1643.85019048 1.0 sherpa +363362 240.97383023 1.0 sherpa +363363 140.512238804 1.0 sherpa +363364 1642.54477535 1.0 sherpa +363365 240.030832472 1.0 sherpa +363366 142.586650552 1.0 sherpa +363367 46.639099307 1.0 sherpa +363368 14.009508576 1.0 sherpa +363369 8.904736706 1.0 sherpa +363370 6.776899365 1.0 sherpa +363371 2.407495134 1.0 sherpa +363372 1.557995219 1.0 sherpa +363373 0.481671305 1.0 sherpa +363374 0.195283767 1.0 sherpa +363375 0.123565964 1.0 sherpa +363376 0.030237082 1.0 sherpa +363377 0.01296887 1.0 sherpa +363378 0.007654784 1.0 sherpa +363379 0.005363995 1.0 sherpa +363380 0.002371048 1.0 sherpa +363381 0.001495305 1.0 sherpa +363382 0.00069072 1.0 sherpa +363383 0.000318973 1.0 sherpa +363384 0.000184686 1.0 sherpa +363385 2.451e-06 1.0 sherpa +363386 1.38e-06 1.0 sherpa +363387 6.69e-07 1.0 sherpa +363388 1641.4628707 1.0 sherpa +363389 241.466440999 1.0 sherpa +363390 140.517436867 1.0 sherpa +363391 46.790575075 1.0 sherpa +363392 14.049268454 1.0 sherpa +363393 8.861525949 1.0 sherpa +363394 6.789837772 1.0 sherpa +363395 2.42660918 1.0 sherpa +363396 1.559604271 1.0 sherpa +363397 0.48716142 1.0 sherpa +363398 0.198314112 1.0 sherpa +363399 0.123000982 1.0 sherpa +363400 0.02875511 1.0 sherpa +363401 0.012936803 1.0 sherpa +363402 0.007968854 1.0 sherpa +363403 0.005414517 1.0 sherpa +363404 0.002400844 1.0 sherpa +363405 0.001494724 1.0 sherpa +363406 0.000697776 1.0 sherpa +363407 0.00033278 1.0 sherpa +363408 0.000189395 1.0 sherpa +363409 2.524e-06 1.0 sherpa +363410 1.218e-06 1.0 sherpa +363411 6.99e-07 1.0 sherpa +363412 8849.62366464 1.0 sherpa +363413 1261.784832 1.0 sherpa +363414 777.421359616 1.0 sherpa +363415 262.063481626 1.0 sherpa +363416 78.642619761 1.0 sherpa +363417 49.007402629 1.0 sherpa +363418 37.875959148 1.0 sherpa +363419 14.581374106 1.0 sherpa +363420 8.773751393 1.0 sherpa +363421 2.696142542 1.0 sherpa +363422 1.067477005 1.0 sherpa +363423 0.7032228 1.0 sherpa +363424 0.167775035 1.0 sherpa +363425 0.070385103 1.0 sherpa +363426 0.044365312 1.0 sherpa +363427 0.02770973 1.0 sherpa +363428 0.012964171 1.0 sherpa +363429 0.007852498 1.0 sherpa +363430 0.003623487 1.0 sherpa +363431 0.001711101 1.0 sherpa +363432 0.001036761 1.0 sherpa +363433 1.0433e-05 1.0 sherpa +363434 6.627e-06 1.0 sherpa +363435 4.16e-06 1.0 sherpa + + + + +################################################################################################################ 0 +# W+jets Madgraph+Py8 + +361520 13939 1.20185 pythia8 +361521 1894 1.20185 pythia8 +361522 642.66 1.20185 pythia8 +361523 179.18 1.20185 pythia8 +361524 70.785 1.20185 pythia8 +361525 13935 1.20185 pythia8 +361526 1893.3 1.20185 pythia8 +361527 642.7 1.20185 pythia8 +361528 179.19 1.20185 pythia8 +361529 70.761 1.20185 pythia8 +361530 13920 1.20185 pythia8 +361531 1891.9 1.20185 pythia8 +361532 641.87 1.20185 pythia8 +361533 179.21 1.20185 pythia8 +361534 71.012 1.20185 pythia8 + + +################################################################################################################ 0 +# Sherpa 2.1 Z+jets +# NLO xsec from Sherpa +# taken from https://twiki.cern.ch/twiki/pub/AtlasProtected/CentralMC15ProductionList/XSections_13TeV_e3651_e4133.txt + +361372 1716.5925 0.9013 sherpa21 +361373 313.551 0.9013 sherpa21 +361374 175.2975 0.9013 sherpa21 +361375 49.26744 0.9013 sherpa21 +361376 16.711394 0.9013 sherpa21 +361377 9.952327 0.9013 sherpa21 +361378 7.145796 0.9013 sherpa21 +361379 2.823864 0.9013 sherpa21 +361380 1.708752 0.9013 sherpa21 +361381 0.44622056 0.9013 sherpa21 +361382 0.20124272 0.9013 sherpa21 +361383 0.12187724 0.9013 sherpa21 +361384 0.026342576 0.9013 sherpa21 +361385 0.012458576 0.9013 sherpa21 +361386 0.007950904 0.9013 sherpa21 +361387 0.0045444375 0.9013 sherpa21 +361388 0.0023897682 0.9013 sherpa21 +361389 0.0014590674 0.9013 sherpa21 +361390 0.0005839938 0.9013 sherpa21 +361391 0.000332937 0.9013 sherpa21 +361392 0.0001976382 0.9013 sherpa21 +361393 2.0636516E-006 0.9013 sherpa21 +361394 1.3032252E-006 0.9013 sherpa21 +361395 8.671232E-007 0.9013 sherpa21 +361396 1716.5925 0.9013 sherpa21 +361397 313.551 0.9013 sherpa21 +361398 175.2975 0.9013 sherpa21 +361399 49.26744 0.9013 sherpa21 +361400 16.711394 0.9013 sherpa21 +361401 9.952327 0.9013 sherpa21 +361402 7.145796 0.9013 sherpa21 +361403 2.823864 0.9013 sherpa21 +361404 1.708752 0.9013 sherpa21 +361405 0.44622056 0.9013 sherpa21 +361406 0.20124272 0.9013 sherpa21 +361407 0.12187724 0.9013 sherpa21 +361408 0.026342576 0.9013 sherpa21 +361409 0.012458576 0.9013 sherpa21 +361410 0.007950904 0.9013 sherpa21 +361411 0.0045444375 0.9013 sherpa21 +361412 0.0023897682 0.9013 sherpa21 +361413 0.0014590674 0.9013 sherpa21 +361414 0.0005839938 0.9013 sherpa21 +361415 0.000332937 0.9013 sherpa21 +361416 0.0001976382 0.9013 sherpa21 +361417 2.0636516E-006 0.9013 sherpa21 +361418 1.3032252E-006 0.9013 sherpa21 +361419 8.671232E-007 0.9013 sherpa21 +361420 1716.5925 0.9013 sherpa21 +361421 313.551 0.9013 sherpa21 +361422 175.2975 0.9013 sherpa21 +361423 49.26744 0.9013 sherpa21 +361424 16.711394 0.9013 sherpa21 +361425 9.952327 0.9013 sherpa21 +361426 7.145796 0.9013 sherpa21 +361427 2.823864 0.9013 sherpa21 +361428 1.708752 0.9013 sherpa21 +361429 0.44622056 0.9013 sherpa21 +361430 0.20124272 0.9013 sherpa21 +361431 0.12187724 0.9013 sherpa21 +361432 0.026342576 0.9013 sherpa21 +361433 0.012458576 0.9013 sherpa21 +361434 0.007950904 0.9013 sherpa21 +361435 0.0045444375 0.9013 sherpa21 +361436 0.0023897682 0.9013 sherpa21 +361437 0.0014590674 0.9013 sherpa21 +361438 0.0005839938 0.9013 sherpa21 +361439 0.000332937 0.9013 sherpa21 +361440 0.0001976382 0.9013 sherpa21 +361441 2.0636516E-006 0.9013 sherpa21 +361442 1.3032252E-006 0.9013 sherpa21 +361443 8.671232E-007 0.9013 sherpa21 + +361444 9292.49 0.9141 sherpa21 +361445 1672.57 0.9141 sherpa21 +361446 955.982 0.9141 sherpa21 +361447 278.000 0.9141 sherpa21 +361448 93.5176 0.9141 sherpa21 +361449 56.9431 0.9141 sherpa21 +361450 40.4600 0.9141 sherpa21 +361451 15.6915 0.9141 sherpa21 +361452 9.72404 0.9141 sherpa21 +361453 2.83776 0.9141 sherpa21 +361454 1.25440 0.9141 sherpa21 +361455 0.78752 0.9141 sherpa21 +361456 0.16347 0.9141 sherpa21 +361457 0.08385 0.9141 sherpa21 +361458 0.04945 0.9141 sherpa21 +361459 0.02904 0.9141 sherpa21 +361460 0.01650 0.9141 sherpa21 +361461 0.00915 0.9141 sherpa21 +361462 0.00328 0.9141 sherpa21 +361463 0.00245 0.9141 sherpa21 +361464 0.00159 0.9141 sherpa21 +361465 1.81635e-05 0.9141 sherpa21 +361466 1.14102e-05 0.9141 sherpa21 +361467 7.52484e-06 0.9141 sherpa21 + +################################################################################################################ 0 +# Sherpa Low Mass DY + +361468 2146.84 0.9013 sherpa21 +361469 106.231 0.9013 sherpa21 +361470 6.95992 0.9013 sherpa21 +361471 0.774166 0.9013 sherpa21 +361472 0.617445 0.9013 sherpa21 +361473 0.0742106 0.9013 sherpa21 +361474 0.00605652 0.9013 sherpa21 +361475 0.001498 0.9013 sherpa21 +361476 2141.34 0.9013 sherpa21 +361477 106.373 0.9013 sherpa21 +361478 6.93811 0.9013 sherpa21 +361479 0.793501 0.9013 sherpa21 +361480 0.621546 0.9013 sherpa21 +361481 0.0825398 0.9013 sherpa21 +361482 0.00628191 0.9013 sherpa21 +361483 0.00151 0.9013 sherpa21 +361484 2159 0.9013 sherpa21 +361485 105.918 0.9013 sherpa21 +361486 6.93153 0.9013 sherpa21 +361487 0.811135 0.9013 sherpa21 +361488 0.617549 0.9013 sherpa21 +361489 0.0833129 0.9013 sherpa21 +361490 0.00700123 0.9013 sherpa21 +361491 0.001437 0.9013 sherpa21 + + +################################################################################################################ 0 +# Z+jets Madgraph+Py8 + +361500 1401.6 1.2320 pythia8 +361501 211.99 1.2320 pythia8 +361502 67.305 1.2320 pythia8 +361503 18.679 1.2320 pythia8 +361504 7.291 1.2320 pythia8 +361505 1402 1.2320 pythia8 +361506 211.95 1.2320 pythia8 +361507 67.353 1.2320 pythia8 +361508 18.633 1.2320 pythia8 +361509 7.3013 1.2320 pythia8 +361510 1397.8 1.2320 pythia8 +361511 211.4 1.2320 pythia8 +361512 67.176 1.2320 pythia8 +361513 18.609 1.2320 pythia8 +361514 7.2749 1.2320 pythia8 +361515 7518.4 1.2283 pythia8 +361516 1200.1 1.2283 pythia8 +361517 387.16 1.2283 pythia8 +361518 110.08 1.2283 pythia8 +361519 43.389 1.2283 pythia8 + +# low mll Z+jets Madgraph samples +361628 2677.1 1.232 pythia8 +361629 44.988 1.232 pythia8 +361630 29.292 1.232 pythia8 +361631 6.117 1.232 pythia8 +361632 2.2091 1.232 pythia8 +361633 2677.1 1.232 pythia8 +361634 44.98 1.232 pythia8 +361635 29.302 1.232 pythia8 +361636 6.1088 1.232 pythia8 +361637 2.2231 1.232 pythia8 +361638 2412.4 1.232 pythia8 +361639 46.019 1.232 pythia8 +361640 28.852 1.232 pythia8 +361641 6.0513 1.232 pythia8 +361642 2.2111 1.232 pythia8 + +################################################################################################################ 0 +# Powheg+Py8 mc15 VV + +361600 10.631 1.0 pythia8 +361601 4.4625 1.0 pythia8 +361602 2.7778 1.0 pythia8 +361603 1.2568 1.0 pythia8 +361604 0.92498 1.0 pythia8 +361605 0.54901 1.0 pythia8 +361606 44.176 1.0 pythia8 +361607 3.2849 1.0 pythia8 +361608 5.7743 1.0 pythia8 +361609 10.099 1.0 pythia8 +361610 2.2739 1.0 pythia8 +361611 3.9448 1.0 pythia8 + + +################################################################################################################ +# Sherpa 2.1 diboson + +361063 12.805 0.91 sherpa21 +361064 1.8446 0.91 sherpa21 +361065 3.6235 0.91 sherpa21 +361066 2.5656 0.91 sherpa21 +361067 5.0169 0.91 sherpa21 +361068 14.022 0.91 sherpa21 +361069 0.02575 0.91 sherpa21 +361070 0.043375 0.91 sherpa21 +361071 0.042017 0.91 sherpa21 +361072 0.031496 0.91 sherpa21 +361073 0.02095 0.91 sherpa21 +361074 0.015884 0.91 sherpa21 +361075 0.011826 0.91 sherpa21 +361076 0.006272 0.91 sherpa21 +361077 0.85492 0.91 sherpa21 +361078 0.3763 0.91 sherpa21 +361079 0.5374 0.91 sherpa21 +361080 0.0508 0.91 sherpa21 +361081 25.995 0.91 sherpa21 +361082 25.974 0.91 sherpa21 +361083 12.543 0.91 sherpa21 +361084 3.7583 0.91 sherpa21 +361085 7.4151 0.91 sherpa21 +361086 2.3647 0.91 sherpa21 +361087 4.6336 0.91 sherpa21 +361088 3.4001 0.91 sherpa21 +361089 0.6003 0.91 sherpa21 +361090 1.5948 0.91 sherpa21 +361091 24.885 0.91 sherpa21 +361092 24.857 0.91 sherpa21 +361093 11.494 0.91 sherpa21 +361094 3.4234 0.91 sherpa21 +361095 6.777 0.91 sherpa21 +361096 2.35832064 0.91 sherpa21 +361097 4.6417833 0.91 sherpa21 + +# Sherpa 2.1 diboson HF filters +344422 0.056385 0.91 sherpa21 +344423 0.833454 0.91 sherpa21 +344424 0.023276 0.91 sherpa21 +344425 0.43897 0.91 sherpa21 +344426 0.046242 0.91 sherpa21 +344427 0.870711 0.91 sherpa21 +344428 0.035488 0.91 sherpa21 +344429 0.638374 0.91 sherpa21 +344431 1.313295 0.91 sherpa21 +344430 0.072535 0.91 sherpa21 + +# Triboson Sherpa 2.1 systematics samples +### warning: dummy cross-sections!! +361643 0 0 sherpa21 +361644 0 0 sherpa21 +361645 0 0 sherpa21 +361646 0 0 sherpa21 +361647 0 0 sherpa21 +361648 0 0 sherpa21 +361649 0 0 sherpa21 +361650 0 0 sherpa21 +361651 0 0 sherpa21 +361652 0 0 sherpa21 +361653 0 0 sherpa21 +361654 0 0 sherpa21 +361655 0 0 sherpa21 +361656 0 0 sherpa21 +361657 0 0 sherpa21 +361658 0 0 sherpa21 +361659 0 0 sherpa21 +361660 0 0 sherpa21 +361661 0 0 sherpa21 +361662 0 0 sherpa21 +361663 0 0 sherpa21 + +################################################################################################################ +# Sherpa 2.2.1 diboson +363355 15.564 0.27976 sherpa +363356 15.563 0.13961 sherpa +363357 6.7973 1.0 sherpa +363358 3.437 1.0 sherpa +363359 24.717 1.0 sherpa +363360 112.74 1.0 sherpa +363489 11.413 1.0 sherpa +363490 1.2557 1.0 sherpa +363491 4.5877 1.0 sherpa +363492 12.465 1.0 sherpa +363493 3.2274 1.0 sherpa +363494 0.60154 1.0 sherpa + + +################################################################################################################ +# Powheg+Herwig++ diboson +### warning: dummy cross-sections!! +361591 0 0 herwigpp +361592 0 0 herwigpp +361593 0 0 herwigpp +361594 0 0 herwigpp +361595 0 0 herwigpp +361596 0 0 herwigpp +361597 0 0 herwigpp + +################################################################################################################ +# MCatNLO VV +361535 1.2197 1.0 herwig +361536 1.2246 1.0 herwig +361537 1.2247 1.0 herwig +361538 1.2247 1.0 herwig +361539 1.2246 1.0 herwig +361540 1.2248 1.0 herwig +361541 1.2247 1.0 herwig +361542 1.2247 1.0 herwig +361543 1.2246 1.0 herwig +361544 1.3342 1.0 herwig +361545 1.3343 1.0 herwig +361546 1.3342 1.0 herwig +361547 1.3344 1.0 herwig +361548 1.3343 1.0 herwig +361549 1.3376 1.0 herwig +361550 1.3344 1.0 herwig +361551 1.3343 1.0 herwig +361552 1.3345 1.0 herwig +361553 0.099781 1.0 herwig +361554 0.061584 1.0 herwig +361555 0.099782 1.0 herwig +361556 0.061579 1.0 herwig +361557 0.099777 1.0 herwig +361558 0.061585 1.0 herwig +361559 0.099774 1.0 herwig +361560 0.061578 1.0 herwig +361561 0.099785 1.0 herwig +361562 0.06158 1.0 herwig +361563 0.099782 1.0 herwig +361564 0.061581 1.0 herwig +361565 0.099785 1.0 herwig +361566 0.061571 1.0 herwig +361567 0.099762 1.0 herwig +361568 0.061574 1.0 herwig +361569 0.09978 1.0 herwig +361570 0.061556 1.0 herwig +361571 0.15771 1.0 herwig +361572 0.088393 1.0 herwig +361573 0.15772 1.0 herwig +361574 0.088398 1.0 herwig +361575 0.15771 1.0 herwig +361576 0.088292 1.0 herwig +361577 0.15772 1.0 herwig +361578 0.08836 1.0 herwig +361579 0.15771 1.0 herwig +361580 0.088398 1.0 herwig +361581 0.15771 1.0 herwig +361582 0.088391 1.0 herwig +361583 0.15771 1.0 herwig +361584 0.088397 1.0 herwig +361585 0.15773 1.0 herwig +361586 0.088397 1.0 herwig +361587 0.15771 1.0 herwig +361588 0.088391 1.0 herwig + + + +################################################################################################################ 0 +# Powheg+Pythia8 Diboson (mc12_13TeV) + +187150 1.1792 1.0 pythia8 +187151 1.1790 1.0 pythia8 +187152 1.1790 1.0 pythia8 +187153 1.1790 1.0 pythia8 +187154 1.1792 1.0 pythia8 +187155 1.1790 1.0 pythia8 +187156 1.1790 1.0 pythia8 +187157 1.1790 1.0 pythia8 +187158 1.1792 1.0 pythia8 +187159 1.1792 1.0 pythia8 +187160 0.4817 1.0 pythia8 +187161 0.3982 1.0 pythia8 +187162 0.0349 1.0 pythia8 +187163 0.5068 1.0 pythia8 +187164 0.3933 1.0 pythia8 +187165 0.0350 1.0 pythia8 +187166 0.2595 1.0 pythia8 +187167 0.2164 1.0 pythia8 +187168 0.0126 1.0 pythia8 + +187170 0.6393 1.0 pythia8 +187171 0.5078 1.0 pythia8 +187172 0.0513 1.0 pythia8 +187173 0.6454 1.0 pythia8 +187174 0.5200 1.0 pythia8 +187175 0.0511 1.0 pythia8 +187176 0.3268 1.0 pythia8 +187177 0.2713 1.0 pythia8 +187178 0.0186 1.0 pythia8 + +187180 0.1217 1.0 pythia8 +187181 0.2514 1.0 pythia8 +187182 0.1804 1.0 pythia8 +187183 0.1222 1.0 pythia8 +187184 0.1823 1.0 pythia8 +187185 0.0150 1.0 pythia8 +187186 0.1032 1.0 pythia8 +187187 0.1032 1.0 pythia8 +187188 0.1032 1.0 pythia8 + + +################################################################################################################ 0 +# Sherpa gamma+jet + +361039 34988 0.41028 sherpa21 +361040 34986 0.48609 sherpa21 +361041 35002 0.10752 sherpa21 +361042 3129 0.39960 sherpa21 +361043 3132.9 0.48199 sherpa21 +361044 3135.2 0.11728 sherpa21 +361045 247.41 0.41049 sherpa21 +361046 247.39 0.50284 sherpa21 +361047 249.37 0.12874 sherpa21 +361048 13.648 0.41834 sherpa21 +361049 13.617 0.47349 sherpa21 +361050 13.874 0.14069 sherpa21 +361051 0.92334 0.38226 sherpa21 +361052 0.92185 0.47148 sherpa21 +361053 0.93819 0.14811 sherpa21 +361054 0.018432 0.37036 sherpa21 +361055 0.018388 0.46691 sherpa21 +361056 0.019046 0.15751 sherpa21 +361057 7.9163e-05 0.38030 sherpa21 +361058 8.0515e-05 0.45148 sherpa21 +361059 8.2153e-05 0.16549 sherpa21 +361060 2.4843e-09 0.40351 sherpa21 +361061 2.5134e-09 0.41614 sherpa21 +361062 2.5431e-09 0.14831 sherpa21 + +################################################################################################################ 0 +# Pythia8 dijet + +361000 76508904600 1. pythia8 +361001 1946305980 1. pythia8 +361002 24431336 1. pythia8 +361003 312104 1. pythia8 +361004 3422.36 1. pythia8 +361005 66.3778 1. pythia8 +361006 2.57984 1. pythia8 +361007 0.1803 1. pythia8 +361008 0.00645739 1. pythia8 +361009 0.00023784 1. pythia8 +361010 7.04754e-06 1. pythia8 +361011 1.13058e-07 1. pythia8 +361012 4.40618e-10 1. pythia8 + +361020 80302080000 1. pythia8 +361021 5.26967e+07 1. pythia8 +361022 809380 1. pythia8 +361023 8452.85 1. pythia8 +361024 134.977 1. pythia8 +361025 4.20402 1. pythia8 +361026 0.242119 1. pythia8 +361027 0.00636958 1. pythia8 +361028 0.00635145 1. pythia8 +361029 0.000236729 1. pythia8 +361030 7.0498e-06 1. pythia8 +361031 1.1416e-07 1. pythia8 +361032 4.40618e-10 1. pythia8 + +################################################################################################################ 0 +# PowhegPythia8 dijet + +426001 1473849828 1. pythia8 +426002 1.97235e+07 1. pythia8 +426003 286031 1. pythia8 +426004 3238.71 1. pythia8 +426005 62.3029 1. pythia8 +426006 2.30961 1. pythia8 +426007 0.176181 1. pythia8 +426008 0.00643204 1. pythia8 +426009 0.000248606 1. pythia8 + +################################################################################################################ 0 +# Powheg+Herwig dijet +### warning: dummy cross-sections!! +426101 0 0 herwigpp +426102 0 0 herwigpp +426103 0 0 herwigpp +426104 0 0 herwigpp +426105 0 0 herwigpp +426106 0 0 herwigpp +426107 0 0 herwigpp +426108 0 0 herwigpp +426109 0 0 herwigpp + +################################################################################################################ 0 +# Sherpa dijet +### warning: dummy cross-sections!! +426131 0 0 sherpa21 +426132 0 0 sherpa21 +426133 0 0 sherpa21 +426134 0 0 sherpa21 +426135 0 0 sherpa21 +426136 0 0 sherpa21 +426137 0 0 sherpa21 +426138 0 0 sherpa21 +426139 0 0 sherpa21 +426140 0 0 sherpa21 +426141 0 0 sherpa21 +426142 0 0 sherpa21 + +################################################################################################################ 0 +## ttH samples aMCatNLOHerwig++ - YR4 values +# ttH H -> gamgam, all ttbar decays +# putting same cross-section as aMCatNLOPythia8 (see below) +341081 0.0010405 1.0 herwigpp +# ttH H->all, different ttbar decays +341177 0.05343 1.0 herwigpp +341270 0.22276 1.0 herwigpp +341271 0.23082 1.0 herwigpp +# ttH inclusive sample +342299 0.5071 1.0 herwigpp +## ttH samples aMCatNLOPythia8 - YR4 values +# ttH H->all, different ttbar decays +343365 0.05343 1.0 pythia8 +343366 0.22276 1.0 pythia8 +343367 0.23082 1.0 pythia8 +# ttH H -> gamgam - see ANALYSISTO-136, ANALYSISTO-276 +343436 0.0010405 1.0 pythia8 +# ttH H -> 4l - see ANALYSISTO-298 +342561 0.000060137 1.0 herwigpp + +################################################################################################################ 0 +## single-top + Higgs samples +## cross-sections taken from https://twiki.cern.ch/twiki/bin/view/AtlasProtected/HtopMC13TeV +## tHjb samples MadGraphHerwig++ +341988 0.00166896 1.0 herwigpp +341989 0.00012335 1.0 herwigpp +341990 0.00061218 1.0 herwigpp +341991 0.422364 1.0 herwigpp +341992 0.031216 1.0 herwigpp +341993 0.15492 1.0 herwigpp +341994 0.222967 1.0 herwigpp +341995 0.016479 1.0 herwigpp +341996 0.081785 1.0 herwigpp +## tHjb samples MadGraphPythia8 +343267 0.00012335 1.0 pythia8 +343270 0.031216 1.0 pythia8 +343273 0.016479 1.0 pythia8 +## tWH samples aMCatNLOHerwig++ +341997 0.000243 1.0 herwigpp +341998 0.000057 1.0 herwigpp +341999 0.000221 1.0 herwigpp +342000 0.086781 1.0 herwigpp +342001 0.007615 1.0 herwigpp +342002 0.055969 1.0 herwigpp +342003 0.045812 1.0 herwigpp +342004 0.014425 1.0 herwigpp +342005 0.029546 1.0 herwigpp +## some other tH samples added by TTP - values to be confirmed by experts!!! +343266 0.00166896 1.0 pythia8 +343268 0.00061218 1.0 pythia8 +343269 0.422364 1.0 pythia8 +343271 0.15492 1.0 pythia8 +343272 0.222967 1.0 pythia8 +343274 0.081785 1.0 pythia8 + +# VBH and ggH - including filter efficiency, see ANALYSISTO-276 +341488 0.001031 1.0 pythia8 +341471 0.0081266 1.0 pythia8 +# HIGGS PowhegPythia (inc. Higgs decays) - see ANALYSISTO-282 +342282 30.198 1.4544 pythia8 +342283 3.828 0.9781 pythia8 +342284 1.1021 1.2522 pythia8 +342285 0.60072 1.4476 pythia8 +# FIXME bbH samples - cross-sections unknown +342286 0 0 pythia8 +342287 0 0 pythia8 + + +# other Higgs - see ANALYSISTO-136 +344133 0.025226 1 herwigpp +344134 0.025226 1 herwigpp + + +################################################################################################################ 0 +# charmonium+Z Pythia8B +### warning: dummy cross-sections!! +304697 0 0 pythia8 +304698 0 0 pythia8 +304699 0 0 pythia8 +304700 0 0 pythia8 +304701 0 0 pythia8 +304702 0 0 pythia8 +304703 0 0 pythia8 +304704 0 0 pythia8 + +################################################################################################################ 0 + +# W'->tb right-handed, leptonic +302713 37.052 1.39 pythia8 +302714 8.9483 1.42 pythia8 +302715 2.9332 1.45 pythia8 +302716 1.1945 1.42 pythia8 +302717 0.52897 1.43 pythia8 +302718 0.25534 1.44 pythia8 +302719 0.13355 1.41 pythia8 +302720 0.071687 1.40 pythia8 +302721 0.040492 1.36 pythia8 +302722 0.023185 1.33 pythia8 +302723 0.013754 1.28 pythia8 + +# W'->tb right-handed, leptonic, extended g'/g range +308088 0.069908000 1.32 pythia8 +308089 0.2015000 1.35 pythia8 +308090 0.42514000 1.37 pythia8 +308091 0.11119000 1.34 pythia8 + +# W'->tb left-handed + STs, leptonic +302724 26.661 1.388 pythia8 +302725 7.8852 1.421 pythia8 +302726 4.0102 1.460 pythia8 +302727 2.8584 1.483 pythia8 +302728 2.4813 1.494 pythia8 +302729 2.3465 1.498 pythia8 +302730 2.295 1.500 pythia8 + +# W'->tb left-handed, leptonic +302731 0.10205 1.40 pythia8 +302732 0.031279 1.36 pythia8 +302733 0.010681 1.29 pythia8 + +# W'->tb right-handed, full-had +302734 1.0596 1.49 pythia8 +302735 0.081045 1.41 pythia8 +302736 0.01011 1.25 pythia8 + +# W'->tb left-handed, full-had +302737 0.80064 1.50 pythia8 +302738 0.062575 1.42 pythia8 +302739 0.0080124 1.26 pythia8 + + +# W'->tb right-handed, leptonic, extended mass range +306123 0.0050524000 1.20 pythia8 +306124 0.0019843000 1.13 pythia8 +306125 0.00083375000 1.07 pythia8 +306126 0.00038097000 1.06 pythia8 + +# W'->tb left-handed, leptonic, extended mass range +306127 0.05516000 1.39 pythia8 +306128 0.018058000 1.32 pythia8 +306129 0.0040047000 1.21 pythia8 +306130 0.0016142000 1.14 pythia8 +306131 0.00070274000 1.10 pythia8 +306132 0.00033373000 1.10 pythia8 + + +# Monotop +302740 2.3654 1.0 pythia8 +302741 0.55645 1.0 pythia8 +302742 0.17367 1.0 pythia8 +302743 0.065191 1.0 pythia8 +302744 0.027735 1.0 pythia8 +302745 0.012895 1.0 pythia8 +302746 0.0063956 1.0 pythia8 +302747 0.0033304 1.0 pythia8 +302748 0.0018022 1.0 pythia8 +302749 14.429 1.0 pythia8 +302750 0.17878 1.0 pythia8 +302751 0.012609 1.0 pythia8 +302752 52.774 1.0 pythia8 +302753 0.76989 1.0 pythia8 +302754 0.066446 1.0 pythia8 +302755 147.25 1.0 pythia8 +302756 2.9285 1.0 pythia8 +302757 0.34373 1.0 pythia8 +302758 2.1909 1.0 pythia8 +302759 197.58 1.0 pythia8 +302760 777.29 1.0 pythia8 +302761 245.13 1.0 pythia8 +302762 130.6 1.0 pythia8 +302763 82.934 1.0 pythia8 +302764 41.318 1.0 pythia8 +302765 23.405 1.0 pythia8 +302766 14.19 1.0 pythia8 +302767 9.0838 1.0 pythia8 +302768 2.1468 1.0 pythia8 +302769 0.54548 1.0 pythia8 +302770 0.17974 1.0 pythia8 +302771 0.069379 1.0 pythia8 +302772 0.029753 1.0 pythia8 +302773 0.013731 1.0 pythia8 +302774 0.0066796 1.0 pythia8 +302775 0.0033791 1.0 pythia8 +302776 0.0017625 1.0 pythia8 + +# Same-sign top (DM) samples +308073 1.3042 1.0 pythia8 +308074 0.38954 1.0 pythia8 +308075 0.15696 1.0 pythia8 +308076 0.075108 1.0 pythia8 +308077 0.040244 1.0 pythia8 +308078 0.084606 1.0 pythia8 +308079 0.022072 1.0 pythia8 +308080 0.0080612 1.0 pythia8 +308081 0.0035796 1.0 pythia8 +308082 0.001815 1.0 pythia8 +308083 0.114 1.0 pythia8 +308084 0.01902 1.0 pythia8 +308085 0.0044234 1.0 pythia8 +308086 0.0012704 1.0 pythia8 +308087 0.0004306 1.0 pythia8 + + +################################################################################################################ 0 + +## TTS samples: taken from https://cds.cern.ch/record/1662536/files/ATL-COM-PHYS-2014-112.pdf? +302468 3.38 1.0 pythia8 +302469 1.16 1.0 pythia8 +302470 0.455 1.0 pythia8 +302471 0.295 1.0 pythia8 +302472 0.195 1.0 pythia8 +302473 0.132 1.0 pythia8 +302474 0.0900 1.0 pythia8 +302475 0.0624 1.0 pythia8 +302476 0.0438 1.0 pythia8 +302477 0.0311 1.0 pythia8 +302478 0.0223 1.0 pythia8 +302479 0.0161 1.0 pythia8 +302480 0.0117 1.0 pythia8 +302481 0.00634 1.0 pythia8 +302482 0.00350 1.0 pythia8 +#TTD +302483 0.455 1 pythia8 +302484 0.0624 1 pythia8 +302485 0.0117 1 pythia8 + +################################################################################################################ 0 + +## BBS samples: taken from https://cds.cern.ch/record/1662536/files/ATL-COM-PHYS-2014-112.pdf? +302486 3.38 1.0 pythia8 +302487 1.16 1.0 pythia8 +302488 0.455 1.0 pythia8 +302489 0.295 1.0 pythia8 +302490 0.195 1.0 pythia8 +302491 0.132 1.0 pythia8 +302492 0.0900 1.0 pythia8 +302493 0.0624 1.0 pythia8 +302494 0.0438 1.0 pythia8 +302495 0.0311 1.0 pythia8 +302496 0.0223 1.0 pythia8 +302497 0.0161 1.0 pythia8 +302498 0.0117 1.0 pythia8 +302499 0.00634 1.0 pythia8 +302500 0.00350 1.0 pythia8 +#BBD +302501 0.455 1 pythia8 +302502 0.0624 1 pythia8 +302503 0.0117 1 pythia8 + + +################################################################################################################ 0 + +## XX,YY samples: taken from https://cds.cern.ch/record/1662536/files/ATL-COM-PHYS-2014-112.pdf? +302504 3.38 1.0 pythia8 +302505 0.455 1.0 pythia8 +302506 0.195 1.0 pythia8 +302507 0.0900 1.0 pythia8 +302508 0.0438 1.0 pythia8 +302509 0.0223 1.0 pythia8 +302510 0.0117 1.0 pythia8 +302511 0.00350 1.0 pythia8 +302512 3.38 1.0 pythia8 +302513 0.455 1.0 pythia8 +302514 0.195 1.0 pythia8 +302515 0.0900 1.0 pythia8 +302516 0.0438 1.0 pythia8 +302517 0.0223 1.0 pythia8 +302518 0.0117 1.0 pythia8 +302519 0.00350 1.0 pythia8 + +# VLQ single X production: +303346 0.02569 1.0 pythia8 +303347 0.006584 1.0 pythia8 +303348 0.002773 1.0 pythia8 + +# more VLQ single production +304747 0.0046041 1.0 pythia8 +304748 0.0044239 1.0 pythia8 +304752 0.00040346 1.0 pythia8 +304753 0.00039333 1.0 pythia8 +306984 0.22063 1.0 pythia8 +306985 0.15591 1.0 pythia8 +306987 0.11118 1.0 pythia8 +306989 0.080249 1.0 pythia8 +306990 0.058438 1.0 pythia8 +306991 0.042992 1.0 pythia8 +306994 0.023735 1.0 pythia8 +306997 0.013472 1.0 pythia8 +306998 0.036963 1.0 pythia8 +306999 0.0077947 1.0 pythia8 +307025 0.0026464 1.0 pythia8 +307033 0.049618 1.0 pythia8 +307035 0.010304 1.0 pythia8 +307074 0.17512 1.0 pythia8 +307075 0.11724 1.0 pythia8 +307076 0.08051 1.0 pythia8 +307078 0.056416 1.0 pythia8 +307079 0.040165 1.0 pythia8 +307081 0.028902 1.0 pythia8 +307084 0.015486 1.0 pythia8 +307087 0.0085394 1.0 pythia8 +307089 0.0048202 1.0 pythia8 +307034 0.013674 1.0 pythia8 +307036 0.007807 1.0 pythia8 +307037 0.005929 1.0 pythia8 + +# FIXME more VLQ single production, cross-sections unknown +304737 0 0 pythia8 +304738 0 0 pythia8 +304741 0 0 pythia8 +304742 0 0 pythia8 + +# ttH(->tautau) +342170 0.0536 0.0632 herwigpp +342171 0.2234 0.0632 herwigpp +342172 0.2315 0.0632 herwigpp + +# Triboson +342099 1.0 0.0069746 pythia8 +342100 1.0 0.0040562 pythia8 +361620 1.0 0.008343 pythia8 +361621 1.0 0.001734 pythia8 +361622 1.0 0.0034299 pythia8 +361623 1.0 0.00021783 pythia8 +361624 1.0 0.000855458 pythia8 +361625 1.0 1.7059e-05 pythia8 +361626 1.0 9.9467e-05 pythia8 +361627 1.0 0.000199561 pythia8 +407022 1.0 0.0055474 pythia8 +407023 1.0 0.0056072 pythia8 +407024 1.0 0.0056491 pythia8 +407025 1.0 0.0018851 pythia8 +407026 1.0 0.0019001 pythia8 +407027 1.0 0.0018949 pythia8 +407028 1.0 0.0027702 pythia8 + +# ttbar ttbar (contact interaction model) +302777 1.0 0.928 pythia8 + +# ttbar ttbar (2UED-RPP model) +302055 1 0.332 pythia8 +302056 1 0.075 pythia8 +302057 1 0.018 pythia8 +302058 1 0.0045 pythia8 +302059 1 0.0011 pythia8 + +# Graviton to ttbar +305012 7.19 1 pythia8 #400 +305013 5.84 1 pythia8 #500 +305014 1.18 1 pythia8 #750 +305015 0.289 1 pythia8 #1000 +305016 0.00498 1 pythia8 #2000 +305017 0.000248 1 pythia8 #3000 + +#Zprime to ttbar +301322 70.27642 1.3 pythia8 # 400GeV +301323 40.12527 1.3 pythia8 # 500GeV +305786 22.784855 1.3 pythia8 # 600GeV +301324 10.70255 1.3 pythia8 # 750GeV +305787 6.8217996 1.3 pythia8 # 800GeV +301325 3.699002 1.3 pythia8 #1000GeV +301326 1.508068 1.3 pythia8 +301327 0.684452 1.3 pythia8 +301328 0.334388 1.3 pythia8 +301329 0.172299 1.3 pythia8 +301330 0.092374 1.3 pythia8 +301331 0.051054 1.3 pythia8 +301332 0.028902 1.3 pythia8 +301333 0.016681 1.3 pythia8 +301334 0.0021272 1.3 pythia8 +301335 0.00033079 1.3 pythia8 + +#KK gluon to ttbar +307522 1187 1 pythia8 +307523 157.6 1 pythia8 +307524 25.59 1 pythia8 +307525 4.196 1 pythia8 +307526 5.534 1 pythia8 +307527 6.918 1 pythia8 +307528 2.360 1 pythia8 +307529 9.530e-01 1 pythia8 +307530 4.383e-01 1 pythia8 +307531 1.431e-01 1 pythia8 +307532 9.182e-02 1 pythia8 + +# VVV +301535 52.706 1 sherpa21 +301536 52.708 1 sherpa21 +301890 15.348 1 sherpa21 +301891 1.5282 1 sherpa21 +301892 0.24155 1 sherpa21 +301893 15.272 1 sherpa21 +301894 1.5235 1 sherpa21 +301895 0.24183 1 sherpa21 +301896 15.297 1 sherpa21 +301897 1.529 1 sherpa21 +301898 0.2426 1 sherpa21 +301899 5.242 1 sherpa21 +301900 0.38455 1 sherpa21 +301901 0.047209 1 sherpa21 +301902 5.2455 1 sherpa21 +301903 0.38548 1 sherpa21 +301904 0.04724 1 sherpa21 +301905 5.249 1 sherpa21 +301906 0.38482 1 sherpa21 +301907 0.047025 1 sherpa21 +301908 4.0365 1 sherpa21 +301909 0.97151 1 sherpa21 +301910 0.17115 1 sherpa21 + +#Vgamma +301887 200.75 1 sherpa21 +301888 200.91 1 sherpa21 +301889 200.78 1 sherpa21 +304776 52.708 1 sherpa21 +343243 52.691 1 sherpa21 + +# Hplus->tb samples +341541 0.56373 1.0 pythia8 +341542 0.44224 1.0 pythia8 +341543 0.35182 1.0 pythia8 +341544 0.28271 1.0 pythia8 +341545 0.22777 1.0 pythia8 +341546 0.15162 1.0 pythia8 +341547 0.10236 1.0 pythia8 +341548 0.049872 1.0 pythia8 +341549 0.02571 1.0 pythia8 +341550 0.013875 1.0 pythia8 +341551 0.0078605 1.0 pythia8 +341552 0.0045696 1.0 pythia8 +341553 0.0027484 1.0 pythia8 +341554 0.001063 1.0 pythia8 +341555 0.00044365 1.0 pythia8 +341556 0.00019537 1.0 pythia8 +341557 8.9756e-05 1.0 pythia8 +341558 4.2758e-05 1.0 pythia8 + + +# VH, H->2a->4b +341577 0.09426 1.0 pythia8 +341578 0.09426 1.0 pythia8 +341579 0.09426 1.0 pythia8 +341580 0.09426 1.0 pythia8 +341581 0.09426 1.0 pythia8 +341582 0.09426 1.0 pythia8 +341583 0.09426 1.0 pythia8 +341584 0.09426 1.0 pythia8 +341585 0.09426 1.0 pythia8 +341586 0.09426 1.0 pythia8 +341587 0.09426 1.0 pythia8 +341588 0.09426 1.0 pythia8 +341589 0.09426 1.0 pythia8 +341590 0.09426 1.0 pythia8 +341591 0.09426 1.0 pythia8 +341592 0.05983 1.0 pythia8 +341593 0.05983 1.0 pythia8 +341594 0.05983 1.0 pythia8 +341595 0.05983 1.0 pythia8 +341596 0.05983 1.0 pythia8 +341597 0.05983 1.0 pythia8 +341598 0.05983 1.0 pythia8 +341599 0.05983 1.0 pythia8 +341600 0.05983 1.0 pythia8 +341601 0.05983 1.0 pythia8 +341602 0.05983 1.0 pythia8 +341603 0.05983 1.0 pythia8 +341604 0.05983 1.0 pythia8 +341605 0.05983 1.0 pythia8 +341606 0.05983 1.0 pythia8 +341607 0.02982 1.0 pythia8 +341608 0.02982 1.0 pythia8 +341609 0.02982 1.0 pythia8 +341610 0.02982 1.0 pythia8 +341611 0.02982 1.0 pythia8 +341612 0.02982 1.0 pythia8 +341613 0.02982 1.0 pythia8 +341614 0.02982 1.0 pythia8 +341615 0.02982 1.0 pythia8 +341616 0.02982 1.0 pythia8 +341617 0.02982 1.0 pythia8 +341618 0.02982 1.0 pythia8 +341619 0.02982 1.0 pythia8 +341620 0.02982 1.0 pythia8 +341621 0.02982 1.0 pythia8 + + +# ttbar LFV Pythia8 +### warning: dummy cross-sections!! +410221 0 0 pythia8 + +# 4tops ttH Madgraph+Pythia8 +### warning: dummy cross-sections!! +344066 0 0 pythia8 +344067 0 0 pythia8 +344068 0 0 pythia8 +344072 0 0 pythia8 +344073 0 0 pythia8 +344074 0 0 pythia8 +344075 0 0 pythia8 +344076 0 0 pythia8 +344078 0 0 pythia8 +344079 0 0 pythia8 +344080 0 0 pythia8 +344081 0 0 pythia8 + +# 4tops 2HDM Madgraph+Pythia8 +### warning: dummy cross-sections!! +304777 0 0 pythia8 +304778 0 0 pythia8 +304779 0 0 pythia8 +304780 0 0 pythia8 +304781 0 0 pythia8 +304782 0 0 pythia8 +304783 0 0 pythia8 + +### doubly charged Higgs +# HppHmm +344096 0.06458 0.2858 pythia8 +344097 0.01334 0.3031 pythia8 +344098 0.003998 0.3198 pythia8 +344364 0.001466 0.3264 pythia8 +344365 0.000610 0.3362 pythia8 +344366 0.000276 0.3451 pythia8 +# HppmmHmp +344367 0.1090 0.260 pythia8 +344368 0.0231 0.324 pythia8 +344369 0.00687 0.342 pythia8 +344370 0.00252 0.360 pythia8 diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/python/getPDF.py b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/python/getPDF.py new file mode 100755 index 0000000000000000000000000000000000000000..580dc0d9862c281f3986a71f73337e84f9ad47b3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/python/getPDF.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import os + +def getWikiFile(): + WikiFile = "svn+ssh://svn.cern.ch/reps/atlasphys/Physics/Top/Software/Production/TopMC12twiki/status/" + com = "svn co "+WikiFile + print com + os.system(com) + + +def producePDFfile(fileout_name='PDF-MC12-8TeV.data'): + filein = open('status/output/PDFInfo/generators_and_PDFs_info.csv', 'r') + fileout = open(fileout_name, 'w') + + dico = {} + + for line in filein.readlines(): + l = line.split(' ') + DSID = l[0][:-1] + PDF= l[-1][:-1].replace(' ', '') # temparory variable + + #print DSID, PDF + + # format: (PDFid;PDFname) + if PDF[0]!="(" or PDF[-1]!=")" or PDF.find(";")==-1: + + # for the Z', do it by hand + if DSID>="110899" and DSID<="110910": + PDF = "21000" + else: + print "wrong format for",line[:-1] + print "-->",PDF,"====" + print "\n" + continue + + else : # good format + PDF = PDF.replace('(', '').replace(')', '') + PDF = PDF.split(";")[0] + #print DSID, PDF + + if dico.has_key(DSID): + if dico[DSID] != PDF: + print DSID,"already exists" + print "\told:",dico[DSID] + print "\tnew:",PDF + else : + dico[DSID]=PDF + out = DSID+"\t"+PDF + fileout.write(out+"\n") + + for sample in ["110906", "110909"]: + if not dico.has_key(sample): + print "adding missing sample",sample,"by hand" + out = sample+"\t21000" + fileout.write(out+"\n") + + for sample in ["203307", "203308", "203309", "203310", "203311", "203312", "203313", "203314", "203315", "203316", "203317", "203318"]: + if not dico.has_key(sample): + print "adding missing sample",sample,"by hand" + out = sample+"\t10042" + fileout.write(out+"\n") + + filein.close() + fileout.close() + +getWikiFile() +producePDFfile() diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5369d691651856262f1ef83b0be93336640dfec1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt @@ -0,0 +1,105 @@ +# Auto-generated on: 2017-03-08 14:47:33.629640 + +# Declare the name of this package: +atlas_subdir( TopAnalysis None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODCore + xAODRootAccess + xAODEgamma + xAODMuon + xAODJet + xAODMissingET + xAODCutFlow + AsgTools + AthContainers + PATInterfaces + TopCPTools + TopEventSelectionTools + TopConfiguration + TopCorrections + TopEvent + TopParticleLevel + TopPartons + TopObjectSelectionTools + TopSystematicObjectMaker + TopFakes + TopDataPreparation + TopHLUpgrade ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopAnalysis _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopAnalysis Root/*.cxx Root/*.h Root/*.icc + TopAnalysis/*.h TopAnalysis/*.icc TopAnalysis/*/*.h + TopAnalysis/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopAnalysis + LINK_LIBRARIES xAODCore + xAODRootAccess + xAODEgamma + xAODMuon + xAODJet + xAODMissingET + xAODCutFlow + AsgTools + AthContainers + PATInterfaces + TopCPTools + TopEventSelectionTools + TopConfiguration + TopCorrections + TopEvent + TopParticleLevel + TopPartons + TopObjectSelectionTools + TopSystematicObjectMaker + TopFakes + TopDataPreparation + TopHLUpgrade + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Install user scripts +atlas_install_scripts( scripts/* ) + +# Build the executables of the package: +atlas_add_executable( top-xaod + util/top-xaod.cxx + LINK_LIBRARIES xAODCore + xAODRootAccess + xAODEgamma + xAODMuon + xAODJet + xAODMissingET + xAODCutFlow + AsgTools + AthContainers + PATInterfaces + TopCPTools + TopEventSelectionTools + TopConfiguration + TopCorrections + TopEvent + TopParticleLevel + TopPartons + TopObjectSelectionTools + TopSystematicObjectMaker + TopFakes + TopDataPreparation + TopHLUpgrade + ${ROOT_LIBRARIES} + TopAnalysis ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07f2e141fb421c55a452209bedb0c4757f007d62 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx @@ -0,0 +1,2691 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/EventSaverFlatNtuple.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEventSelectionTools/TreeManager.h" + +#include "AthContainers/AuxTypeRegistry.h" + +#include "TFile.h" +#include <cmath> +#include <iostream> +#include <boost/algorithm/string.hpp> + +#include "TopParticleLevel/ParticleLevelEvent.h" + +#include "TopFakes/TopFakesMMWeightCalculator.h" + +namespace top { + + EventSaverFlatNtuple::EventSaverFlatNtuple() : + asg::AsgTool( "top::EventSaverFlatNtuple" ), + m_config(nullptr), + m_sfRetriever(nullptr), + m_outputFile(nullptr), + m_truthTreeManager(nullptr), + m_particleLevelTreeManager(nullptr), + + m_weight_mc(0.), + m_weight_pileup(0.), + + // cumulative SF + m_weight_leptonSF(0.), + + m_weight_leptonSF_EL_SF_Trigger_UP(0.), + m_weight_leptonSF_EL_SF_Trigger_DOWN(0.), + m_weight_leptonSF_EL_SF_Reco_UP(0.), + m_weight_leptonSF_EL_SF_Reco_DOWN(0.), + m_weight_leptonSF_EL_SF_ID_UP(0.), + m_weight_leptonSF_EL_SF_ID_DOWN(0.), + m_weight_leptonSF_EL_SF_Isol_UP(0.), + m_weight_leptonSF_EL_SF_Isol_DOWN(0.), + + m_weight_leptonSF_MU_SF_Trigger_STAT_UP(0.), + m_weight_leptonSF_MU_SF_Trigger_STAT_DOWN(0.), + m_weight_leptonSF_MU_SF_Trigger_SYST_UP(0.), + m_weight_leptonSF_MU_SF_Trigger_SYST_DOWN(0.), + // Muon ID SF systematics (regular) + m_weight_leptonSF_MU_SF_ID_STAT_UP(0.), + m_weight_leptonSF_MU_SF_ID_STAT_DOWN(0.), + m_weight_leptonSF_MU_SF_ID_SYST_UP(0.), + m_weight_leptonSF_MU_SF_ID_SYST_DOWN(0.), + // Muon ID SF systematics (low pt) + m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_UP(0.), + m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_DOWN(0.), + m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP(0.), + m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_DOWN(0.), + // Muon isolation SF systematics + m_weight_leptonSF_MU_SF_Isol_STAT_UP(0.), + m_weight_leptonSF_MU_SF_Isol_STAT_DOWN(0.), + m_weight_leptonSF_MU_SF_Isol_SYST_UP(0.), + m_weight_leptonSF_MU_SF_Isol_SYST_DOWN(0.), + m_weight_leptonSF_MU_SF_TTVA_STAT_UP(0.), + m_weight_leptonSF_MU_SF_TTVA_STAT_DOWN(0.), + m_weight_leptonSF_MU_SF_TTVA_SYST_UP(0.), + m_weight_leptonSF_MU_SF_TTVA_SYST_DOWN(0.), + + // individual components electrons + m_weight_indiv_SF_EL_Trigger(0.), + m_weight_indiv_SF_EL_Trigger_UP(0.), + m_weight_indiv_SF_EL_Trigger_DOWN(0.), + m_weight_indiv_SF_EL_Reco(0.), + m_weight_indiv_SF_EL_Reco_UP(0.), + m_weight_indiv_SF_EL_Reco_DOWN(0.), + m_weight_indiv_SF_EL_ID(0.), + m_weight_indiv_SF_EL_ID_UP(0.), + m_weight_indiv_SF_EL_ID_DOWN(0.), + m_weight_indiv_SF_EL_Isol(0.), + m_weight_indiv_SF_EL_Isol_UP(0.), + m_weight_indiv_SF_EL_Isol_DOWN(0.), + m_weight_indiv_SF_EL_ChargeID(0.), + m_weight_indiv_SF_EL_ChargeID_UP(0.), + m_weight_indiv_SF_EL_ChargeID_DOWN(0.), + m_weight_indiv_SF_EL_ChargeMisID(0.), + m_weight_indiv_SF_EL_ChargeMisID_STAT_UP(0.), + m_weight_indiv_SF_EL_ChargeMisID_STAT_DOWN(0.), + m_weight_indiv_SF_EL_ChargeMisID_SYST_UP(0.), + m_weight_indiv_SF_EL_ChargeMisID_SYST_DOWN(0.), + + m_weight_indiv_SF_MU_Trigger(0.), + m_weight_indiv_SF_MU_Trigger_STAT_UP(0.), + m_weight_indiv_SF_MU_Trigger_STAT_DOWN(0.), + m_weight_indiv_SF_MU_Trigger_SYST_UP(0.), + m_weight_indiv_SF_MU_Trigger_SYST_DOWN(0.), + // Muon ID SF systematics (regular) + m_weight_indiv_SF_MU_ID(0.), + m_weight_indiv_SF_MU_ID_STAT_UP(0.), + m_weight_indiv_SF_MU_ID_STAT_DOWN(0.), + m_weight_indiv_SF_MU_ID_SYST_UP(0.), + m_weight_indiv_SF_MU_ID_SYST_DOWN(0.), + // Muon ID SF systematics (low pt) + m_weight_indiv_SF_MU_ID_STAT_LOWPT_UP(0.), + m_weight_indiv_SF_MU_ID_STAT_LOWPT_DOWN(0.), + m_weight_indiv_SF_MU_ID_SYST_LOWPT_UP(0.), + m_weight_indiv_SF_MU_ID_SYST_LOWPT_DOWN(0.), + // Muon isolation SF systematics + m_weight_indiv_SF_MU_Isol(0.), + m_weight_indiv_SF_MU_Isol_SYST_UP(0.), + m_weight_indiv_SF_MU_Isol_SYST_DOWN(0.), + m_weight_indiv_SF_MU_Isol_STAT_UP(0.), + m_weight_indiv_SF_MU_Isol_STAT_DOWN(0.), + m_weight_indiv_SF_MU_TTVA(0.), + m_weight_indiv_SF_MU_TTVA_SYST_UP(0.), + m_weight_indiv_SF_MU_TTVA_SYST_DOWN(0.), + m_weight_indiv_SF_MU_TTVA_STAT_UP(0.), + m_weight_indiv_SF_MU_TTVA_STAT_DOWN(0.), + + m_fakesMM_weights(), + + m_eventNumber(0), + m_runNumber(0), + m_randomRunNumber(0), + m_mcChannelNumber(0), + + m_mu_original(0.), + m_mu(0.), + + m_backgroundFlags(0), + m_hasBadMuon(0), + m_makeRCJets(false), + m_makeVarRCJets(false), + m_met_met(0.), + m_met_phi(0.) + { + } + + EventSaverFlatNtuple::~EventSaverFlatNtuple() + { + for (std::unordered_map<std::string,int*>::iterator i=m_extraTruthVars_int.begin();i!=m_extraTruthVars_int.end();++i) + delete (*i).second; + + for (std::unordered_map<std::string,float*>::iterator i=m_extraTruthVars_float.begin();i!=m_extraTruthVars_float.end();++i) + delete (*i).second; + } + + std::shared_ptr<top::TopConfig> EventSaverFlatNtuple::topConfig() + { + return m_config; + } + + std::vector<std::shared_ptr<top::TreeManager>> EventSaverFlatNtuple::treeManagers() + { + return m_treeManagers; + } + + std::shared_ptr<top::TreeManager> EventSaverFlatNtuple::truthTreeManager() + { + return m_truthTreeManager; + } + + std::shared_ptr<top::TreeManager> EventSaverFlatNtuple::particleLevelTreeManager() + { + return m_particleLevelTreeManager; + } + + std::shared_ptr<top::ScaleFactorRetriever> EventSaverFlatNtuple::scaleFactorRetriever() + { + return m_sfRetriever; + } + + std::vector<top::TreeManager::BranchFilter> & EventSaverFlatNtuple::branchFilters() + { + return m_branchFilters; + } + + void EventSaverFlatNtuple::initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches) { + m_config = config; + m_outputFile = file; + m_extraBranches = extraBranches; + m_selectionDecisions.resize(m_extraBranches.size()); + + + // fixed-R re-clustering (RC) + if (config->useRCJets() == true){ + m_makeRCJets = true; + m_rc = std::unique_ptr<RCJetMC15> ( new RCJetMC15( "RCJetMC15" ) ); + top::check(m_rc->setProperty( "config" , config ) , "Failed to set config property of RCJetMC15"); + top::check(m_rc->initialize(),"Failed to initialize RCJetMC15"); + } + + // variable-R re-clustering (VarRC) + if (config->useVarRCJets() == true){ + m_makeVarRCJets = true; + m_VarRCjetBranches.clear(); // clear map of branches just in case + m_VarRCjetsubBranches.clear(); + + boost::split(m_VarRCJetRho, config->VarRCJetRho(), boost::is_any_of(",")); + boost::split(m_VarRCJetMassScale, config->VarRCJetMassScale(), boost::is_any_of(",")); + + for (auto& rho : m_VarRCJetRho){ + for (auto& mass_scale : m_VarRCJetMassScale){ + std::replace( rho.begin(), rho.end(), '.', '_'); + std::string name = rho+mass_scale; + m_VarRC[name] = std::unique_ptr<RCJetMC15> ( new RCJetMC15( "VarRCJetMC15_"+name ) ); + top::check(m_VarRC[name]->setProperty( "config" , config ) , "Failed to set config property of VarRCJetMC15"); + top::check(m_VarRC[name]->setProperty( "VarRCjets", true ) , "Failed to set VarRCjets property of VarRCJetMC15"); + top::check(m_VarRC[name]->setProperty( "VarRCjets_rho", rho ) , "Failed to set VarRCjets rho property of VarRCJetMC15"); + top::check(m_VarRC[name]->setProperty( "VarRCjets_mass_scale", mass_scale ) , "Failed to set VarRCjets mass scale property of VarRCJetMC15"); + top::check(m_VarRC[name]->initialize(),"Failed to initialize VarRCJetMC15"); + } // end loop over mass scale parameters (e.g., top mass, w mass, etc.) + } // end loop over mass scale multiplies (e.g., 1.,2.,etc.) + } // end make VarRC jets + + + //make a tree for each systematic + std::string nominalTTreeName("SetMe"),nominalLooseTTreeName("SetMe"); + if (!m_config->doLooseTreeOnly() && !m_config->HLLHC()) { + for (auto treeName : *config->systAllTTreeNames()) { + m_treeManagers.push_back(std::shared_ptr<top::TreeManager>( new top::TreeManager(treeName.second, file , m_config->outputFileSetAutoFlushZero()) ) ); + m_treeManagers.back()->branchFilters() = branchFilters(); + if (treeName.first == m_config->nominalHashValue()) { + nominalTTreeName = treeName.second; + } + } + } + + if (m_config->doLooseEvents()) { + for (auto treeName : *config->systAllTTreeNames()) { + m_treeManagers.push_back(std::shared_ptr<top::TreeManager>( new top::TreeManager(treeName.second+"_Loose", file , m_config->outputFileSetAutoFlushZero()) ) ); + m_treeManagers.back()->branchFilters() = branchFilters(); + if (treeName.first == m_config->nominalHashValue()) { + nominalLooseTTreeName = treeName.second+"_Loose"; + } + } + } + + // Truth tree + if (m_config->isMC()) { + + m_sfRetriever = std::unique_ptr<top::ScaleFactorRetriever> ( new top::ScaleFactorRetriever( m_config ) ); + + m_truthTreeManager = std::shared_ptr<top::TreeManager>( new top::TreeManager( "truth" , file , m_config->outputFileSetAutoFlushZero()) ); + m_truthTreeManager->branchFilters() = branchFilters(); + m_truthTreeManager->makeOutputVariable(m_weight_mc, "weight_mc"); + m_truthTreeManager->makeOutputVariable(m_eventNumber, "eventNumber"); + m_truthTreeManager->makeOutputVariable(m_runNumber, "runNumber"); + m_truthTreeManager->makeOutputVariable(m_mu, "mu"); + m_truthTreeManager->makeOutputVariable(m_weight_pileup, "weight_pileup"); + if (m_config->isMC() && m_config->doPileupReweighting()) m_truthTreeManager->makeOutputVariable(m_randomRunNumber, "randomRunNumber"); + m_truthTreeManager->makeOutputVariable(m_mcChannelNumber, "mcChannelNumber"); + + // Only if you really really want it - this is BIG + if (m_config->useTruthParticles() && m_config->doTruthBlockInfo() ) { + m_truthTreeManager->makeOutputVariable(m_mc_pt, "mc_pt"); + m_truthTreeManager->makeOutputVariable(m_mc_eta, "mc_eta"); + m_truthTreeManager->makeOutputVariable(m_mc_phi, "mc_phi"); + m_truthTreeManager->makeOutputVariable(m_mc_e, "mc_e"); + m_truthTreeManager->makeOutputVariable(m_mc_pdgId, "mc_pdgId"); + } + + // PDF information + if (m_config->doTruthPDFInfo()) { + if (m_config->doTruthPDFInfoInNominalTrees()) {//if PDF info requested to be saved in nominal trees of truth one + for (auto systematicTree : m_treeManagers) {//loop on systematic trees to only get the nominal ones + if (systematicTree->name() == nominalTTreeName || systematicTree->name() == nominalLooseTTreeName) { + systematicTree->makeOutputVariable(m_PDFinfo_X1,"PDFinfo_X1"); + systematicTree->makeOutputVariable(m_PDFinfo_X2,"PDFinfo_X2"); + systematicTree->makeOutputVariable(m_PDFinfo_PDGID1,"PDFinfo_PDGID1"); + systematicTree->makeOutputVariable(m_PDFinfo_PDGID2,"PDFinfo_PDGID2"); + systematicTree->makeOutputVariable(m_PDFinfo_Q,"PDFinfo_Q"); + systematicTree->makeOutputVariable(m_PDFinfo_XF1,"PDFinfo_XF1"); + systematicTree->makeOutputVariable(m_PDFinfo_XF2,"PDFinfo_XF2"); + } + } + } + else { + m_truthTreeManager->makeOutputVariable(m_PDFinfo_X1,"PDFinfo_X1"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_X2,"PDFinfo_X2"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_PDGID1,"PDFinfo_PDGID1"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_PDGID2,"PDFinfo_PDGID2"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_Q,"PDFinfo_Q"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_XF1,"PDFinfo_XF1"); + m_truthTreeManager->makeOutputVariable(m_PDFinfo_XF2,"PDFinfo_XF2"); + } + } + + // MC Generator weights + if (m_config->doMCGeneratorWeights()) { + if (m_config->doMCGeneratorWeightsInNominalTrees()) {//if MCGeneratorWeights requested to be saved in nominal trees of truth one + for (auto systematicTree : m_treeManagers) {//loop on systematic trees to only get the nominal ones + if (systematicTree->name() == nominalTTreeName || systematicTree->name() == nominalLooseTTreeName) { + systematicTree->makeOutputVariable(m_mc_generator_weights,"mc_generator_weights"); + } + } + } + else { + m_truthTreeManager->makeOutputVariable(m_mc_generator_weights,"mc_generator_weights"); + } + } + + if( m_config->saveLHAPDFEvent() ){ + for( const auto& pdfset : m_config->LHAPDFSets() ) + m_PDF_eventWeights[ pdfset ] = std::vector<float>(); + + for( auto& pdf : m_PDF_eventWeights ) { + if (m_config->doLHAPDFInNominalTrees()) {//if PDF weights requested to be saved in nominal trees instead of truth one + for (auto systematicTree : m_treeManagers) {//loop on systematic trees to only get the nominal ones + if (systematicTree->name() == nominalTTreeName || systematicTree->name() == nominalLooseTTreeName) + systematicTree->makeOutputVariable( pdf.second, pdf.first ); + } + } + else { + m_truthTreeManager->makeOutputVariable( pdf.second, pdf.first ); + } + } + } + + } + + //loop over systematics and attach variables + for (auto systematicTree : m_treeManagers) { + + if (m_config->isMC()) { + + systematicTree->makeOutputVariable(m_weight_mc, "weight_mc"); + + //some event weights + systematicTree->makeOutputVariable(m_weight_pileup, "weight_pileup"); + systematicTree->makeOutputVariable(m_weight_leptonSF , "weight_leptonSF"); + + if (m_config->usePhotons()) + systematicTree->makeOutputVariable(m_weight_photonSF, + "weight_photonSF"); + + if (m_config->useTaus()) + systematicTree->makeOutputVariable(m_weight_tauSF, + "weight_tauSF"); + + // nominal b-tagging SFs + for( auto& tagWP : m_config -> bTagWP_available()){ + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + m_weight_bTagSF[tagWP] = 0.; + systematicTree->makeOutputVariable(m_weight_bTagSF[tagWP] , "weight_bTagSF_"+shortBtagWP(tagWP)); + } + if( m_config->useTrackJets() ) { + for( auto& tagWP : m_config -> bTagWP_available_trkJet()) { + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + m_weight_trackjet_bTagSF[tagWP] = 0.; + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF[tagWP] , "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)); + } + } + + systematicTree->makeOutputVariable(m_weight_jvt, "weight_jvt"); + + if (m_config->isSherpa22Vjets()) + systematicTree->makeOutputVariable(m_weight_sherpa_22_vjets, + "weight_sherpa_22_vjets"); + + if (systematicTree->name() == nominalTTreeName || systematicTree->name() == nominalLooseTTreeName) { + + systematicTree->makeOutputVariable(m_weight_pileup_UP , "weight_pileup_UP"); + systematicTree->makeOutputVariable(m_weight_pileup_DOWN , "weight_pileup_DOWN"); + + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Trigger_UP, "weight_leptonSF_EL_SF_Trigger_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Trigger_DOWN, "weight_leptonSF_EL_SF_Trigger_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Reco_UP, "weight_leptonSF_EL_SF_Reco_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Reco_DOWN, "weight_leptonSF_EL_SF_Reco_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_ID_UP, "weight_leptonSF_EL_SF_ID_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_ID_DOWN, "weight_leptonSF_EL_SF_ID_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Isol_UP, "weight_leptonSF_EL_SF_Isol_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_EL_SF_Isol_DOWN, "weight_leptonSF_EL_SF_Isol_DOWN"); + + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Trigger_STAT_UP, "weight_leptonSF_MU_SF_Trigger_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Trigger_STAT_DOWN, "weight_leptonSF_MU_SF_Trigger_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Trigger_SYST_UP, "weight_leptonSF_MU_SF_Trigger_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Trigger_SYST_DOWN, "weight_leptonSF_MU_SF_Trigger_SYST_DOWN"); + // Muon ID SF systematics (regular) + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_STAT_UP, "weight_leptonSF_MU_SF_ID_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_STAT_DOWN, "weight_leptonSF_MU_SF_ID_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_SYST_UP, "weight_leptonSF_MU_SF_ID_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_SYST_DOWN, "weight_leptonSF_MU_SF_ID_SYST_DOWN"); + // Muon ID SF systematics (low pt) + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_UP, "weight_leptonSF_MU_SF_ID_STAT_LOWPT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_DOWN, "weight_leptonSF_MU_SF_ID_STAT_LOWPT_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP, "weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_DOWN, "weight_leptonSF_MU_SF_ID_SYST_LOWPT_DOWN"); + // Muon isolation SF systematics + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Isol_STAT_UP, "weight_leptonSF_MU_SF_Isol_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Isol_STAT_DOWN, "weight_leptonSF_MU_SF_Isol_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Isol_SYST_UP, "weight_leptonSF_MU_SF_Isol_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_Isol_SYST_DOWN, "weight_leptonSF_MU_SF_Isol_SYST_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_TTVA_STAT_UP, "weight_leptonSF_MU_SF_TTVA_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_TTVA_STAT_DOWN, "weight_leptonSF_MU_SF_TTVA_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_TTVA_SYST_UP, "weight_leptonSF_MU_SF_TTVA_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_TTVA_SYST_DOWN, "weight_leptonSF_MU_SF_TTVA_SYST_DOWN"); + + + // write also out the individual components: + + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Trigger, "weight_indiv_SF_EL_Trigger"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Trigger_UP, "weight_indiv_SF_EL_Trigger_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Trigger_DOWN, "weight_indiv_SF_EL_Trigger_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Reco, "weight_indiv_SF_EL_Reco"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Reco_UP, "weight_indiv_SF_EL_Reco_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Reco_DOWN, "weight_indiv_SF_EL_Reco_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ID, "weight_indiv_SF_EL_ID"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ID_UP, "weight_indiv_SF_EL_ID_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ID_DOWN, "weight_indiv_SF_EL_ID_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Isol, "weight_indiv_SF_EL_Isol"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Isol_UP, "weight_indiv_SF_EL_Isol_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_Isol_DOWN, "weight_indiv_SF_EL_Isol_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeID, "weight_indiv_SF_EL_ChargeID"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeID_UP, "weight_indiv_SF_EL_ChargeID_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeID_DOWN, "weight_indiv_SF_EL_ChargeID_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeMisID, "weight_indiv_SF_EL_ChargeMisID"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeMisID_STAT_UP, "weight_indiv_SF_EL_ChargeMisID_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeMisID_STAT_DOWN,"weight_indiv_SF_EL_ChargeMisID_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeMisID_SYST_UP, "weight_indiv_SF_EL_ChargeMisID_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_EL_ChargeMisID_SYST_DOWN,"weight_indiv_SF_EL_ChargeMisID_SYST_DOWN"); + + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Trigger, "weight_indiv_SF_MU_Trigger"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Trigger_STAT_UP, "weight_indiv_SF_MU_Trigger_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Trigger_STAT_DOWN, "weight_indiv_SF_MU_Trigger_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Trigger_SYST_UP, "weight_indiv_SF_MU_Trigger_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Trigger_SYST_DOWN, "weight_indiv_SF_MU_Trigger_SYST_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID, "weight_indiv_SF_MU_ID"); + // Muon ID SF systematics (regular) + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_STAT_UP, "weight_indiv_SF_MU_ID_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_STAT_DOWN, "weight_indiv_SF_MU_ID_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_SYST_UP, "weight_indiv_SF_MU_ID_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_SYST_DOWN, "weight_indiv_SF_MU_ID_SYST_DOWN"); + // Muon ID SF systematics (low pt) + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_STAT_LOWPT_UP, "weight_indiv_SF_MU_ID_STAT_LOWPT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_STAT_LOWPT_DOWN, "weight_indiv_SF_MU_ID_STAT_LOWPT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_SYST_LOWPT_UP, "weight_indiv_SF_MU_ID_SYST_LOWPT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_ID_SYST_LOWPT_DOWN, "weight_indiv_SF_MU_ID_SYST_LOWPT_DOWN"); + // Muon isolation SF systematics + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Isol, "weight_indiv_SF_MU_Isol"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Isol_STAT_UP, "weight_indiv_SF_MU_Isol_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Isol_STAT_DOWN, "weight_indiv_SF_MU_Isol_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Isol_SYST_UP, "weight_indiv_SF_MU_Isol_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_Isol_SYST_DOWN, "weight_indiv_SF_MU_Isol_SYST_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_TTVA, "weight_indiv_SF_MU_TTVA"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_TTVA_STAT_UP, "weight_indiv_SF_MU_TTVA_STAT_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_TTVA_STAT_DOWN, "weight_indiv_SF_MU_TTVA_STAT_DOWN"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_TTVA_SYST_UP, "weight_indiv_SF_MU_TTVA_SYST_UP"); + systematicTree->makeOutputVariable(m_weight_indiv_SF_MU_TTVA_SYST_DOWN, "weight_indiv_SF_MU_TTVA_SYST_DOWN"); + + if (m_config->useTaus()) { + systematicTree->makeOutputVariable(m_weight_tauSF_ELEOLR_UP, + "weight_tauSF_ELEOLR_UP"); + systematicTree->makeOutputVariable(m_weight_tauSF_ELEOLR_DOWN, + "weight_tauSF_ELEOLR_DOWN"); + systematicTree->makeOutputVariable(m_weight_tauSF_JETID_UP, + "weight_tauSF_JETID_UP"); + systematicTree->makeOutputVariable(m_weight_tauSF_JETID_DOWN, + "weight_tauSF_JETID_DOWN"); + systematicTree->makeOutputVariable(m_weight_tauSF_RECO_UP, + "weight_tauSF_RECO_UP"); + systematicTree->makeOutputVariable(m_weight_tauSF_RECO_DOWN, + "weight_tauSF_RECO_DOWN"); + } + + if (m_config->usePhotons()) { + systematicTree->makeOutputVariable(m_weight_photonSF_ID_UP, + "weight_photonSF_ID_UP"); + systematicTree->makeOutputVariable(m_weight_photonSF_ID_DOWN, + "weight_photonSF_ID_DOWN"); + systematicTree->makeOutputVariable(m_weight_photonSF_effIso, + "weight_photonSF_effIso"); + systematicTree->makeOutputVariable(m_weight_photonSF_effLowPtIso_UP, + "weight_photonSF_effLowPtIso_UP"); + systematicTree->makeOutputVariable(m_weight_photonSF_effLowPtIso_DOWN, + "weight_photonSF_effLowPtIso_DOWN"); + systematicTree->makeOutputVariable(m_weight_photonSF_effTrkIso_UP, + "weight_photonSF_effTrkIso_UP"); + systematicTree->makeOutputVariable(m_weight_photonSF_effTrkIso_DOWN, + "weight_photonSF_effTrkIso_DOWN"); + } + + systematicTree->makeOutputVariable(m_weight_jvt_up, "weight_jvt_UP"); + systematicTree->makeOutputVariable(m_weight_jvt_down, "weight_jvt_DOWN"); + + } + + // for b-tagging SFs, can also have systematic-shifted in systematics trees + if (systematicTree->name() == nominalTTreeName || systematicTree->name() == nominalLooseTTreeName || m_config->dumpBtagSystsInSystTrees()) { + // b-tagging SFs: eigenvectors and named systematics + for( auto& tagWP : m_config -> bTagWP_available()) { + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + // up + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_B_up[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_B_up"); + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_C_up[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_C_up"); + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_Light_up[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_Light_up"); + // down + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_B_down[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_B_down"); + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_C_down[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_C_down"); + systematicTree->makeOutputVariable(m_weight_bTagSF_eigen_Light_down[tagWP], "weight_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_Light_down"); + // named systematics + for (auto name : m_config->btagging_namedSysts(tagWP)) { + systematicTree->makeOutputVariable(m_weight_bTagSF_named_up[tagWP][name], "weight_bTagSF_"+shortBtagWP(tagWP)+"_"+betterBtagNamedSyst(name)+"_up" ); + systematicTree->makeOutputVariable(m_weight_bTagSF_named_down[tagWP][name], "weight_bTagSF_"+shortBtagWP(tagWP)+"_"+betterBtagNamedSyst(name)+"_down" ); + } + } + if( m_config->useTrackJets() ) { + for( auto& tagWP : m_config -> bTagWP_available_trkJet()) { + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + // up + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_B_up[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_B_up"); + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_C_up[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_C_up"); + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_Light_up[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_Light_up"); + // down + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_B_down[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_B_down"); + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_C_down[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_C_down"); + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_eigen_Light_down[tagWP], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_eigenvars_Light_down"); + // named systematics + for (auto name : m_config->trkjet_btagging_namedSysts(tagWP)) { + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_named_up[tagWP][name], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_"+betterBtagNamedSyst(name)+"_up" ); + systematicTree->makeOutputVariable(m_weight_trackjet_bTagSF_named_down[tagWP][name], "weight_trackjet_bTagSF_"+shortBtagWP(tagWP)+"_"+betterBtagNamedSyst(name)+"_down" ); + } + } + } + } + } + + ///-- weights for matrix-method fakes estimate --/// + if (!m_config->isMC() && systematicTree->name().find("Loose") != std::string::npos && m_config->doFakesMMWeights()) { + top::TopFakesMMWeightCalculator const* fakesMMWeightCalc(nullptr); + if ( asg::ToolStore::contains<top::TopFakesMMWeightCalculator>("MMWeightCalculator") ) { + fakesMMWeightCalc = asg::ToolStore::get<top::TopFakesMMWeightCalculator>("MMWeightCalculator"); + } + else { + ATH_MSG_ERROR("EventSaverFlatNtuple::initialize" ); + throw std::runtime_error("Unable to retrieve top::TopFakesMMWeightCalculator tool"); + } + for(const auto& branchName : m_extraBranches){//loop on selections + for(const auto& conf : fakesMMWeightCalc->GetFakesMMConfigNames(branchName)) { + std::string MMweight_branch_name = "fakesMM_weight_" + branchName + "_" + conf; + systematicTree->makeOutputVariable(m_fakesMM_weights[branchName][conf], MMweight_branch_name); + } + } + } + + //event info + systematicTree->makeOutputVariable(m_eventNumber, "eventNumber"); + systematicTree->makeOutputVariable(m_runNumber, "runNumber"); + if (m_config->isMC() && m_config->doPileupReweighting()) systematicTree->makeOutputVariable(m_randomRunNumber, "randomRunNumber"); + systematicTree->makeOutputVariable(m_mcChannelNumber, "mcChannelNumber"); + systematicTree->makeOutputVariable(m_mu, "mu"); + if (!m_config->isMC()) { + systematicTree->makeOutputVariable(m_mu_original, "mu_original_xAOD"); + } + systematicTree->makeOutputVariable(m_backgroundFlags, "backgroundFlags"); + if (m_config->useMuons()) + systematicTree->makeOutputVariable(m_hasBadMuon, "hasBadMuon"); + + //electrons + if (m_config->useElectrons()) { + systematicTree->makeOutputVariable(m_el_pt, "el_pt"); + systematicTree->makeOutputVariable(m_el_eta, "el_eta"); + systematicTree->makeOutputVariable(m_el_cl_eta, "el_cl_eta"); + systematicTree->makeOutputVariable(m_el_phi, "el_phi"); + systematicTree->makeOutputVariable(m_el_e, "el_e"); + systematicTree->makeOutputVariable(m_el_charge, "el_charge"); + systematicTree->makeOutputVariable(m_el_topoetcone20, "el_topoetcone20"); + systematicTree->makeOutputVariable(m_el_ptvarcone20, "el_ptvarcone20"); + if (systematicTree->name().find("Loose") != std::string::npos) { + systematicTree->makeOutputVariable(m_el_isTight, "el_isTight"); + } + systematicTree->makeOutputVariable(m_el_CF, "el_CF"); + systematicTree->makeOutputVariable(m_el_d0sig, "el_d0sig"); + systematicTree->makeOutputVariable(m_el_delta_z0_sintheta, "el_delta_z0_sintheta"); + if (m_config->isMC()) { + systematicTree->makeOutputVariable(m_el_true_type, "el_true_type"); + systematicTree->makeOutputVariable(m_el_true_origin, "el_true_origin"); + systematicTree->makeOutputVariable(m_el_true_typebkg, "el_true_typebkg"); + systematicTree->makeOutputVariable(m_el_true_originbkg, "el_true_originbkg"); + } + } + + //muons + if (m_config->useMuons()) { + systematicTree->makeOutputVariable(m_mu_pt, "mu_pt"); + systematicTree->makeOutputVariable(m_mu_eta, "mu_eta"); + systematicTree->makeOutputVariable(m_mu_phi, "mu_phi"); + systematicTree->makeOutputVariable(m_mu_e, "mu_e"); + systematicTree->makeOutputVariable(m_mu_charge, "mu_charge"); + systematicTree->makeOutputVariable(m_mu_topoetcone20, "mu_topoetcone20"); + systematicTree->makeOutputVariable(m_mu_ptvarcone30, "mu_ptvarcone30"); + if (systematicTree->name().find("Loose") != std::string::npos) { + systematicTree->makeOutputVariable(m_mu_isTight, "mu_isTight"); + } + systematicTree->makeOutputVariable(m_mu_d0sig, "mu_d0sig"); + systematicTree->makeOutputVariable(m_mu_delta_z0_sintheta, "mu_delta_z0_sintheta"); + if (m_config->isMC()) { + systematicTree->makeOutputVariable(m_mu_true_type, "mu_true_type"); + systematicTree->makeOutputVariable(m_mu_true_origin, "mu_true_origin"); + } + } + + //photons + if (m_config->usePhotons()) { + systematicTree->makeOutputVariable(m_ph_pt, "ph_pt"); + systematicTree->makeOutputVariable(m_ph_eta, "ph_eta"); + systematicTree->makeOutputVariable(m_ph_phi, "ph_phi"); + systematicTree->makeOutputVariable(m_ph_e, "ph_e"); + systematicTree->makeOutputVariable(m_ph_iso, "ph_iso"); + } + + //taus + if (m_config->useTaus()) { + systematicTree->makeOutputVariable(m_tau_pt, "tau_pt"); + systematicTree->makeOutputVariable(m_tau_eta, "tau_eta"); + systematicTree->makeOutputVariable(m_tau_phi, "tau_phi"); + systematicTree->makeOutputVariable(m_tau_charge, "tau_charge"); + } + + //jets + if (m_config->useJets()) { + systematicTree->makeOutputVariable(m_jet_pt, "jet_pt"); + systematicTree->makeOutputVariable(m_jet_eta, "jet_eta"); + systematicTree->makeOutputVariable(m_jet_phi, "jet_phi"); + systematicTree->makeOutputVariable(m_jet_e, "jet_e"); + systematicTree->makeOutputVariable(m_jet_mv2c00, "jet_mv2c00"); + systematicTree->makeOutputVariable(m_jet_mv2c10, "jet_mv2c10"); + systematicTree->makeOutputVariable(m_jet_mv2c20, "jet_mv2c20"); + systematicTree->makeOutputVariable(m_jet_ip3dsv1, "jet_ip3dsv1"); + systematicTree->makeOutputVariable(m_jet_jvt, "jet_jvt"); + systematicTree->makeOutputVariable(m_jet_passfjvt,"jet_passfjvt"); + if (m_config->isMC()) { + systematicTree->makeOutputVariable(m_jet_truthflav, "jet_truthflav"); + systematicTree->makeOutputVariable(m_jet_truthPartonLabel, "jet_truthPartonLabel"); + systematicTree->makeOutputVariable(m_jet_isTrueHS, "jet_isTrueHS"); + } + for( auto& tagWP : m_config -> bTagWP_available()){ + if (tagWP!= "Continuous") systematicTree->makeOutputVariable(m_jet_isbtagged[tagWP] , "jet_isbtagged_"+shortBtagWP(tagWP)); + else systematicTree->makeOutputVariable(m_jet_tagWeightBin , "jet_tagWeightBin"); + } + } + + //large-R jets + if (m_config->useLargeRJets()) { + systematicTree->makeOutputVariable(m_ljet_pt, "ljet_pt"); + systematicTree->makeOutputVariable(m_ljet_eta, "ljet_eta"); + systematicTree->makeOutputVariable(m_ljet_phi, "ljet_phi"); + systematicTree->makeOutputVariable(m_ljet_e, "ljet_e"); + systematicTree->makeOutputVariable(m_ljet_m, "ljet_m"); + systematicTree->makeOutputVariable(m_ljet_sd12, "ljet_sd12"); + } + + //track jets + if (m_config->useTrackJets()) { + systematicTree->makeOutputVariable(m_tjet_pt, "tjet_pt"); + systematicTree->makeOutputVariable(m_tjet_eta, "tjet_eta"); + systematicTree->makeOutputVariable(m_tjet_phi, "tjet_phi"); + systematicTree->makeOutputVariable(m_tjet_e, "tjet_e"); + systematicTree->makeOutputVariable(m_tjet_mv2c00, "tjet_mv2c00"); + systematicTree->makeOutputVariable(m_tjet_mv2c10, "tjet_mv2c10"); + systematicTree->makeOutputVariable(m_tjet_mv2c20, "tjet_mv2c20"); + for( auto& tagWP : m_config -> bTagWP_available_trkJet()){ + if (tagWP!= "Continuous") systematicTree->makeOutputVariable(m_tjet_isbtagged[tagWP] , "tjet_isbtagged_"+shortBtagWP(tagWP)); + else systematicTree->makeOutputVariable(m_tjet_tagWeightBin , "tjet_tagWeightBin"); + } + } + + // RC branches + if (m_makeRCJets){ + systematicTree->makeOutputVariable(m_rcjet_pt, "rcjet_pt"); + systematicTree->makeOutputVariable(m_rcjet_eta, "rcjet_eta"); + systematicTree->makeOutputVariable(m_rcjet_phi, "rcjet_phi"); + systematicTree->makeOutputVariable(m_rcjet_e, "rcjet_e"); + systematicTree->makeOutputVariable(m_rcjet_d12, "rcjet_d12"); // requires >= 2 subjets + systematicTree->makeOutputVariable(m_rcjet_d23, "rcjet_d23"); // requires >= 3 subjets + systematicTree->makeOutputVariable(m_rcjetsub_pt, "rcjetsub_pt"); // vector of vectors for subjet info + systematicTree->makeOutputVariable(m_rcjetsub_eta, "rcjetsub_eta"); + systematicTree->makeOutputVariable(m_rcjetsub_phi, "rcjetsub_phi"); + systematicTree->makeOutputVariable(m_rcjetsub_e, "rcjetsub_e"); + systematicTree->makeOutputVariable(m_rcjetsub_mv2c10, "rcjetsub_mv2c10"); + } + + // vRC branches + if (m_makeVarRCJets){ + std::string VarRC = "vrcjet"; + + for (auto& rho : m_VarRCJetRho){ + for (auto& mass_scale : m_VarRCJetMassScale){ + std::replace( rho.begin(), rho.end(), '.', '_'); + std::string name = rho+mass_scale; + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_pt"], VarRC+"_"+name+"_pt"); + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_eta"],VarRC+"_"+name+"_eta"); + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_phi"],VarRC+"_"+name+"_phi"); + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_e"], VarRC+"_"+name+"_e"); + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_d12"],VarRC+"_"+name+"_d12"); // requires >= 2 subjets + systematicTree->makeOutputVariable(m_VarRCjetBranches[VarRC+"_"+name+"_d23"],VarRC+"_"+name+"_d23"); // requires >= 3 subjets + systematicTree->makeOutputVariable(m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_pt"], VarRC+"sub_"+name+"_pt"); // vector of vectors for subjet info + systematicTree->makeOutputVariable(m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_eta"], VarRC+"sub_"+name+"_eta"); + systematicTree->makeOutputVariable(m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_phi"], VarRC+"sub_"+name+"_phi"); + systematicTree->makeOutputVariable(m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_e"], VarRC+"sub_"+name+"_e"); + systematicTree->makeOutputVariable(m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_mv2c10"], VarRC+"sub_"+name+"_mv2c10"); + } // end loop over mass parameters + } // end loop over multipliers for mass scale + } // end if VarRC jets + + //met + systematicTree->makeOutputVariable(m_met_met, "met_met"); + systematicTree->makeOutputVariable(m_met_phi, "met_phi"); + + if (m_config->doKLFitter()) { + systematicTree->makeOutputVariable(m_klfitter_selected,"klfitter_selected"); + systematicTree->makeOutputVariable(m_klfitter_minuitDidNotConverge,"klfitter_minuitDidNotConverge"); + systematicTree->makeOutputVariable(m_klfitter_fitAbortedDueToNaN,"klfitter_fitAbortedDueToNaN"); + systematicTree->makeOutputVariable(m_klfitter_atLeastOneFitParameterAtItsLimit,"klfitter_atLeastOneFitParameterAtItsLimit"); + systematicTree->makeOutputVariable(m_klfitter_invalidTransferFunctionAtConvergence,"klfitter_invalidTransferFunctionAtConvergence"); + + /// Global result + systematicTree->makeOutputVariable(m_klfitter_bestPermutation,"klfitter_bestPermutation"); + systematicTree->makeOutputVariable(m_klfitter_logLikelihood,"klfitter_logLikelihood"); + systematicTree->makeOutputVariable(m_klfitter_eventProbability,"klfitter_eventProbability"); + systematicTree->makeOutputVariable(m_klfitter_parameters,"klfitter_parameters"); + systematicTree->makeOutputVariable(m_klfitter_parameterErrors,"klfitter_parameterErrors"); + + /// Model + 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"); + systematicTree->makeOutputVariable(m_klfitter_model_bhad_E,"klfitter_model_bhad_E"); + systematicTree->makeOutputVariable(m_klfitter_model_bhad_jetIndex,"klfitter_model_bhad_jetIndex"); + + systematicTree->makeOutputVariable(m_klfitter_model_blep_pt,"klfitter_model_blep_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_blep_eta,"klfitter_model_blep_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_blep_phi,"klfitter_model_blep_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_blep_E,"klfitter_model_blep_E"); + systematicTree->makeOutputVariable(m_klfitter_model_blep_jetIndex,"klfitter_model_blep_jetIndex"); + + systematicTree->makeOutputVariable(m_klfitter_model_lq1_pt,"klfitter_model_lq1_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_lq1_eta,"klfitter_model_lq1_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_lq1_phi,"klfitter_model_lq1_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_lq1_E,"klfitter_model_lq1_E"); + systematicTree->makeOutputVariable(m_klfitter_model_lq1_jetIndex,"klfitter_model_lq1_jetIndex"); + + systematicTree->makeOutputVariable(m_klfitter_model_lq2_pt,"klfitter_model_lq2_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_lq2_eta,"klfitter_model_lq2_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_lq2_phi,"klfitter_model_lq2_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_lq2_E,"klfitter_model_lq2_E"); + systematicTree->makeOutputVariable(m_klfitter_model_lq2_jetIndex,"klfitter_model_lq2_jetIndex"); + + if(m_config->KLFitterLH() == "ttH"){ + + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b1_pt,"klfitter_model_Higgs_b1_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b1_eta,"klfitter_model_Higgs_b1_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b1_phi,"klfitter_model_Higgs_b1_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b1_E,"klfitter_model_Higgs_b1_E"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b1_jetIndex,"klfitter_model_Higgs_b1_jetIndex"); + + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b2_pt,"klfitter_model_Higgs_b2_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b2_eta,"klfitter_model_Higgs_b2_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b2_phi,"klfitter_model_Higgs_b2_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b2_E,"klfitter_model_Higgs_b2_E"); + systematicTree->makeOutputVariable(m_klfitter_model_Higgs_b2_jetIndex,"klfitter_model_Higgs_b2_jetIndex"); + + } + + systematicTree->makeOutputVariable(m_klfitter_model_lep_pt,"klfitter_model_lep_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_lep_eta,"klfitter_model_lep_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_lep_phi,"klfitter_model_lep_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_lep_E,"klfitter_model_lep_E"); + + systematicTree->makeOutputVariable(m_klfitter_model_nu_pt,"klfitter_model_nu_pt"); + systematicTree->makeOutputVariable(m_klfitter_model_nu_eta,"klfitter_model_nu_eta"); + systematicTree->makeOutputVariable(m_klfitter_model_nu_phi,"klfitter_model_nu_phi"); + systematicTree->makeOutputVariable(m_klfitter_model_nu_E,"klfitter_model_nu_E"); + + 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"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topLep_E,"klfitter_bestPerm_topLep_E"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topLep_m,"klfitter_bestPerm_topLep_m"); + + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topHad_pt,"klfitter_bestPerm_topHad_pt"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topHad_eta,"klfitter_bestPerm_topHad_eta"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topHad_phi,"klfitter_bestPerm_topHad_phi"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topHad_E,"klfitter_bestPerm_topHad_E"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_topHad_m,"klfitter_bestPerm_topHad_m"); + + systematicTree->makeOutputVariable(m_klfitter_bestPerm_ttbar_pt,"klfitter_bestPerm_ttbar_pt"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_ttbar_eta,"klfitter_bestPerm_ttbar_eta"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_ttbar_phi,"klfitter_bestPerm_ttbar_phi"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_ttbar_E,"klfitter_bestPerm_ttbar_E"); + systematicTree->makeOutputVariable(m_klfitter_bestPerm_ttbar_m,"klfitter_bestPerm_ttbar_m"); + + + } + + if (m_config->doPseudoTop()) { + + systematicTree->makeOutputVariable(m_PseudoTop_Reco_ttbar_pt, "PseudoTop_Reco_ttbar_pt"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_ttbar_eta, "PseudoTop_Reco_ttbar_eta"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_ttbar_phi, "PseudoTop_Reco_ttbar_phi"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_ttbar_m, "PseudoTop_Reco_ttbar_m"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_had_pt, "PseudoTop_Reco_top_had_pt"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_had_eta, "PseudoTop_Reco_top_had_eta"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_had_phi, "PseudoTop_Reco_top_had_phi"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_had_m, "PseudoTop_Reco_top_had_m"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_lep_pt, "PseudoTop_Reco_top_lep_pt"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_lep_eta, "PseudoTop_Reco_top_lep_eta"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_lep_phi, "PseudoTop_Reco_top_lep_phi"); + systematicTree->makeOutputVariable(m_PseudoTop_Reco_top_lep_m, "PseudoTop_Reco_top_lep_m"); + + } + + //extra branches telling you if the event passed / failed a selection + int index(0); + for (const auto& branchName : m_extraBranches) { + m_selectionDecisions[index] = 0; + systematicTree->makeOutputVariable(m_selectionDecisions[index], branchName); + // Add all triggers to a map so we don't get any duplicates + for (auto& trigger_name : m_config->allTriggers( branchName ) ) { + m_triggerDecisions [trigger_name] = 0; + if (!m_config->isMC() && m_config->doFakesMMWeights()) + m_triggerPrescales [trigger_name] = -99999.;//initialised to dummmy value, in case it can't be retrieved by the tool + } + for (auto& trigger_name : m_config->electronTriggers( branchName ) ) + m_el_trigMatched [trigger_name] = std::vector<char>(); + for (auto& trigger_name : m_config->muonTriggers( branchName ) ) + m_mu_trigMatched [trigger_name] = std::vector<char>(); + ++index; + } + + for( auto& trig_name : m_triggerDecisions ) + systematicTree->makeOutputVariable( trig_name.second, trig_name.first ); + if (!m_config->isMC() && m_config->doFakesMMWeights()) { + for( auto& trig_name : m_triggerPrescales ) + systematicTree->makeOutputVariable( trig_name.second, "PS_"+trig_name.first ); + } + for( auto& trig_name : m_el_trigMatched ) + systematicTree->makeOutputVariable( trig_name.second, "el_trigMatch_"+trig_name.first ); + for( auto& trig_name : m_mu_trigMatched ) + systematicTree->makeOutputVariable( trig_name.second, "mu_trigMatch_"+trig_name.first ); + + } + } + + void EventSaverFlatNtuple::setupParticleLevelTreeManager(const top::ParticleLevelEvent& plEvent){ + // Quick return if particle level is disabled or the tree is already initialised. + // If particle level is disabled, no tree will be created. + if ( not m_config->doTopParticleLevel() or m_particleLevelTreeManager ){ + return; + } + + m_particleLevelTreeManager = std::make_shared<top::TreeManager>( "particleLevel", m_outputFile, m_config->outputFileSetAutoFlushZero() ); + + m_particleLevelTreeManager->makeOutputVariable(m_weight_mc, "weight_mc"); + + //event info + m_particleLevelTreeManager->makeOutputVariable(m_eventNumber, "eventNumber"); + m_particleLevelTreeManager->makeOutputVariable(m_runNumber, "runNumber"); + if (m_config->isMC() && m_config->doPileupReweighting()) m_particleLevelTreeManager->makeOutputVariable(m_randomRunNumber, "randomRunNumber"); + m_particleLevelTreeManager->makeOutputVariable(m_mcChannelNumber, "mcChannelNumber"); + m_particleLevelTreeManager->makeOutputVariable(m_mu, "mu"); + m_particleLevelTreeManager->makeOutputVariable(m_weight_pileup, "weight_pileup"); + + if (m_config->doPseudoTop()) { + + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_ttbar_pt, "PseudoTop_Particle_ttbar_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_ttbar_eta, "PseudoTop_Particle_ttbar_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_ttbar_phi, "PseudoTop_Particle_ttbar_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_ttbar_m, "PseudoTop_Particle_ttbar_m"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_had_pt, "PseudoTop_Particle_top_had_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_had_eta, "PseudoTop_Particle_top_had_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_had_phi, "PseudoTop_Particle_top_had_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_had_m, "PseudoTop_Particle_top_had_m"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_lep_pt, "PseudoTop_Particle_top_lep_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_lep_eta, "PseudoTop_Particle_top_lep_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_lep_phi, "PseudoTop_Particle_top_lep_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_PseudoTop_Particle_top_lep_m, "PseudoTop_Particle_top_lep_m"); + + } + + //electrons + if ( m_config->useTruthElectrons() ){ + m_particleLevelTreeManager->makeOutputVariable(m_el_pt, "el_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_el_eta, "el_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_el_phi, "el_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_el_e, "el_e"); + m_particleLevelTreeManager->makeOutputVariable(m_el_charge, "el_charge"); + + m_particleLevelTreeManager->makeOutputVariable(m_el_pt_bare, "el_pt_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_el_eta_bare, "el_eta_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_el_phi_bare, "el_phi_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_el_e_bare, "el_e_bare"); + } + + //muons + if ( m_config->useTruthMuons() ){ + m_particleLevelTreeManager->makeOutputVariable(m_mu_pt, "mu_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_eta, "mu_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_phi, "mu_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_e, "mu_e"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_charge, "mu_charge"); + + m_particleLevelTreeManager->makeOutputVariable(m_mu_pt_bare, "mu_pt_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_eta_bare, "mu_eta_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_phi_bare, "mu_phi_bare"); + m_particleLevelTreeManager->makeOutputVariable(m_mu_e_bare, "mu_e_bare"); + } + + //photons + if (m_config->useTruthPhotons()) { + m_particleLevelTreeManager->makeOutputVariable(m_ph_pt, "ph_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_ph_eta, "ph_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_ph_phi, "ph_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_ph_e, "ph_e"); + } + + //jets + if ( m_config->useTruthJets() ){ + m_particleLevelTreeManager->makeOutputVariable(m_jet_pt, "jet_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_jet_eta, "jet_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_jet_phi, "jet_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_jet_e, "jet_e"); + + m_particleLevelTreeManager->makeOutputVariable(m_jet_Ghosts_BHadron_Final_Count, "jet_nGhosts_bHadron"); + m_particleLevelTreeManager->makeOutputVariable(m_jet_Ghosts_CHadron_Final_Count, "jet_nGhosts_cHadron"); + } + + //large R jets + if ( m_config->useTruthLargeRJets() ){ + m_particleLevelTreeManager->makeOutputVariable(m_ljet_pt, "ljet_pt"); + m_particleLevelTreeManager->makeOutputVariable(m_ljet_eta, "ljet_eta"); + m_particleLevelTreeManager->makeOutputVariable(m_ljet_phi, "ljet_phi"); + m_particleLevelTreeManager->makeOutputVariable(m_ljet_e, "ljet_e"); + + m_particleLevelTreeManager->makeOutputVariable(m_ljet_Ghosts_BHadron_Final_Count, "ljet_nGhosts_bHadron"); + m_particleLevelTreeManager->makeOutputVariable(m_ljet_Ghosts_CHadron_Final_Count, "ljet_nGhosts_cHadron"); + } + + //met + if ( m_config->useTruthMET() ){ + m_particleLevelTreeManager->makeOutputVariable(m_met_met, "met_met"); + m_particleLevelTreeManager->makeOutputVariable(m_met_phi, "met_phi"); + } + + // Setup PDF info branches if PDF info is requested. + if (m_config->doTruthPDFInfo()) { + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_X1, "PDFinfo_X1"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_X2, "PDFinfo_X2"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_PDGID1, "PDFinfo_PDGID1"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_PDGID2, "PDFinfo_PDGID2"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_Q, "PDFinfo_Q"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_XF1, "PDFinfo_XF1"); + m_particleLevelTreeManager->makeOutputVariable(m_PDFinfo_XF2, "PDFinfo_XF2"); + } + + // Setup MC generator weights branch if requested. + if (m_config->doMCGeneratorWeights()) { + m_particleLevelTreeManager->makeOutputVariable(m_mc_generator_weights, "mc_generator_weights"); + } + + // Setup PDF weight branches if PDF systematics are requested, + if( m_config->saveLHAPDFEvent() ){ + for ( auto & pdf : m_PDF_eventWeights ) { + m_particleLevelTreeManager->makeOutputVariable( pdf.second, pdf.first ); + } + } + + // Setup the selection decision branches. This is a two-step process: + // + // (1) First, we need to create an array of variables which will be used to + // store the data in the TTree. The variable + // m_particleLevel_SelectionDecisions is just that: A std::vector of + // pairs, thwere the .first corresponds to the name of the selection, + // and the .second is the actual variable. + // (2) Secondly, we need to attach the newly created variables to the + // particle level tree manager. + m_particleLevel_SelectionDecisions.reserve( plEvent.m_selectionDecisions.size() ); + for ( const auto & selectionDecision : plEvent.m_selectionDecisions ){ + m_particleLevel_SelectionDecisions.push_back( std::make_pair( selectionDecision.first, + selectionDecision.second ) ); + } + + for ( auto & selectionDecision : m_particleLevel_SelectionDecisions ){ + m_particleLevelTreeManager->makeOutputVariable( selectionDecision.second, selectionDecision.first ); + } + } + + void EventSaverFlatNtuple::setupUpgradeTreeManager(/*const top::ParticleLevelEvent& upgradeEvent*/){ + // Quick return if upgrade is disabled or the tree is already initialised. + if ( not m_config->HLLHC() or m_upgradeTreeManager ){ + return; + } + + m_upgradeTreeManager = std::make_shared<top::TreeManager>( "upgrade", m_outputFile, m_config->outputFileSetAutoFlushZero() ); + + m_upgradeTreeManager->makeOutputVariable(m_weight_mc, "weight_mc"); + + //event info + m_upgradeTreeManager->makeOutputVariable(m_eventNumber, "eventNumber"); + m_upgradeTreeManager->makeOutputVariable(m_runNumber, "runNumber"); + m_upgradeTreeManager->makeOutputVariable(m_mcChannelNumber, "mcChannelNumber"); + m_upgradeTreeManager->makeOutputVariable(m_mu, "mu"); + + // electrons + m_upgradeTreeManager->makeOutputVariable(m_el_pt, "el_pt"); + m_upgradeTreeManager->makeOutputVariable(m_el_eta, "el_eta"); + m_upgradeTreeManager->makeOutputVariable(m_el_phi, "el_phi"); + m_upgradeTreeManager->makeOutputVariable(m_el_e, "el_e"); + m_upgradeTreeManager->makeOutputVariable(m_el_charge, "el_charge"); + + // muons + m_upgradeTreeManager->makeOutputVariable(m_mu_pt, "mu_pt"); + m_upgradeTreeManager->makeOutputVariable(m_mu_eta, "mu_eta"); + m_upgradeTreeManager->makeOutputVariable(m_mu_phi, "mu_phi"); + m_upgradeTreeManager->makeOutputVariable(m_mu_e, "mu_e"); + m_upgradeTreeManager->makeOutputVariable(m_mu_charge, "mu_charge"); + + // jets + m_upgradeTreeManager->makeOutputVariable(m_jet_pt, "jet_pt"); + m_upgradeTreeManager->makeOutputVariable(m_jet_eta, "jet_eta"); + m_upgradeTreeManager->makeOutputVariable(m_jet_phi, "jet_phi"); + m_upgradeTreeManager->makeOutputVariable(m_jet_e, "jet_e"); + m_upgradeTreeManager->makeOutputVariable(m_jet_mv1eff, "jet_mv1eff"); + m_upgradeTreeManager->makeOutputVariable(m_jet_isPileup, "jet_isPileup"); + + m_upgradeTreeManager->makeOutputVariable(m_jet_Ghosts_BHadron_Final_Count, "jet_nGhosts_bHadron"); + m_upgradeTreeManager->makeOutputVariable(m_jet_Ghosts_CHadron_Final_Count, "jet_nGhosts_cHadron"); + + // MET + m_upgradeTreeManager->makeOutputVariable(m_met_met, "met_met"); + m_upgradeTreeManager->makeOutputVariable(m_met_phi, "met_phi"); + }//setupUpgradeTreeManager + + void EventSaverFlatNtuple::recordSelectionDecision(const top::Event& event) { + int index(0); + for (const auto& branchName : m_extraBranches) { + m_selectionDecisions[index] = event.m_info->auxdataConst<int>(branchName); + ++index; + } + } + + void EventSaverFlatNtuple::recordTriggerDecision(const top::Event& event) { + + for (const auto& trigger : m_triggerDecisions) + m_triggerDecisions[trigger.first] = event.m_info->auxdataConst<char>("TRIGDEC_"+trigger.first); + if (!m_config->isMC() && m_config->doFakesMMWeights()) { + for (const auto& trigger : m_triggerPrescales) + m_triggerPrescales[trigger.first] = event.m_info->auxdataConst<float>("TRIGPS_"+trigger.first); + } + + } + + void EventSaverFlatNtuple::saveEvent(const top::Event& event) { + + // record the event? + if (m_config->saveOnlySelectedEvents() && !event.m_saveEvent) + return; + + //We have decorated event-info with a variable for each selection - with pass / fail + recordSelectionDecision(event); + + recordTriggerDecision(event); + + //some event weights + m_weight_mc = 0.; + if (m_config->isMC()) +// m_weight_mc = event.m_info->mcEventWeight(); + m_weight_mc = event.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + if (m_config->isMC()) { + + m_weight_pileup = m_sfRetriever->pileupSF(event); + + m_weight_leptonSF = m_sfRetriever->leptonSF(event,top::topSFSyst::nominal); + + if (m_config->useTaus()) + m_weight_tauSF = m_sfRetriever->tauSF(event, top::topSFSyst::nominal); + + if (m_config->usePhotons()) + m_weight_photonSF = m_sfRetriever->photonSF(event, top::topSFSyst::nominal); + + for( auto& tagWP : m_config -> bTagWP_available()) { + m_weight_bTagSF[tagWP] = m_sfRetriever->btagSF(event, top::topSFSyst::nominal, tagWP); + } + if (m_config->useTrackJets()) { + for( auto& tagWP : m_config -> bTagWP_available_trkJet()) { + m_weight_trackjet_bTagSF[tagWP] = m_sfRetriever->btagSF(event, top::topSFSyst::nominal, tagWP, true); + } + } + + m_weight_jvt = m_sfRetriever->jvtSF(event, top::topSFSyst::nominal); + + if (m_config->isSherpa22Vjets()) { + if (event.m_info->isAvailable<double>("Sherpa22VJetsWeight")) { + m_weight_sherpa_22_vjets = event.m_info->auxdataConst<double>("Sherpa22VJetsWeight"); + } + } + + // writing the systematic-shifted SFs only in the nominal (or nominal_Loose) tree + if (event.m_hashValue == m_config->nominalHashValue()) { + + m_weight_pileup_UP = m_sfRetriever->pileupSF( event, +1 ); // up variation + m_weight_pileup_DOWN = m_sfRetriever->pileupSF( event, -1 ); // down variation + + m_weight_leptonSF_EL_SF_Trigger_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Trigger_UP); + m_weight_leptonSF_EL_SF_Trigger_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Trigger_DOWN); + m_weight_leptonSF_EL_SF_Reco_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Reco_UP); + m_weight_leptonSF_EL_SF_Reco_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Reco_DOWN); + m_weight_leptonSF_EL_SF_ID_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_ID_UP); + m_weight_leptonSF_EL_SF_ID_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_ID_DOWN); + m_weight_leptonSF_EL_SF_Isol_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Isol_UP); + m_weight_leptonSF_EL_SF_Isol_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::EL_SF_Isol_DOWN); + + m_weight_leptonSF_MU_SF_Trigger_STAT_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Trigger_STAT_UP); + m_weight_leptonSF_MU_SF_Trigger_STAT_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Trigger_STAT_DOWN); + m_weight_leptonSF_MU_SF_Trigger_SYST_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Trigger_SYST_UP); + m_weight_leptonSF_MU_SF_Trigger_SYST_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Trigger_SYST_DOWN); + // Muon ID SF systematics (regular) + m_weight_leptonSF_MU_SF_ID_STAT_UP = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_STAT_UP); + m_weight_leptonSF_MU_SF_ID_STAT_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_STAT_DOWN); + m_weight_leptonSF_MU_SF_ID_SYST_UP = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_SYST_UP); + m_weight_leptonSF_MU_SF_ID_SYST_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_SYST_DOWN); + // Muon ID SF systematics (regular) + m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_UP = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_STAT_LOWPT_UP); + m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_STAT_LOWPT_DOWN); + m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_SYST_LOWPT_UP); + m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_ID_SYST_LOWPT_DOWN); + // Muon isolation SF systematics + m_weight_leptonSF_MU_SF_Isol_STAT_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Isol_STAT_UP); + m_weight_leptonSF_MU_SF_Isol_STAT_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Isol_STAT_DOWN); + m_weight_leptonSF_MU_SF_Isol_SYST_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Isol_SYST_UP); + m_weight_leptonSF_MU_SF_Isol_SYST_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_Isol_SYST_DOWN); + m_weight_leptonSF_MU_SF_TTVA_STAT_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_TTVA_STAT_UP); + m_weight_leptonSF_MU_SF_TTVA_STAT_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_TTVA_STAT_DOWN); + m_weight_leptonSF_MU_SF_TTVA_SYST_UP = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_TTVA_SYST_UP); + m_weight_leptonSF_MU_SF_TTVA_SYST_DOWN = m_sfRetriever->leptonSF(event,top::topSFSyst::MU_SF_TTVA_SYST_DOWN); + + + m_weight_indiv_SF_EL_Trigger = m_sfRetriever -> triggerSF(event,top::topSFSyst::nominal); + m_weight_indiv_SF_EL_Trigger_UP = m_sfRetriever -> triggerSF(event,top::topSFSyst::EL_SF_Trigger_UP); + m_weight_indiv_SF_EL_Trigger_DOWN = m_sfRetriever -> triggerSF(event,top::topSFSyst::EL_SF_Trigger_DOWN); + m_weight_indiv_SF_EL_Reco = m_sfRetriever -> electronSF(event,top::topSFSyst::nominal, top::topSFComp::RECO); + m_weight_indiv_SF_EL_Reco_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_Reco_UP, top::topSFComp::RECO); + m_weight_indiv_SF_EL_Reco_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_Reco_DOWN, top::topSFComp::RECO); + m_weight_indiv_SF_EL_ID = m_sfRetriever -> electronSF(event,top::topSFSyst::nominal, top::topSFComp::ID); + m_weight_indiv_SF_EL_ID_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ID_UP, top::topSFComp::ID); + m_weight_indiv_SF_EL_ID_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ID_DOWN, top::topSFComp::ID); + m_weight_indiv_SF_EL_Isol = m_sfRetriever -> electronSF(event,top::topSFSyst::nominal, top::topSFComp::ISOLATION); + m_weight_indiv_SF_EL_Isol_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_Isol_UP, top::topSFComp::ISOLATION); + m_weight_indiv_SF_EL_Isol_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_Isol_DOWN, top::topSFComp::ISOLATION); + m_weight_indiv_SF_EL_ChargeID = m_sfRetriever -> electronSF(event,top::topSFSyst::nominal, top::topSFComp::CHARGEID); + m_weight_indiv_SF_EL_ChargeID_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeID_UP, top::topSFComp::CHARGEID); + m_weight_indiv_SF_EL_ChargeID_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeID_DOWN,top::topSFComp::CHARGEID); + m_weight_indiv_SF_EL_ChargeMisID = m_sfRetriever -> electronSF(event,top::topSFSyst::nominal, top::topSFComp::CHARGEMISID); + m_weight_indiv_SF_EL_ChargeMisID_STAT_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeMisID_STAT_UP, top::topSFComp::CHARGEMISID); + m_weight_indiv_SF_EL_ChargeMisID_STAT_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeMisID_STAT_DOWN,top::topSFComp::CHARGEMISID); + m_weight_indiv_SF_EL_ChargeMisID_SYST_UP = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeMisID_SYST_UP, top::topSFComp::CHARGEMISID); + m_weight_indiv_SF_EL_ChargeMisID_SYST_DOWN = m_sfRetriever -> electronSF(event,top::topSFSyst::EL_SF_ChargeMisID_SYST_DOWN,top::topSFComp::CHARGEMISID); + ATH_MSG_DEBUG("Electron Trigger SF = "<<m_weight_indiv_SF_EL_Trigger<<" + "<<m_weight_indiv_SF_EL_Trigger_UP<<" - "<<m_weight_indiv_SF_EL_Trigger_DOWN); + ATH_MSG_DEBUG("Electron Reco SF = "<<m_weight_indiv_SF_EL_Reco<<" + "<<m_weight_indiv_SF_EL_Reco_UP<<" - "<<m_weight_indiv_SF_EL_Reco_DOWN); + ATH_MSG_DEBUG("Electron ID SF = "<<m_weight_indiv_SF_EL_ID<<" + "<<m_weight_indiv_SF_EL_ID_UP<<" - "<<m_weight_indiv_SF_EL_ID_DOWN); + ATH_MSG_DEBUG("Electron Charge ID SF = "<<m_weight_indiv_SF_EL_ChargeID<<" + "<<m_weight_indiv_SF_EL_ChargeID_UP<<" - "<<m_weight_indiv_SF_EL_ChargeID_DOWN); + ATH_MSG_DEBUG("Electron Charge Mis ID SF = "<<m_weight_indiv_SF_EL_ChargeMisID<<" + "<<m_weight_indiv_SF_EL_ChargeMisID_STAT_UP<<" - "<<m_weight_indiv_SF_EL_ChargeMisID_STAT_DOWN<<" + "<<m_weight_indiv_SF_EL_ChargeMisID_SYST_UP<<" - "<<m_weight_indiv_SF_EL_ChargeMisID_SYST_DOWN); + + m_weight_indiv_SF_MU_Trigger = m_sfRetriever -> triggerSF(event,top::topSFSyst::nominal); + m_weight_indiv_SF_MU_Trigger_STAT_UP = m_sfRetriever -> triggerSF(event,top::topSFSyst::MU_SF_Trigger_STAT_UP); + m_weight_indiv_SF_MU_Trigger_STAT_DOWN = m_sfRetriever -> triggerSF(event,top::topSFSyst::MU_SF_Trigger_STAT_DOWN); + m_weight_indiv_SF_MU_Trigger_SYST_UP = m_sfRetriever -> triggerSF(event,top::topSFSyst::MU_SF_Trigger_SYST_UP); + m_weight_indiv_SF_MU_Trigger_SYST_DOWN = m_sfRetriever -> triggerSF(event,top::topSFSyst::MU_SF_Trigger_SYST_DOWN); + m_weight_indiv_SF_MU_ID = m_sfRetriever -> muonSF(event,top::topSFSyst::nominal, top::topSFComp::ID); + // Muon ID SF systematics (regular) + m_weight_indiv_SF_MU_ID_STAT_UP = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_STAT_UP, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_STAT_DOWN = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_STAT_DOWN, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_SYST_UP = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_SYST_UP, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_SYST_DOWN = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_SYST_DOWN, top::topSFComp::ID); + // Muon ID SF systematics (low pt) + m_weight_indiv_SF_MU_ID_STAT_LOWPT_UP = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_STAT_LOWPT_UP, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_STAT_LOWPT_DOWN = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_STAT_LOWPT_DOWN, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_SYST_LOWPT_UP = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_SYST_LOWPT_UP, top::topSFComp::ID); + m_weight_indiv_SF_MU_ID_SYST_LOWPT_DOWN = m_sfRetriever->muonSF(event, top::topSFSyst::MU_SF_ID_SYST_LOWPT_DOWN, top::topSFComp::ID); + // Muon isolation SF systematics + m_weight_indiv_SF_MU_Isol = m_sfRetriever -> muonSF(event,top::topSFSyst::nominal, top::topSFComp::ISOLATION); + m_weight_indiv_SF_MU_Isol_STAT_UP = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_Isol_STAT_UP, top::topSFComp::ISOLATION); + m_weight_indiv_SF_MU_Isol_STAT_DOWN = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_Isol_STAT_DOWN, top::topSFComp::ISOLATION); + m_weight_indiv_SF_MU_Isol_SYST_UP = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_Isol_SYST_UP, top::topSFComp::ISOLATION); + m_weight_indiv_SF_MU_Isol_SYST_DOWN = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_Isol_SYST_DOWN, top::topSFComp::ISOLATION); + m_weight_indiv_SF_MU_TTVA = m_sfRetriever -> muonSF(event,top::topSFSyst::nominal, top::topSFComp::TTVA); + m_weight_indiv_SF_MU_TTVA_STAT_UP = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_TTVA_STAT_UP, top::topSFComp::TTVA); + m_weight_indiv_SF_MU_TTVA_STAT_DOWN = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_TTVA_STAT_DOWN, top::topSFComp::TTVA); + m_weight_indiv_SF_MU_TTVA_SYST_UP = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_TTVA_SYST_UP, top::topSFComp::TTVA); + m_weight_indiv_SF_MU_TTVA_SYST_DOWN = m_sfRetriever -> muonSF(event,top::topSFSyst::MU_SF_TTVA_SYST_DOWN, top::topSFComp::TTVA); + + + ATH_MSG_DEBUG("Muon Trigger SF = "<<m_weight_indiv_SF_MU_Trigger<<" + "<< m_weight_indiv_SF_MU_Trigger_STAT_UP<<" - "<< m_weight_indiv_SF_MU_Trigger_STAT_DOWN<<" + "<< m_weight_indiv_SF_MU_Trigger_SYST_UP<<" - "<< m_weight_indiv_SF_MU_Trigger_SYST_DOWN); + + ATH_MSG_DEBUG("Muon ID SF = "<<m_weight_indiv_SF_MU_ID<<" + "<< m_weight_indiv_SF_MU_ID_STAT_UP<<" - "<< m_weight_indiv_SF_MU_ID_STAT_DOWN<<" + "<< m_weight_indiv_SF_MU_ID_SYST_UP<<" - "<< m_weight_indiv_SF_MU_ID_SYST_DOWN); + + + if (m_config->useTaus()) { + // Tau-electron overlap removal + m_weight_tauSF_ELEOLR_UP = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_ELEOLR_TOTAL_UP); + m_weight_tauSF_ELEOLR_DOWN = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_ELEOLR_TOTAL_DOWN); + // Tau Jet IDWP + m_weight_tauSF_JETID_UP = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_JETID_TOTAL_UP); + m_weight_tauSF_JETID_DOWN = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_JETID_TOTAL_DOWN); + // Tau reconstruction + m_weight_tauSF_RECO_UP = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_RECO_TOTAL_UP); + m_weight_tauSF_RECO_DOWN = m_sfRetriever->tauSF(event, top::topSFSyst::TAU_SF_RECO_TOTAL_DOWN); + } + + if (m_config->usePhotons()) { + m_weight_photonSF_ID_UP = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_IDSF_UP); + m_weight_photonSF_ID_DOWN = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_IDSF_DOWN); + m_weight_photonSF_effIso = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_EFF_ISO); + m_weight_photonSF_effLowPtIso_UP = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_EFF_LOWPTISO_UP); + m_weight_photonSF_effLowPtIso_DOWN = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_EFF_LOWPTISO_DOWN); + m_weight_photonSF_effTrkIso_UP = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_EFF_TRKISO_UP); + m_weight_photonSF_effTrkIso_DOWN = m_sfRetriever->photonSF(event, top::topSFSyst::PHOTON_EFF_TRKISO_DOWN); + } + + + m_weight_jvt_up = m_sfRetriever->jvtSF(event, top::topSFSyst::JVT_UP); + m_weight_jvt_down = m_sfRetriever->jvtSF(event, top::topSFSyst::JVT_DOWN); + } + + // for b-tagging SFs, can also have systematic-shifted in systematics trees + if (event.m_hashValue == m_config->nominalHashValue() || m_config->dumpBtagSystsInSystTrees()) { + for( auto& tagWP : m_config -> bTagWP_available()) { + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_B, + m_weight_bTagSF_eigen_B_up[tagWP], + m_weight_bTagSF_eigen_B_down[tagWP], tagWP); + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_C, + m_weight_bTagSF_eigen_C_up[tagWP], + m_weight_bTagSF_eigen_C_down[tagWP], tagWP); + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_LIGHT, + m_weight_bTagSF_eigen_Light_up[tagWP], + m_weight_bTagSF_eigen_Light_down[tagWP], tagWP); + for (auto name : m_config->btagging_namedSysts(tagWP)) { + m_weight_bTagSF_named_up[tagWP][name] = m_sfRetriever->btagSF( event, top::topSFSyst::BTAG_SF_NAMED_UP, tagWP, false, name ); + m_weight_bTagSF_named_down[tagWP][name] = m_sfRetriever->btagSF( event, top::topSFSyst::BTAG_SF_NAMED_DOWN, tagWP, false, name ); + } + } + if (m_config->useTrackJets()) { + for( auto& tagWP : m_config -> bTagWP_available_trkJet()) { + // skip uncalibrated though available WPs + if (std::find(m_config->bTagWP_calibrated().begin(), m_config->bTagWP_calibrated().end(), tagWP) == m_config->bTagWP_calibrated().end()) continue; + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_B, + m_weight_trackjet_bTagSF_eigen_B_up[tagWP], + m_weight_trackjet_bTagSF_eigen_B_down[tagWP], tagWP, true); + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_C, + m_weight_trackjet_bTagSF_eigen_C_up[tagWP], + m_weight_trackjet_bTagSF_eigen_C_down[tagWP], tagWP, true); + m_sfRetriever->btagSF_eigen_vars(event, top::topSFSyst::BTAG_SF_EIGEN_LIGHT, + m_weight_trackjet_bTagSF_eigen_Light_up[tagWP], + m_weight_trackjet_bTagSF_eigen_Light_down[tagWP], tagWP, true); + for (auto name : m_config->btagging_namedSysts(tagWP)) { + m_weight_trackjet_bTagSF_named_up[tagWP][name] = m_sfRetriever->btagSF( event, top::topSFSyst::BTAG_SF_NAMED_UP, tagWP, true, name); + m_weight_trackjet_bTagSF_named_down[tagWP][name] = m_sfRetriever->btagSF( event, top::topSFSyst::BTAG_SF_NAMED_DOWN, tagWP, true, name ); + } + } + } + } + } + + ///-- weights for matrix-method fakes estimate --/// + if (!m_config->isMC() && m_config->doFakesMMWeights()) { + top::TopFakesMMWeightCalculator const* fakesMMWeightCalc(nullptr); + if ( asg::ToolStore::contains<top::TopFakesMMWeightCalculator>("MMWeightCalculator") ) { + fakesMMWeightCalc = asg::ToolStore::get<top::TopFakesMMWeightCalculator>("MMWeightCalculator"); + } + else { + ATH_MSG_ERROR("EventSaverFlatNtuple::initialize" ); + throw std::runtime_error("Unable to retrieve top::TopFakesMMWeightCalculator tool"); + } + for(const auto& branchName : m_extraBranches) {//loop on selections + for(const auto& conf : fakesMMWeightCalc->GetFakesMMConfigNames(branchName)) { + std::string MMweight_branch_name = "fakesMM_weight_" + branchName + "_" + conf; + std::string decorName = "MMWeight_"; decorName += branchName; decorName += "_"; decorName += conf; + if( event.m_info->isAvailable<float>(decorName.c_str()) ) { + m_fakesMM_weights[branchName][conf] = event.m_info->auxdataConst<float>(decorName.c_str()); + } + else {//if decoration is not present, it means this weight is not relevant for this channel - a hurtless weight=1. is then applied + m_fakesMM_weights[branchName][conf] = 1.; + } + } + } + } + + //event info + m_eventNumber = event.m_info -> eventNumber(); + m_runNumber = event.m_info -> runNumber(); + m_randomRunNumber = 0; + if (m_config->isMC() && m_config->doPileupReweighting()) { + if (event.m_info->isAvailable<unsigned int>("RandomRunNumber")) + m_randomRunNumber = event.m_info->auxdataConst<unsigned int>("RandomRunNumber"); + } + m_mcChannelNumber = 0; + + if (m_config->isMC()) + m_mcChannelNumber = event.m_info -> mcChannelNumber(); + + // (non-collision-)background flags + m_backgroundFlags = 0; + if (event.m_info->isAvailable<unsigned int>("backgroundFlags")) + m_backgroundFlags = event.m_info->auxdataConst<unsigned int>("backgroundFlags"); + + // hasBadMuon flag + m_hasBadMuon = 0; + if (m_config->useMuons() && event.m_info->isAvailable<char>("AnalysisTop_HASBADMUON")) + m_hasBadMuon = event.m_info->auxdataConst<char>("AnalysisTop_HASBADMUON"); + + // mu values (original and corrected by pileup reweighting tool) + m_mu_original = event.m_info->averageInteractionsPerCrossing(); + + // set these all to zero (maybe not the most sensible value...) + m_mu = 0; + + if (m_config->isMC()) + m_mu = m_mu_original; + if (!m_config->isMC()) { + // If we have the corrected mu value from pileup reweighting then save that + // instead of mu value in (d)xAOD. + if( event.m_info->isAvailable<float>("corrected_averageInteractionsPerCrossing") ) + m_mu = event.m_info->auxdataConst<float>("corrected_averageInteractionsPerCrossing"); + } + + ATH_MSG_DEBUG(" mu = "<<m_mu_original<<" -> "<<m_mu); + + //electrons + if (m_config->useElectrons()) { + unsigned int i(0); + unsigned int n_electrons = event.m_electrons.size(); + m_el_pt.resize(n_electrons); + m_el_eta.resize(n_electrons); + m_el_cl_eta.resize(n_electrons); + m_el_phi.resize(n_electrons); + m_el_e.resize(n_electrons); + m_el_charge.resize(n_electrons); + m_el_topoetcone20.resize(n_electrons); + m_el_ptvarcone20.resize(n_electrons); + m_el_isTight.resize(n_electrons); + m_el_CF.resize(n_electrons); + for( const auto& trigger : m_el_trigMatched ) + m_el_trigMatched[trigger.first].resize(n_electrons); + m_el_d0sig.resize(n_electrons); + m_el_delta_z0_sintheta.resize(n_electrons); + if (m_config->isMC()) { + m_el_true_type.resize(n_electrons); + m_el_true_origin.resize(n_electrons); + m_el_true_typebkg.resize(n_electrons); + m_el_true_originbkg.resize(n_electrons); + } + + for (const auto* const elPtr : event.m_electrons) { + m_el_pt[i] = elPtr->pt(); + m_el_eta[i] = elPtr->eta(); + m_el_cl_eta[i] = elPtr->caloCluster()->etaBE(2); + m_el_phi[i] = elPtr->phi(); + m_el_e[i] = elPtr->e(); + m_el_charge[i] = elPtr->charge(); + elPtr->isolationValue( m_el_topoetcone20[i] , xAOD::Iso::topoetcone20 ); + elPtr->isolationValue( m_el_ptvarcone20[i] , xAOD::Iso::ptvarcone20 ); + if (event.m_isLoose) { + if (elPtr->isAvailable<char>("passPreORSelection")) { + m_el_isTight[i] = elPtr->auxdataConst<char>("passPreORSelection"); + } + } + if (elPtr->isAvailable<char>("passChargeID")) + m_el_CF[i] = elPtr->auxdataConst<char>("passChargeID"); + for( const auto& trigger : m_el_trigMatched ){ + std::string trig = "TRIGMATCH_"+trigger.first; + m_el_trigMatched[trigger.first][i] = elPtr->auxdataConst<char>(trig); + } + if( elPtr->isAvailable<float>("d0sig") ) + m_el_d0sig[i] = elPtr->auxdataConst<float>("d0sig"); + if( elPtr->isAvailable<float>("delta_z0_sintheta") ) + m_el_delta_z0_sintheta[i] = elPtr->auxdataConst<float>("delta_z0_sintheta"); + + //retrieve the truth-matching variables from MCTruthClassifier + if (m_config->isMC()) { + m_el_true_type[i] = 0; + m_el_true_origin[i] = 0; + m_el_true_typebkg[i] = 0; + m_el_true_originbkg[i] = 0; + static SG::AuxElement::Accessor<int> typeel("truthType"); + static SG::AuxElement::Accessor<int> origel("truthOrigin"); + static SG::AuxElement::Accessor<int> typebkgel("bkgTruthType"); + static SG::AuxElement::Accessor<int> origbkgel("bkgTruthOrigin"); + if (typeel.isAvailable(*elPtr)) m_el_true_type[i] = typeel(*elPtr); + if (origel.isAvailable(*elPtr)) m_el_true_origin[i] = origel(*elPtr); + if (typebkgel.isAvailable(*elPtr)) m_el_true_typebkg[i] = typebkgel(*elPtr); + if (origbkgel.isAvailable(*elPtr)) m_el_true_originbkg[i] = origbkgel(*elPtr); + } + ++i; + } + } + + //muons + if (m_config->useMuons()) { + unsigned int i(0); + unsigned int n_muons = event.m_muons.size(); + m_mu_pt.resize(n_muons); + m_mu_eta.resize(n_muons); + m_mu_phi.resize(n_muons); + m_mu_e.resize(n_muons); + m_mu_charge.resize(n_muons); + m_mu_topoetcone20.resize(n_muons); + m_mu_ptvarcone30.resize(n_muons); + m_mu_isTight.resize(n_muons); + for( const auto& trigger : m_mu_trigMatched ) + m_mu_trigMatched[trigger.first].resize(n_muons); + m_mu_d0sig.resize(n_muons); + m_mu_delta_z0_sintheta.resize(n_muons); + if (m_config->isMC()) { + m_mu_true_type.resize(n_muons); + m_mu_true_origin.resize(n_muons); + } + + for (const auto* const muPtr : event.m_muons) { + m_mu_pt[i] = muPtr->pt(); + m_mu_eta[i] = muPtr->eta(); + m_mu_phi[i] = muPtr->phi(); + m_mu_e[i] = muPtr->e(); + m_mu_charge[i] = muPtr->charge(); + muPtr->isolation( m_mu_topoetcone20[i] , xAOD::Iso::topoetcone20 ); + muPtr->isolation( m_mu_ptvarcone30[i] , xAOD::Iso::ptvarcone30 ); + if (event.m_isLoose) { + if (muPtr->isAvailable<char>("passPreORSelection")) { + m_mu_isTight[i] = muPtr->auxdataConst<char>("passPreORSelection"); + } + } + for( const auto& trigger : m_mu_trigMatched ){ + std::string trig = "TRIGMATCH_"+trigger.first; + m_mu_trigMatched[trigger.first][i] = muPtr->auxdataConst<char>(trig); + } + if( muPtr->isAvailable<float>("d0sig") ) + m_mu_d0sig[i] = muPtr->auxdataConst<float>("d0sig"); + if( muPtr->isAvailable<float>("delta_z0_sintheta") ) + m_mu_delta_z0_sintheta[i] = muPtr->auxdataConst<float>("delta_z0_sintheta"); + + //retrieve the truth-matching variables from MCTruthClassifier + if (m_config->isMC()) { + static SG::AuxElement::Accessor<int> acc_mctt("truthType"); + static SG::AuxElement::Accessor<int> acc_mcto("truthOrigin"); + m_mu_true_type[i]=0; + m_mu_true_origin[i]=0; + const xAOD::TrackParticle* mutrack = muPtr->primaryTrackParticle(); + if (mutrack!=nullptr) { + if (acc_mctt.isAvailable(*mutrack)) m_mu_true_type[i] = acc_mctt(*mutrack); + if (acc_mcto.isAvailable(*mutrack)) m_mu_true_origin[i] = acc_mcto(*mutrack); + } + } + ++i; + } + } + + //photons + if (m_config->usePhotons()) { + unsigned int i(0); + m_ph_pt.resize(event.m_photons.size()); + m_ph_eta.resize(event.m_photons.size()); + m_ph_phi.resize(event.m_photons.size()); + m_ph_e.resize(event.m_photons.size()); + m_ph_iso.resize(event.m_photons.size()); + for (const auto* const phPtr : event.m_photons) { + m_ph_pt[i] = phPtr->pt(); + m_ph_eta[i] = phPtr->eta(); + m_ph_phi[i] = phPtr->phi(); + m_ph_e[i] = phPtr->e(); + + m_ph_iso[i] = 0.; + if (phPtr->isAvailable<float>("ptvarcone20")) + m_ph_iso[i] = phPtr->auxdata<float>("ptvarcone20"); + + ++i; + } + } + + + //taus + if (m_config->useTaus()) { + unsigned int i(0); + m_tau_pt.resize(event.m_tauJets.size()); + m_tau_eta.resize(event.m_tauJets.size()); + m_tau_phi.resize(event.m_tauJets.size()); + m_tau_charge.resize(event.m_tauJets.size()); + for (const auto* const tauPtr : event.m_tauJets) { + m_tau_pt[i] = tauPtr->pt(); + m_tau_eta[i] = tauPtr->eta(); + m_tau_phi[i] = tauPtr->phi(); + m_tau_charge[i] = tauPtr->charge(); + ++i; + } + } + + //jets + if (m_config->useJets()) { + unsigned int i(0); + m_jet_pt.resize(event.m_jets.size()); + m_jet_eta.resize(event.m_jets.size()); + m_jet_phi.resize(event.m_jets.size()); + m_jet_e.resize(event.m_jets.size()); + m_jet_mv2c00.resize(event.m_jets.size()); + m_jet_mv2c10.resize(event.m_jets.size()); + m_jet_mv2c20.resize(event.m_jets.size()); + m_jet_ip3dsv1.resize(event.m_jets.size()); + m_jet_jvt.resize(event.m_jets.size()); + m_jet_passfjvt.resize(event.m_jets.size()); + if (m_config->isMC()) { + m_jet_truthflav.resize(event.m_jets.size()); + m_jet_truthPartonLabel.resize(event.m_jets.size()); + m_jet_isTrueHS.resize(event.m_jets.size()); + } + for( auto& tagWP : m_config -> bTagWP_available()){ + if (tagWP!= "Continuous") m_jet_isbtagged[tagWP].resize(event.m_jets.size()); + else m_jet_tagWeightBin.resize(event.m_jets.size()); + } + for (const auto* const jetPtr : event.m_jets) { + m_jet_pt[i] = jetPtr->pt(); + m_jet_eta[i] = jetPtr->eta(); + m_jet_phi[i] = jetPtr->phi(); + m_jet_e[i] = jetPtr->e(); + m_jet_ip3dsv1[i] = jetPtr->btagging()->SV1plusIP3D_discriminant(); + if (m_config->isMC()) { + m_jet_truthflav[i] = -99; + if(jetPtr->isAvailable<int>("HadronConeExclTruthLabelID")){ + jetPtr->getAttribute("HadronConeExclTruthLabelID", m_jet_truthflav[i]); + } + m_jet_truthPartonLabel[i] = -99; + if(jetPtr->isAvailable<int>("PartonTruthLabelID")){ + jetPtr->getAttribute("PartonTruthLabelID", m_jet_truthPartonLabel[i]); + } + m_jet_isTrueHS[i] = false; + if(jetPtr->isAvailable<char>("AnalysisTop_isHS")){ + jetPtr->getAttribute("AnalysisTop_isHS", m_jet_isTrueHS[i]); + } + } + for( auto& tagWP : m_config -> bTagWP_available()){ + if (tagWP!= "Continuous") { + m_jet_isbtagged[tagWP][i] = false; + if(jetPtr->isAvailable<char>("isbtagged_"+tagWP)) + m_jet_isbtagged[tagWP][i] = jetPtr->auxdataConst<char>("isbtagged_"+tagWP); + } + else { + m_jet_tagWeightBin[i] = -2;// AT default value + if(jetPtr->isAvailable<int>("tagWeightBin")) + m_jet_tagWeightBin[i] = jetPtr->auxdataConst<int>("tagWeightBin"); + } + } + + // for studies on high performance b-tagging + // the following are in DC14 + double mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c00", mvx); + m_jet_mv2c00[i] = mvx; + mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c10", mvx); + m_jet_mv2c10[i] = mvx; + mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c20", mvx); + m_jet_mv2c20[i] = mvx; + + m_jet_jvt[i] = -1; + if (jetPtr->isAvailable<float>("AnalysisTop_JVT")) { + m_jet_jvt[i] = jetPtr->auxdataConst<float>("AnalysisTop_JVT"); + } + m_jet_passfjvt[i] = -1; + if (jetPtr->isAvailable<char>("passFJVT")) { + m_jet_passfjvt[i] = jetPtr->getAttribute<char>("passFJVT"); + } + + ++i; + } + } + + //large-R jets + if (m_config->useLargeRJets()) { + unsigned int i(0); + m_ljet_pt.resize(event.m_largeJets.size()); + m_ljet_eta.resize(event.m_largeJets.size()); + m_ljet_phi.resize(event.m_largeJets.size()); + m_ljet_e.resize(event.m_largeJets.size()); + m_ljet_m.resize(event.m_largeJets.size()); + m_ljet_sd12.resize(event.m_largeJets.size()); + for (const auto* const jetPtr : event.m_largeJets) { + m_ljet_pt[i] = jetPtr->pt(); + m_ljet_eta[i] = jetPtr->eta(); + m_ljet_phi[i] = jetPtr->phi(); + m_ljet_e[i] = jetPtr->e(); + m_ljet_m[i] = jetPtr->m(); + m_ljet_sd12[i] = 0; + float Split12 = 0; + jetPtr->getAttribute("Split12", Split12); + m_ljet_sd12[i] = Split12; + + ++i; + } + } + + //track jets + if (m_config->useTrackJets()) { + unsigned int i(0); + m_tjet_pt.resize(event.m_trackJets.size()); + m_tjet_eta.resize(event.m_trackJets.size()); + m_tjet_phi.resize(event.m_trackJets.size()); + m_tjet_e.resize(event.m_trackJets.size()); + m_tjet_mv2c00.resize(event.m_trackJets.size()); + m_tjet_mv2c10.resize(event.m_trackJets.size()); + m_tjet_mv2c20.resize(event.m_trackJets.size()); + for( auto& tagWP : m_config -> bTagWP_available_trkJet()) { + if (tagWP!= "Continuous") m_tjet_isbtagged[tagWP].resize(event.m_trackJets.size()); + else m_tjet_tagWeightBin.resize(event.m_trackJets.size()); + } + for (const auto* const jetPtr : event.m_trackJets) { + m_tjet_pt[i] = jetPtr->pt(); + m_tjet_eta[i] = jetPtr->eta(); + m_tjet_phi[i] = jetPtr->phi(); + m_tjet_e[i] = jetPtr->e(); + + double mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c00", mvx); + m_tjet_mv2c00[i] = mvx; + mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c10", mvx); + m_tjet_mv2c10[i] = mvx; + mvx = -999; + jetPtr->btagging()->MVx_discriminant("MV2c20", mvx); + m_tjet_mv2c20[i] = mvx; + for( auto& tagWP : m_config -> bTagWP_available_trkJet()){ + if (tagWP!= "Continuous") { + m_tjet_isbtagged[tagWP][i] = false; + if(jetPtr->isAvailable<char>("isbtagged_"+tagWP)) + m_tjet_isbtagged[tagWP][i] = jetPtr->auxdataConst<char>("isbtagged_"+tagWP); + } + else { + m_tjet_tagWeightBin[i] = -2;// AT default value + if(jetPtr->isAvailable<int>("tagWeightBin")) + m_tjet_tagWeightBin[i] = jetPtr->auxdataConst<int>("tagWeightBin"); + } + } + ++i; + } + } + + if (m_makeRCJets){ + // Execute the re-clustering code + // - make jet container of small-r jets in the event, put it in TStore, do re-clustering + top::check(m_rc->execute(event),"Failed to execute RCJetMC15 container"); + + // Get the name of the container of re-clustered jets in TStore + m_RCJetContainer = m_rc->rcjetContainerName(event.m_hashValue,event.m_isLoose); + + // -- Retrieve the re-clustered jets from TStore & save good re-clustered jets -- // + const xAOD::JetContainer* rc_jets(nullptr); + top::check(evtStore()->retrieve(rc_jets,m_RCJetContainer),"Failed to retrieve RC JetContainer"); + + // re-clustered jet substructure + static SG::AuxElement::ConstAccessor<float> RCSplit12("Split12"); + static SG::AuxElement::ConstAccessor<float> RCSplit23("Split23"); + + // Initialize the vectors to be saved as branches + unsigned int sizeOfRCjets(rc_jets->size()); + + m_rcjet_pt.resize(sizeOfRCjets,-999.); + m_rcjet_eta.resize(sizeOfRCjets,-999.); + m_rcjet_phi.resize(sizeOfRCjets,-999.); + m_rcjet_e.resize(sizeOfRCjets,-999.); + m_rcjet_d12.resize(sizeOfRCjets,-999.); + m_rcjet_d23.resize(sizeOfRCjets,-999.); + m_rcjetsub_pt.resize(sizeOfRCjets, std::vector<float>()); + m_rcjetsub_eta.resize(sizeOfRCjets, std::vector<float>()); + m_rcjetsub_phi.resize(sizeOfRCjets, std::vector<float>()); + m_rcjetsub_e.resize(sizeOfRCjets, std::vector<float>()); + m_rcjetsub_mv2c10.resize(sizeOfRCjets, std::vector<float>()); + + unsigned int i = 0; + for (xAOD::JetContainer::const_iterator jet_itr = rc_jets->begin(); jet_itr != rc_jets->end(); ++jet_itr) { + const xAOD::Jet* rc_jet = *jet_itr; + + if (!m_rc->passSelection(*rc_jet)) + continue; + + m_rcjet_pt[i] = rc_jet->pt(); + m_rcjet_eta[i] = rc_jet->eta(); + m_rcjet_phi[i] = rc_jet->phi(); + m_rcjet_e[i] = rc_jet->e(); + + m_rcjet_d12[i] = (RCSplit12.isAvailable(*rc_jet)) ? RCSplit12(*rc_jet) : -999.; + m_rcjet_d23[i] = (RCSplit23.isAvailable(*rc_jet)) ? RCSplit23(*rc_jet) : -999.; + + // loop over subjets + m_rcjetsub_pt[i].clear(); // clear the vector size (otherwise it grows out of control!) + m_rcjetsub_eta[i].clear(); + m_rcjetsub_phi[i].clear(); + m_rcjetsub_e[i].clear(); + m_rcjetsub_mv2c10[i].clear(); + + const xAOD::Jet* subjet(nullptr); + const xAOD::BTagging* btag(nullptr); + for(auto rc_jet_subjet : rc_jet->getConstituents()){ + subjet = static_cast<const xAOD::Jet*>(rc_jet_subjet->rawConstituent()); + btag = subjet->btagging(); + + double mvx10(-999.); // b-tagging mv2c10 + + if (btag){ + btag->MVx_discriminant("MV2c10",mvx10); + } + else{ + mvx10 = -999.; + } + + m_rcjetsub_pt[i].push_back(subjet->pt()); + m_rcjetsub_eta[i].push_back(subjet->eta()); + m_rcjetsub_phi[i].push_back(subjet->phi()); + m_rcjetsub_e[i].push_back(subjet->e()); + m_rcjetsub_mv2c10[i].push_back(mvx10); + } // end for-loop over subjets + ++i; + } // end for-loop over re-clustered jets + + m_rcjet_pt.resize(i); + m_rcjet_eta.resize(i); + m_rcjet_phi.resize(i); + m_rcjet_e.resize(i); + m_rcjet_d12.resize(i); + m_rcjet_d23.resize(i); + m_rcjetsub_pt.resize(i, std::vector<float>()); + m_rcjetsub_eta.resize(i, std::vector<float>()); + m_rcjetsub_phi.resize(i, std::vector<float>()); + m_rcjetsub_e.resize(i, std::vector<float>()); + m_rcjetsub_mv2c10.resize(i, std::vector<float>()); + } // end if make rcjets + // end re-clustered jets + + /**********************************/ + // VarRC jets + if (m_makeVarRCJets){ + // Execute the re-clustering code + // - make jet container, put it in TStore, do re-clustering + std::string VarRC = "vrcjet"; + for (auto& rho : m_VarRCJetRho){ + for (auto& mass_scale : m_VarRCJetMassScale){ + std::replace( rho.begin(), rho.end(), '.', '_'); + std::string name = rho+mass_scale; + + top::check(m_VarRC[name]->execute(event),"Failed to execute RCJetMC15 container"); + + // Get the name of the container of re-clustered jets in TStore + m_RCJetContainer = m_VarRC[name]->rcjetContainerName(event.m_hashValue,event.m_isLoose); + + // -- Retrieve the re-clustered jets from TStore & save good re-clustered jets -- // + const xAOD::JetContainer* vrc_jets(nullptr); + top::check(evtStore()->retrieve(vrc_jets,m_RCJetContainer),"Failed to retrieve RC JetContainer"); + + // re-clustered jet substructure + static SG::AuxElement::ConstAccessor<float> VarRCSplit12("Split12"); + static SG::AuxElement::ConstAccessor<float> VarRCSplit23("Split23"); + + // Initialize the vectors to be saved as branches + unsigned int sizeOfRCjets(vrc_jets->size()); + m_VarRCjetBranches[VarRC+"_"+name+"_pt"].resize(sizeOfRCjets,-999.); + m_VarRCjetBranches[VarRC+"_"+name+"_eta"].resize(sizeOfRCjets,-999.); + m_VarRCjetBranches[VarRC+"_"+name+"_phi"].resize(sizeOfRCjets,-999.); + m_VarRCjetBranches[VarRC+"_"+name+"_e"].resize(sizeOfRCjets,-999.); + m_VarRCjetBranches[VarRC+"_"+name+"_d12"].resize(sizeOfRCjets,-999.); + m_VarRCjetBranches[VarRC+"_"+name+"_d23"].resize(sizeOfRCjets,-999.); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_pt"].resize(sizeOfRCjets, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_eta"].resize(sizeOfRCjets, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_phi"].resize(sizeOfRCjets, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_e"].resize(sizeOfRCjets, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_mv2c10"].resize(sizeOfRCjets, std::vector<float>()); + + unsigned int i = 0; + for (xAOD::JetContainer::const_iterator jet_itr = vrc_jets->begin(); jet_itr != vrc_jets->end(); ++jet_itr) { + const xAOD::Jet* rc_jet = *jet_itr; + + if (!m_VarRC[name]->passSelection(*rc_jet)) + continue; + + m_VarRCjetBranches[VarRC+"_"+name+"_pt"][i] = rc_jet->pt(); + m_VarRCjetBranches[VarRC+"_"+name+"_eta"][i] = rc_jet->eta(); + m_VarRCjetBranches[VarRC+"_"+name+"_phi"][i] = rc_jet->phi(); + m_VarRCjetBranches[VarRC+"_"+name+"_e"][i] = rc_jet->e(); + + m_VarRCjetBranches[VarRC+"_"+name+"_d12"][i] = (VarRCSplit12.isAvailable(*rc_jet)) ? VarRCSplit12(*rc_jet) : -999.; + m_VarRCjetBranches[VarRC+"_"+name+"_d23"][i] = (VarRCSplit23.isAvailable(*rc_jet)) ? VarRCSplit23(*rc_jet) : -999.; + + // loop over subjets + const xAOD::Jet* subjet(nullptr); + const xAOD::BTagging* btag(nullptr); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_pt"][i].clear(); // clear the vector size (otherwise it grows out of control!) + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_eta"][i].clear(); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_phi"][i].clear(); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_e"][i].clear(); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_mv2c10"][i].clear(); + for(auto rc_jet_subjet : rc_jet->getConstituents()){ + subjet = static_cast<const xAOD::Jet*>(rc_jet_subjet->rawConstituent()); + btag = subjet->btagging(); + + double mvx10(-999.); // b-tagging mv2c10 + + if (btag){ + btag->MVx_discriminant("MV2c10",mvx10); + } + else{ + mvx10 = -999.; + } + + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_pt"][i].push_back(subjet->pt()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_eta"][i].push_back(subjet->eta()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_phi"][i].push_back(subjet->phi()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_e"][i].push_back(subjet->e()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_mv2c10"][i].push_back(mvx10); + } // end for-loop over subjets + ++i; + + } // end for-loop over re-clustered jets + + m_VarRCjetBranches[VarRC+"_"+name+"_pt"].resize(i); + m_VarRCjetBranches[VarRC+"_"+name+"_eta"].resize(i); + m_VarRCjetBranches[VarRC+"_"+name+"_phi"].resize(i); + m_VarRCjetBranches[VarRC+"_"+name+"_e"].resize(i); + m_VarRCjetBranches[VarRC+"_"+name+"_d12"].resize(i); + m_VarRCjetBranches[VarRC+"_"+name+"_d23"].resize(i); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_pt"].resize(i, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_eta"].resize(i, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_phi"].resize(i, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_e"].resize(i, std::vector<float>()); + m_VarRCjetsubBranches[VarRC+"_"+name+"_sub_mv2c10"].resize(i, std::vector<float>()); + } // end loop over mass parameters + } // end loop over multipliers for mass scale + } // end if make VarRC jets + // end VarRC jets + + + //met + m_met_met = event.m_met->met(); + m_met_phi = event.m_met->phi(); + + //KLFitter + if (m_config->doKLFitter()) { + unsigned int nPermutations(0),iPerm(0),bestPerm(0); + bool validKLFitter(false); + m_klfitter_selected = 0; + if (event.m_KLFitterResults != nullptr) { + validKLFitter = true; + m_klfitter_selected = 1; + nPermutations = event.m_KLFitterResults->size(); + } + + m_klfitter_minuitDidNotConverge.resize(nPermutations); + m_klfitter_fitAbortedDueToNaN.resize(nPermutations); + m_klfitter_atLeastOneFitParameterAtItsLimit.resize(nPermutations); + m_klfitter_invalidTransferFunctionAtConvergence.resize(nPermutations); + + /// Global result + m_klfitter_bestPermutation.resize(nPermutations); + m_klfitter_logLikelihood.resize(nPermutations); + m_klfitter_eventProbability.resize(nPermutations); + m_klfitter_parameters.resize(nPermutations); + m_klfitter_parameterErrors.resize(nPermutations); + + /// Model + m_klfitter_model_bhad_pt.resize(nPermutations); + m_klfitter_model_bhad_eta.resize(nPermutations); + m_klfitter_model_bhad_phi.resize(nPermutations); + m_klfitter_model_bhad_E.resize(nPermutations); + m_klfitter_model_bhad_jetIndex.resize(nPermutations); + + m_klfitter_model_blep_pt.resize(nPermutations); + m_klfitter_model_blep_eta.resize(nPermutations); + m_klfitter_model_blep_phi.resize(nPermutations); + m_klfitter_model_blep_E.resize(nPermutations); + m_klfitter_model_blep_jetIndex.resize(nPermutations); + + m_klfitter_model_lq1_pt.resize(nPermutations); + m_klfitter_model_lq1_eta.resize(nPermutations); + m_klfitter_model_lq1_phi.resize(nPermutations); + m_klfitter_model_lq1_E.resize(nPermutations); + m_klfitter_model_lq1_jetIndex.resize(nPermutations); + + m_klfitter_model_lq2_pt.resize(nPermutations); + m_klfitter_model_lq2_eta.resize(nPermutations); + m_klfitter_model_lq2_phi.resize(nPermutations); + m_klfitter_model_lq2_E.resize(nPermutations); + m_klfitter_model_lq2_jetIndex.resize(nPermutations); + + if(m_config -> KLFitterLH() == "ttH"){ + + m_klfitter_model_Higgs_b1_pt.resize(nPermutations); + m_klfitter_model_Higgs_b1_eta.resize(nPermutations); + m_klfitter_model_Higgs_b1_phi.resize(nPermutations); + m_klfitter_model_Higgs_b1_E.resize(nPermutations); + m_klfitter_model_Higgs_b1_jetIndex.resize(nPermutations); + + m_klfitter_model_Higgs_b2_pt.resize(nPermutations); + m_klfitter_model_Higgs_b2_eta.resize(nPermutations); + m_klfitter_model_Higgs_b2_phi.resize(nPermutations); + m_klfitter_model_Higgs_b2_E.resize(nPermutations); + m_klfitter_model_Higgs_b2_jetIndex.resize(nPermutations); + + } + + m_klfitter_model_lep_pt.resize(nPermutations); + m_klfitter_model_lep_eta.resize(nPermutations); + m_klfitter_model_lep_phi.resize(nPermutations); + m_klfitter_model_lep_E.resize(nPermutations); + + m_klfitter_model_nu_pt.resize(nPermutations); + m_klfitter_model_nu_eta.resize(nPermutations); + m_klfitter_model_nu_phi.resize(nPermutations); + m_klfitter_model_nu_E.resize(nPermutations); + + if (validKLFitter) { + for (const auto* const klPtr : *event.m_KLFitterResults) { + m_klfitter_minuitDidNotConverge[iPerm] = klPtr->minuitDidNotConverge(); + m_klfitter_fitAbortedDueToNaN[iPerm] = klPtr->fitAbortedDueToNaN(); + m_klfitter_atLeastOneFitParameterAtItsLimit[iPerm] = klPtr->atLeastOneFitParameterAtItsLimit(); + m_klfitter_invalidTransferFunctionAtConvergence[iPerm] = klPtr->invalidTransferFunctionAtConvergence(); + + /// Global result + m_klfitter_bestPermutation[iPerm] = klPtr->bestPermutation(); + if (klPtr->bestPermutation() == 1){ + bestPerm = iPerm; + } + m_klfitter_logLikelihood[iPerm] = klPtr->logLikelihood(); + m_klfitter_eventProbability[iPerm] = klPtr->eventProbability(); + m_klfitter_parameters[iPerm] = klPtr->parameters(); + m_klfitter_parameterErrors[iPerm] = klPtr->parameterErrors(); + + /// Model + 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(); + m_klfitter_model_bhad_E[iPerm] = klPtr->model_bhad_E(); + m_klfitter_model_bhad_jetIndex[iPerm] = klPtr->model_bhad_jetIndex(); + + m_klfitter_model_blep_pt[iPerm] = klPtr->model_blep_pt(); + m_klfitter_model_blep_eta[iPerm] = klPtr->model_blep_eta(); + m_klfitter_model_blep_phi[iPerm] = klPtr->model_blep_phi(); + m_klfitter_model_blep_E[iPerm] = klPtr->model_blep_E(); + m_klfitter_model_blep_jetIndex[iPerm] = klPtr->model_blep_jetIndex(); + + m_klfitter_model_lq1_pt[iPerm] = klPtr->model_lq1_pt(); + m_klfitter_model_lq1_eta[iPerm] = klPtr->model_lq1_eta(); + m_klfitter_model_lq1_phi[iPerm] = klPtr->model_lq1_phi(); + m_klfitter_model_lq1_E[iPerm] = klPtr->model_lq1_E(); + m_klfitter_model_lq1_jetIndex[iPerm] = klPtr->model_lq1_jetIndex(); + + m_klfitter_model_lq2_pt[iPerm] = klPtr->model_lq2_pt(); + m_klfitter_model_lq2_eta[iPerm] = klPtr->model_lq2_eta(); + m_klfitter_model_lq2_phi[iPerm] = klPtr->model_lq2_phi(); + m_klfitter_model_lq2_E[iPerm] = klPtr->model_lq2_E(); + m_klfitter_model_lq2_jetIndex[iPerm] = klPtr->model_lq2_jetIndex(); + + if(m_config -> KLFitterLH() == "ttH"){ + + m_klfitter_model_Higgs_b1_pt[iPerm] = klPtr->model_Higgs_b1_pt(); + m_klfitter_model_Higgs_b1_eta[iPerm] = klPtr->model_Higgs_b1_eta(); + m_klfitter_model_Higgs_b1_phi[iPerm] = klPtr->model_Higgs_b1_phi(); + m_klfitter_model_Higgs_b1_E[iPerm] = klPtr->model_Higgs_b1_E(); + m_klfitter_model_Higgs_b1_jetIndex[iPerm] = klPtr->model_Higgs_b1_jetIndex(); + + m_klfitter_model_Higgs_b2_pt[iPerm] = klPtr->model_Higgs_b2_pt(); + m_klfitter_model_Higgs_b2_eta[iPerm] = klPtr->model_Higgs_b2_eta(); + m_klfitter_model_Higgs_b2_phi[iPerm] = klPtr->model_Higgs_b2_phi(); + m_klfitter_model_Higgs_b2_E[iPerm] = klPtr->model_Higgs_b2_E(); + m_klfitter_model_Higgs_b2_jetIndex[iPerm] = klPtr->model_Higgs_b2_jetIndex(); + + } + + m_klfitter_model_lep_pt[iPerm] = klPtr->model_lep_pt(); + m_klfitter_model_lep_eta[iPerm] = klPtr->model_lep_eta(); + m_klfitter_model_lep_phi[iPerm] = klPtr->model_lep_phi(); + m_klfitter_model_lep_E[iPerm] = klPtr->model_lep_E(); + + m_klfitter_model_nu_pt[iPerm] = klPtr->model_nu_pt(); + m_klfitter_model_nu_eta[iPerm] = klPtr->model_nu_eta(); + m_klfitter_model_nu_phi[iPerm] = klPtr->model_nu_phi(); + m_klfitter_model_nu_E[iPerm] = klPtr->model_nu_E(); + + + ++iPerm; + } + + // now take the best permutation and build the tops and the ttbar system! + + TLorentzVector bhad,blep,lq1,lq2,lep,nu,top_had,top_lep,ttbar; + + bhad.SetPtEtaPhiE(m_klfitter_model_bhad_pt[bestPerm], m_klfitter_model_bhad_eta[bestPerm], m_klfitter_model_bhad_phi[bestPerm], m_klfitter_model_bhad_E[bestPerm]); + blep.SetPtEtaPhiE(m_klfitter_model_blep_pt[bestPerm], m_klfitter_model_blep_eta[bestPerm], m_klfitter_model_blep_phi[bestPerm], m_klfitter_model_blep_E[bestPerm]); + lq1.SetPtEtaPhiE(m_klfitter_model_lq1_pt[bestPerm], m_klfitter_model_lq1_eta[bestPerm], m_klfitter_model_lq1_phi[bestPerm], m_klfitter_model_lq1_E[bestPerm]); + lq2.SetPtEtaPhiE(m_klfitter_model_lq2_pt[bestPerm], m_klfitter_model_lq2_eta[bestPerm], m_klfitter_model_lq2_phi[bestPerm], m_klfitter_model_lq2_E[bestPerm]); + lep.SetPtEtaPhiE(m_klfitter_model_lep_pt[bestPerm], m_klfitter_model_lep_eta[bestPerm], m_klfitter_model_lep_phi[bestPerm], m_klfitter_model_lep_E[bestPerm]); + nu.SetPtEtaPhiE(m_klfitter_model_nu_pt[bestPerm], m_klfitter_model_nu_eta[bestPerm], m_klfitter_model_nu_phi[bestPerm], m_klfitter_model_nu_E[bestPerm]); + + top_had = bhad+lq1+lq2; + top_lep = blep+lep+nu; + ttbar = top_had+top_lep; + + m_klfitter_bestPerm_topLep_pt = top_lep.Pt(); + m_klfitter_bestPerm_topLep_eta = top_lep.Eta(); + m_klfitter_bestPerm_topLep_phi = top_lep.Phi(); + m_klfitter_bestPerm_topLep_E = top_lep.E(); + m_klfitter_bestPerm_topLep_m = top_lep.M(); + + m_klfitter_bestPerm_topHad_pt = top_had.Pt(); + m_klfitter_bestPerm_topHad_eta = top_had.Eta(); + m_klfitter_bestPerm_topHad_phi = top_had.Phi(); + m_klfitter_bestPerm_topHad_E = top_had.E(); + m_klfitter_bestPerm_topHad_m = top_had.M(); + + m_klfitter_bestPerm_ttbar_pt = ttbar.Pt(); + m_klfitter_bestPerm_ttbar_eta = ttbar.Eta(); + m_klfitter_bestPerm_ttbar_phi = ttbar.Phi(); + m_klfitter_bestPerm_ttbar_E = ttbar.E(); + m_klfitter_bestPerm_ttbar_m = ttbar.M(); + + + + } + + } + + if(m_config->doPseudoTop()){ + + const xAOD::PseudoTopResultContainer* pseudoTopResultContainer(nullptr); + const xAOD::PseudoTopResult* pseudoTopResult(nullptr); + + if (evtStore()->contains<xAOD::PseudoTopResultContainer>(m_config->sgKeyPseudoTop(event.m_hashValue))) { + top::check(evtStore()->retrieve(pseudoTopResultContainer, m_config->sgKeyPseudoTop(event.m_hashValue)),"Failed to retrieve PseudoTop"); + + pseudoTopResult = pseudoTopResultContainer->at(0); + + m_PseudoTop_Reco_ttbar_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_ttbar_pt"); + m_PseudoTop_Reco_ttbar_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_ttbar_eta"); + m_PseudoTop_Reco_ttbar_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_ttbar_phi"); + m_PseudoTop_Reco_ttbar_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_ttbar_m"); + + m_PseudoTop_Reco_top_lep_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_lep_pt"); + m_PseudoTop_Reco_top_lep_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_lep_eta"); + m_PseudoTop_Reco_top_lep_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_lep_phi"); + m_PseudoTop_Reco_top_lep_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_lep_m"); + + m_PseudoTop_Reco_top_had_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_had_pt"); + m_PseudoTop_Reco_top_had_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_had_eta"); + m_PseudoTop_Reco_top_had_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_had_phi"); + m_PseudoTop_Reco_top_had_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Reco_top_had_m"); + + + } + } + + //do it! + m_treeManagers[event.m_ttreeIndex]->fill(); + } + + + void EventSaverFlatNtuple::saveTruthEvent() + { + + const xAOD::EventInfo* eventInfo(nullptr); + top::check( evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()) , "Failed to retrieve EventInfo" ); + + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth event container" ); + unsigned int truthEventSize = truthEvent->size(); + top::check( truthEventSize==1 , "Failed to retrieve truth PDF info - truth event container size is different from 1 (strange)" ); + +// m_weight_mc = eventInfo -> mcEventWeight(); + m_weight_mc = truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + m_eventNumber = eventInfo -> eventNumber(); + m_runNumber = eventInfo -> runNumber(); + m_mcChannelNumber = eventInfo -> mcChannelNumber(); + m_mu = eventInfo->averageInteractionsPerCrossing(); + if (m_config->doPileupReweighting() && !m_config->isTruthDxAOD()) { + m_weight_pileup = eventInfo->auxdataConst<float>("PileupWeight"); + m_randomRunNumber = eventInfo->auxdataConst<unsigned int>("RandomRunNumber"); + } + else { + m_weight_pileup = NAN; + m_randomRunNumber = 0; + } + + //MC particle + if (m_config->useTruthParticles() && m_config->doTruthBlockInfo()) { + + const xAOD::TruthParticleContainer* truth(nullptr); + top::check( evtStore()->retrieve(truth,m_config->sgKeyMCParticle()) , "Failed to retrieve TruthParticleContainer" ); + + if (truth != nullptr) { + unsigned int i(0); + unsigned int truthSize = truth->size(); + m_mc_pt.resize(truthSize); + m_mc_eta.resize(truthSize); + m_mc_phi.resize(truthSize); + m_mc_e.resize(truthSize); + m_mc_pdgId.resize(truthSize); + for (const auto* const mcPtr : *truth) { + + // Fix for + // Warning in <TVector3::PseudoRapidity>: transvers momentum = 0! return +/- 10e10 + + float eta(-999.9); + + if ( !( mcPtr->p4().CosTheta()*mcPtr->p4().CosTheta() >= 1 && mcPtr->p4().Pz() != 0 ) ) { + eta = mcPtr->eta(); + } + + m_mc_pt[i] = mcPtr->pt(); + m_mc_eta[i] = eta; + m_mc_phi[i] = mcPtr->phi(); + m_mc_e[i] = mcPtr->e(); + m_mc_pdgId[i] = mcPtr->pdgId(); + ++i; + } + } + } + + if (m_config->doTruthPDFInfo()) { + // delegate to helper function. + loadPdfInfo(); + } + + if (m_config->doMCGeneratorWeights()) { + // delegate to helper function. + loadMCGeneratorWeights(); + } + + if (m_config->doTopPartonHistory()) { + + const xAOD::PartonHistoryContainer* partonHistoryContainer(nullptr); + const xAOD::PartonHistory* partonHistory(nullptr); + if (evtStore()->contains<xAOD::PartonHistoryContainer>(m_config->sgKeyTopPartonHistory())) { + top::check(evtStore()->retrieve(partonHistoryContainer, m_config->sgKeyTopPartonHistory()),"Failed to retrieve Top Parton History"); + if (partonHistoryContainer->size() == 1) { + partonHistory = partonHistoryContainer->at(0); + } + } + + if (partonHistory != nullptr) { + if (!m_config->isTopPartonHistoryRegisteredInNtuple()) { + registerObjectIntoTruthTree( *(partonHistory) ); + m_config->setTopPartonHistoryRegisteredInNtuple(); + } + saveObjectIntoTruthTree( *(partonHistory) ); + } + + } + + if( m_config->saveLHAPDFEvent() ){ + // Delegate to helper function. + loadPdfWeights(); + } + + m_truthTreeManager->fill(); + + } + + void EventSaverFlatNtuple::saveParticleLevelEvent(const top::ParticleLevelEvent& plEvent){ + // Quick return if particle level is disabled. No tree will be created! + if ( not m_config->doTopParticleLevel() ){ + return; + } + + // Setup the TTree. This should come at the very top in order to make sure + // that event for non-MC data, the TTree will be created (but remains empty). + setupParticleLevelTreeManager( plEvent ); + + // No need to attempt to write out anything for non-MC data. + if ( ! m_config->isMC() ){ + return; + } + + for ( auto & selectionDecision : m_particleLevel_SelectionDecisions ){ + selectionDecision.second = plEvent.m_selectionDecisions[ selectionDecision.first ]; + } + + // to get the fixed mc weight + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth event container" ); + unsigned int truthEventSize = truthEvent->size(); + top::check( truthEventSize==1 , "Failed to retrieve truth PDF info - truth event container size is different from 1 (strange)" ); + +// m_weight_mc = plEvent.m_info->mcEventWeight(); + m_weight_mc = truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + m_eventNumber = plEvent.m_info->eventNumber(); + m_runNumber = plEvent.m_info->runNumber(); + m_mcChannelNumber = plEvent.m_info->mcChannelNumber(); + + m_mu = plEvent.m_info->averageInteractionsPerCrossing(); + + if (m_config->doPileupReweighting() && !m_config->isTruthDxAOD()) { + m_weight_pileup = plEvent.m_info->auxdataConst<float>("PileupWeight"); + m_randomRunNumber = plEvent.m_info->auxdataConst<unsigned int>("RandomRunNumber"); + } + else { + m_weight_pileup = NAN; + m_randomRunNumber = 0; + } + + //electrons + if ( m_config->useTruthElectrons() ){ + unsigned int i = 0; + + m_el_pt.resize(plEvent.m_electrons->size()); + m_el_eta.resize(plEvent.m_electrons->size()); + m_el_phi.resize(plEvent.m_electrons->size()); + m_el_e.resize(plEvent.m_electrons->size()); + m_el_charge.resize(plEvent.m_electrons->size()); + + m_el_pt_bare.resize(plEvent.m_electrons->size()); + m_el_eta_bare.resize(plEvent.m_electrons->size()); + m_el_phi_bare.resize(plEvent.m_electrons->size()); + m_el_e_bare.resize(plEvent.m_electrons->size()); + + for (const auto & elPtr : * plEvent.m_electrons) { + m_el_pt[i] = elPtr->pt(); + m_el_eta[i] = elPtr->eta(); + m_el_phi[i] = elPtr->phi(); + m_el_e[i] = elPtr->e(); + m_el_charge[i] = elPtr->charge(); + + m_el_pt_bare[i] = elPtr->auxdata<float>( "pt_bare" ); + m_el_eta_bare[i] = elPtr->auxdata<float>( "eta_bare" ); + m_el_phi_bare[i] = elPtr->auxdata<float>( "phi_bare" ); + m_el_e_bare[i] = elPtr->auxdata<float>( "e_bare" ); + + ++i; + } + } + + //muons + if ( m_config->useTruthMuons() ){ + unsigned int i = 0; + + m_mu_pt.resize(plEvent.m_muons->size()); + m_mu_eta.resize(plEvent.m_muons->size()); + m_mu_phi.resize(plEvent.m_muons->size()); + m_mu_e.resize(plEvent.m_muons->size()); + m_mu_charge.resize(plEvent.m_muons->size()); + + m_mu_pt_bare.resize(plEvent.m_muons->size()); + m_mu_eta_bare.resize(plEvent.m_muons->size()); + m_mu_phi_bare.resize(plEvent.m_muons->size()); + m_mu_e_bare.resize(plEvent.m_muons->size()); + + for (const auto & muPtr : * plEvent.m_muons) { + m_mu_pt[i] = muPtr->pt(); + m_mu_eta[i] = muPtr->eta(); + m_mu_phi[i] = muPtr->phi(); + m_mu_e[i] = muPtr->e(); + m_mu_charge[i] = muPtr->charge(); + + m_mu_pt_bare[i] = muPtr->auxdata<float>( "pt_bare" ); + m_mu_eta_bare[i] = muPtr->auxdata<float>( "eta_bare" ); + m_mu_phi_bare[i] = muPtr->auxdata<float>( "phi_bare" ); + m_mu_e_bare[i] = muPtr->auxdata<float>( "e_bare" ); + + ++i; + } + } + + //photons + if (m_config->useTruthPhotons()) { + unsigned int i(0); + m_ph_pt.resize(plEvent.m_photons->size()); + m_ph_eta.resize(plEvent.m_photons->size()); + m_ph_phi.resize(plEvent.m_photons->size()); + m_ph_e.resize(plEvent.m_photons->size()); + for (const auto* const phPtr : * plEvent.m_photons) { + m_ph_pt[i] = phPtr->pt(); + m_ph_eta[i] = phPtr->eta(); + m_ph_phi[i] = phPtr->phi(); + m_ph_e[i] = phPtr->e(); + + ++i; + } + } + + //jets + if ( m_config->useTruthJets() ){ + unsigned int i = 0; + + m_jet_pt.resize(plEvent.m_jets->size()); + m_jet_eta.resize(plEvent.m_jets->size()); + m_jet_phi.resize(plEvent.m_jets->size()); + m_jet_e.resize(plEvent.m_jets->size()); + m_jet_Ghosts_BHadron_Final_Count.resize(plEvent.m_jets->size()); + m_jet_Ghosts_CHadron_Final_Count.resize(plEvent.m_jets->size()); + for (const auto & jetPtr : * plEvent.m_jets) { + m_jet_pt[i] = jetPtr->pt(); + m_jet_eta[i] = jetPtr->eta(); + m_jet_phi[i] = jetPtr->phi(); + m_jet_e[i] = jetPtr->e(); + + m_jet_Ghosts_BHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostBHadronsFinalCount" ); + m_jet_Ghosts_CHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostCHadronsFinalCount" ); + + ++i; + } + } + + //large R jets + if ( m_config->useTruthLargeRJets() ){ + unsigned int i = 0; + + m_ljet_pt.resize(plEvent.m_largeRJets->size()); + m_ljet_eta.resize(plEvent.m_largeRJets->size()); + m_ljet_phi.resize(plEvent.m_largeRJets->size()); + m_ljet_e.resize(plEvent.m_largeRJets->size()); + m_ljet_Ghosts_BHadron_Final_Count.resize(plEvent.m_largeRJets->size()); + m_ljet_Ghosts_CHadron_Final_Count.resize(plEvent.m_largeRJets->size()); + for (const auto & jetPtr : * plEvent.m_largeRJets) { + m_ljet_pt[i] = jetPtr->pt(); + m_ljet_eta[i] = jetPtr->eta(); + m_ljet_phi[i] = jetPtr->phi(); + m_ljet_e[i] = jetPtr->e(); + + m_ljet_Ghosts_BHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostBHadronsFinalCount" ); + m_ljet_Ghosts_CHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostCHadronsFinalCount" ); + + ++i; + } + } + + //met + if ( m_config->useTruthMET() ){ + m_met_met = plEvent.m_met->met(); + m_met_phi = plEvent.m_met->phi(); + } + + // Let us write the PDF Info into the branch variable(s). + if ( m_config->doTruthPDFInfo() ) { + // Delegate to helper function. + loadPdfInfo(); + } + + if (m_config->doMCGeneratorWeights()) { + // delegate to helper function. + loadMCGeneratorWeights(); + } + + // Let us write the PDF weights into the branch variable(s). + if( m_config->saveLHAPDFEvent() ){ + // Delegate to helper function. + loadPdfWeights(); + } + + if(m_config->doPseudoTop()){ + + const xAOD::PseudoTopResultContainer* pseudoTopResultContainer(nullptr); + const xAOD::PseudoTopResult* pseudoTopResult(nullptr); + + if (evtStore()->contains<xAOD::PseudoTopResultContainer>(m_config->sgKeyPseudoTop(0))) { + top::check(evtStore()->retrieve(pseudoTopResultContainer, m_config->sgKeyPseudoTop(0)), "Failed to retrieve PseudoTop"); + + pseudoTopResult = pseudoTopResultContainer->at(0); + + m_PseudoTop_Particle_ttbar_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_ttbar_pt"); + m_PseudoTop_Particle_ttbar_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_ttbar_eta"); + m_PseudoTop_Particle_ttbar_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_ttbar_phi"); + m_PseudoTop_Particle_ttbar_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_ttbar_m"); + + m_PseudoTop_Particle_top_lep_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_lep_pt"); + m_PseudoTop_Particle_top_lep_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_lep_eta"); + m_PseudoTop_Particle_top_lep_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_lep_phi"); + m_PseudoTop_Particle_top_lep_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_lep_m"); + + m_PseudoTop_Particle_top_had_pt = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_had_pt"); + m_PseudoTop_Particle_top_had_eta = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_had_eta"); + m_PseudoTop_Particle_top_had_phi = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_had_phi"); + m_PseudoTop_Particle_top_had_m = pseudoTopResult -> auxdecor<float>("PseudoTop_Particle_top_had_m"); + + + } + } + + + + //do it! + m_particleLevelTreeManager->fill(); + } + + void EventSaverFlatNtuple::saveUpgradeEvent(const top::ParticleLevelEvent& upgradeEvent){ + // Quick return if upgrade is disabled. No tree will be created! + if ( not m_config->HLLHC() ){ + return; + } + + // Setup the TTree. This should come at the very top in order to make sure + // that event for non-MC data, the TTree will be created (but remains empty). + setupUpgradeTreeManager( /*upgradeEvent*/ ); + + // No need to attempt to write out anything for non-MC data. + if ( ! m_config->isMC() ){ + return; + } + + // to get the fixed mc weight + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth event container" ); + unsigned int truthEventSize = truthEvent->size(); + top::check( truthEventSize==1 , "Failed to retrieve truth PDF info - truth event container size is different from 1 (strange)" ); + +// m_weight_mc = plEvent.m_info->mcEventWeight(); + m_weight_mc = truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + m_eventNumber = upgradeEvent.m_info->eventNumber(); + m_runNumber = upgradeEvent.m_info->runNumber(); + m_mcChannelNumber = upgradeEvent.m_info->mcChannelNumber(); + + m_mu = upgradeEvent.m_info->averageInteractionsPerCrossing(); + + // save electrons + unsigned int i = 0; + m_el_pt.resize(upgradeEvent.m_electrons->size()); + m_el_eta.resize(upgradeEvent.m_electrons->size()); + m_el_phi.resize(upgradeEvent.m_electrons->size()); + m_el_e.resize(upgradeEvent.m_electrons->size()); + m_el_charge.resize(upgradeEvent.m_electrons->size()); + + for (const auto elPtr : * upgradeEvent.m_electrons) { + m_el_pt[i] = elPtr->pt(); + m_el_eta[i] = elPtr->eta(); + m_el_phi[i] = elPtr->phi(); + m_el_e[i] = elPtr->e(); + m_el_charge[i] = elPtr->charge(); + ++i; + } + + // save muons + i = 0; + m_mu_pt.resize(upgradeEvent.m_muons->size()); + m_mu_eta.resize(upgradeEvent.m_muons->size()); + m_mu_phi.resize(upgradeEvent.m_muons->size()); + m_mu_e.resize(upgradeEvent.m_muons->size()); + m_mu_charge.resize(upgradeEvent.m_muons->size()); + + for (const auto muPtr : * upgradeEvent.m_muons) { + m_mu_pt[i] = muPtr->pt(); + m_mu_eta[i] = muPtr->eta(); + m_mu_phi[i] = muPtr->phi(); + m_mu_e[i] = muPtr->e(); + m_mu_charge[i] = muPtr->charge(); + ++i; + } + + // save jets + i = 0; + m_jet_pt.resize(upgradeEvent.m_jets->size()); + m_jet_eta.resize(upgradeEvent.m_jets->size()); + m_jet_phi.resize(upgradeEvent.m_jets->size()); + m_jet_e.resize(upgradeEvent.m_jets->size()); + m_jet_mv1eff.resize(upgradeEvent.m_jets->size()); + m_jet_isPileup.resize(upgradeEvent.m_jets->size()); + m_jet_Ghosts_BHadron_Final_Count.resize(upgradeEvent.m_jets->size()); + m_jet_Ghosts_CHadron_Final_Count.resize(upgradeEvent.m_jets->size()); + for (const auto & jetPtr : * upgradeEvent.m_jets) { + m_jet_pt[i] = jetPtr->pt(); + m_jet_eta[i] = jetPtr->eta(); + m_jet_phi[i] = jetPtr->phi(); + m_jet_e[i] = jetPtr->e(); + + m_jet_mv1eff[i] = jetPtr->auxdata<float>("mv1TagEff"); + + if(jetPtr->auxdata<int>("pileUp")==0) { + m_jet_isPileup[i]=0; + m_jet_Ghosts_BHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostBHadronsFinalCount" ); + m_jet_Ghosts_CHadron_Final_Count[i] = jetPtr->auxdata<int>( "GhostCHadronsFinalCount" ); + } else { + m_jet_isPileup[i]=1; + m_jet_Ghosts_BHadron_Final_Count[i] = 0; + m_jet_Ghosts_CHadron_Final_Count[i] = 0; + } + + ++i; + } + + // MET + m_met_met = upgradeEvent.m_met->met(); + m_met_phi = upgradeEvent.m_met->phi(); + + // fill the tree + m_upgradeTreeManager->fill(); + + }//saveUpgradeEvent + + void EventSaverFlatNtuple::finalize() + { + m_outputFile->Write(); + } + + void EventSaverFlatNtuple::loadPdfInfo(){ + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth PDF info" ); + + if (truthEvent != nullptr) { + unsigned int i(0); + unsigned int truthEventSize = truthEvent->size(); + m_PDFinfo_X1.resize(truthEventSize); + m_PDFinfo_X2.resize(truthEventSize); + m_PDFinfo_PDGID1.resize(truthEventSize); + m_PDFinfo_PDGID2.resize(truthEventSize); + m_PDFinfo_Q.resize(truthEventSize); + m_PDFinfo_XF1.resize(truthEventSize); + m_PDFinfo_XF2.resize(truthEventSize); + + for (const auto * const tePtr : * truthEvent) { + // LMTODO: ASG tools/pdfInfo() can't be used yet, since scale Q is not available + // xAOD::TruthEvent::PdfInfo _pdfInfo=tePtr->pdfInfo(); + // if _pdfInfo.valid() { m_PDFinfo_X1[i] = _pdfInfo.x1; //etc. } + std::string PDFinfoVarName="X1"; + if (truthEvent->isAvailable<float>(PDFinfoVarName)) + m_PDFinfo_X1[i] = (*tePtr).auxdataConst< float >( PDFinfoVarName ); + PDFinfoVarName="X2"; + if (truthEvent->isAvailable<float>(PDFinfoVarName)) + m_PDFinfo_X2[i] = (*tePtr).auxdataConst< float >( PDFinfoVarName ); + PDFinfoVarName="PDGID1"; + if (truthEvent->isAvailable<int>(PDFinfoVarName)) + m_PDFinfo_PDGID1[i] = (*tePtr).auxdataConst< int >( PDFinfoVarName ); + PDFinfoVarName="PDGID2"; + if (truthEvent->isAvailable<int>(PDFinfoVarName)) + m_PDFinfo_PDGID2[i] = (*tePtr).auxdataConst< int >( PDFinfoVarName ); + PDFinfoVarName="XF1"; + if (truthEvent->isAvailable<float>(PDFinfoVarName)) + m_PDFinfo_XF1[i] = (*tePtr).auxdataConst< float >( PDFinfoVarName ); + PDFinfoVarName="XF2"; + if (truthEvent->isAvailable<float>(PDFinfoVarName)) + m_PDFinfo_XF2[i] = (*tePtr).auxdataConst< float >( PDFinfoVarName ); + PDFinfoVarName="Q"; + if (truthEvent->isAvailable<float>(PDFinfoVarName)) + m_PDFinfo_Q[i] = (*tePtr).auxdataConst< float >( PDFinfoVarName ); + ++i; + } + } + } + + void EventSaverFlatNtuple::loadPdfWeights(){ + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth PDF info" ); + + for( auto tePtr : * truthEvent ){ + for( const std::string & pdf_name : m_config->LHAPDFSets() ){ + if( tePtr->isAvailable<std::vector<float> >( "AnalysisTop_" + pdf_name + "_Weights") ){ + m_PDF_eventWeights[ pdf_name ] = tePtr->auxdata<std::vector<float> >("AnalysisTop_" + pdf_name + "_Weights"); + } + } + } + } + + void EventSaverFlatNtuple::loadMCGeneratorWeights(){ + const xAOD::TruthEventContainer * truthEvent(nullptr); + top::check( evtStore()->retrieve(truthEvent, m_config->sgKeyTruthEvent()) , "Failed to retrieve MC Generator weights - impossible to retrieve truth event container" ); + unsigned int truthEventSize = truthEvent->size(); + top::check( truthEventSize==1 , "Failed to retrieve truth PDF info - truth event container size is different from 1 (strange)" ); + m_mc_generator_weights = truthEvent->at(0)->weights(); + } + + + // This bit is new + // It is not optimal and can do with a lot of improvement + // Consider it a first pass + // + // We can save xAOD objects into flat ntuple by looking at their SG::AuxElement data + // + // inspired by: + // https://svnweb.cern.ch/trac/atlasoff/browser/Event/xAOD/xAODCore/tags/xAODCore-00-00-93/Root/PrintHelpers.cxx + + void EventSaverFlatNtuple::registerObjectIntoTruthTree(const SG::AuxElement& obj) + { + // If the container doesn't have an auxiliary store, bail now: + if (!obj.container()->getConstStore()) + return; + + // Get a convenience pointer to the aux type registry: + SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + + // Get the auxiliary IDs of the object: + const SG::auxid_set_t& auxids = + ( obj.container()->getConstStore() ? + obj.container()->getConstStore()->getAuxIDs() : + obj.getConstStore()->getAuxIDs() ); + + // find the variables and fill them + for (SG::auxid_t auxid : auxids) { + // get the type of the variable + const std::type_info* ti = reg.getType( auxid ); + // get the name of the variable + const std::string name = reg.getName( auxid ); + + // Add variable + if (*ti == typeid( int ) ){ + m_extraTruthVars_int.insert( std::make_pair( name , new int ) ); + } + else if (*ti == typeid( float ) ){ + m_extraTruthVars_float.insert( std::make_pair( name , new float ) ); + } + else { + ATH_MSG_INFO("insertObjectIntoTruthTree - you need another variable map for more types!"); + } + } + + // add the variables to the truthTreeManager + for (std::unordered_map<std::string,int*>::const_iterator i=m_extraTruthVars_int.begin();i!=m_extraTruthVars_int.end();++i) { + m_truthTreeManager->makeOutputVariable(*(*i).second,(*i).first); + } + for (std::unordered_map<std::string,float*>::const_iterator i=m_extraTruthVars_float.begin();i!=m_extraTruthVars_float.end();++i) { + m_truthTreeManager->makeOutputVariable(*(*i).second,(*i).first); + } + } + + void EventSaverFlatNtuple::saveObjectIntoTruthTree(const SG::AuxElement& obj) + { + // If the container doesn't have an auxiliary store, bail now: + if (!obj.container()->getConstStore()) + return; + + // Get a convenience pointer to the aux type registry: + SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + // Get the auxiliary IDs of the object: + const SG::auxid_set_t& auxids = + ( obj.container()->getConstStore() ? + obj.container()->getConstStore()->getAuxIDs() : + obj.getConstStore()->getAuxIDs() ); + + // setup new variables + for (SG::auxid_t auxid : auxids) { + // get the type of the variable + const std::type_info* ti = reg.getType( auxid ); + // get the name of the variable + const std::string name = reg.getName( auxid ); + + // Add variable + if (*ti == typeid( int ) ){ + std::unordered_map<std::string,int*>::iterator itr = m_extraTruthVars_int.find( name ); + if (itr != m_extraTruthVars_int.end()) { + *((*itr).second) = obj.auxdataConst<int> (name); + } + } + else if (*ti == typeid( float ) ){ + std::unordered_map<std::string,float*>::iterator itr = m_extraTruthVars_float.find( name ); + if (itr != m_extraTruthVars_float.end()) { + *((*itr).second) = obj.auxdataConst<float> (name); + } + } + else { + ATH_MSG_INFO("saveObjectIntoTruthTree - you need another variable map for more types!"); + } + } + } + + // get short name for FixedCutBEff_* WPs + std::string EventSaverFlatNtuple::shortBtagWP(std::string const & WP) const { + std::string str = "FixedCutBEff_"; + std::string out = WP; + if (out.find(str) != std::string::npos) { + out.replace(out.find(str),str.length(),""); + } + return out; + } + + // remove "FT_EFF_", spaces, and "-" in named systematics + std::string EventSaverFlatNtuple::betterBtagNamedSyst (const std::string name) { + std::string str = "FT_EFF_"; + std::string out = name; + if (out.find(str) != std::string::npos) { + out.replace(out.find(str),str.length(),""); + } + str = " "; + while (out.find(str) != std::string::npos) { + out.replace(out.find(str),str.length(),"_"); + } + str = "-"; + while (out.find(str) != std::string::npos) { + out.replace(out.find(str),str.length(),"_"); + } + return out; + } + +} // namespace diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAOD.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAOD.cxx new file mode 100644 index 0000000000000000000000000000000000000000..34fb1578fa3d234198ab7317a65d466903cd962a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAOD.cxx @@ -0,0 +1,202 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/EventSaverxAOD.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/SystematicEvent.h" + +#include "TopPartons/PartonHistory.h" + +#include "TopConfiguration/TopConfig.h" + +#include "xAODRootAccess/TEvent.h" + +#include "TFile.h" + +namespace top { + +EventSaverxAOD::EventSaverxAOD() : + asg::AsgTool( "top::EventSaverxAOD" ), + m_prefix("CorrectedSelected"), + m_config(nullptr), + m_outputFile(nullptr) { +} + +EventSaverxAOD::~EventSaverxAOD() +{ +} + +void EventSaverxAOD::initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches) { + m_config = config; + m_outputFile = file; + top::check(evtStore()->event()->writeTo(m_outputFile), "EventSaverxAOD trying to call writeTo on output file"); + + //EventInfo + std::string eventInfoList = "runNumber.eventNumber.eventTypeBitmask.averageInteractionsPerCrossing"; + if (config->isMC()) + eventInfoList += ".mcChannelNumber.mcEventWeights.PileupWeight"; + + //Add extra branches - e.g. if it passed the ee / mumu / emu selection per event + for (const auto& branchName : extraBranches) + eventInfoList += "." + branchName; + + //std::cout << "EventLoaderCorrectSelect::branchesToSave - EventInfo " << eventInfoList << std::endl; + evtStore()->event()->setAuxItemList("EventInfoAux.", eventInfoList); + + //Electrons + evtStore()->event()->setAuxItemList(m_prefix + m_config->sgKeyElectrons() + "Aux.", "pt.eta.phi.m.charge"); + + //Muons + evtStore()->event()->setAuxItemList(m_prefix + m_config->sgKeyMuons() + "Aux.", "pt.eta.phi.m.charge.muonType.combinedTrackParticleLink"); + + //Once mu has a built-in charge we can get rid of this + //Muon charge is a property of the associated track - e.g. d0.z0.phi.theta.qOverP + evtStore()->event()->setAuxItemList("InDetTrackParticlesAux.", "qOverP"); + evtStore()->event()->setAuxItemList("ExtrapolatedMuonTrackParticlesAux.", "qOverP"); + evtStore()->event()->setAuxItemList("CombinedMuonTrackParticlesAux.", "qOverP"); + + //Jets + evtStore()->event()->setAuxItemList(m_prefix + m_config->sgKeyJets() + "Aux.", "pt.eta.phi.m.btaggingLink"); + + //b-tagging + const std::string btagName = "BTagging_" + m_config->sgKeyJets().substr(0, m_config->sgKeyJets().size() - 4); + evtStore()->event()->setAuxItemList(btagName + "Aux.", "MV1_discriminant"); + + //MET seems to be pretty small already +} + +void EventSaverxAOD::saveEvent(const top::Event& event) { + //only save the nominal variation for now - speak to Attila about TEvent.fill not taking a tree name + if (event.m_hashValue != m_config->nominalHashValue()) + return; + + // record the event? + if (m_config->saveOnlySelectedEvents() && !event.m_saveEvent) + return; + + // Systematic Event + const xAOD::SystematicEventContainer* allSystematics(nullptr); + top::check(evtStore()->retrieve(allSystematics,m_config->sgKeyTopSystematicEvents()) , "Failed to retrieve xAOD::SystematicEventContainer" ); + + xAOD::SystematicEventContainer* allSystematics_output = new xAOD::SystematicEventContainer{}; + SG::IAuxStore* allSystematics_aux = evtStore()->event()->recordAux( m_config->sgKeyTopSystematicEvents() + "Aux." ); + allSystematics_output->setStore( allSystematics_aux ); + for (auto currentSystematic : *allSystematics) { + xAOD::SystematicEvent* out = new xAOD::SystematicEvent{}; + out->makePrivateStore( *currentSystematic ); + allSystematics_output->push_back( out ); + } + top::check(evtStore()->event()->record(allSystematics_output,m_config->sgKeyTopSystematicEvents()),"Failed to record xAOD::SystematicEventContainer" ); + + + // Top Parton History + if (m_config->doTopPartonHistory()) { + if (evtStore()->contains<xAOD::PartonHistoryContainer>(m_config->sgKeyTopPartonHistory())) { + const xAOD::PartonHistoryContainer* partonHistory(nullptr); + top::check(evtStore()->retrieve(partonHistory, m_config->sgKeyTopPartonHistory()),"Failed to retrieve Top Parton History"); + + xAOD::PartonHistoryContainer* partonHistory_output = new xAOD::PartonHistoryContainer{}; + SG::IAuxStore* partonHistory_aux = evtStore()->event()->recordAux( m_config->sgKeyTopPartonHistory() + "Aux." ); + partonHistory_output->setStore( partonHistory_aux ); + for (auto x : *partonHistory) { + xAOD::PartonHistory* out = new xAOD::PartonHistory{}; + out->makePrivateStore( *x ); + partonHistory_output->push_back( out ); + } + top::check(evtStore()->event()->record(partonHistory_output,m_config->sgKeyTopPartonHistory()),"Failed to record Parton History" ); + } + } + + + + //Event Info + top::check(evtStore()->event()->copy("EventInfo"), "copying event info failed"); + + //Electrons + if (m_config->useElectrons()) { + xAOD::ElectronContainer* electrons_output = new xAOD::ElectronContainer(); + SG::IAuxStore* electrons_aux = evtStore()->event()->recordAux(m_prefix + m_config->sgKeyElectrons() + "Aux."); + electrons_output->setStore(electrons_aux); + + for (const auto* const elPtr : event.m_electrons) { + xAOD::Electron* outputElPtr = new xAOD::Electron(); + outputElPtr->makePrivateStore(*elPtr); + electrons_output->push_back(outputElPtr); + } + + top::check(evtStore()->event()->record(electrons_output, m_prefix + m_config->sgKeyElectrons()), "xAOD::TEvent record " + m_prefix + m_config->sgKeyElectrons() + " failed"); + } + + //Muons + if (m_config->useMuons()) { + xAOD::MuonContainer* muons_output = new xAOD::MuonContainer(); + SG::IAuxStore* muons_aux = evtStore()->event()->recordAux(m_prefix + m_config->sgKeyMuons() + "Aux."); + muons_output->setStore(muons_aux); + + for (const auto* const muPtr : event.m_muons) { + xAOD::Muon* outputMuPtr = new xAOD::Muon(); + outputMuPtr->makePrivateStore(*muPtr); + muons_output->push_back(outputMuPtr); + } + + top::check(evtStore()->event()->record(muons_output, m_prefix + m_config->sgKeyMuons()), "xAOD::TEvent record " + m_prefix + m_config->sgKeyMuons() + " failed"); + + //for now... + //Muon charge is a property of the associated track + //Copy tracks (for muon charge) + check(evtStore()->event()->copy("InDetTrackParticles"), "xAOD::TEvent copy InDetTrackParticles failed"); + check(evtStore()->event()->copy("ExtrapolatedMuonTrackParticles"), "xAOD::TEvent copy InDetTrackParticles ExtrapolatedMuonTrackParticles"); + check(evtStore()->event()->copy("CombinedMuonTrackParticles"), "xAOD::TEvent copy InDetTrackParticles CombinedMuonTrackParticles"); + } + + //Jets + if (m_config->useJets()) { + xAOD::JetContainer* jets_output = new xAOD::JetContainer(); + SG::IAuxStore* jets_aux = evtStore()->event()->recordAux(m_prefix + m_config->sgKeyJets() + "Aux."); + jets_output->setStore(jets_aux); + + for (const auto* const jetPtr : event.m_jets) { + xAOD::Jet* outputJetPtr = new xAOD::Jet(); + outputJetPtr->makePrivateStore(*jetPtr); + jets_output->push_back(outputJetPtr); + } + + top::check(evtStore()->event()->record(jets_output, m_prefix + m_config->sgKeyJets()), "xAOD::TEvent record " + m_prefix + m_config->sgKeyJets() + " failed"); + + //b-tagging variables need the BTagging_JetNameWithoutJetsOnTheEnd container + //remove Jets from the end of the container name and add BTagging_ + const std::string btagName = "BTagging_" + m_config->sgKeyJets().substr(0, m_config->sgKeyJets().size() - 4); + check(evtStore()->event()->copy(btagName), "xAOD::TEvent copy " + btagName + " failed"); + } + + //Large Jets + if (m_config->useLargeRJets()) { + xAOD::JetContainer* largeJets_output = new xAOD::JetContainer(); + SG::IAuxStore* largeJets_aux = evtStore()->event()->recordAux(m_prefix + m_config->sgKeyLargeRJets() + "Aux."); + largeJets_output->setStore(largeJets_aux); + + for (const auto* const jetPtr : event.m_largeJets) { + xAOD::Jet* outputJetPtr = new xAOD::Jet(); + outputJetPtr->makePrivateStore(*jetPtr); + largeJets_output->push_back(outputJetPtr); + } + + check(evtStore()->event()->record(largeJets_output, m_prefix + m_config->sgKeyLargeRJets()), "xAOD::TEvent record " + m_prefix + m_config->sgKeyLargeRJets() + " failed"); + } + + //MET + top::check(evtStore()->event()->copy(m_config->sgKeyMissingEt()), "xAOD::TEvent copy " + m_config->sgKeyMissingEt() + " failed"); + + //do it! + top::check(evtStore()->event()->fill(), "xAOD::TEvent fill failed"); +} + +void EventSaverxAOD::finalize() { + m_outputFile->Write(); + top::check(evtStore()->event()->finishWritingTo(m_outputFile), "EventSaverxAOD::finalise trying to call finishWritingTo"); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAODNext.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAODNext.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7845c85afc7953d81140d0ae78851131d8379deb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverxAODNext.cxx @@ -0,0 +1,665 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/EventSaverxAODNext.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/SystematicEvent.h" + +#include "TopPartons/PartonHistory.h" + +#include "TopConfiguration/ConfigurationSettings.h" +#include "TopConfiguration/TopConfig.h" + +#include "xAODRootAccess/TEvent.h" + +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODJet/JetContainer.h" +// #include "xAODBtagging/BTaggingContainer.h" +#include "xAODMissingET/MissingETContainer.h" + + +#include "TFile.h" + +namespace top { + + EventSaverxAODNext::EventSaverxAODNext() : + asg::AsgMetadataTool( "top::EventSaverxAODNext" ), + m_config(nullptr), + m_outputFile(nullptr), + m_saveAllObjects(false) + { + } + + EventSaverxAODNext::~EventSaverxAODNext() + { + } + + void EventSaverxAODNext::initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches) { + m_config = config; + m_outputFile = file; + top::check(evtStore()->event()->writeTo(m_outputFile), "EventSaverxAODNext trying to call writeTo on output file"); + + // Persist the top::TopConfig settings - we'll need this to make sense of the output when reading it back + top::check( outputMetaStore()->record( m_config->createPersistentSettings() , "TopPersistentSettings" ) , "Failed to save TopPersistentSettings" ); + auto* const settings = top::ConfigurationSettings::get(); + + //EventInfo + std::string eventInfoList = settings->value("EventVariableSaveList"); + if (config->isMC()) + eventInfoList += ".mcChannelNumber.mcEventWeights"; + + //Add extra branches - e.g. if it passed the ee / mumu / emu selection per event + for (const auto& branchName : extraBranches) + eventInfoList += "." + branchName; + + //std::cout << "EventLoaderCorrectSelect::branchesToSave - EventInfo " << eventInfoList << std::endl; + evtStore()->event()->setAuxItemList("EventInfoAux.", eventInfoList); + + // Photons + if (m_config->usePhotons()) { + std::string photonVariableSaveList = settings->value("PhotonVariableSaveList"); + if (config->isMC()) { + photonVariableSaveList += ".truthType.truthOrigin"; + } + + for (auto currentSystematic : *m_config->systSgKeyMapPhotons()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , photonVariableSaveList ); + } + } // Photons + + // Electrons + if (m_config->useElectrons()) { + std::string electronVariableSaveList = settings->value("ElectronVariableSaveList"); + if (config->isMC()) { + electronVariableSaveList += ".truthType.truthOrigin"; + } + + for (auto currentSystematic : *m_config->systSgKeyMapElectrons()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , electronVariableSaveList ); + } + } // Electrons + + // Muons + if (m_config->useMuons()) { + std::string muonVariableSaveList = settings->value("MuonVariableSaveList"); + + // When these variables exist + // if (config->isMC()) { + // muonVariableSaveList += ".truthType.truthOrigin"; + // } + + for (auto currentSystematic : *m_config->systSgKeyMapMuons()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , muonVariableSaveList ); + } + } // Muons + + // Taus + if (m_config->useTaus()) { + std::string tauVariableSaveList = settings->value("TauVariableSaveList"); + + for (auto currentSystematic : *m_config->systSgKeyMapTaus()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , tauVariableSaveList ); + } + } // Taus + + + // Jets + if (m_config->useJets()) { + std::string jetVariableSaveList = settings->value("JetVariableSaveList"); + + for (auto currentSystematic : *m_config->systSgKeyMapJets(false)) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , jetVariableSaveList ); + } + } + + if (m_config->useLargeRJets()) { + std::string jetVariableSaveList = settings->value("JetVariableSaveList"); + + for (auto currentSystematic : *m_config->systSgKeyMapLargeRJets()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , jetVariableSaveList ); + } + } + + if (m_config->useTrackJets()) { + std::string jetVariableSaveList = settings->value("JetVariableSaveList"); + + for (auto currentSystematic : *m_config->systSgKeyMapTrackJets()) { + std::string sgKey = currentSystematic.second; + evtStore()->event()->setAuxItemList(sgKey + "Aux." , jetVariableSaveList ); + } + } + + if (m_config->useJets() || m_config->useLargeRJets() || m_config->useTrackJets()) { + // B-tagging + std::string bTagVariableSaveList = settings->value("BTagVariableSaveList"); + evtStore()->event()->setAuxItemList("BTagging_AntiKt4EMTopoAux.",bTagVariableSaveList); + } // B-tagging + + + } + + void EventSaverxAODNext::saveEventToxAOD() + { + // Systematic Event + const xAOD::SystematicEventContainer* allSystematics(nullptr); + top::check(evtStore()->retrieve(allSystematics,m_config->sgKeyTopSystematicEvents()) , "Failed to retrieve xAOD::SystematicEventContainer" ); + + // Save all reco event objects? + // If no systematic in the event passes the event selection + // We don't fill the collections - this saves a lot of disk space + bool saveEvent(false),saveEventObjects(false); + if (!m_config->saveOnlySelectedEvents()) { + saveEvent = true; + } + if (m_config->saveOnlySelectedEvents()) { + for (auto x : *allSystematics) { + if (x->auxdataConst<char>(m_config->passEventSelectionDecoration()) == 1) { + saveEvent = true; + saveEventObjects = true; + break; + } + } + } // Save reco event? + + if (saveEvent) { + + //Event Info + top::check(evtStore()->event()->copy("EventInfo"), "copying event info failed"); + + // BTagging - can consider thinning this at some point. + // Tricky computation as all jet collections need updated ElementLinks + top::check(evtStore()->event()->copy("BTagging_AntiKt4EMTopo") , "copying btagging failed" ); + + top::check(evtStore()->event()->copy("egammaClusters"), "copying egamma clusters failed"); + + // Object Thinning maps + std::shared_ptr<ThinningMap_t> photonThinningMap = savePhotons(saveEventObjects); + std::shared_ptr<ThinningMap_t> electronThinningMap = saveElectrons(saveEventObjects); + std::shared_ptr<ThinningMap_t> muonThinningMap = saveMuons(saveEventObjects); + std::shared_ptr<ThinningMap_t> tauThinningMap = saveTaus(saveEventObjects); + std::shared_ptr<ThinningMap_t> jetThinningMap = saveJets(saveEventObjects); + std::shared_ptr<ThinningMap_t> largeRJetThinningMap = saveLargeRJets(saveEventObjects); + std::shared_ptr<ThinningMap_t> trackJetThinningMap = saveTrackJets(saveEventObjects); + + // Save SystematicEventContainer + xAOD::SystematicEventContainer* allSystematics_output = new xAOD::SystematicEventContainer{}; + SG::IAuxStore* allSystematics_output_aux = evtStore()->event()->recordAux( m_config->sgKeyTopSystematicEvents() + "Aux." ); + allSystematics_output->setStore( allSystematics_output_aux ); + if (saveEventObjects) { + for (auto systematicPtr : *allSystematics) { + xAOD::SystematicEvent* out = new xAOD::SystematicEvent{}; + out->makePrivateStore( *systematicPtr ); + out->setGoodPhotons ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodPhotons() , photonThinningMap ) ); + out->setGoodElectrons ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodElectrons() , electronThinningMap ) ); + out->setGoodMuons ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodMuons() , muonThinningMap ) ); + out->setGoodTaus ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodTaus() , tauThinningMap ) ); + out->setGoodJets ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodJets() , jetThinningMap ) ); + out->setGoodLargeRJets( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodLargeRJets() , largeRJetThinningMap ) ); + out->setGoodTrackJets ( thinObjectSelection( systematicPtr->hashValue() , systematicPtr->goodTrackJets() , trackJetThinningMap ) ); + allSystematics_output->push_back( out ); + + // Missing ET + xAOD::MissingETContainer* met(nullptr); + top::check( evtStore()->retrieve(met,m_config->sgKeyMissingEt( systematicPtr->hashValue() ) ) , "Failed to retrieve MET" ); + + xAOD::MissingETContainer* output_met = new xAOD::MissingETContainer{}; + SG::IAuxStore* output_met_aux = evtStore()->event()->recordAux( m_config->sgKeyMissingEt( systematicPtr->hashValue() ) + "Aux." ); + output_met->setStore( output_met_aux ); + for (auto x : *met) { + xAOD::MissingET* out = new xAOD::MissingET{}; + out->makePrivateStore( *x ); + output_met->push_back( out ); + } + top::check( evtStore()->event()->record(output_met,m_config->sgKeyMissingEt( systematicPtr->hashValue() )) , "Failed to save MET" ); + + + } + } + top::check(evtStore()->event()->record(allSystematics_output,m_config->sgKeyTopSystematicEvents()),"Failed to record xAOD::SystematicEventContainer" ); + + // Write to disk + top::check(evtStore()->event()->fill(), "xAOD::TEvent fill failed"); + } + } + + + + std::vector<unsigned int> EventSaverxAODNext::thinObjectSelection(const std::size_t hashValue , + const std::vector<unsigned int>& objectList , + const std::shared_ptr<ThinningMap_t> thinningMap) const + { + // reduced output + std::vector<unsigned int> out; + + // Find the correct systematic in the thinningMap + ThinningMap_Itr Itr = thinningMap->find( hashValue ); + // If the systematic is not in the map, then we use the nominal hashValue + // This happens, for example, when we look at a jet systematic and are looping over electrons + if (Itr == thinningMap->end()) { + Itr = thinningMap->find( m_config->nominalHashValue() ); + } + + // double check that we have a valid systematic + if (Itr != thinningMap->end()) { + + // Get the relevant thinningMap for this specific systematic + std::map<unsigned int,unsigned int> currentSystematicThinningMap = (*Itr).second; + + // Loop over the original good object list, this contains information about objects we are not going to save + // Use the thinningMap to build a new good object list based on the objects we are saving + for (auto i : objectList) { + std::map<unsigned int,unsigned int>::const_iterator Itr2 = currentSystematicThinningMap.find( i ); + if (Itr2 != currentSystematicThinningMap.end()) { + out.push_back( (*Itr2).second ); + } + } + } + + return out; + } + + /** + * All the saveObject functions work the same way + * - we should probably turn this into a template method at some point + * + * We only save objects that pass the pre overlap removal selection + * - This throws away a lot of objects and saves a lot of disk space + * + * We need to consider every calibration systematic variation + * - Each calibration systematic contains a vector of goodIndices used to form top::Event's + * - We need to re-map these vectors if we throw away objects + * - For example, lets consider a dummy jet systematic: + * - calibrated JetContainer has objects [0,1,2,3,4,5,6,7,8] + * - The pre OR selection cuts keep objects [3,4,7] + * - We only want to save objects [3,4,7], objects [0,1,2,5,6,8] are a waste of disk space + * - The saved objects in the output mini-xAOD become [0,1,2] + * - We need to map [ 3->0 , 4->1 , 7->2 ] + * - This needs to be done for each xAOD::SystematicEvent + * + */ + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::savePhotons(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->usePhotons()) { + + for (auto currentSystematic : *m_config->systSgKeyMapPhotons()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::PhotonContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve photons"); + + xAOD::PhotonContainer* output = new xAOD::PhotonContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Photon* out = new xAOD::Photon{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::PhotonContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics; + } // use object type + + return thinningMap; + } + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveElectrons(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useElectrons()) { + + for (auto currentSystematic : *m_config->systSgKeyMapElectrons()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::ElectronContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve electrons"); + + xAOD::ElectronContainer* output = new xAOD::ElectronContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Electron* out = new xAOD::Electron{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + // Reset calo cluster links + for (std::map<unsigned int,unsigned int>::const_iterator i=currentSystematicThinningMap.begin();i!=currentSystematicThinningMap.end();++i) { + output->at((*i).second)->setCaloClusterLinks( xaod->at((*i).first)->caloClusterLinks() ); + } + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::ElectronContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveMuons(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useMuons()) { + + for (auto currentSystematic : *m_config->systSgKeyMapMuons()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::MuonContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve muons"); + + xAOD::MuonContainer* output = new xAOD::MuonContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Muon* out = new xAOD::Muon{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::MuonContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveTaus(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useTaus()) { + + for (auto currentSystematic : *m_config->systSgKeyMapTaus()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::TauJetContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve taus"); + + xAOD::TauJetContainer* output = new xAOD::TauJetContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::TauJet* out = new xAOD::TauJet{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::TauJetContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveJets(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useJets()) { + + for (auto currentSystematic : *m_config->systSgKeyMapJets(false)) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::JetContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve electrons"); + + xAOD::JetContainer* output = new xAOD::JetContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Jet* out = new xAOD::Jet{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + + // Reset b-tagging links + for (std::map<unsigned int,unsigned int>::const_iterator i=currentSystematicThinningMap.begin();i!=currentSystematicThinningMap.end();++i) { + output->at((*i).second)->setBTaggingLink ( xaod->at((*i).first)->btaggingLink() ); + } + + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::JetContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveLargeRJets(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useLargeRJets()) { + + for (auto currentSystematic : *m_config->systSgKeyMapLargeRJets()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::JetContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve electrons"); + + xAOD::JetContainer* output = new xAOD::JetContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Jet* out = new xAOD::Jet{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + + // Reset b-tagging links + for (std::map<unsigned int,unsigned int>::const_iterator i=currentSystematicThinningMap.begin();i!=currentSystematicThinningMap.end();++i) { + output->at((*i).second)->setBTaggingLink ( xaod->at((*i).first)->btaggingLink() ); + } + + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::JetContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + std::shared_ptr<std::map<std::size_t,std::map<unsigned int,unsigned int>>> EventSaverxAODNext::saveTrackJets(const bool saveEventObjects) + { + std::shared_ptr<ThinningMap_t> thinningMap( new ThinningMap_t ); + if (m_config->useTrackJets()) { + + for (auto currentSystematic : *m_config->systSgKeyMapTrackJets()) { + std::map<unsigned int,unsigned int> currentSystematicThinningMap; + std::string sgKey = currentSystematic.second; + const xAOD::JetContainer* xaod(nullptr); + top::check(evtStore()->retrieve(xaod,sgKey),"Failed to retrieve electrons"); + + xAOD::JetContainer* output = new xAOD::JetContainer{}; + SG::IAuxStore* output_aux = evtStore()->event()->recordAux( sgKey + "Aux." ); + output->setStore( output_aux ); + + if( saveEventObjects ) { + unsigned int index(0),indexReduced(0); + for (auto x : *xaod) { + + bool save(m_saveAllObjects); + if (x->isAvailable<char>("passPreORSelection")) { + if (x->auxdataConst<char>("passPreORSelection") == 1) { + save = true; + } + } + if (x->isAvailable<char>("passPreORSelectionLoose")) { + if (x->auxdataConst<char>("passPreORSelectionLoose") == 1) { + save = true; + } + } + + if (save) { + currentSystematicThinningMap.insert( std::make_pair( index , indexReduced ) ); + xAOD::Jet* out = new xAOD::Jet{}; + out->makePrivateStore( *x ); + output->push_back( out ); + ++indexReduced; + } + ++index; + } // Loop over container + + // Reset b-tagging links + for (std::map<unsigned int,unsigned int>::const_iterator i=currentSystematicThinningMap.begin();i!=currentSystematicThinningMap.end();++i) { + output->at((*i).second)->setBTaggingLink ( xaod->at((*i).first)->btaggingLink() ); + } + + } // saveEventObjects + top::check(evtStore()->event()->record(output,sgKey),"Failed to record xAOD::JetContainer"); + thinningMap->insert( std::make_pair(currentSystematic.first, currentSystematicThinningMap) ); + } // Loop over all systematics + } // use object type + + return thinningMap; + } + + void EventSaverxAODNext::finalize() { + m_outputFile->Write(); + top::check(evtStore()->event()->finishWritingTo(m_outputFile), "EventSaverxAODNext::finalise trying to call finishWritingTo"); + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelection.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..90f4fbf746877273a0533e09840dd28392d4c0d2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelection.cxx @@ -0,0 +1,598 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/EventSelection.h" +#include "TopAnalysis/Tools.h" + +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include "TopCorrections/ScaleFactorRetriever.h" + +#include "PATInterfaces/SystematicSet.h" + +#include <iomanip> +#include <sstream> +#include <cassert> +#include <utility> + +#include "TH1D.h" +#include "TFile.h" +#include "TClass.h" +#include "TROOT.h" + +#include "TopParticleLevel/ParticleLevelEvent.h" + +#include "TopEventSelectionTools/FakesMMConfigs.h" + +namespace top { + +EventSelection::EventSelection(const std::string& name, const std::vector<std::string>& cutNames, TFile* outputFile, const std::vector<std::unique_ptr<top::ToolLoaderBase>>& toolLoaders,std::shared_ptr<top::TopConfig> config, EL::Worker* wk) : + m_cutflow(nullptr), + m_cutflow_Loose(nullptr), + m_cutflowMCWeights(nullptr), + m_cutflowMCWeights_Loose(nullptr), + m_cutflowPUWeights(nullptr), + m_cutflowPUWeights_Loose(nullptr), + m_cutflowZVtxWeights(nullptr), + m_cutflowZVtxWeights_Loose(nullptr), + m_cutflowMCPUWeights(nullptr), + m_cutflowMCPUWeights_Loose(nullptr), + m_cutflowMCPUZVtxWeights(nullptr), + m_cutflowMCPUZVtxWeights_Loose(nullptr), + m_cutflowScaleFactors(nullptr), + m_cutflowScaleFactors_Loose(nullptr), + m_cutflowBScaleFactors(nullptr), + m_cutflowBScaleFactors_Loose(nullptr), + m_cutflowParticleLevel(nullptr), + m_cutflowUpgradeLevel(nullptr), + m_name(name), + m_isMC(false), + m_sfRetriever(nullptr), + m_nominalHashValue(0), + m_containsInitial(false), + m_containsGRL(false), + m_containsGoodCalo(false), + m_containsPrimaryVertex(false), + m_positionInitial(0), + m_positionGRL(0), + m_positionGoodCalo(0), + m_positionPrimaryVertex(0), + m_toBeSaved(false) +{ + + // We use the nominal hash value so we don't do + // string comparisions during the event loop + CP::SystematicSet nominal; + m_nominalHashValue = nominal.hash(); + + // need that later for the sf in the cutflow, not especially elegant but works for now + m_config = config; + m_isMC = config->isMC(); + + if(m_isMC) + m_sfRetriever = std::unique_ptr<top::ScaleFactorRetriever> ( new top::ScaleFactorRetriever( config) ); + + TDirectory* plotDir = outputFile->mkdir(m_name.c_str()); + plotDir->cd(); + if (!config->doLooseTreeOnly()) { + m_cutflow = new TH1D("cutflow", (name + " cutflow").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCWeights = new TH1D("cutflow_mc", (name + " cutflow MC weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowPUWeights = new TH1D("cutflow_pu", (name + " cutflow PU weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowZVtxWeights = new TH1D("cutflow_zvtx", (name + " cutflow ZVtx weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCPUWeights = new TH1D("cutflow_mc_pu", (name + " cutflow MC*PU weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCPUZVtxWeights = new TH1D("cutflow_mc_pu_zvtx", (name + " cutflow MC*PU*ZVtx weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowScaleFactors = new TH1D("cutflow_scale_factors", (name + " cutflow ScaleFactors").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowBScaleFactors = new TH1D("cutflow_btag_scale_factors", (name + " cutflow b-tag ScaleFactors").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + } + if (config->doLooseEvents()) { + m_cutflow_Loose = new TH1D("cutflow_Loose", (name + " cutflow_Loose").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCWeights_Loose = new TH1D("cutflow_mc_Loose", (name + " cutflow_Loose MC weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowPUWeights_Loose = new TH1D("cutflow_pu_Loose", (name + " cutflow_Loose PU weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowZVtxWeights_Loose = new TH1D("cutflow_zvtx_Loose", (name + " cutflow_Loose ZVtx weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCPUWeights_Loose = new TH1D("cutflow_mc_pu_Loose", (name + " cutflow_Loose MC*PU weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowMCPUZVtxWeights_Loose = new TH1D("cutflow_mc_pu_zvtx_Loose", (name + " cutflow_Loose MC*PU*ZVtx weights").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowScaleFactors_Loose = new TH1D("cutflow_scale_factors_Loose", (name + " cutflow_Loose ScaleFactors").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + m_cutflowBScaleFactors_Loose = new TH1D("cutflow_btag_scale_factors_Loose", (name + " cutflow_Loose b-tag ScaleFactors").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + } + + if ( config->doTopParticleLevel() ){ + m_cutflowParticleLevel = new TH1D("cutflow_particle_level", (name + " cutflow_particle_level").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + } + + if ( config->HLLHC() ){ + m_cutflowUpgradeLevel = new TH1D("cutflow_upgrade_level", (name + " cutflow_upgrade_level").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5); + } + + unsigned int i(0); + for (const auto& currentCutName : cutNames) { + + //look through all the libraries and load any tools + top::EventSelectorBase* tool = nullptr; + for (auto& libraryPtr : toolLoaders) { + tool = libraryPtr->initTool(m_name, currentCutName, outputFile, config, wk); + if (tool) + break; + } + + if (tool != nullptr) { + m_allCuts.emplace_back(std::move(tool)); + } else { + std::cout << "Could not find " << currentCutName << std::endl; + exit(1); + } + + // Initlal and GRL + if (currentCutName == "INITIAL") { + m_containsInitial = true; + m_positionInitial = i; + } + + if (currentCutName == "GRL") { + m_containsGRL = true; + m_positionGRL = i; + } + + if (currentCutName == "GOODCALO") { + m_containsGoodCalo = true; + m_positionGoodCalo = i; + } + + if (currentCutName == "PRIVTX") { + m_containsPrimaryVertex = true; + m_positionPrimaryVertex = i; + } + + //some cutflow histograms + if (!config->doLooseTreeOnly()) { + m_cutflow->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowPUWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowZVtxWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCPUWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCPUZVtxWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowScaleFactors->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowBScaleFactors->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + } + if (config->doLooseEvents()) { + m_cutflow_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowPUWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowZVtxWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCPUWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowMCPUZVtxWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowScaleFactors_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + m_cutflowBScaleFactors_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + } + + if ( m_cutflowParticleLevel ){ + m_cutflowParticleLevel->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + } + + if ( m_cutflowUpgradeLevel ){ + m_cutflowUpgradeLevel->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str()); + } + + if (currentCutName == "SAVE") { + m_toBeSaved = true; + } + + ++i; + } + + //be nice to the user and tell them what they enabled + //at the very start of the run. It allows them to quit the program + //if they notice a problem. + printCuts(); +} + +EventSelection::EventSelection(EventSelection&& other) : + m_allCuts(std::move(other.m_allCuts)), + m_cutflow(std::move(other.m_cutflow)), + m_cutflow_Loose(std::move(other.m_cutflow_Loose)), + m_cutflowMCWeights(std::move(other.m_cutflowMCWeights)), + m_cutflowMCWeights_Loose(std::move(other.m_cutflowMCWeights_Loose)), + m_cutflowPUWeights(std::move(other.m_cutflowPUWeights)), + m_cutflowPUWeights_Loose(std::move(other.m_cutflowPUWeights_Loose)), + m_cutflowZVtxWeights(std::move(other.m_cutflowZVtxWeights)), + m_cutflowZVtxWeights_Loose(std::move(other.m_cutflowZVtxWeights_Loose)), + m_cutflowMCPUWeights(std::move(other.m_cutflowMCPUWeights)), + m_cutflowMCPUWeights_Loose(std::move(other.m_cutflowMCPUWeights_Loose)), + m_cutflowMCPUZVtxWeights(std::move(other.m_cutflowMCPUZVtxWeights)), + m_cutflowMCPUZVtxWeights_Loose(std::move(other.m_cutflowMCPUZVtxWeights_Loose)), + m_cutflowScaleFactors(std::move(other.m_cutflowScaleFactors)), + m_cutflowScaleFactors_Loose(std::move(other.m_cutflowScaleFactors_Loose)), + m_cutflowBScaleFactors(std::move(other.m_cutflowBScaleFactors)), + m_cutflowBScaleFactors_Loose(std::move(other.m_cutflowBScaleFactors_Loose)), + m_cutflowParticleLevel(std::move(other.m_cutflowParticleLevel)), + m_cutflowUpgradeLevel(std::move(other.m_cutflowUpgradeLevel)), + m_name(std::move(other.m_name)), + m_isMC(std::move(other.m_isMC)), + m_config(std::move(other.m_config)), + m_sfRetriever(nullptr), + m_nominalHashValue(std::move(other.m_nominalHashValue)), + m_containsInitial(std::move(other.m_containsInitial)), + m_containsGRL(std::move(other.m_containsGRL)), + m_containsGoodCalo(std::move(other.m_containsGoodCalo)), + m_containsPrimaryVertex(std::move(other.m_containsPrimaryVertex)), + m_positionInitial(std::move(other.m_positionInitial)), + m_positionGRL(std::move(other.m_positionGRL)), + m_positionGoodCalo(std::move(other.m_positionGoodCalo)), + m_positionPrimaryVertex(std::move(other.m_positionPrimaryVertex)), + m_toBeSaved(std::move(other.m_toBeSaved)) +{ + + // need this to calculate the lepton SF for the cutflow + if(m_isMC) + m_sfRetriever = std::unique_ptr<top::ScaleFactorRetriever> ( new top::ScaleFactorRetriever( m_config ) ); + +} + +void EventSelection::countInitial(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const +{ + if (m_containsInitial) { + if (!m_config->doLooseTreeOnly()) { + m_cutflow->Fill(m_positionInitial); + m_cutflowMCWeights->Fill(m_positionInitial,mcEventWeight); + m_cutflowPUWeights->Fill(m_positionInitial,pileupWeight); + m_cutflowZVtxWeights->Fill(m_positionInitial,zvtxWeight); + m_cutflowMCPUWeights->Fill(m_positionInitial,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights->Fill(m_positionInitial,mcEventWeight*pileupWeight*zvtxWeight); + } + if (m_config->doLooseEvents()) { + m_cutflow_Loose->Fill(m_positionInitial); + m_cutflowMCWeights_Loose->Fill(m_positionInitial,mcEventWeight); + m_cutflowPUWeights_Loose->Fill(m_positionInitial,pileupWeight); + m_cutflowZVtxWeights_Loose->Fill(m_positionInitial,zvtxWeight); + m_cutflowMCPUWeights_Loose->Fill(m_positionInitial,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights_Loose->Fill(m_positionInitial,mcEventWeight*pileupWeight*zvtxWeight); + } + } +} + +void EventSelection::countGRL(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const +{ + if (m_containsGRL) { + if (!m_config->doLooseTreeOnly()) { + m_cutflow->Fill(m_positionGRL); + m_cutflowMCWeights->Fill(m_positionGRL,mcEventWeight); + m_cutflowPUWeights->Fill(m_positionGRL,pileupWeight); + m_cutflowZVtxWeights->Fill(m_positionGRL,zvtxWeight); + m_cutflowMCPUWeights->Fill(m_positionGRL,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights->Fill(m_positionGRL,mcEventWeight*pileupWeight*zvtxWeight); + } + if (m_config->doLooseEvents()) { + m_cutflow_Loose->Fill(m_positionGRL); + m_cutflowMCWeights_Loose->Fill(m_positionGRL,mcEventWeight); + m_cutflowPUWeights_Loose->Fill(m_positionGRL,pileupWeight); + m_cutflowZVtxWeights_Loose->Fill(m_positionGRL,zvtxWeight); + m_cutflowMCPUWeights_Loose->Fill(m_positionGRL,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights_Loose->Fill(m_positionGRL,mcEventWeight*pileupWeight*zvtxWeight); + } + } +} + +void EventSelection::countGoodCalo(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const +{ + if (m_containsGoodCalo) { + if (!m_config->doLooseTreeOnly()) { + m_cutflow->Fill(m_positionGoodCalo); + m_cutflowMCWeights->Fill(m_positionGoodCalo,mcEventWeight); + m_cutflowPUWeights->Fill(m_positionGoodCalo,pileupWeight); + m_cutflowZVtxWeights->Fill(m_positionGoodCalo,zvtxWeight); + m_cutflowMCPUWeights->Fill(m_positionGoodCalo,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights->Fill(m_positionGoodCalo,mcEventWeight*pileupWeight*zvtxWeight); + } + if (m_config->doLooseEvents()) { + m_cutflow_Loose->Fill(m_positionGoodCalo); + m_cutflowMCWeights_Loose->Fill(m_positionGoodCalo,mcEventWeight); + m_cutflowPUWeights_Loose->Fill(m_positionGoodCalo,pileupWeight); + m_cutflowZVtxWeights_Loose->Fill(m_positionGoodCalo,zvtxWeight); + m_cutflowMCPUWeights_Loose->Fill(m_positionGoodCalo,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights_Loose->Fill(m_positionGoodCalo,mcEventWeight*pileupWeight*zvtxWeight); + } + } +} + +void EventSelection::countPrimaryVertex(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const +{ + if (m_containsPrimaryVertex) { + if (!m_config->doLooseTreeOnly()) { + m_cutflow->Fill(m_positionPrimaryVertex); + m_cutflowMCWeights->Fill(m_positionPrimaryVertex,mcEventWeight); + m_cutflowPUWeights->Fill(m_positionPrimaryVertex,pileupWeight); + m_cutflowZVtxWeights->Fill(m_positionPrimaryVertex,zvtxWeight); + m_cutflowMCPUWeights->Fill(m_positionPrimaryVertex,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights->Fill(m_positionPrimaryVertex,mcEventWeight*pileupWeight*zvtxWeight); + } + if (m_config->doLooseEvents()) { + m_cutflow_Loose->Fill(m_positionPrimaryVertex); + m_cutflowMCWeights_Loose->Fill(m_positionPrimaryVertex,mcEventWeight); + m_cutflowPUWeights_Loose->Fill(m_positionPrimaryVertex,pileupWeight); + m_cutflowZVtxWeights_Loose->Fill(m_positionPrimaryVertex,zvtxWeight); + m_cutflowMCPUWeights_Loose->Fill(m_positionPrimaryVertex,mcEventWeight*pileupWeight); + m_cutflowMCPUZVtxWeights_Loose->Fill(m_positionPrimaryVertex,mcEventWeight*pileupWeight*zvtxWeight); + } + } +} + +bool EventSelection::apply(const top::Event& event) const { + unsigned int i(0); + bool passEvent(false); + + for (const auto& currentCut : m_allCuts) { + const bool passed = currentCut->apply(event); + //std::cout << (*it)->name() << " " << passed << std::endl; + + if (!passed) + break; + + double mcweight = 1.; + double puweight = 1.; + double zvtxweight = 1.; + double leptonSF = 1.; + double btagSF = 1.; + + if (m_isMC) { +// mcweight = event.m_info->mcEventWeight(); + mcweight = event.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + if (top::ScaleFactorRetriever::hasPileupSF(event)) + puweight = top::ScaleFactorRetriever::pileupSF(event); + + leptonSF = m_sfRetriever -> leptonSF(event, top::topSFSyst::nominal); + + for (auto& tag : ( m_config->useTrackJets() ? m_config->bTagWP_available_trkJet() : m_config->bTagWP_available())){ + btagSF = m_sfRetriever -> btagSF(event, top::topSFSyst::nominal, tag, m_config->useTrackJets()); + } + + } + + //add cutflow information for the nominal (not systematic) selection + //For data we have (sometimes) the same event with loose and tight + //The cutflow is just the "analysis" -> tight to avoid double counting + if (event.m_hashValue == m_nominalHashValue) { + bool countThisCut(true); + if ( m_containsInitial && i == m_positionInitial) {countThisCut = false;} + if ( m_containsGRL && i == m_positionGRL) {countThisCut = false;} + if ( m_containsGoodCalo && i == m_positionGoodCalo) {countThisCut = false;} + if ( m_containsPrimaryVertex && i == m_positionPrimaryVertex) {countThisCut = false;} + if (countThisCut) { + if (!m_config->doLooseTreeOnly() && !event.m_isLoose) { + m_cutflow->Fill(i); + m_cutflowMCWeights->Fill(i, mcweight); + m_cutflowPUWeights->Fill(i, puweight); + m_cutflowZVtxWeights->Fill(i, zvtxweight); + m_cutflowMCPUWeights->Fill(i, mcweight * puweight); + m_cutflowMCPUZVtxWeights->Fill(i, mcweight * puweight * zvtxweight); + m_cutflowScaleFactors->Fill(i, leptonSF); + m_cutflowBScaleFactors->Fill(i, btagSF); + } + if (m_config->doLooseEvents() && event.m_isLoose) { + m_cutflow_Loose->Fill(i); + m_cutflowMCWeights_Loose->Fill(i, mcweight); + m_cutflowPUWeights_Loose->Fill(i, puweight); + m_cutflowZVtxWeights_Loose->Fill(i, zvtxweight); + m_cutflowMCPUWeights_Loose->Fill(i, mcweight * puweight); + m_cutflowMCPUZVtxWeights_Loose->Fill(i, mcweight * puweight * zvtxweight); + m_cutflowScaleFactors_Loose->Fill(i, leptonSF); + m_cutflowBScaleFactors_Loose->Fill(i, btagSF); + } + } + } + + passEvent |= (currentCut->name() == "SAVE"); + ++i; + } + + // If "SAVE" wasn't found but event passes all cuts, event passes the selection + passEvent |= (i == m_allCuts.size()); + + return passEvent; +} + +bool EventSelection::applyParticleLevel(const top::ParticleLevelEvent& plEvent) const { + // In principle, this function should never be called for non-active + // particle level. However, for code safetly, include a null pointer + // check. Return false here because "do-not-do-particle-level" is equivalent + // to "do-no-save-particle-level". + if ( not m_cutflowParticleLevel ){ return false; } + + unsigned int i(0); + bool passEvent(false); + + for (const auto& currentCut : m_allCuts) { + const bool passed = currentCut->applyParticleLevel( plEvent ); + //std::cout << (*it)->name() << " " << passed << std::endl; + + if (!passed) + break; + + m_cutflowParticleLevel->Fill(i); + + passEvent |= (currentCut->name() == "SAVE"); + ++i; + } + + // If "SAVE" wasn't found but event passes all cuts, event passes the selection + passEvent |= (i == m_allCuts.size()); + + return passEvent; +} + +bool EventSelection::applyUpgradeLevel(const top::ParticleLevelEvent& upgradeEvent) const { + // In principle, this function should never be called for non-active + // upgrade level. However, for code safetly, include a null pointer + // check. Return false here because "do-not-do-particle-level" is equivalent + // to "do-no-save-particle-level". + if ( not m_cutflowUpgradeLevel ){ return false; } + + unsigned int i(0); + bool passEvent(false); + + for (const auto& currentCut : m_allCuts) { + // we use applyParticleLevel, because in the end upgrade events are smeared + // truth level, so we can just re-use this function + const bool passed = currentCut->applyParticleLevel( upgradeEvent ); + //std::cout << (*it)->name() << " " << passed << std::endl; + + if (!passed) + break; + + m_cutflowUpgradeLevel->Fill(i); + + passEvent |= (currentCut->name() == "SAVE"); + ++i; + } + + // If "SAVE" wasn't found but event passes all cuts, event passes the selection + passEvent |= (i == m_allCuts.size()); + + return passEvent; +} + +void EventSelection::finalise() const { + //2dp, neater output for numbers + std::cout << std::right; + if (m_isMC) + std::cout << std::fixed << std::setprecision(2); + + if (!m_config->doLooseTreeOnly()) { + //channel name + std::cout << " - " << m_name << " cutflow:\n"; + + //some headings + std::cout << std::setw(7) << "" << + std::setw(30) << "cut" << + std::setw(15) << "events"; + + if (m_isMC) + std::cout << std::setw(15) << "mc weights" << + std::setw(15) << "mc*pu weights" << + std::setw(15) << "lepton SF" << + std::setw(15) << "b-tag SF" ; + + if( m_cutflowParticleLevel ) { + std::cout << std::setw(15) << "particle level"; + } + + if( m_cutflowUpgradeLevel ) { + std::cout << std::setw(15) << "upgrade level"; + } + + std::cout << "\n"; + + //cutflow table content + for (int i = 1; i <= m_cutflow->GetNbinsX(); ++i) { + std::cout << " " << std::setw(3) << i + << std::setw(30) << m_cutflow->GetXaxis()->GetBinLabel(i) + << std::setw(15) << m_cutflow->GetBinContent(i); + + if (m_isMC) + std::cout << std::setw(15) << m_cutflowMCWeights->GetBinContent(i) + << std::setw(15) << m_cutflowMCPUWeights->GetBinContent(i) + << std::setw(15) << m_cutflowScaleFactors->GetBinContent(i) + << std::setw(15) << m_cutflowBScaleFactors->GetBinContent(i); + + if ( m_cutflowParticleLevel ){ + std::cout << std::setw(15) << m_cutflowParticleLevel->GetBinContent(i); + } + + if ( m_cutflowUpgradeLevel ){ + std::cout << std::setw(15) << m_cutflowUpgradeLevel->GetBinContent(i); + } + + std::cout << "\n"; + } + } + if (m_config->doLooseEvents()) { + //channel name + std::cout << " - " << m_name << " cutflow (Loose):\n"; + + //some headings + std::cout << std::setw(7) << "" << + std::setw(30) << "cut" << + std::setw(15) << "events"; + + if (m_isMC) + std::cout << std::setw(15) << "mc weights" << + std::setw(15) << "mc*pu weights" << + std::setw(15) << "lepton SF" << + std::setw(15) << "b-tag SF" ; + + if( m_cutflowParticleLevel ) { + std::cout << std::setw(15) << "particle level"; + } + + if( m_cutflowUpgradeLevel ) { + std::cout << std::setw(15) << "upgrade level"; + } + + + std::cout << "\n"; + + //cutflow table content + for (int i = 1; i <= m_cutflow_Loose->GetNbinsX(); ++i) { + std::cout << " " << std::setw(3) << i + << std::setw(30) << m_cutflow_Loose->GetXaxis()->GetBinLabel(i) + << std::setw(15) << m_cutflow_Loose->GetBinContent(i); + + if (m_isMC) + std::cout << std::setw(15) << m_cutflowMCWeights_Loose->GetBinContent(i) + << std::setw(15) << m_cutflowMCPUWeights_Loose->GetBinContent(i) + << std::setw(15) << m_cutflowScaleFactors_Loose->GetBinContent(i) + << std::setw(15) << m_cutflowBScaleFactors_Loose->GetBinContent(i); + + if ( m_cutflowParticleLevel ){ + std::cout << std::setw(15) << m_cutflowParticleLevel->GetBinContent(i); + } + + if ( m_cutflowUpgradeLevel ){ + std::cout << std::setw(15) << m_cutflowUpgradeLevel->GetBinContent(i); + } + + std::cout << "\n"; + } + } + std::cout << "\n"; +} + +const std::string EventSelection::name() const { + return m_name; +} + +std::vector<std::string> EventSelection::GetFakesMMConfigs() const { + std::vector<std::string> configs; + for (const auto& currentCutName : m_allCuts) { + if (currentCutName->name()!="FAKESMMCONFIGS") continue; + else { + FakesMMConfigs* conf = dynamic_cast<FakesMMConfigs*>(currentCutName.get()); + for (std::string s : conf->configurations()) + configs.push_back(s); + } + } + return configs; +} + +void EventSelection::printCuts() { + std::cout << " - " << m_name << ":\n"; + if (!m_config->doLooseTreeOnly()) { + for (int i = 1; i <= m_cutflow->GetNbinsX(); ++i) { + std::cout << " " << std::setw(3) << i + << std::setw(30) << m_cutflow->GetXaxis()->GetBinLabel(i) + << "\n"; + } + } + else if (m_config->doLooseEvents()) { + for (int i = 1; i <= m_cutflow_Loose->GetNbinsX(); ++i) { + std::cout << " " << std::setw(3) << i + << std::setw(30) << m_cutflow_Loose->GetXaxis()->GetBinLabel(i) + << "\n"; + } + } + + std::cout << "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelectionManager.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelectionManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f7168b5489d59ce31f2b80b863139b407faf5d77 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSelectionManager.cxx @@ -0,0 +1,167 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/EventSelectionManager.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/SystematicEvent.h" +#include "TopConfiguration/TopConfig.h" + +#include "TopEventSelectionTools/ToolLoaderBase.h" + +#include <iostream> +#include <string> +#include <sstream> +#include <algorithm> +#include <iterator> + +#include "TFile.h" +#include "TClass.h" +#include "TROOT.h" + +#include "TopParticleLevel/ParticleLevelEvent.h" + +namespace top { + +EventSelectionManager::EventSelectionManager(const std::vector<SelectionConfigurationData>& selectionConfigData, TFile* outputFile, const std::string& toolLoaderNames, std::shared_ptr<top::TopConfig> config, EL::Worker* wk) { + std::vector<std::string> tokens; + + std::stringstream ss(toolLoaderNames); + std::string item; + char delim = ' '; + while (std::getline(ss, item, delim)) + tokens.push_back(item); + + std::vector<std::unique_ptr<top::ToolLoaderBase>> toolLoaders; + for (const auto& toolLoaderName : tokens) { + //remove the lib and add namespace and Loader to the class name + std::string className = "top::" + toolLoaderName.substr(3) + "Loader"; + + std::cout << "Attempting to load Tools from this class: " << className << "\n"; + TClass* c = ::TClass::GetClass(className.c_str()); + + //okay, so that failed + //maybe the user didn't put it in the top namespace - try again without top::? + if (c == nullptr) { + className = toolLoaderName.substr(3) + "Loader"; + std::cout << "Attempting to load Tools from this class: " << className << "\n"; + c = ::TClass::GetClass(className.c_str()); + } + + //okay, so that worked! + if (c != nullptr) { + std::cout << " Success part 1 of 2" << "\n"; + top::ToolLoaderBase* bc = static_cast<top::ToolLoaderBase*> (c->New()); + + if (bc) { + std::cout << " Success part 2 of 2" << "\n"; + toolLoaders.push_back(std::unique_ptr<top::ToolLoaderBase>(bc)); + } else + std::cout << " Failure converting to ToolLoaderBase\n"; + } else + std::cout << " Class " << className << " in library " << toolLoaderName << " not found - this is only a problem if you wrote one in your library\n"; + } + + std::cout << "\nTelling you how I'm configured, before I do anything:\n"; + for (const auto& currentConfig : selectionConfigData) + m_selections.emplace_back(currentConfig.m_name, currentConfig.m_cutnames, outputFile, toolLoaders,config,wk); +} + +EventSelectionManager::EventSelectionManager(EventSelectionManager&& other) : + m_selections(std::move(other.m_selections)) { +} + +void EventSelectionManager::countInitial(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) +{ + for (const auto& currentSelection : m_selections) + currentSelection.countInitial(mcEventWeight,pileupWeight,zvtxWeight); +} + +void EventSelectionManager::countGRL(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) +{ + for (const auto& currentSelection : m_selections) + currentSelection.countGRL(mcEventWeight,pileupWeight,zvtxWeight); +} + +void EventSelectionManager::countGoodCalo(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) +{ + for (const auto& currentSelection : m_selections) + currentSelection.countGoodCalo(mcEventWeight,pileupWeight,zvtxWeight); +} + +void EventSelectionManager::countPrimaryVertex(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) +{ + for (const auto& currentSelection : m_selections) + currentSelection.countPrimaryVertex(mcEventWeight,pileupWeight,zvtxWeight); +} + +bool EventSelectionManager::apply(top::Event& event,const xAOD::SystematicEvent& currentSystematic) { + bool save(false); + for (const auto& currentSelection : m_selections) { + const bool passedThisSelection = currentSelection.apply(event); + + //save result as new branch (int) + event.m_info->auxdecor<int>(currentSelection.name()) = passedThisSelection; + //save result as decoration + currentSystematic.auxdecor<int>(currentSelection.name()) = passedThisSelection ? 1 : 0; + + //Did any of the selections with SAVE specified pass for this event (if so we might want to keep the event) + save |= (passedThisSelection && currentSelection.ToBeSaved()); + } + + return save; +} + +bool EventSelectionManager::applyParticleLevel(const top::ParticleLevelEvent& plEvent) { + bool save(false); + for (const auto& currentSelection : m_selections) { + const bool passedThisSelection = currentSelection.applyParticleLevel( plEvent ); + + //save result as new branch (int) + plEvent.m_selectionDecisions[ currentSelection.name() ] = passedThisSelection; + + //Did any of the selections with SAVE specified pass for this event (if so we might want to keep the event) + save |= (passedThisSelection && currentSelection.ToBeSaved()); + } + + return save; +} + +bool EventSelectionManager::applyUpgradeLevel(const top::ParticleLevelEvent& upgradeEvent) { + bool save(false); + for (const auto& currentSelection : m_selections) { + const bool passedThisSelection = currentSelection.applyUpgradeLevel( upgradeEvent ); + + //save result as new branch (int) + upgradeEvent.m_selectionDecisions[ currentSelection.name() ] = passedThisSelection; + + //Did any of the selections with SAVE specified pass for this event (if so we might want to keep the event) + save |= (passedThisSelection && currentSelection.ToBeSaved()); + } + + return save; +} + +void EventSelectionManager::finalise() { + std::cout << "Final yields:\n"; + for (const auto& currentSelection : m_selections) + currentSelection.finalise(); +} + +void EventSelectionManager::addExtraBranches(std::vector<std::string>& extraBranchList) { + for (const auto& currentSelection : m_selections) + extraBranchList.push_back(currentSelection.name()); +} + +std::vector<std::string> EventSelectionManager::GetFakesMMConfigs(std::string selection) const { + for (const auto& currentSelection : m_selections) + if (currentSelection.name() == selection) return currentSelection.GetFakesMMConfigs(); + std::cout << "WARNING: Attempt to retrieve the FakesMMConfigs for non-existing selection " << selection << std::endl; + std::cout << " This is nonense - returning empty list" << std::endl; + std::vector<std::string> empty; + return empty; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..656be7428b15ac326a2ed72334b73359b0574efc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/LinkDef.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/ObjectLoaderStandardCuts.h" + +#include "TopAnalysis/EventSaverFlatNtuple.h" +#include "TopAnalysis/EventSaverxAOD.h" +#include "TopAnalysis/EventSaverxAODNext.h" + +#ifdef __CINT__ + +#pragma extra_include "TopAnalysis/ObjectLoaderStandardCuts.h"; +#pragma extra_include "TopAnalysis/EventSaverFlatNtuple.h"; +#pragma extra_include "TopAnalysis/EventSaverxAOD.h"; +#pragma extra_include "TopAnalysis/EventSaverxAODNext.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +//for loading the object selection at run time +#pragma link C++ class top::ObjectLoaderBase+; +#pragma link C++ class top::ObjectLoaderStandardCuts+; + +//for loading the event saver at run time +#pragma link C++ class top::EventSaverBase+; +#pragma link C++ class top::EventSaverFlatNtuple+; +#pragma link C++ class top::EventSaverxAOD+; +#pragma link C++ class top::EventSaverxAODNext+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a8797c37c3493db48ba26910ef37de2c6269b5aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/ObjectLoaderStandardCuts.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include "TopObjectSelectionTools/TopObjectSelection.h" +#include "TopObjectSelectionTools/ElectronLikelihoodMC15.h" +#include "TopObjectSelectionTools/ElectronCutBasedMC15.h" +#include "TopObjectSelectionTools/IsolationTools.h" +#include "TopObjectSelectionTools/MuonMC15.h" +#include "TopObjectSelectionTools/AntiMuonMC15.h" +#include "TopObjectSelectionTools/TauMC15.h" +#include "TopObjectSelectionTools/JetMC15.h" +#include "TopObjectSelectionTools/TrackJetMC15.h" +#include "TopObjectSelectionTools/PhotonMC15.h" +#include "TopObjectSelectionTools/OverlapRemovalASG.h" + +namespace top { + + top::TopObjectSelection* ObjectLoaderStandardCuts::init(std::shared_ptr<top::TopConfig> topConfig) + { + top::TopObjectSelection* objectSelection = new top::TopObjectSelection(topConfig->objectSelectionName()); + top::check(objectSelection->setProperty( "config" , topConfig ) , "Failed to setProperty for top::TopObjectSelection" ); + top::check(objectSelection->initialize() , "Failed to initialize top::TopObjectSelection" ); + + // Debug messages? + // objectSelection->msg().setLevel(MSG::DEBUG); + + ///-- Photons --// + if(topConfig->usePhotons()) { + objectSelection->photonSelection(new top::PhotonMC15(topConfig->photonPtcut(), + topConfig->photonEtacut(), + topConfig->photonIdentification(), + topConfig->photonIdentificationLoose(), + new top::StandardIsolation( + topConfig->photonIsolation(), + topConfig->photonIsolationLoose() )) ); + } + + ///-- Electrons --/// + if (topConfig->useElectrons()) { + if (topConfig->electronID().find("LH") == std::string::npos && topConfig->electronIDLoose().find("LH") == std::string::npos) { + //both the tight and loose user settings do not contain LH -> cut based + objectSelection->electronSelection(new top::ElectronCutBasedMC15(topConfig->electronPtcut(), + topConfig->electronVetoLArCrack(), + topConfig->electronID(), + topConfig->electronIDLoose(), + new top::StandardIsolation( + topConfig->electronIsolation() , + topConfig->electronIsolationLoose() )) ); + + } else if (topConfig->electronID().find("LH") != std::string::npos && topConfig->electronIDLoose().find("LH") != std::string::npos) { + //user wants likelihood electrons + objectSelection->electronSelection(new top::ElectronLikelihoodMC15(topConfig->isPrimaryxAOD(), + topConfig->electronPtcut(), + topConfig->electronVetoLArCrack(), + topConfig->electronID(), + topConfig->electronIDLoose(), + new top::StandardIsolation( + topConfig->electronIsolation() , + topConfig->electronIsolationLoose() ), + topConfig->applyTTVACut() + ) ); + + } else { + std::cout << "\nHo hum\n"; + std::cout << "Not sure it makes sense to use a mix of LH and cut-based electrons for the tight/loose definitions\n"; + std::cout << "Tight electron definition is " << topConfig->electronID() << "\n"; + std::cout << "Loose electron definition is " << topConfig->electronIDLoose() << "\n"; + std::cout << "If it does make sense, feel free to fix this\n"; + exit(1); + } + } + + ///-- Muons --/// + if (topConfig->useMuons()) { + + + if (topConfig->useAntiMuons()) + objectSelection -> muonSelection(new top::AntiMuonMC15(topConfig->muonPtcut(), new top::StandardIsolation(topConfig->muonIsolation(), topConfig->muonIsolationLoose()) )); + else + objectSelection -> muonSelection(new top::MuonMC15(topConfig->muonPtcut(), new top::StandardIsolation(topConfig->muonIsolation(), topConfig->muonIsolationLoose()), topConfig->applyTTVACut()) ); + + } + + + ///-- Taus --/// + if (topConfig->useTaus()) { + objectSelection->tauSelection(new top::TauMC15()); + } + + ///-- Jets --/// + if (topConfig->useJets()) { + objectSelection -> jetSelection(new top::JetMC15(topConfig->jetPtcut(), topConfig->jetEtacut(), topConfig->fwdJetAndMET())); + } + + ///-- Large R Jets --/// + if (topConfig->useLargeRJets()) {// not doing JVT cut for large-R jets + objectSelection -> largeJetSelection(new top::JetMC15(topConfig->largeRJetPtcut(), topConfig->largeRJetEtacut(), false)); + } + + ///-- Track Jets --/// + if (topConfig->useTrackJets()) { + objectSelection -> trackJetSelection(new top::TrackJetMC15(topConfig->trackJetPtcut(), topConfig->trackJetEtacut())); + } + + ///-- Overlap removal --/// + /// single parameter: boolean to do OR with large-R jets + objectSelection->overlapRemovalPostSelection(new top::OverlapRemovalASG( (topConfig->doLargeJetOverlapRemoval() && topConfig->useLargeRJets())) ); + + return objectSelection; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6c1de11684c086b940995a55fa95d8cb3a7081c5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx @@ -0,0 +1,393 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopAnalysis/Tools.h" + +#include "TopAnalysis/ObjectLoaderBase.h" +#include "TopAnalysis/EventSaverBase.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TopEventSelectionTools/ToolLoaderBase.h" +#include "xAODMetaData/FileMetaData.h" + +#include <iostream> +#include <fstream> +#include <sstream> +#include <cstdlib> +#include <cmath> +#include <memory> + +#include "TTree.h" +#include "TFile.h" +#include "TSystem.h" +#include "TROOT.h" + +#include "xAODRootAccess/Init.h" + +#include "PATInterfaces/SystematicCode.h" +#include "PATInterfaces/CorrectionCode.h" + +#ifndef ROOTCORE +#include "AthAnalysisBaseComps/AthAnalysisHelper.h" +#endif + +namespace top { + +void xAODInit(bool failOnUnchecked) { + if (!xAOD::Init()) { + std::cout << "Failed xAOD::Init - no idea what to do, exiting\n"; + exit(1); + } + + //fail on unchecked error codes + if (failOnUnchecked) { + xAOD::TReturnCode::enableFailure(); + CP::SystematicCode::enableFailure(); + CP::CorrectionCode::enableFailure(); + //StatusCode::enableFailure(); + } +} + +bool isFilePrimaryxAOD(TFile* inputFile) { + TTree* metaData = dynamic_cast<TTree*> (inputFile->Get("MetaData")); + + if (metaData) { + metaData->LoadTree(0); + + TObjArray* ar = metaData->GetListOfBranches(); + for (int i = 0; i < ar->GetEntries(); ++i) { + TBranch* b = (TBranch*) ar->At(i); + std::string name = std::string(b->GetName()); + // std::cout << name << std::endl; + if (name == "StreamAOD") + return true; + } + } else { + std::cout << "isFilePrimaryxAOD says MetaData tree missing from input file.\n Weird" << std::endl; + exit(1); + } + + return false; +} + +bool isFileSimulation(TFile* inputFile, const std::string& eventInfoName) { + xAOD::TEvent xaodEvent(xAOD::TEvent::kClassAccess); + top::check(xaodEvent.readFrom(inputFile), "Tools::isFileSimulation Failed to read file in"); + + xaodEvent.getEntry(0); + const xAOD::EventInfo* eventInfo(0); + top::check(xaodEvent.retrieve(eventInfo, eventInfoName) , "Tools::isFileSimulation Failed to get " + eventInfoName); + return eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION); +} + +bool isTruthDxAOD(TFile* inputFile) { + TTree* metaData = dynamic_cast<TTree*> (inputFile->Get("MetaData")); + + if (metaData) { + metaData->LoadTree(0); + + TObjArray* ar = metaData->GetListOfBranches(); + for (int i = 0; i < ar->GetEntries(); ++i) { + TBranch* b = (TBranch*) ar->At(i); + std::string name = std::string(b->GetName()); + // std::cout << name << std::endl; + if (name.find("DAOD_TRUTH") != std::string::npos) + return true; + } + } else { + throw std::runtime_error("isTruthDxAOD says MetaData tree" + " missing from input file.\n Weird"); + } + + return false; +} + + +unsigned int getDSID(TFile* inputFile, const std::string& eventInfoName){ + + xAOD::TEvent xaodEvent(xAOD::TEvent::kClassAccess); + top::check(xaodEvent.readFrom(inputFile), "Tools::isFileSimulation Failed to read file in"); + + xaodEvent.getEntry(0); + const xAOD::EventInfo* eventInfo(0); + top::check(xaodEvent.retrieve(eventInfo, eventInfoName) , "Tools::isFileSimulation Failed to get " + eventInfoName); + + return eventInfo-> mcChannelNumber(); + +} + + +bool isFileFastSim(TFile* /*inputFile*/) { + + + return false; + +} + + +std::string getDerivationStream(TFile* inputFile){ + + TTree* metaData = dynamic_cast<TTree*> (inputFile->Get("MetaData")); + + if (metaData) { + metaData->LoadTree(0); + + TObjArray* ar = metaData->GetListOfBranches(); + for (int i = 0; i < ar->GetEntries(); ++i) { + TBranch* b = (TBranch*) ar->At(i); + std::string name = std::string(b->GetName()); + // Find a variable name with Stream, then split off from DAOD + // If we only need TOPQX, we just find "_", add 1 and substring from there instead + if (name.find("Stream") != std::string::npos){ + auto cursor = name.find("_"); + std::string stream = name.substr(cursor+1); + return stream; + } + } + } + else { + throw std::runtime_error("getDerivationStream says MetaData tree" + " missing from input file.\n Weird"); + } + + // If we don't already return, something unexpected has happened and we need to fix it! + throw std::runtime_error("Cannot determine the derivation stream. Please report."); + +} + + + +xAOD::TEvent::EAuxMode guessAccessMode(const std::string& filename, const std::string& electronCollectionName) { + + //there must be a better way than this + std::unique_ptr<TFile> inputFile(TFile::Open(filename.c_str())); + + xAOD::TEvent xaodEvent(xAOD::TEvent::kBranchAccess); + top::check( xaodEvent.readFrom(inputFile.get()) , "Failed to guessAccessMode" ); + + //if we're unlucky and none of the events have electrons we can't + //tell which mode we need -> use ClassAccess + bool fallback = true; + xAOD::TEvent::EAuxMode mode = xAOD::TEvent::kBranchAccess; + + if (electronCollectionName != "None") { + //look at the first n events + unsigned int entries = xaodEvent.getEntries(); + + for (unsigned int i = 0; i < entries; ++i) { + xaodEvent.getEntry(i); + + const xAOD::ElectronContainer* electrons(0); + top::check( xaodEvent.retrieve(electrons, electronCollectionName) , "Failed to guessAccessMode" ); + + try { + //loading the electron pt only works for class access for the first + //round of xAODs made for DC14 8 TeV + //class access doesn't let us make out mini-xAOD super small though + + //branch access is available for the xAOD->xAOD reprocessing, + //derivations and 13 TeV DC14 MC samples + if (!electrons->empty()) { + fallback = false; + electrons->at(0)->pt(); + break; + } + } catch(...) { + mode = xAOD::TEvent::kClassAccess; + break; + } + } + } + + if (fallback) { + std::cout << "Falling back to kClassAccess" << std::endl; + mode = xAOD::TEvent::kClassAccess; + } + + //useful message + if (mode == xAOD::TEvent::kClassAccess) + std::cout << "guessAccessMode: Using kClassAccess\n"; + else if (mode == xAOD::TEvent::kBranchAccess) + std::cout << "guessAccessMode: Using kBranchAccess\n"; + + return mode; +} + +std::vector<std::string> loadCuts(const std::string& filename) { + std::vector<std::string> v; + + std::fstream in(filename.c_str()); + + if (!in.is_open()) { + std::cout << "Problem opening " << filename << "\n"; + exit(1); + } + + std::string str; + while (std::getline(in, str)) { + std::string newstring(str); + + if (str.find("#") != std::string::npos) + newstring = str.substr(0, str.find("#")); + + //leading and trailing white space removal + while (std::isspace(*newstring.begin())) + newstring.erase(newstring.begin()); + + while (std::isspace(*newstring.rbegin())) + newstring.erase(newstring.length() - 1); + + //make sure it contains something + if (newstring.size() > 0) + v.push_back(newstring); + } + + return v; +} + +unsigned int checkFiles(const std::vector<std::string>& filenames) { + std::cout << "Input filenames:\n"; + unsigned int i = 0; + unsigned int totalYield = 0; + + for (const auto& filename : filenames) { + std::unique_ptr<TFile> f(TFile::Open(filename.c_str())); + std::cout << " " << i + 1 << "/" << filenames.size() << " File: " << filename; + + if (!f.get()) { + std::cout << "\nDid not manage to open " << filename << std::endl; + std::cout << "Can't continue" << std::endl; + exit(1); + } + + const TTree* const t = dynamic_cast<TTree* > (f->Get("CollectionTree")); + + //some files made by the derivation framework have no events passing the + //cuts -> which means no collection tree. + //the old behaviour was to end execution on this problem + //not any more! + int entries = 0; + std::string note; + if (t) + entries = t->GetEntries(); + else + note = " (No CollectionTree)"; + + std::cout << " Entries: " << entries << note << "\n"; + totalYield += entries; + + ++i; + } + + std::cout << "\n"; + + return totalYield; +} + +std::vector<std::string> fileList(const std::string& filename) { + std::ifstream ifs(filename.c_str()); + + if (!ifs) { + std::cout << "File does not exist " << filename << std::endl; + std::cout << "This should contain a list - comma separated list of" << std::endl; + std::cout << "input files" << std::endl; + std::cout << "Can't continue" << std::endl; + exit(1); + } + + //loop over the lines in the file + std::stringstream wholefile; + + //read the file, and replace new lines with commas + //if the line already has comma separated filenames (a la the grid) + //these will be included automagically. + std::string line; + while (!ifs.eof()) { + std::getline(ifs, line); + wholefile << line << ','; + } + + //somewhere to save the filenames + std::vector<std::string> fileList; + + //now zoom through the whole file string and split at the comma + std::string to; + while (std::getline(wholefile, to, ',')) { + if (to.size() > 0) + fileList.push_back(to); + } + + if (fileList.size() == 0) { + std::cout << "Could not get a list of input files from " << filename << std::endl; + std::cout << "Can't continue" << std::endl; + exit(1); + } + + return fileList; +} + +void loadLibraries(const std::string& libraryNames) { + std::vector<std::string> tokens; + + std::stringstream ss(libraryNames); + std::string item; + char delim = ' '; + while (std::getline(ss, item, delim)) + tokens.push_back(item); + + std::vector<std::unique_ptr<top::ToolLoaderBase>> toolLoaders; + for (const auto& toolLoaderName : tokens) { + std::cout << "Attempting to load library: " << toolLoaderName << ".so\n"; + gSystem->Load((toolLoaderName + ".so").c_str()); + } +} + +top::TopObjectSelection* loadObjectSelection(std::shared_ptr<top::TopConfig> config) { + std::cout << "Attempting to load ObjectSelection: " << config->objectSelectionName() << std::endl; + TClass* c = ::TClass::GetClass( config->objectSelectionName().c_str() ); + + if (c == nullptr) { + std::cout << "Didn't manage to load " << config->objectSelectionName() << std::endl; + exit(1); + } + + top::ObjectLoaderBase* bc = static_cast<top::ObjectLoaderBase*> (c->New()); + + if (bc == nullptr) { + std::cout << "Didn't manage to cast it to top::ObjectLoaderBase " << std::endl; + exit(1); + } + + top::TopObjectSelection* objectSelection = bc->init(config); + + if (objectSelection == nullptr) { + std::cout << "Didn't manage to make a top::ObjectSelection class" << std::endl; + exit(1); + } + + return objectSelection; +} + +top::EventSaverBase* loadEventSaver(std::shared_ptr<top::TopConfig> config) { + std::cout << "Attempting to load OutputFormat: " << config->outputFormat() << std::endl; + TClass* c = ::TClass::GetClass( config->outputFormat().c_str() ); + + if (c == nullptr) { + std::cout << "Didn't manage to load " << config->outputFormat() << std::endl; + exit(1); + } + + top::EventSaverBase* bc = static_cast<top::EventSaverBase*> (c->New()); + + if (bc == nullptr) { + std::cout << "Didn't manage to cast it to top::EventSaverBase " << std::endl; + exit(1); + } + + return bc; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverBase.h new file mode 100644 index 0000000000000000000000000000000000000000..31887cf8f13807fb80a9e6a8512bcd45c42f5814 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverBase.h @@ -0,0 +1,100 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSAVERBASE_H_ +#define EVENTSAVERBASE_H_ + +#include <vector> +#include <string> +#include <memory> + +#include <TClass.h> + +class TFile; + +namespace top { + class Event; + class TreeManager; + class TopConfig; + class ParticleLevelEvent; + + /** + * @brief A base class so users can write their own event saving stuff. Some + * people, for some reason, prefer flat ntuples to xAODs. + */ + class EventSaverBase{ + + public: + /** + * @brief Default ctor/dtor - ROOT wants to use these, don't use fancy ctors + */ + EventSaverBase(){} + virtual ~EventSaverBase(){} + + /** + * @brief Called once at the start of the job after the file has been opened. + * + * @param config You may need stuff from the configuration. + * @param file You probably need the file if you're going to write to it. + * @param extraBranches So you can write extra branches (only for xAOD). + */ + virtual void initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches) = 0; + + /** + * @brief I guess you want to save an event sometimes to. + * There are multiple ways you might want to do this + * All methods below are implemented with a simple return + * This means that you do not need to implement them in + * your derived class + * + * @param event The event in question, in the format used internally. + */ + virtual void saveEvent(const top::Event& /*event*/){return;} + virtual void saveEventToxAOD(){return;} + + /** + * @breif Run for every event + * + * This fills, if requested, the: + * MC truth record + * PDF info + * TopPartons + */ + virtual void saveTruthEvent(){return;} + + /*! + * @brief Function to save the particle level event. + * This function has a default implementation that does ... nothing! This + * is deliberate since doing so does not force developers of custom + * EventSaver tools to implement particle level saving. + * @param plEvent The particle level event whose contents will be saved. + */ + virtual void saveParticleLevelEvent(const top::ParticleLevelEvent& /* plEvent */) { + /* Deliberately No-Op */ + return; + } + + /*! + * @brief Function to save the upgrade event. + * This function has a default implementation that does ... nothing! This + * is deliberate since doing so does not force developers of custom + * EventSaver tools to implement upgrade saving. + * @param upgradeEvent The upgrade event whose contents will be saved. + */ + virtual void saveUpgradeEvent(const top::ParticleLevelEvent& /* plEvent */) { + /* Deliberately No-Op */ + return; + } + + /** + * @brief So you can write something at the end of the job (like metadata). + */ + virtual void finalize(){return;} + + ClassDef(top::EventSaverBase, 0); + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h new file mode 100644 index 0000000000000000000000000000000000000000..82ab1d577f1bc5dcf76c84268726d8f03ee6127e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h @@ -0,0 +1,690 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSAVERFLATNTUPLE_H_ +#define EVENTSAVERFLATNTUPLE_H_ + +#include "TopAnalysis/EventSaverBase.h" +#include "TopCorrections/ScaleFactorRetriever.h" +#include "TopEventSelectionTools/TreeManager.h" +#include "TopObjectSelectionTools/RCJetMC15.h" + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AthContainers/AuxElement.h" +#include "AthContainers/DataVector.h" +#include <unordered_map> + +namespace top { + +// fwd declare upgrade class +class UpgradeEvent; + +/** + * @brief Some code that writes out a 'standard' flat ntuple. This can be + * extended if the user wants to inherit from this and implement the functions + * themselves. + */ +class EventSaverFlatNtuple : public top::EventSaverBase , public asg::AsgTool { + +public: + /** + * @brief A default constructor so that this class can be created at + * run-time by ROOT. + */ + EventSaverFlatNtuple(); + + /** + * @brief Does nothing. + */ + virtual ~EventSaverFlatNtuple(); + + /** + * @brief initialise is run before the event loop. + * + * @param config The configuration object (not used by the default flat + * ntuple). + * @param file The output file is used to put the TTrees in. + * @param extraBranches Extra info requested (like which selections are + * passed). + */ + virtual void initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches); + + //Keep the asg::AsgTool happy + virtual StatusCode initialize(){return StatusCode::SUCCESS;} + + /** + * @brief Run for every event (actually every systematic for every event). + * + * This does the tree filling work. + * + * @param event The top::Event which has had object selection and overlap + * removal (if requested) applied to it. + */ + virtual void saveEvent(const top::Event& event); + + /** + * @breif Run for every event + * + * This fills, if requested, the: + * MC truth record + * PDF info + * TopPartons + */ + virtual void saveTruthEvent(); + + /*! + * @brief Store the particle level event's content in the particle level + * TTree as flat n-tuple. + * + * This function shall be executed once for each event which is intended for + * storage. It writes out the pass/fail results of all EventSelection chains + * that have been applied to that specific event object. + * + * @param plEvent The particle level event whose data content will be + * written to the output. + */ + virtual void saveParticleLevelEvent(const top::ParticleLevelEvent& plEvent); + + /*! + * @brief Store the upgrade event's content in the upgrade + * TTree as flat n-tuple. + * + * This function shall be executed once for each event which is intended for + * storage. It writes out the pass/fail results of all EventSelection chains + * that have been applied to that specific event object. + * + * @param upgradeEvent The upgrade event whose data content will be + * written to the output. + */ + virtual void saveUpgradeEvent(const top::ParticleLevelEvent& plEvent); + + /** + * @brief Not used by the flat ntuple code yet, but needed by the xAOD code. + */ + virtual void finalize(); + + /** + * @brief shorten name of b-tagging working point (FixedCutBEff_*) + */ + std::string shortBtagWP(std::string const & WP) const; + +protected: + /** + * @brief Allow child classes to access the configuration object. + */ + std::shared_ptr<top::TopConfig> topConfig(); + + /** + * @brief Allow classes that build on top of this to access the tree managers. + * + * Why not just make the variable that contains them protected? Because of + * http://programmers.stackexchange.com/questions/162643/why-is-clean-code-suggesting-avoiding-protected-variables + * + * @return A vector of the treeManagers (one for each systematic). + */ + std::vector<std::shared_ptr<top::TreeManager>> treeManagers(); + std::shared_ptr<top::TreeManager> truthTreeManager(); + + /*! + * @brief Return a shared pointer to the top::TreeManager object that is + * used for the particle level output tree. + * @returns A shared pointer to the top::TreeManager object that is used to + * write out the particle level event data. + */ + std::shared_ptr<top::TreeManager> particleLevelTreeManager(); + + + /** + * @brief Return a shared pointer to the top::ScaleFactorRetriever object + * which allows us to easily access the SF decorations + * @returns A shared pointer to the top::ScaleFactorRetriever object + */ + std::shared_ptr<top::ScaleFactorRetriever> scaleFactorRetriever(); + + /*! + * @brief Function to access the branch filters - cf ANALYSISTO-61 + * @returns A shared pointer to the m_branchFilters object + */ + std::vector<top::TreeManager::BranchFilter> & branchFilters(); + + /*! + * @brief Internal function which configures the particle level tree + * manager. It does branch setup etc. + */ + void setupParticleLevelTreeManager(const top::ParticleLevelEvent& plEvent); + + /*! + * @brief Internal function which configures the upgrade tree manager. + * It does branch setup etc. + */ + void setupUpgradeTreeManager(/*const top::UpgradeEvent& upgradeEvent*/); +private: + /** + * @brief For each selection that we run in the top-xaod code, we "decorate" + * event info with a variable saying if this event passed or failed it. + * + * This code takes the decoration from event info + * + * @param event The top event, need this so we can access the decorators on EventInfo + * @param extraBranches The names of the branches we added to EventInfo (one per event) + */ + void recordSelectionDecision(const top::Event& event); + void recordTriggerDecision(const top::Event& event); + + void registerObjectIntoTruthTree(const SG::AuxElement& obj); + void saveObjectIntoTruthTree(const SG::AuxElement& obj); + + /*! + * @brief Helper function to load the PDF info from the current truth event + * and write it into the branch output variable(s). + * + * After calling this function, the `m_PDFinfo*` variables will contain the + * current truth event's PDF info data (given that the truth event is + * valid). + */ + void loadPdfInfo(); + + /*! + * @brief Helper function to load the PDF weights from the current truth + * event and write them into the branch output variable. + * + * After calling this function, the `m_PDF_eventWeights` variable will + * contain the current truth event's LHA PDF weights for the requested PDF + * sets (given that the truth event is valid). + */ + void loadPdfWeights(); + + /*! + * @brief Helper function to load the OTF-computed MC generator weights. + */ + void loadMCGeneratorWeights(); + + ///Configuration + std::shared_ptr<top::TopConfig> m_config; + + ///Scale factors + std::shared_ptr<top::ScaleFactorRetriever> m_sfRetriever; + + ///The file where everything goes + TFile* m_outputFile; + + ///A simple way to write out branches, without having to worry about the type. + std::vector<std::shared_ptr<top::TreeManager>> m_treeManagers; + std::shared_ptr<top::TreeManager> m_truthTreeManager; + + /// The top::TreeManager used for the particle level data output. + std::shared_ptr<top::TreeManager> m_particleLevelTreeManager; + /// The array of variables used for storing the particle level selection + /// decisions. The std::pair contains: + /// .first --- The name of the selection + /// .second --- The variable used for storing into the TTree + std::vector< std::pair<std::string,int> > m_particleLevel_SelectionDecisions; + + /// TreeManager for upgrade analysis data output + std::shared_ptr<top::TreeManager> m_upgradeTreeManager; + + ///names of the passed / failed branches. + std::vector<std::string> m_extraBranches; + + /// branch filters - cf ANALYSISTO-61 + std::vector<top::TreeManager::BranchFilter> m_branchFilters; + + ///Decisions on if the event passed / failed a particular selection. + std::vector<int> m_selectionDecisions; + + ///Decisions on if the event passed / failed a particular trigger. + std::unordered_map<std::string, char> m_triggerDecisions; + + ///Pre-scale of the trigger menu for each event. + std::unordered_map<std::string, float> m_triggerPrescales; + + //Store output PDF weights from LHAPDF + std::unordered_map<std::string, std::vector<float> > m_PDF_eventWeights; + + //some event weights + float m_weight_mc; + float m_weight_pileup; + ///-- Pileup SF systematics --/// + float m_weight_pileup_UP; + float m_weight_pileup_DOWN; + ///-- Lepton SF --/// + float m_weight_leptonSF; + ///-- Lepton SF - electron SF systematics --/// + float m_weight_leptonSF_EL_SF_Trigger_UP; + float m_weight_leptonSF_EL_SF_Trigger_DOWN; + float m_weight_leptonSF_EL_SF_Reco_UP; + float m_weight_leptonSF_EL_SF_Reco_DOWN; + float m_weight_leptonSF_EL_SF_ID_UP; + float m_weight_leptonSF_EL_SF_ID_DOWN; + float m_weight_leptonSF_EL_SF_Isol_UP; + float m_weight_leptonSF_EL_SF_Isol_DOWN; + ///-- Lepton SF - muon SF systematics --/// + float m_weight_leptonSF_MU_SF_Trigger_STAT_UP; + float m_weight_leptonSF_MU_SF_Trigger_STAT_DOWN; + float m_weight_leptonSF_MU_SF_Trigger_SYST_UP; + float m_weight_leptonSF_MU_SF_Trigger_SYST_DOWN; + // Muon ID SF systematics (regular) + float m_weight_leptonSF_MU_SF_ID_STAT_UP; + float m_weight_leptonSF_MU_SF_ID_STAT_DOWN; + float m_weight_leptonSF_MU_SF_ID_SYST_UP; + float m_weight_leptonSF_MU_SF_ID_SYST_DOWN; + // Muon ID SF systematics (low pT) + float m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_UP; + float m_weight_leptonSF_MU_SF_ID_STAT_LOWPT_DOWN; + float m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP; + float m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_DOWN; + // Muon isolation SF systematics + float m_weight_leptonSF_MU_SF_Isol_STAT_UP; + float m_weight_leptonSF_MU_SF_Isol_STAT_DOWN; + float m_weight_leptonSF_MU_SF_Isol_SYST_UP; + float m_weight_leptonSF_MU_SF_Isol_SYST_DOWN; + float m_weight_leptonSF_MU_SF_TTVA_STAT_UP; + float m_weight_leptonSF_MU_SF_TTVA_STAT_DOWN; + float m_weight_leptonSF_MU_SF_TTVA_SYST_UP; + float m_weight_leptonSF_MU_SF_TTVA_SYST_DOWN; + + ///-- individual components for lepton SF --/// + float m_weight_indiv_SF_EL_Trigger; + float m_weight_indiv_SF_EL_Trigger_UP; + float m_weight_indiv_SF_EL_Trigger_DOWN; + float m_weight_indiv_SF_EL_Reco; + float m_weight_indiv_SF_EL_Reco_UP; + float m_weight_indiv_SF_EL_Reco_DOWN; + float m_weight_indiv_SF_EL_ID; + float m_weight_indiv_SF_EL_ID_UP; + float m_weight_indiv_SF_EL_ID_DOWN; + float m_weight_indiv_SF_EL_Isol; + float m_weight_indiv_SF_EL_Isol_UP; + float m_weight_indiv_SF_EL_Isol_DOWN; + float m_weight_indiv_SF_EL_ChargeID; + float m_weight_indiv_SF_EL_ChargeID_UP; + float m_weight_indiv_SF_EL_ChargeID_DOWN; + float m_weight_indiv_SF_EL_ChargeMisID; + float m_weight_indiv_SF_EL_ChargeMisID_STAT_UP; + float m_weight_indiv_SF_EL_ChargeMisID_STAT_DOWN; + float m_weight_indiv_SF_EL_ChargeMisID_SYST_UP; + float m_weight_indiv_SF_EL_ChargeMisID_SYST_DOWN; + float m_weight_indiv_SF_MU_Trigger; + float m_weight_indiv_SF_MU_Trigger_STAT_UP; + float m_weight_indiv_SF_MU_Trigger_STAT_DOWN; + float m_weight_indiv_SF_MU_Trigger_SYST_UP; + float m_weight_indiv_SF_MU_Trigger_SYST_DOWN; + float m_weight_indiv_SF_MU_ID; + // Muon ID SF systematics (regular) + float m_weight_indiv_SF_MU_ID_STAT_UP; + float m_weight_indiv_SF_MU_ID_STAT_DOWN; + float m_weight_indiv_SF_MU_ID_SYST_UP; + float m_weight_indiv_SF_MU_ID_SYST_DOWN; + // Muon ID SF systematics (low pt) + float m_weight_indiv_SF_MU_ID_STAT_LOWPT_UP; + float m_weight_indiv_SF_MU_ID_STAT_LOWPT_DOWN; + float m_weight_indiv_SF_MU_ID_SYST_LOWPT_UP; + float m_weight_indiv_SF_MU_ID_SYST_LOWPT_DOWN; + // Muon isolation systematics + float m_weight_indiv_SF_MU_Isol; + float m_weight_indiv_SF_MU_Isol_SYST_UP; + float m_weight_indiv_SF_MU_Isol_SYST_DOWN; + float m_weight_indiv_SF_MU_Isol_STAT_UP; + float m_weight_indiv_SF_MU_Isol_STAT_DOWN; + float m_weight_indiv_SF_MU_TTVA; + float m_weight_indiv_SF_MU_TTVA_SYST_UP; + float m_weight_indiv_SF_MU_TTVA_SYST_DOWN; + float m_weight_indiv_SF_MU_TTVA_STAT_UP; + float m_weight_indiv_SF_MU_TTVA_STAT_DOWN; + + // Taus + float m_weight_tauSF; + float m_weight_tauSF_ELEOLR_UP; + float m_weight_tauSF_ELEOLR_DOWN; + float m_weight_tauSF_JETID_UP; + float m_weight_tauSF_JETID_DOWN; + float m_weight_tauSF_RECO_UP; + float m_weight_tauSF_RECO_DOWN; + + // Photons + float m_weight_photonSF = 0.; + float m_weight_photonSF_ID_UP = 0.; + float m_weight_photonSF_ID_DOWN = 0.; + float m_weight_photonSF_effIso = 0.; + float m_weight_photonSF_effLowPtIso_UP = 0.; + float m_weight_photonSF_effLowPtIso_DOWN = 0.; + float m_weight_photonSF_effTrkIso_UP = 0.; + float m_weight_photonSF_effTrkIso_DOWN = 0.; + float m_weight_photonSF_isoDDonoff_UP = 0.; + float m_weight_photonSF_isoDDonoff_DOWN = 0.; + + // nominal b-tagging SF [WP] + std::unordered_map<std::string, float> m_weight_bTagSF; + std::unordered_map<std::string, float> m_weight_trackjet_bTagSF; + + // JVT (c++11 initialization for fun) + float m_weight_jvt = 0.0; + float m_weight_jvt_up = 0.0; + float m_weight_jvt_down = 0.0; + + // Sherpa 2.2 weight + float m_weight_sherpa_22_vjets = 0.; + + // eigen variations affecting b-jets [WP] + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_B_up; + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_B_down; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_B_up; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_B_down; + + // eigen variations affecting c-jets [WP] + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_C_up; + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_C_down; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_C_up; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_C_down; + + // eigen variations affecting light jets [WP] + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_Light_up; + std::unordered_map<std::string, std::vector<float>> m_weight_bTagSF_eigen_Light_down; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_Light_up; + std::unordered_map<std::string, std::vector<float>> m_weight_trackjet_bTagSF_eigen_Light_down; + + // named systematics [WP][name] + std::unordered_map<std::string, std::unordered_map<std::string, float>> m_weight_bTagSF_named_up; + std::unordered_map<std::string, std::unordered_map<std::string, float>> m_weight_bTagSF_named_down; + std::unordered_map<std::string, std::unordered_map<std::string, float>> m_weight_trackjet_bTagSF_named_up; + std::unordered_map<std::string, std::unordered_map<std::string, float>> m_weight_trackjet_bTagSF_named_down; + + // remove "FT_EFF_" and spaces in named systematics + std::string betterBtagNamedSyst (const std::string WP); + + ///-- weights for matrix-method fakes estimate, for each selection and configuration --/// + /// m_fakesMM_weights[selection][configuration] + std::unordered_map<std::string,std::unordered_map<std::string, float>> m_fakesMM_weights; + + + //event info + unsigned long long m_eventNumber; + unsigned int m_runNumber; + unsigned int m_randomRunNumber; + unsigned int m_mcChannelNumber; + float m_mu_original; + float m_mu; + // non-collision background flag - usage: https://twiki.cern.ch/twiki/bin/view/Atlas/NonCollisionBackgroundsRunTwo#Recommend_cuts_tools_and_procedu + unsigned int m_backgroundFlags; + // hasBadMuon flag - see: https://twiki.cern.ch/twiki/bin/viewauth/Atlas/MuonSelectionTool#is_BadMuon_Flag_Event_Veto + unsigned int m_hasBadMuon; + + //electrons + std::vector<float> m_el_pt; + std::vector<float> m_el_eta; + std::vector<float> m_el_cl_eta; + std::vector<float> m_el_phi; + std::vector<float> m_el_e; + std::vector<float> m_el_charge; + std::vector<float> m_el_topoetcone20; + std::vector<float> m_el_ptvarcone20; + std::vector<char> m_el_isTight; + std::vector<char> m_el_CF; // pass charge ID selector (has no charge flip) + std::unordered_map<std::string, std::vector<char> > m_el_trigMatched; + std::vector<float> m_el_d0sig; + std::vector<float> m_el_delta_z0_sintheta; + std::vector<int> m_el_true_type; + std::vector<int> m_el_true_origin; + std::vector<int> m_el_true_typebkg; + std::vector<int> m_el_true_originbkg; + + //muons + std::vector<float> m_mu_pt; + std::vector<float> m_mu_eta; + std::vector<float> m_mu_phi; + std::vector<float> m_mu_e; + std::vector<float> m_mu_charge; + std::vector<float> m_mu_topoetcone20; + std::vector<float> m_mu_ptvarcone30; + std::vector<char> m_mu_isTight; + std::unordered_map<std::string, std::vector<char> > m_mu_trigMatched; + std::vector<float> m_mu_d0sig; + std::vector<float> m_mu_delta_z0_sintheta; + std::vector<int> m_mu_true_type; + std::vector<int> m_mu_true_origin; + //photons + std::vector<float> m_ph_pt; + std::vector<float> m_ph_eta; + std::vector<float> m_ph_phi; + std::vector<float> m_ph_e; + std::vector<float> m_ph_iso; + + //taus + std::vector<float> m_tau_pt; + std::vector<float> m_tau_eta; + std::vector<float> m_tau_phi; + std::vector<float> m_tau_charge; + + //jets + std::vector<float> m_jet_pt; + std::vector<float> m_jet_eta; + std::vector<float> m_jet_phi; + std::vector<float> m_jet_e; + std::vector<float> m_jet_mv2c00; + std::vector<float> m_jet_mv2c10; + std::vector<float> m_jet_mv2c20; + std::vector<float> m_jet_jvt; + std::vector<char> m_jet_passfjvt; + std::vector<float> m_jet_ip3dsv1; + std::vector<int> m_jet_truthflav; + std::vector<int> m_jet_truthPartonLabel; + std::vector<char> m_jet_isTrueHS; + std::unordered_map<std::string, std::vector<char>> m_jet_isbtagged;//one vector per jet per WP + std::vector<int> m_jet_tagWeightBin;//tag-weight bin in case Continuous WP is used + + // for upgrade, we store the tagging efficiency per jet & whether it is from pileup + std::vector<float> m_jet_mv1eff; + std::vector<float> m_jet_isPileup; + + //large-R jets + std::vector<float> m_ljet_pt; + std::vector<float> m_ljet_eta; + std::vector<float> m_ljet_phi; + std::vector<float> m_ljet_e; + std::vector<float> m_ljet_m; + std::vector<float> m_ljet_sd12; + + //track jets + std::vector<float> m_tjet_pt; + std::vector<float> m_tjet_eta; + std::vector<float> m_tjet_phi; + std::vector<float> m_tjet_e; + std::vector<float> m_tjet_mv2c00; + std::vector<float> m_tjet_mv2c10; + std::vector<float> m_tjet_mv2c20; + std::unordered_map<std::string, std::vector<char>> m_tjet_isbtagged;//one vector per jet per WP + std::vector<int> m_tjet_tagWeightBin;//tag-weight bin in case Continuous WP is used + + //re-clustered jets + // -> need unordered map for systematics + bool m_makeRCJets; // making re-clustered jets + bool m_makeVarRCJets; // making VarRC jets + std::string m_RCJetContainer; // name for RC jets container in TStore + std::vector<std::string> m_VarRCJetRho; + std::vector<std::string> m_VarRCJetMassScale; + std::unique_ptr<RCJetMC15> m_rc; + std::map<std::string,std::unique_ptr<RCJetMC15> > m_VarRC; + std::string m_egamma; // egamma systematic naming scheme + std::string m_muonsyst; // muon systematic naming scheme + std::string m_jetsyst; // jet systematic naming scheme + std::unordered_map<std::size_t, JetReclusteringTool*> m_jetReclusteringTool; + std::map<std::string,std::vector<float>> m_VarRCjetBranches; + std::map<std::string,std::vector<std::vector<float>>> m_VarRCjetsubBranches; + std::vector<int> m_rcjet_nsub; + std::vector<float> m_rcjet_pt; + std::vector<float> m_rcjet_eta; + std::vector<float> m_rcjet_phi; + std::vector<float> m_rcjet_e; + std::vector<float> m_rcjet_d12; + std::vector<float> m_rcjet_d23; + std::vector<std::vector<float> > m_rcjetsub_pt; + std::vector<std::vector<float> > m_rcjetsub_eta; + std::vector<std::vector<float> > m_rcjetsub_phi; + std::vector<std::vector<float> > m_rcjetsub_e; + std::vector<std::vector<float> > m_rcjetsub_mv2c10; + + //met + float m_met_met; + float m_met_phi; + + //KLFitter + short m_klfitter_selected; + /// Error flags + std::vector<short> m_klfitter_minuitDidNotConverge; + std::vector<short> m_klfitter_fitAbortedDueToNaN; + std::vector<short> m_klfitter_atLeastOneFitParameterAtItsLimit; + std::vector<short> m_klfitter_invalidTransferFunctionAtConvergence; + + /// Global result + std::vector<unsigned int> m_klfitter_bestPermutation; + std::vector<float> m_klfitter_logLikelihood; + std::vector<float> m_klfitter_eventProbability; + std::vector<std::vector<double>> m_klfitter_parameters; + std::vector<std::vector<double>> m_klfitter_parameterErrors; + + /// Model + std::vector<float> m_klfitter_model_bhad_pt; + std::vector<float> m_klfitter_model_bhad_eta; + std::vector<float> m_klfitter_model_bhad_phi; + std::vector<float> m_klfitter_model_bhad_E; + std::vector<unsigned int> m_klfitter_model_bhad_jetIndex; + + std::vector<float> m_klfitter_model_blep_pt; + std::vector<float> m_klfitter_model_blep_eta; + std::vector<float> m_klfitter_model_blep_phi; + std::vector<float> m_klfitter_model_blep_E; + std::vector<unsigned int> m_klfitter_model_blep_jetIndex; + + std::vector<float> m_klfitter_model_lq1_pt; + std::vector<float> m_klfitter_model_lq1_eta; + std::vector<float> m_klfitter_model_lq1_phi; + std::vector<float> m_klfitter_model_lq1_E; + std::vector<unsigned int> m_klfitter_model_lq1_jetIndex; + + std::vector<float> m_klfitter_model_lq2_pt; + std::vector<float> m_klfitter_model_lq2_eta; + std::vector<float> m_klfitter_model_lq2_phi; + std::vector<float> m_klfitter_model_lq2_E; + std::vector<unsigned int> m_klfitter_model_lq2_jetIndex; + + std::vector<float> m_klfitter_model_Higgs_b1_pt; + std::vector<float> m_klfitter_model_Higgs_b1_eta; + std::vector<float> m_klfitter_model_Higgs_b1_phi; + std::vector<float> m_klfitter_model_Higgs_b1_E; + std::vector<unsigned int> m_klfitter_model_Higgs_b1_jetIndex; + + std::vector<float> m_klfitter_model_Higgs_b2_pt; + std::vector<float> m_klfitter_model_Higgs_b2_eta; + std::vector<float> m_klfitter_model_Higgs_b2_phi; + std::vector<float> m_klfitter_model_Higgs_b2_E; + std::vector<unsigned int> m_klfitter_model_Higgs_b2_jetIndex; + + std::vector<float> m_klfitter_model_lep_pt; + std::vector<float> m_klfitter_model_lep_eta; + std::vector<float> m_klfitter_model_lep_phi; + std::vector<float> m_klfitter_model_lep_E; + + std::vector<float> m_klfitter_model_nu_pt; + std::vector<float> m_klfitter_model_nu_eta; + std::vector<float> m_klfitter_model_nu_phi; + std::vector<float> m_klfitter_model_nu_E; + + // calculated KLFitter variables for best perm + float m_klfitter_bestPerm_topLep_pt; + float m_klfitter_bestPerm_topLep_eta; + float m_klfitter_bestPerm_topLep_phi; + float m_klfitter_bestPerm_topLep_E; + float m_klfitter_bestPerm_topLep_m; + + float m_klfitter_bestPerm_topHad_pt; + float m_klfitter_bestPerm_topHad_eta; + float m_klfitter_bestPerm_topHad_phi; + float m_klfitter_bestPerm_topHad_E; + float m_klfitter_bestPerm_topHad_m; + + float m_klfitter_bestPerm_ttbar_pt; + float m_klfitter_bestPerm_ttbar_eta; + float m_klfitter_bestPerm_ttbar_phi; + float m_klfitter_bestPerm_ttbar_E; + float m_klfitter_bestPerm_ttbar_m; + + // PseudoTop variables + + float m_PseudoTop_Reco_ttbar_pt; + float m_PseudoTop_Reco_ttbar_eta; + float m_PseudoTop_Reco_ttbar_phi; + float m_PseudoTop_Reco_ttbar_m; + float m_PseudoTop_Reco_top_had_pt; + float m_PseudoTop_Reco_top_had_eta; + float m_PseudoTop_Reco_top_had_phi; + float m_PseudoTop_Reco_top_had_m; + float m_PseudoTop_Reco_top_lep_pt; + float m_PseudoTop_Reco_top_lep_eta; + float m_PseudoTop_Reco_top_lep_phi; + float m_PseudoTop_Reco_top_lep_m; + float m_PseudoTop_Particle_ttbar_pt; + float m_PseudoTop_Particle_ttbar_eta; + float m_PseudoTop_Particle_ttbar_phi; + float m_PseudoTop_Particle_ttbar_m; + float m_PseudoTop_Particle_top_had_pt; + float m_PseudoTop_Particle_top_had_eta; + float m_PseudoTop_Particle_top_had_phi; + float m_PseudoTop_Particle_top_had_m; + float m_PseudoTop_Particle_top_lep_pt; + float m_PseudoTop_Particle_top_lep_eta; + float m_PseudoTop_Particle_top_lep_phi; + float m_PseudoTop_Particle_top_lep_m; + + + //MC + std::vector<float> m_mc_pt; + std::vector<float> m_mc_eta; + std::vector<float> m_mc_phi; + std::vector<float> m_mc_e; + std::vector<int> m_mc_pdgId; + + //PDFInfo + std::vector<float> m_PDFinfo_X1; + std::vector<float> m_PDFinfo_X2; + std::vector<int> m_PDFinfo_PDGID1; + std::vector<int> m_PDFinfo_PDGID2; + std::vector<float> m_PDFinfo_Q; + std::vector<float> m_PDFinfo_XF1; + std::vector<float> m_PDFinfo_XF2; + + //the on-the-fly computed generator weights + //there is one vector of float per entry in the trutheventcontainer (which should have only 1 entry) + std::vector<float> m_mc_generator_weights; + + //Extra variables for Particle Level (bare lepton kinematics and b-Hadron + //tagging information). + std::vector<float> m_el_pt_bare; + std::vector<float> m_el_eta_bare; + std::vector<float> m_el_phi_bare; + std::vector<float> m_el_e_bare; + + std::vector<float> m_mu_pt_bare; + std::vector<float> m_mu_eta_bare; + std::vector<float> m_mu_phi_bare; + std::vector<float> m_mu_e_bare; + + std::vector<int> m_jet_Ghosts_BHadron_Final_Count; + std::vector<int> m_jet_Ghosts_CHadron_Final_Count; + std::vector<int> m_ljet_Ghosts_BHadron_Final_Count; + std::vector<int> m_ljet_Ghosts_CHadron_Final_Count; + + + // Truth tree inserted variables + // This can be expanded as required + // This is just a first pass at doing this sort of thing + std::unordered_map<std::string,int*> m_extraTruthVars_int; + std::unordered_map<std::string,float*> m_extraTruthVars_float; + + ClassDef(top::EventSaverFlatNtuple, 0); +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAOD.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAOD.h new file mode 100644 index 0000000000000000000000000000000000000000..9bd31692393895451dd9668567399f7edbbc0985 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAOD.h @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSAVERXAOD_H_ +#define EVENTSAVERXAOD_H_ + +#include "TopAnalysis/EventSaverBase.h" + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +class TFile; + +namespace top { + +/** + * @brief Write out the selected events in xAOD format. At some point this will + * be the future. But probably not right now. Still too many missing features. + */ +class EventSaverxAOD : public top::EventSaverBase , public asg::AsgTool { + +public: + /** + * @brief Kept simple, set the output container prefix (so they have a + * different name to the input containers). + */ + EventSaverxAOD(); + + virtual ~EventSaverxAOD(); + + /** + * @brief This does some configuration of the output file. It also keeps track + * of which branches should be saved. + * + * You surely don't need all the branches, but if you do remove the + * corresponding line. + * + * We can't do much in the constructor, like I would like, because we're + * letting root make this. So instead we have a function here. + * + * @param config The top::TopConfig object that contains lots of settings and + * stuff. + * @param file The output TFile that you want to save things to. + * @param extraBranches List of extra branches that (currently) are attached to + * EventInfo. e.g. the branch that tells you if an event passed a certain + * selection. If you add it here, it'll be written to the output file. + */ + virtual void initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches); + + //Keep the asg::AsgTool happy + virtual StatusCode initialize(){return StatusCode::SUCCESS;} + + /** + * @brief Save an event. + * + * Why am I only writing out the nominal tree. + * + * I thought the fill for the xaod would allow me to specify the tree name, + * but it seems I can only do that in the writeTo. Maybe their is a clever + * way around it, but I'm too tired of this. + * + * Why not save shallow copies? This would be nice. But aren't shallow + * copies unsorted? We'd have to remember to sort them. + * + * It looks like branch removal from things in containers (jets, leptons) is + * still not working. So the xAOD files are still huge. + * + * @param event The top event for this particular systematic variation. + * @param xaodEvent The xAOD event object, so we can actually save. + */ + virtual void saveEvent(const top::Event& event); + + ///xAOD needs to write some more stuff to the file at the end of a job + virtual void finalize(); + +private: + ///Name to prepend to the output containers + const std::string m_prefix; + + ///We need access to the configuration file to get the container names. + std::shared_ptr<top::TopConfig> m_config; + + ///We need to hold on to the output file + TFile* m_outputFile; + + ClassDef(top::EventSaverxAOD, 0); +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAODNext.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAODNext.h new file mode 100644 index 0000000000000000000000000000000000000000..ff2257b9f749ec0f4ddbd2a51fd4b570ccf6096e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverxAODNext.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSAVERXAODNEXT_H_ +#define EVENTSAVERXAODNEXT_H_ + +#include "TopAnalysis/EventSaverBase.h" + +// Framework include(s): +#include "AsgTools/AsgMetadataTool.h" + +class TFile; + +namespace top { + + /** + * @brief Write out the selected events in xAOD format. + * Next generation xAOD output - still in development + */ + class EventSaverxAODNext : public top::EventSaverBase , public asg::AsgMetadataTool { + + public: + + EventSaverxAODNext(); + + virtual ~EventSaverxAODNext(); + + /** + * @brief This does some configuration of the output file. It also keeps track + * of which branches should be saved. + * + * You surely don't need all the branches, but if you do remove the + * corresponding line. + * + * We can't do much in the constructor, like I would like, because we're + * letting root make this. So instead we have a function here. + * + * @param config The top::TopConfig object that contains lots of settings and + * stuff. + * @param file The output TFile that you want to save things to. + * @param extraBranches List of extra branches that (currently) are attached to + * EventInfo. e.g. the branch that tells you if an event passed a certain + * selection. If you add it here, it'll be written to the output file. + */ + virtual void initialize(std::shared_ptr<top::TopConfig> config, TFile* file, const std::vector<std::string>& extraBranches); + + //Keep the asg::AsgTool happy + virtual StatusCode initialize(){return StatusCode::SUCCESS;} + + + virtual void saveEventToxAOD(); + + ///xAOD needs to write some more stuff to the file at the end of a job + virtual void finalize(); + + private: + ///We need access to the configuration file to get the container names. + std::shared_ptr<top::TopConfig> m_config; + + ///We need to hold on to the output file + TFile* m_outputFile; + + bool m_saveAllObjects; + + // helper typedef + typedef std::map<std::size_t,std::map<unsigned int,unsigned int>> ThinningMap_t; + typedef ThinningMap_t::const_iterator ThinningMap_Itr; + + std::shared_ptr<ThinningMap_t> savePhotons(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveElectrons(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveMuons(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveTaus(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveJets(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveLargeRJets(const bool saveEventObjects); + std::shared_ptr<ThinningMap_t> saveTrackJets(const bool saveEventObjects); + + std::vector<unsigned int> thinObjectSelection(const std::size_t hashValue , + const std::vector<unsigned int>& objectList , + const std::shared_ptr<ThinningMap_t> thinningMap) const; + + + ClassDef(top::EventSaverxAODNext, 0); + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelection.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelection.h new file mode 100644 index 0000000000000000000000000000000000000000..116fa78daa2cd7364074fe3916dabb62194f4575 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelection.h @@ -0,0 +1,259 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSELECTION_H_ +#define EVENTSELECTION_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventSelectionTools/ToolLoaderBase.h" +#include "TopCorrections/ScaleFactorRetriever.h" + +#include <string> +#include <vector> +#include <memory> + +class TH1D; +class TFile; + +namespace EL { + class Worker; +} + +namespace top { + class Event; + class TopConfig; + class ParticleLevelEvent; +} + +namespace top { +/** + * @brief Perform the event selection on a top::Event object. + * + * Class to perform the event selection and keep track of the number + * of events passing each cut. It is also responsible for writing out the + * 4-vectors in the output file if the user so wished. + */ +class EventSelection final { +public: + /** + * @brief Construct using a vector of cuts. + * + * The user supplies a simple vector of string that contains the cuts that + * should be applied. The tool will try to load each cut (and quit with + * and error message if it can't). + * + * It also sets up a histogram which contains all the cuts on the x-axis + * and each bin is the number of events passing a cut (in order). + */ + EventSelection(const std::string& name, const std::vector<std::string>& cutNames, TFile* outputFile, const std::vector<std::unique_ptr<top::ToolLoaderBase>>& toolLoaders,std::shared_ptr<top::TopConfig> config, EL::Worker* wk); + + /** + * @brief Does not do anything + */ + virtual ~EventSelection() {} + + /** + * @brief Move constructor + */ + EventSelection(EventSelection&& other); + + /** + * @brief Default constructor is not allowed + */ + EventSelection() = delete; + + /** + * @brief Copy is not allowed + */ + EventSelection(const EventSelection&) = delete; + + /** + * @brief Assignment is not allowed. + */ + EventSelection& operator=(const EventSelection&) = delete; + + /** + * @brief Count the number of initial events + */ + virtual void countInitial(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const; + /** + * @brief Count the number of events passing GRL + */ + virtual void countGRL(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const; + /** + * @brief Count the number of events passing Good Calo + */ + virtual void countGoodCalo(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const; + /** + * @brief Count the number of events passing Primary Vertex + */ + virtual void countPrimaryVertex(const float mcEventWeight,const float pileupWeight,const float zvtxWeight) const; + + /** + * @brief Apply the selection for each event. + * + * This loops through all the configured cuts in order and looks to see if + * the top::Event passes them or not. It fills the cutflow histogram if + * the events passes. + * + * @param event This is not modified by the cuts so is const. In the event + * loop each event is passed to this function and the cuts are applied and + * the results recorded. + * @return If the event passes all cuts, or at least all those before SAVE + * then true will be returned - which means that this event passes + * the selection - and false otherwise. The selection flag will be set accordingly. + * In case of true if SAVE is present then the event will be saved. + */ + virtual bool apply(const top::Event& event) const; + + /*! + * @brief Apply the selection for each particle level event. + * + * This loops through all the cuts configured for reco (nominal) level to + * see if the top::ParticleLevelEvent passes them or not. It also fills the + * particle level cutflow histogram corresponding to the stage up to which + * the event passes through the event selection. + * + * @param plEvent This is the particle level event which is in question. It + * will not be modified by any of the cuts. + * @return If the event passes all cuts, or at least all those before SAVE + * then true will be returned - which means that this event passes + * the selection - and false otherwise. The selection flag will be set accordingly. + * In case of true if SAVE is present then the event will be saved. + */ + virtual bool applyParticleLevel(const top::ParticleLevelEvent& plEvent) const; + + /*! + * @brief Apply the selection for each upgrade level event. + * + * This loops through all the cuts configured for reco (nominal) level to + * see if the top::ParticleLevelEvent passes them or not. It also fills the + * upgrade level cutflow histogram corresponding to the stage up to which + * the event passes through the event selection. + * + * @param plEvent This is the upgrade level event which is in question. It + * will not be modified by any of the cuts. + * @return If the event passes all cuts, or at least all those before SAVE + * then true will be returned - which means that this event passes + * the selection - and false otherwise. The selection flag will be set accordingly. + * In case of true if SAVE is present then the event will be saved. + */ + virtual bool applyUpgradeLevel(const top::ParticleLevelEvent& plEvent) const; + + /** + * @brief Print some yield information. + * + * This is not done in the destructor because we might not have a file + * open at that point in time. + */ + virtual void finalise() const; + + /** + * @brief Tells you the name of this event selection. + * + * @return The name of this event selection + */ + const std::string name() const; + + /** + * @brief Gives you the lists of the Fakes MM configurations associated to this selection. + * + * @return The list of configurations + */ + std::vector<std::string> GetFakesMMConfigs() const; + + /** + * @brief Tells if the event should be saved if it passes this selection + * + * @return If one of the cuts is called SAVE, returns true + * + */ + bool ToBeSaved() const {return m_toBeSaved;}; + +private: + /** + * @brief Print a cutflow showing the number of events passing each cut. + */ + virtual void printCuts(); + + ///Vector of all the tools that will be used in the analysis. + std::vector<std::unique_ptr<EventSelectorBase>> m_allCuts; + + ///The cutflow histogram filled by the tool. + mutable TH1D* m_cutflow; + mutable TH1D* m_cutflow_Loose; + + ///Cutflow counting MC weights instead of events + mutable TH1D* m_cutflowMCWeights; + mutable TH1D* m_cutflowMCWeights_Loose; + + ///Cutflow counting PileUp weights instead of events + mutable TH1D* m_cutflowPUWeights; + mutable TH1D* m_cutflowPUWeights_Loose; + + ///Cutflow counting ZVtx weights instead of events + mutable TH1D* m_cutflowZVtxWeights; + mutable TH1D* m_cutflowZVtxWeights_Loose; + + ///Cutflow counting MC*Pileup weights instead of events + mutable TH1D* m_cutflowMCPUWeights; + mutable TH1D* m_cutflowMCPUWeights_Loose; + + ///Cutflow counting MC*Pileup*ZVtx weights instead of events + mutable TH1D* m_cutflowMCPUZVtxWeights; + mutable TH1D* m_cutflowMCPUZVtxWeights_Loose; + + ///Cutflow counting ScaleFactors instead of events + mutable TH1D* m_cutflowScaleFactors; + mutable TH1D* m_cutflowScaleFactors_Loose; + + ///Cutflow counting b-tagging scale factors instead of events + mutable TH1D* m_cutflowBScaleFactors; + mutable TH1D* m_cutflowBScaleFactors_Loose; + + ///The particle level cutflow histogram filled by the tool. + mutable TH1D* m_cutflowParticleLevel; + + ///The upgrade level cutflow histogram filled by the tool. + mutable TH1D* m_cutflowUpgradeLevel; + + + /** + * @brief Name of this selection (you can have multiple selections run in + * the same job + */ + std::string m_name; + + ///To turn on/off confusing messages about mc weights when running on data + mutable bool m_isMC; + + /// + std::shared_ptr<TopConfig> m_config; + + ///Scale factors + std::unique_ptr<ScaleFactorRetriever> m_sfRetriever; + + // Nominal hash value + std::size_t m_nominalHashValue; + + // Does this selection contain initial and GRL? + // If so, what are their positions in the cut flow? + bool m_containsInitial; + bool m_containsGRL; + bool m_containsGoodCalo; + bool m_containsPrimaryVertex; + unsigned int m_positionInitial; + unsigned int m_positionGRL; + unsigned int m_positionGoodCalo; + unsigned int m_positionPrimaryVertex; + + // If true, event will be saved if it passes this selection + // If false, event will only be saved if it passes another selection + // If an event is saved, the flags of all selections (those passed and those not passed) are saved + bool m_toBeSaved; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelectionManager.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelectionManager.h new file mode 100644 index 0000000000000000000000000000000000000000..53f793c3f333783bb62a5e9d65726e92a55cdb45 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSelectionManager.h @@ -0,0 +1,164 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSELECTIONMANAGER_H_ +#define EVENTSELECTIONMANAGER_H_ + +#include <vector> +#include <memory> + +#include "TopConfiguration/SelectionConfigurationData.h" +#include "TopAnalysis/EventSelection.h" + +class TFile; + +namespace EL { + class Worker; +} + +namespace xAOD{ + class SystematicEvent; +} + +namespace top { + class Event; + class TopConfig; + class ParticleLevelEvent; +} + +namespace top{ +/** + * @brief Maybe you want to run multiple selections (e+jets, mu+jets) on the + * same input files at the same time. This class helps. + * + * I've heard a rumour that we'll only have a single trigger stream in 2015. + * I guess this means that it'd be useful to be able to run multiple, orthogonal, + * selections at the same time on the same input files. You could imagine + * running ee, mumu, emu, e+jets and mu+jets. + */ +class EventSelectionManager { +public: + /** + * @brief Loads the file and initialises all the relevant tools. + * + * @param selectionConfigData Vector of SelectionConfigurationData which + * contains the name of the event selection and a vector of cuts saved in + * string format + * @param outputFile Output file for attaching plots to, etc. + */ + explicit EventSelectionManager(const std::vector<SelectionConfigurationData>& selectionConfigData, TFile* outputFile, const std::string& toolLoaderNames, std::shared_ptr<top::TopConfig> config,EL::Worker* wk = nullptr); + + /** + * @brief Does not need to do anything + */ + virtual ~EventSelectionManager() {} + + /** + * @brief Move constructor + */ + EventSelectionManager(EventSelectionManager&& other); + + EventSelectionManager() = delete; + EventSelectionManager(const EventSelectionManager& rhs) = delete; + EventSelectionManager& operator=(const EventSelectionManager& rhs) = delete; + + /** + * @brief Count the number of initial events + */ + virtual void countInitial(const float mcEventWeight,const float pileupWeight,const float zvtxWeight); + /** + * @brief Count the number of events passing GRL + */ + virtual void countGRL(const float mcEventWeight,const float pileupWeight,const float zvtxWeight); + /** + * @brief Count the number of events passing Good Calo + */ + virtual void countGoodCalo(const float mcEventWeight,const float pileupWeight,const float zvtxWeight); + /** + * @brief Count the number of events passing Primary Vertex + */ + virtual void countPrimaryVertex(const float mcEventWeight,const float pileupWeight,const float zvtxWeight); + + /** + * @brief Run through the event selections for each event. + * + * For each event loop through all the selections. If any selection wants + * to save the event then return true at the end. Otherwise, just the event + * level cut code is run. + * + * At the request of Danilo Enoque Ferreira de Lima it now attaches (to the + * EventInfo object) a variable for each selection being run with a bool for + * pass / fail. + * + * @param event The event in question + * @return Returns true if the event passes at least one selection for which + * SAVE is requested (for saving events to trees). + */ + virtual bool apply(top::Event& event,const xAOD::SystematicEvent& currentSystematic); + + /*! + * @brief Execute the event selection using the Particle Level data. + * + * This uses the same event selection objects as the reco level (nominal) + * selection. The function is almost a carbon copy of the apply(top::Event&) + * variant. + * + * @param plEvent The particle level event in question. + * @return Returns true if the event passes at least one selection for which + * SAVE is requested (for saving events to trees). + */ + virtual bool applyParticleLevel(const top::ParticleLevelEvent& plEvent); + + /*! + * @brief Execute the event selection using the Upgrade Level data. + * + * This uses the same event selection objects as the reco level (nominal) + * selection. The function is almost a carbon copy of the apply(top::Event&) + * variant. + * + * @param upgradeEvent The upgrade level event in question. + * @return Returns true if the event passes at least one selection for which + * SAVE is requested (for saving events to trees). + */ + virtual bool applyUpgradeLevel(const top::ParticleLevelEvent& upgradeEvent); + + /** + * @brief Call finalise on each tool. + * + * Not done in the destructor because these things (might) be copied around + * in memory by some calls. This is only called once, just before the + * destructor at the end of the program. + */ + virtual void finalise(); + + /** + * @brief To get the mini xAOD really small we need to tell it which + * branches to save + * + * For tiny files we need to tell the code exactly which branches to write- + * out. This adds a branch for each selection saying if the event passed + * or failed that selection. + * + * @param extraBranchList A vector of strings that is added to. A branch + * for each selection is added (this is stored in event info). + */ + virtual void addExtraBranches(std::vector<std::string>& extraBranchList); + + /** + * @brief Gives you the lists of the Fakes MM configurations associated to a selection. + * + * @return The list of configurations associated to the requested selection + * + * @param selection The requested selection. + */ + std::vector<std::string> GetFakesMMConfigs(std::string selection) const; + +private: + ///A vector of EventSelection objects, for doing fancy things + std::vector<top::EventSelection> m_selections; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..08984fddff5a209284e433fcf9e8f561dabf2c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderBase.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef OBJECTLOADERBASE_H_ +#define OBJECTLOADERBASE_H_ + +#include "TObject.h" +#include <memory> + +namespace top { +class TopConfig; +class TopObjectSelection; + +/** + * @brief People seem to want to be able to configure the objects used in their + * anaysis for some reason. This is a common base class for doing just that. + * It only has one function, init, and once that has run and made the object + * selection object then this can be deleted. + * + */ +class ObjectLoaderBase { +public: + /** + * @brief This will inherit from this, but it doesn't do anything really. + */ + virtual ~ObjectLoaderBase() {} + + /** + * @brief Must implement this to load your own object selection. We have + * two examples top::ObjectLoaderStandardCuts and top::ObjectLoaderTtres. + * + * @param topConfig Since you might need access to the user configuration + * loaded from the config file at run time. + * @return + */ + virtual top::TopObjectSelection* init(std::shared_ptr<top::TopConfig> topConfig) = 0; + + ClassDef(top::ObjectLoaderBase, 0) +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderStandardCuts.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderStandardCuts.h new file mode 100644 index 0000000000000000000000000000000000000000..cbcf30c59cfefe95bdf91a16ff98da5eea4ee680 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/ObjectLoaderStandardCuts.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef OBJECTLOADERSTANDARDCUTS_H_ +#define OBJECTLOADERSTANDARDCUTS_H_ + +#include "TopAnalysis/ObjectLoaderBase.h" + +namespace top { + +/** + * @brief This loads our "standard" object selection used in the top group. + * + * You can modify this directly, inherit from it and make changes or write your + * own. It's really your decision and I can't tell you what to do (you should + * write your own in a separate library then when you change release it wont + * be a big deal). + */ +class ObjectLoaderStandardCuts : public ObjectLoaderBase { +public: + + /** + * @brief Setup the cuts. Probably easiest if you look at the code, no? + * + * @param topConfig The config that has been loaded. + * @return A fully configured object that can be used to control which + * objects (physics ones, not computer ones) are selected by the program. + */ + top::TopObjectSelection* init(std::shared_ptr<top::TopConfig> topConfig); + + ClassDef(top::ObjectLoaderStandardCuts, 0) +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h new file mode 100644 index 0000000000000000000000000000000000000000..89f0cd263d10a389bcdcaf92ea52200cc05311d8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h @@ -0,0 +1,188 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPTOOLS_H__ +#define TOPTOOLS_H__ + +#include <vector> +#include <string> + +#include "xAODRootAccess/TEvent.h" + +#include "TopConfiguration/TopConfig.h" + +/** + * @file Tools.h + * + * Some tools to make life in the xAOD world a bit easier. Including ways + * to initialise, guess the best "mode" to open an xAOD with, load cuts, list + * files, check yields of files, and load some "tools". + */ + +namespace top { +class TopObjectSelection; +class EventSaverBase; + +/** + * @brief A little wrapper for the xAOD tools. Also turns enabled the failure + * on unchecked status codes. + * + * @param failOnUnchecked Terminate the job on unchecked status codes by + * default. + */ +void xAODInit(bool failOnUnchecked = true); + +/** + * @brief Sometimes we need to know if we're running on a primary xAOD or a + * derivation. + * + * To figure this out (while we wait for a proper solution) we can open up + * the MetaData tree. As far as I can tell primary xAODs have a branch called + * StreamAOD and derivations have something a bit like StreamDAOD_TOPQ1. + * So if we see StreamAOD, we know it's a primary xAOD. I hope. + * + * @param inputFile A pointer to the input file + * @return True if this is a primary xAOD + */ +bool isFilePrimaryxAOD(TFile* inputFile); + +/** + * @brief Some of our things need to know if the events are MC or data before + * we're in the event loop. In the future this should be in the file metadata + * but right now we can't access it easily in RootCore. + * + * @param inputFile A pointer to the input file + * @param eventInfoName Name of the EventInfo container in the xAOD + * @return True if MC simulation, false for data + */ +bool isFileSimulation(TFile* inputFile, const std::string& eventInfoName); + +bool isTruthDxAOD(TFile* inputFile); + +unsigned int getDSID(TFile* inputFile, const std::string& eventInfoName); + +/** + * @brief Some of our things need to know if the events are AFII or FullSim + * for certain systematics. + * + * @param inputFile A pointer to the input file + * @param eventInfoName Name of the EventInfo container in the xAOD + * @return True if fast simulation, false for FullSim + */ +bool isFileFastSim(TFile* inputFile); + +/** + * @brief Function to determine the derivation type using string manipulation + * + * @param inputFile A pointer to the input file + * + * @return string with the derivation stream name + */ + +std::string getDerivationStream(TFile* inputFile); + + +/** + * @brief xAODs can be accessed in class or branch access mode. Guess 'the best' + * by trying branch access first and falling back to class access if that fails. + * + * Try to guess the 'best' mode to open the files with. The way we do this is + * first try with branch access (this is what is preferred because it'll allow + * us to make our mini xAODs smaller by kicking-out branches). The problem is + * the first xAODs for 8 TeV DC14 can't be read in this mode (actually only the + * egamma objects). This is fixed for 13 TeV, and will be for the 8 TeV + * derivations and the xAOD->xAOD reprocessing. + * + * This function opens the file, loads the first event and attempts to read the + * electron collection. If that works in branch mode it returns branch mode. + * If it fails, it returns class mode. + * + * @param filename A file that you're going to run on, so we can attempt to + * figure out which mode to use. + * + * @param electronCollectionName Name of the electron collection - no really! + * + * @return BranchAccess (preferred) or ClassAccess if the test fails. + */ +xAOD::TEvent::EAuxMode guessAccessMode(const std::string& filename, const std::string& electronCollectionName); + +/** + * @brief Load the file and make a vector of the cuts to pass on to the + * selection tool. + * + * @param filename The text file to load and read the cut information from. The + * idea is that the user will supply this at the command line. + * + * @return a vector with one cut-tool and configuration per line. + */ +std::vector<std::string> loadCuts(const std::string& filename); + +/** + * @brief Given a filename for a text file, parse it and extract a list of root + * files. + * + * This should open the text file and split it into a vector of strings. It + * should handle filenames that are separated by a newline or a comma. + * + * @param filename The text file that we want to parse. + * @return A vector of filenames. + */ +std::vector<std::string> fileList(const std::string& filename); + +/** + * @brief Open each file in the vector and get the number of events in it. + * + * Useful to make sure all the files are readable before jumping into an event + * loop. Also returns the total yield for all files. If the file can't be + * opened or the CollectionTree is missing then it will print an error message + * and exit. + * + * @param filenames A vector of filenames to check. + * @return The total yield for all files. + */ +unsigned int checkFiles(const std::vector<std::string>& filenames); + +/** + * @brief So that we can load external libraries with (1) extra event selection + * tools in, (2) user defined object selection and (3) user defined output file + * formats. For all those things the user supplies the class name of the class + * to load. But we also need the library that they're in so that root can load + * it. + * + * @param libraryNames The name of the library, for exmample + * libTopEventSelectionTools + */ +void loadLibraries(const std::string& libraryNames); + +/** + * @brief Users may want to define (and load!) their own object selection. Once + * the library is loaded we also need to know the class that they want to use. + * Root then loads that class and attempts to convert it to a + * top::TopObjectSelection pointer. Only if that works can the program + * continue. If it doesn't work, the program should end (not much point running + * if you didn't manage to configure the objects to run on, is there?) + * + * @param config The object selection setup needs access to the config object, which + * should know the name of the object selection to use + * + * @return The object selection pointer. + */ +top::TopObjectSelection* loadObjectSelection(std::shared_ptr<top::TopConfig> config); + +/** + * @brief Users may also want to write out custom ntuples / xAODs. This too + * can be loaded from the name of the class supplied in the configuration file. + * + * @param outputFormat Name of the class to load for the output format. For + * example top::EventSaverxAOD, or top::EventSaverFlatNtuple. Note that user + * defined ones are also allowed. Due to popular demand. + * + * @return If everything works, then a pointer to the event saver object. + * Otherwise the program should end and tell people why. + */ +top::EventSaverBase* loadEventSaver(std::shared_ptr<top::TopConfig> config); + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopDoxygenLayout.xml b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopDoxygenLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..873a1ba6fe81ec7f85f3b6e5c6706a5543b0e5f7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopDoxygenLayout.xml @@ -0,0 +1,206 @@ +<doxygenlayout version="1.0"> + <!-- Generated by doxygen 1.8.8 --> + <!-- Navigation index tabs for HTML output --> + <navindex> + <tab type="mainpage" visible="yes" title=""/> + <tab type="user" url="@ref tapage" title="Analysis"/> + <tab type="user" url="@ref tconfpage" title="Configuration"/> + <tab type="user" url="@ref tevpage" title="Event"/> + <tab type="user" url="@ref tfpage" title="Fakes"/> + <tab type="user" url="@ref tsompage" title="SystematicObjects"/> + <tab type="user" url="@ref tcpage" title="Corrections"/> + <tab type="user" url="@ref tostpage" title="ObjectSelectionTools"/> + <tab type="user" url="@ref testpage" title="EventSelectionTools"/> + <tab type="user" url="@ref tertpage" title="EventReconstructionTools"/> + <tab type="user" url="@ref tepage" title="Examples"/> + + <tab type="pages" visible="no" title="" intro=""/> + + <tab type="modules" visible="yes" title="" intro=""/> + <tab type="namespaces" visible="yes" title=""> + <tab type="namespacelist" visible="yes" title="" intro=""/> + <tab type="namespacemembers" visible="yes" title="" intro=""/> + </tab> + <tab type="classes" visible="yes" title=""> + <tab type="classlist" visible="yes" title="" intro=""/> + <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> + <tab type="hierarchy" visible="yes" title="" intro=""/> + <tab type="classmembers" visible="yes" title="" intro=""/> + </tab> + <tab type="files" visible="yes" title=""> + <tab type="filelist" visible="yes" title="" intro=""/> + <tab type="globals" visible="yes" title="" intro=""/> + </tab> + <tab type="examples" visible="yes" title="" intro=""/> + </navindex> + + <!-- Layout definition for a class page --> + <class> + <briefdescription visible="yes"/> + <includes visible="$SHOW_INCLUDE_FILES"/> + <inheritancegraph visible="$CLASS_GRAPH"/> + <collaborationgraph visible="$COLLABORATION_GRAPH"/> + <memberdecl> + <nestedclasses visible="yes" title=""/> + <publictypes title=""/> + <services title=""/> + <interfaces title=""/> + <publicslots title=""/> + <signals title=""/> + <publicmethods title=""/> + <publicstaticmethods title=""/> + <publicattributes title=""/> + <publicstaticattributes title=""/> + <protectedtypes title=""/> + <protectedslots title=""/> + <protectedmethods title=""/> + <protectedstaticmethods title=""/> + <protectedattributes title=""/> + <protectedstaticattributes title=""/> + <packagetypes title=""/> + <packagemethods title=""/> + <packagestaticmethods title=""/> + <packageattributes title=""/> + <packagestaticattributes title=""/> + <properties title=""/> + <events title=""/> + <privatetypes title=""/> + <privateslots title=""/> + <privatemethods title=""/> + <privatestaticmethods title=""/> + <privateattributes title=""/> + <privatestaticattributes title=""/> + <friends title=""/> + <related title="" subtitle=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <typedefs title=""/> + <enums title=""/> + <services title=""/> + <interfaces title=""/> + <constructors title=""/> + <functions title=""/> + <related title=""/> + <variables title=""/> + <properties title=""/> + <events title=""/> + </memberdef> + <allmemberslink visible="yes"/> + <usedfiles visible="$SHOW_USED_FILES"/> + <authorsection visible="yes"/> + </class> + + <!-- Layout definition for a namespace page --> + <namespace> + <briefdescription visible="yes"/> + <memberdecl> + <nestednamespaces visible="yes" title=""/> + <constantgroups visible="yes" title=""/> + <classes visible="yes" title=""/> + <typedefs title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <typedefs title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + </memberdef> + <authorsection visible="yes"/> + </namespace> + + <!-- Layout definition for a file page --> + <file> + <briefdescription visible="yes"/> + <includes visible="$SHOW_INCLUDE_FILES"/> + <includegraph visible="$INCLUDE_GRAPH"/> + <includedbygraph visible="$INCLUDED_BY_GRAPH"/> + <sourcelink visible="yes"/> + <memberdecl> + <classes visible="yes" title=""/> + <namespaces visible="yes" title=""/> + <constantgroups visible="yes" title=""/> + <defines title=""/> + <typedefs title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <defines title=""/> + <typedefs title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + </memberdef> + <authorsection/> + </file> + + <!-- Layout definition for a group page --> + <group> + <briefdescription visible="yes"/> + <groupgraph visible="$GROUP_GRAPHS"/> + <memberdecl> + <nestedgroups visible="yes" title=""/> + <dirs visible="yes" title=""/> + <files visible="yes" title=""/> + <namespaces visible="yes" title=""/> + <classes visible="yes" title=""/> + <defines title=""/> + <typedefs title=""/> + <enums title=""/> + <enumvalues title=""/> + <functions title=""/> + <variables title=""/> + <signals title=""/> + <publicslots title=""/> + <protectedslots title=""/> + <privateslots title=""/> + <events title=""/> + <properties title=""/> + <friends title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <pagedocs/> + <inlineclasses title=""/> + <defines title=""/> + <typedefs title=""/> + <enums title=""/> + <enumvalues title=""/> + <functions title=""/> + <variables title=""/> + <signals title=""/> + <publicslots title=""/> + <protectedslots title=""/> + <privateslots title=""/> + <events title=""/> + <properties title=""/> + <friends title=""/> + </memberdef> + <authorsection visible="yes"/> + </group> + + <!-- Layout definition for a directory page --> + <directory> + <briefdescription visible="yes"/> + <directorygraph visible="yes"/> + <memberdecl> + <dirs visible="yes"/> + <files visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + </directory> +</doxygenlayout> diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..0dca43bf55fb1e984f61675d01bd24aa308b4f66 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/cmt/Makefile.RootCore @@ -0,0 +1,24 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + +PACKAGE = TopAnalysis +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = -g +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = xAODCore xAODRootAccess xAODEgamma xAODMuon xAODJet xAODMissingET xAODCutFlow AsgTools AthContainers PATInterfaces TopCPTools TopEventSelectionTools TopConfiguration TopCorrections TopEvent TopParticleLevel TopPartons TopObjectSelectionTools TopSystematicObjectMaker TopFakes TopDataPreparation TopHLUpgrade +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_NOGRID = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 +PACKAGE_REFLEX = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/at-pkg b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/at-pkg new file mode 100755 index 0000000000000000000000000000000000000000..5f1b64bcde01780cada00311b2a52a3ed0729d99 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/at-pkg @@ -0,0 +1,88 @@ +#!/bin/bash +echo "Creating a new cmake folder for use with AnalysisTop" +pkgname=$1 +classname=$2 +echo "Creating $pkgname with $classname" + +mkdir -p $pkgname/Root $pkgname/$pkgname $pkgname/util $pkgname/scripts $pkgname/share +touch $pkgname/Root/LinkDef.h + +echo " +# Declare the name of this package: +atlas_subdir( $pkgname None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + TopAnalysis + TopCPTools + TopEventSelectionTools + TopConfiguration + TopCorrections + TopEvent + TopParticleLevel + TopPartons + TopObjectSelectionTools + TopSystematicObjectMaker + TopFakes + TopDataPreparation + TopHLUpgrade ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( $pkgname _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( $pkgname Root/*.cxx Root/*.h Root/*.icc + $pkgname/*.h $pkgname/*.icc $pkgname/*/*.h + $pkgname/*/*.icc \${_cintDictSource} + PUBLIC_HEADERS $pkgname + LINK_LIBRARIES TopAnalysis + TopCPTools + TopEventSelectionTools + TopConfiguration + TopCorrections + TopEvent + TopParticleLevel + TopPartons + TopObjectSelectionTools + TopSystematicObjectMaker + TopFakes + TopDataPreparation + TopHLUpgrade + \${ROOT_LIBRARIES} + INCLUDE_DIRS \${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Install user scripts +atlas_install_scripts( scripts/*.py ) + +# Build the executables of the package: +#atlas_add_executable( myexec_$pkgname +# util/myexec_$pkgname.cxx +# LINK_LIBRARIES TopCPTools +# TopEventSelectionTools +# TopConfiguration +# TopCorrections +# TopEvent +# TopParticleLevel +# TopPartons +# TopObjectSelectionTools +# TopSystematicObjectMaker +# TopFakes +# TopDataPreparation +# TopHLUpgrade +# ${ROOT_LIBRARIES} +# TopAnalysis ) +" > $pkgname/CMakeLists.txt + +touch $pkgname/$pkgname/$classname.h +touch $pkgname/Root/$classname.cxx diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/validation.py b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/validation.py new file mode 100755 index 0000000000000000000000000000000000000000..0b4cc37b6445bb872af23ee0501d96e17b5130d2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/validation.py @@ -0,0 +1,395 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import ROOT +import random,string + +import TopExamples.AtlasStyle + +import sys +import os +import re + +def thumbnail(plot, width, height): + img = ROOT.TASImage(plot) + img.Scale(width, height) + name = plot.replace('.png', '_tn.png') + img.WriteImage(name) + +def br(): + out.write('<br>\n') + +def h1(txt): + out.write('<h1>%s</h1>\n' % txt) + +def h3(txt): + out.write('<h3>%s</h3>\n' % txt) + + +# rebin histogram to add underflow and overflow bins +def addUnderOverflowBin(h): + # see https://root.cern.ch/phpBB3/viewtopic.php?t=6764 + # function to paint the histogram h with extra bins for underflows/overflows + nx = h.GetNbinsX()+1 + xbins = [] + for r in range(nx+1): + xbins.append(h.GetBinLowEdge(r)) + + xbins.append(xbins[nx-1]+h.GetBinWidth(nx)) + # book a temporary histogram having extra bins, change name to avoid memory leak warnings + xName="".join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(5)) + htmp = ROOT.TH1D(h.GetName()+xName, h.GetTitle(), nx+1, h.GetBinLowEdge(1)-h.GetBinWidth(1), xbins[nx]) + # Set up plot for markers and errors + htmp.Sumw2() + # fill the new histogram including the underflows/overflows + for r in range(nx+1): + htmp.SetBinContent(htmp.FindBin(htmp.GetBinCenter(r+1)),h.GetBinContent(r)) + htmp.SetBinError(htmp.FindBin(htmp.GetBinCenter(r+1)),h.GetBinError(r)) + + htmp.SetEntries(h.GetEffectiveEntries()) + htmp.SetXTitle(h.GetXaxis().GetTitle()) + htmp.SetYTitle(h.GetYaxis().GetTitle()) + return htmp + + +# create ratio plot +def createRatio(h1, h2): + hRatio = h1.Clone("hRatio") + hRatio.SetLineColor(ROOT.kBlack) + hRatio.SetMarkerStyle(20) + hRatio.SetTitle("") + hRatio.SetMinimum(0.8) + hRatio.SetMaximum(1.20) + #hRatio.Sumw2() # this should have already been done in addUnderOverflowBin (warnings if uncommented) + hRatio.SetStats(0) + hRatio.Divide(h2) + + # Adjust y-axis settings + y = hRatio.GetYaxis() + y.SetTitle("Ratio") + y.SetNdivisions(505) + y.SetTitleSize(20) + y.SetTitleFont(43) + y.SetTitleOffset(1.2) + y.SetLabelFont(43) + y.SetLabelSize(15) + + # Adjust x-axis settings + x = hRatio.GetXaxis() + x.SetTitleSize(20) + x.SetTitleFont(43) + x.SetTitleOffset(3.5) + x.SetLabelFont(43) + x.SetLabelSize(10) + return hRatio + + +def createCanvasPads(): + c1.cd() + # Upper histogram plot is pad1 + pad1.SetBottomMargin(0) + pad1.Draw() + # Lower ratio plot is pad2 + pad2.SetTopMargin(0) + pad2.SetBottomMargin(0.2) + pad2.SetGridx() + pad2.SetGridy() + pad2.Draw() + + +def plot(name): + legend = ROOT.TLegend(0.70, 0.80, 0.90, 0.90) + legend.SetFillColor(0) + legend.SetFillStyle(0) + legend.SetBorderSize(0) + legend.SetTextFont(72) + legend.SetTextSize(0.04) + + stack = ROOT.THStack() + h = [] # list of rebinned histograms for the stack + + for i, f in enumerate(files): + h_orig = f.Get(name) + h.append(addUnderOverflowBin(h_orig)) + + h[i].SetLineColor(histogramStyles[i].m_linecolour) + h[i].SetLineStyle(histogramStyles[i].m_linestyle) + h[i].SetLineWidth(histogramStyles[i].m_linewidth) + h[i].SetFillColor(histogramStyles[i].m_fillcolour) + + version = re.findall("\d+[\.]?", names[i]) + if (version): + versionName = 'AT-%s'% ''.join(str(e) for e in version) + else: + versionName = names[i].replace('.root','') + legend.AddEntry(h[i], versionName, 'f') + + stack.Add(h[i]) + + #for the cutflow histograms print the number of entries on the bin + txt = 'hist nostack' + if name.find('cutflow') > -1: + txt += ' text' + + # Create different pads + createCanvasPads() + pad1.cd() + + stack.Draw(txt) + stack.GetHistogram().GetXaxis().SetTitle(h[0].GetXaxis().GetTitle()) + stack.GetHistogram().GetYaxis().SetTitle(h[0].GetYaxis().GetTitle()) + # Change the size of the numbers in the Y axis and the range + stack.GetHistogram().GetYaxis().SetLabelSize(0.04) + Ymax = stack.GetHistogram().GetMaximum() + stack.SetMaximum(Ymax+0.1*Ymax) + + legend.Draw('same') + + if len(files) == 2: + # Create ratio plot + hRatio = createRatio(h[0],h[1]) + pad2.cd() + hRatio.Draw() + + thesame = True + for i in range(1, h[0].GetNbinsX()): #h.Chi2Test better? + if h[0].GetBinContent(i) != h[1].GetBinContent(i): + thesame = False + + if not thesame: + x1 = stack.GetHistogram().GetXaxis().GetXmin() + x2 = stack.GetHistogram().GetXaxis().GetXmax() + + y1 = stack.GetHistogram().GetMinimum() + y2 = stack.GetHistogram().GetMaximum() + + pad1.cd() + box = ROOT.TBox(x1, y1, x2, y2) + box.SetFillStyle(0) + box.SetLineColor(ROOT.kRed) + box.SetLineWidth(3) + box.Draw('same') + + + #write the channel in the top right + caption = name.split('/')[0] + lmode = ROOT.TLatex() + lmode.SetTextAlign(31); #right, obviously + lmode.SetNDC() + lmode.SetTextColor(1) + lmode.SetTextFont(72) + lmode.SetTextSize(0.04) + lmode.DrawLatex(0.95, 0.96, caption) + + filename = name.replace('/','_') + '.png' + c1.Print(outputdir + '/' + filename) + thumbnail(outputdir + '/' + filename, 250, 250) + out.write('<a href="%s"><img src="%s"></a>\n' % (filename, filename.replace('.png', '_tn.png'))) + + +# electron plots +def plotElectrons(channel): + h3('Electrons') + plot(channel + '/el_true_type') + plot(channel + '/el_n') + br() + plot(channel + '/el_pt') + plot(channel + '/el_eta') + plot(channel + '/el_phi') + plot(channel + '/el_charge') + plot(channel + '/el_trkpart_charge') + br() + + plot(channel + '/el_topoetcone20') + plot(channel + '/el_topoetcone30') + plot(channel + '/el_topoetcone40') + br() + + plot(channel + '/el_ptcone20') + plot(channel + '/el_ptcone30') + plot(channel + '/el_ptcone40') + br() + + plot(channel + '/el_ptvarcone20') + plot(channel + '/el_ptvarcone30') + plot(channel + '/el_ptvarcone40') + br() + + +# muon plots +def plotMuons(channel): + h3('Muons') + plot(channel + '/mu_true_type') + plot(channel + '/mu_n') + br() + plot(channel + '/mu_pt') + plot(channel + '/mu_eta') + plot(channel + '/mu_phi') + plot(channel + '/mu_charge') + br() + + plot(channel + '/mu_topoetcone20') + plot(channel + '/mu_topoetcone30') + plot(channel + '/mu_topoetcone40') + br() + + plot(channel + '/mu_ptcone20') + plot(channel + '/mu_ptcone30') + plot(channel + '/mu_ptcone40') + br() + + plot(channel + '/mu_ptvarcone20') + plot(channel + '/mu_ptvarcone30') + plot(channel + '/mu_ptvarcone40') + br() + + +# photon plots +def plotPhotons(channel): + h3('Photons') + plot(channel + '/ph_n') + plot(channel + '/ph_pt') + plot(channel + '/ph_eta') + plot(channel + '/ph_phi') + plot(channel + '/ph_e') + plot(channel + '/ph_ptvarcone20') + br() + + +# jet and large-R jet plots +def plotJets(channel): + h3('All Jets') + plot(channel + '/jet_n') + br() + plot(channel + '/jet_pt') + plot(channel + '/jet_eta') + plot(channel + '/jet_phi') + plot(channel + '/jet_e') + br() + plot(channel + '/jet_mv2c10') + plot(channel + '/jet_truthflav') + plot(channel + '/jet_isbtagged_77') + plot(channel + '/jet_btagSF_77') + + for i in range(4): + h3('Jet%d' % i) + plot(channel + '/jet%d_pt' % i) + plot(channel + '/jet%d_eta' % i) + plot(channel + '/jet%d_phi' % i) + plot(channel + '/jet%d_e' % i) + br() + plot(channel + '/jet%d_mv2c10' % i) + plot(channel + '/jet%d_truthflav' % i) + plot(channel + '/jet%d_isbtagged_77' % i) + plot(channel + '/jet%d_btagSF_77' % i) + + h3('Large-R jet') + plot(channel + '/ljet_n') + plot(channel + '/ljet_pt') + plot(channel + '/ljet_eta') + plot(channel + '/ljet_phi') + plot(channel + '/ljet_m') + plot(channel + '/ljet_sd12') + + + +# tau plots +def plotTau(channel): + h3('Tau') + plot(channel + '/taujet_n') + plot(channel + '/taujet_pt') + plot(channel + '/taujet_eta') + plot(channel + '/taujet_phi') + plot(channel + '/taujet_charge') + + + +ROOT.gROOT.SetBatch(True) + +channels = ['ejets_2015', 'ejets_2016', 'mujets_2015', 'mujets_2016', 'ee_2015', 'ee_2016', 'mumu_2015', 'mumu_2016', 'emu_2015', 'emu_2016'] +particles = ['Electrons', 'Muons', 'Photons', 'Jets', 'Tau', 'MET'] + + +if len(sys.argv) < 2: + print 'Try:' + print 'python %s outputdir/ primary.root rel_1.root' % sys.argv[0] + sys.exit() + +outputdir = sys.argv[1] + +names = sys.argv[2:] +print 'Expecting these files', names + +#try to make it, but don't worry too much if it already exists +try: + os.mkdir(outputdir) +except: + pass + +class HistStyle: + def __init__(self, linecolour, linestyle, linewidth, fillcolour): + self.m_linecolour = linecolour + self.m_linestyle = linestyle + self.m_linewidth = linewidth + self.m_fillcolour = fillcolour + +histogramStyles = [ + HistStyle(ROOT.kYellow, 1, 3, ROOT.kYellow), + HistStyle(ROOT.kBlack, 2, 3, 0), + HistStyle(ROOT.kRed, 3, 3, 0), + HistStyle(ROOT.kGreen, 4, 3, 0), + HistStyle(ROOT.kBlue, 5, 3, 0), + HistStyle(ROOT.kGray, 6, 3, ROOT.kGray), +] + +files = [] +for name in names: + files.append(ROOT.TFile.Open(name)) + +if len(files) > len(histogramStyles): + print 'You are trying to open more files than we have styles' + print 'edit the histogramStyles list and add some more' + sys.exit(1) + +out = open(outputdir + '/index.html', 'w') +c1 = ROOT.TCanvas('c1', '', 600, 600) +pad1 = ROOT.TPad("pad1", "pad1", 0, 0.3, 1, 1.0) +pad2 = ROOT.TPad("pad2", "pad2", 0, 0.05, 1, 0.3) + +h3('Cutflows') +for channel in channels: + plot(channel + '/cutflow') + +for channel in channels: + h1(channel) + + h3('Event stuff') + plot(channel + '/mc_weight') + plot(channel + '/pileup_weight') + plot(channel + '/event_mu') + plot(channel + '/jvt_SF') + + print channel + + if 'Electrons' in particles: + plotElectrons(channel) + + if 'Muons' in particles: + plotMuons(channel) + + if 'Photons' in particles: + plotPhotons(channel) + + if 'Jets' in particles: + plotJets(channel) + + if 'Taus' in particles: + plotTaus(channel) + + + h3('MET') + plot(channel + '/event_met_et') + plot(channel + '/event_met_phi') + +out.close() diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/allhadronic-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/allhadronic-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..65bfb2c56c71020b189cef96ebbec3eb59a0d1af --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/allhadronic-cuts.txt @@ -0,0 +1,76 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo False + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics All +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + +SELECTION allhad +INITIAL +GRL +GOODCALO +PRIVTX +#HFOR +TRIGDEC HLT_3j175 HLT_3j175_PS +EL_N 25000 == 0 +MU_N 25000 == 0 +JETCLEAN LooseBad +JET_N 25000 >= 6 +#JET_N_BTAG FixedCutBEff_77 >= 2 +#EXAMPLEPLOTS +SAVE + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/dil-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/dil-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcb420fd512cad4d1c57aa33566f0e0dfadb34b5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/dil-cuts.txt @@ -0,0 +1,242 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics All +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + + + +######################## +### basic selection with mandatory cuts for reco level +######################## + +SUB BASIC +INITIAL +GRL +GOODCALO +PRIVTX +RECO_LEVEL + +######################## +### definition of the data periods +######################## + +SUB period_2015 +RUN_NUMBER >= 276262 +RUN_NUMBER <= 284484 + +SUB period_2016 +RUN_NUMBER >= 297730 + +######################## +### lepton trigger and offline cuts for reco-level selections +######################## + +SUB EL_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose +EL_N 25000 >= 1 + +SUB EL_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 +EL_N 27000 >= 1 + +SUB MU_2015 +. BASIC +. period_2015 +TRIGDEC HLT_mu20_iloose_L1MU15 HLT_mu50 +MU_N 25000 >= 1 + +SUB MU_2016 +. BASIC +. period_2016 +TRIGDEC HLT_mu26_ivarmedium HLT_mu50 +MU_N 27000 >= 1 + +SUB EM_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose HLT_mu20_iloose_L1MU15 HLT_mu50 +EL_N_OR_MU_N 25000 >= 1 + +SUB EM_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 HLT_mu26_ivarmedium HLT_mu50 +EL_N_OR_MU_N 27000 >= 1 + + +######################## +### emu selections +######################## + +SUB emu_basic +EL_N 25000 >= 1 +MU_N 25000 >= 1 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +HT > 120000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +EL_N 25000 == 1 +MU_N 25000 == 1 +OS +MLL > 15000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +NOBADMUON + +SELECTION emu_2015 +. EM_2015 +. emu_basic +SAVE + +SELECTION emu_2016 +. EM_2016 +. emu_basic +SAVE + +SELECTION emu_particle +PRIVTX +PARTICLE_LEVEL +EL_N_OR_MU_N 27000 >= 1 +. emu_basic +SAVE + +######################## +### ee selections +######################## + +SUB ee_basic +EL_N 25000 >= 2 +TRIGMATCH +JETCLEAN LooseBad +MET > 60000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +EL_N 25000 == 2 +MU_N 25000 == 0 +OS +MLL > 15000 +MLLWIN 80000 100000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +#JET_N_BTAG FixedCutBEff_77 > 1 +NOBADMUON + +SELECTION ee_2015 +. EL_2015 +. ee_basic +SAVE + +SELECTION ee_2016 +. EL_2016 +. ee_basic +SAVE + +SELECTION ee_particle +PRIVTX +PARTICLE_LEVEL +EL_N 27000 >= 1 +. ee_basic +SAVE + +######################## +### mumu selections +######################## + +SUB mumu_basic +MU_N 25000 >= 2 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +MET > 60000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +MU_N 25000 == 2 +EL_N 25000 == 0 +OS +MLL > 15000 +MLLWIN 80000 100000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +#JET_N_BTAG FixedCutBEff_77 > 1 +NOBADMUON + +SELECTION mumu_2015 +. MU_2015 +. mumu_basic +SAVE + +SELECTION mumu_2016 +. MU_2016 +. mumu_basic +SAVE + +SELECTION mumu_particle +PRIVTX +PARTICLE_LEVEL +MU_N 27000 >= 1 +. mumu_basic +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data-rel21.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data-rel21.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea76f436e28d28db2d6a16f97f45dc852a7e7f6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data-rel21.txt @@ -0,0 +1,10 @@ +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000027.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000153.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000393.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000073.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000228.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000422.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000132.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000279.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000146.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/data/data16_13TeV.00311321.physics_Main.deriv.DAOD_TOPQ1.r9264_p3083_p3142/DAOD_TOPQ1.11286123._000368.pool.root.1 diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data.txt new file mode 100644 index 0000000000000000000000000000000000000000..553f357242dc49458e12428502676f3ad00d50af --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-data.txt @@ -0,0 +1,10 @@ +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000038.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000051.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000063.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000064.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000074.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000097.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000104.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000114.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000119.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/data16_13TeV/data16_13TeV.00297730.physics_Main.merge.DAOD_TOPQ1.f694_m1583_p2950/DAOD_TOPQ1.10313062._000127.pool.root.1 diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc-rel21.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc-rel21.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8629c9f1a6e090f8230d0798544a5d9fe8a147 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc-rel21.txt @@ -0,0 +1 @@ +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/rel21/mc/group.phys-top.11303793.EXT0._000011.DAOD_TOPQ1.DAOD.root diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc.txt new file mode 100644 index 0000000000000000000000000000000000000000..0333ae5561a7398efb5c3f9532c99ab1c792ab35 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-mc.txt @@ -0,0 +1,3 @@ +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/mc15_13TeV/mc15_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.DAOD_TOPQ1.e5458_s2726_r7772_r7676_p2952/DAOD_TOPQ1.10298091._000131.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/mc15_13TeV/mc15_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.DAOD_TOPQ1.e5458_s2726_r7772_r7676_p2952/DAOD_TOPQ1.10298091._000451.pool.root.1 + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-old.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-old.txt new file mode 100644 index 0000000000000000000000000000000000000000..18ea18d1dce93d768d60f3997c8e0b2cac6a3ac8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/input-old.txt @@ -0,0 +1,3 @@ +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/mc15_13TeV/mc15_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.DAOD_TOPQ1.e5458_s2726_r7772_r7676_p2877.09970904._000001.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/mc15_13TeV/mc15_13TeV.410502.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_allhad.merge.DAOD_TOPQ1.e5475_s2726_r7772_r7676_p2877.10083471._000016.pool.root.1 +root://eosatlas//eos/atlas/atlascerngroupdisk/phys-top/topreco/mc15_13TeV/mc15_13TeV.410503.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_dil.merge.DAOD_TOPQ1.e5475_s2726_r7772_r7676_p2877.09970914._000103.pool.root.1 diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljets-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljets-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..48bd73599027513f1555d73d2260bb93ea157fed --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljets-cuts.txt @@ -0,0 +1,203 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics All +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + + + + +######################## +### basic selection with mandatory cuts for reco level +######################## + +SUB BASIC +INITIAL +GRL +GOODCALO +PRIVTX +RECO_LEVEL + +######################## +### definition of the data periods +######################## + +SUB period_2015 +RUN_NUMBER >= 276262 +RUN_NUMBER <= 284484 + +SUB period_2016 +RUN_NUMBER >= 297730 + +######################## +### lepton trigger and offline cuts for reco-level selections +######################## + +SUB EL_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose +EL_N 25000 >= 1 + +SUB EL_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 +EL_N 27000 >= 1 + +SUB MU_2015 +. BASIC +. period_2015 +TRIGDEC HLT_mu20_iloose_L1MU15 HLT_mu50 +MU_N 25000 >= 1 + +SUB MU_2016 +. BASIC +. period_2016 +TRIGDEC HLT_mu26_ivarmedium HLT_mu50 +MU_N 27000 >= 1 + +SUB EM_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose HLT_mu20_iloose_L1MU15 HLT_mu50 +EL_N_OR_MU_N 25000 >= 1 + +SUB EM_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 HLT_mu26_ivarmedium HLT_mu50 +EL_N_OR_MU_N 27000 >= 1 + +######################## +### e+jets selections +######################## + +SUB ejets_basic +EL_N 25000 == 1 +MU_N 25000 == 0 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +JET_N 25000 >= 1 +JET_N 25000 >= 2 +JET_N 25000 >= 3 +JET_N 25000 >= 4 +MET > 30000 +MWT > 30000 +#JET_N_BTAG FixedCutBEff_77 >= 1 +#RECO::KLFITTERRUN kElectron +#KLFITTER > -50.0 +EXAMPLEPLOTS +#PRINT +NOBADMUON + +SELECTION ejets_2015 +. EL_2015 +. ejets_basic +SAVE + +SELECTION ejets_2016 +. EL_2016 +. ejets_basic +SAVE + +SELECTION ejets_particle +PRIVTX +PARTICLE_LEVEL +EL_N 27000 >= 1 +. ejets_basic +SAVE + +######################## +### mu+jets selections +######################## + +SUB mujets_basic +MU_N 25000 == 1 +EL_N 25000 == 0 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +JET_N 25000 >= 1 +JET_N 25000 >= 2 +JET_N 25000 >= 3 +JET_N 25000 >= 4 +MET+MWT > 60000 +#JET_N_BTAG FixedCutBEff_77 >= 1 +#RECO::KLFITTERRUN kMuon +#KLFITTER > -50.0 +EXAMPLEPLOTS +#PRINT +NOBADMUON + +SELECTION mujets_2015 +. MU_2015 +. mujets_basic +SAVE + +SELECTION mujets_2016 +. MU_2016 +. mujets_basic +SAVE + +SELECTION mujets_particle +PRIVTX +PARTICLE_LEVEL +MU_N 27000 >= 1 +. mujets_basic +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljetsgamma-cuts2.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljetsgamma-cuts2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdd45111235aec27cf35631335c3c4b8ed01324d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/ljetsgamma-cuts2.txt @@ -0,0 +1,137 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName Photons + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TruthPhotonCollectionName TruthPhotons +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics Nominal + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + + + +######################## +### basic selection with mandatory cuts for reco level +######################## + +SUB BASIC +INITIAL +GRL +GOODCALO +PRIVTX +RECO_LEVEL + +######################## +### definition of the data periods +######################## + +SUB period_2015 +RUN_NUMBER >= 276262 +RUN_NUMBER <= 284484 + +SUB period_2016 +RUN_NUMBER >= 297730 + +######################## +### lepton trigger and offline cuts for reco-level selections +######################## + +SUB EL_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose +EL_N 25000 >= 1 + +SUB EL_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 +EL_N 27000 >= 1 + +######################## +### l+jets gamma selections +######################## + +SUB gamma_basic +EL_N 25000 == 1 +MU_N 25000 == 0 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +MET > 30000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +EL_N 25000 == 1 +MU_N 25000 == 0 +PH_N 25000 >= 1 +#MEGWIN 80000 100000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +NOBADMUON + +SELECTION gamma_2015 +. EL_2015 +. gamma_basic +SAVE + +SELECTION gamma_2016 +. EL_2016 +. gamma_basic +SAVE + +SELECTION gamma_particle +PRIVTX +PARTICLE_LEVEL +EL_N 27000 >= 1 +. gamma_basic +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..7444ac136f5ded7775ac25aa213eeb4026d728f1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/mainpage.h @@ -0,0 +1,83 @@ +/** + * @mainpage + * + * This is documentation for the top code in the release. The general idea is that people + * will submit a job to the derived xAOD using the top-xaod executable (see @ref tapage). + * The output of this will be downloaded and used to make histograms (see @ref tepage). + * @ref tapage will run on the grid and do the object corrections, selection and + * overlap-removal. It will write out only events objects that pass the cuts and only for + * the events that pass the selection the user provides. @ref tepage can read these + * mini-xAOD files and perform any remaining cuts (e.g. for different signal and control + * regions) and make plots. + * + * AnalysisTop is split into: + * - @ref tapage Code to read xAOD and make mini-xAOD with some selection + * - @ref tevpage Some tools for passing an event around + * - @ref tconfpage Configuration for the top software + * - @ref tsompage Systematics for object variations + * - @ref tcpage Scale factors + * - @ref tostpage Object selection + * - @ref testpage Event selection (and event loading) + * - @ref tertpage Event reconstruction (e.g. KLFitter) + * - @ref tfpage Tools for data-driven background estimates + * - @ref tepage Example of making plots from the output of the above + * + * + * @page tapage TopAnalysis + * + * @section i Introduction + * + * Use like: + * + * @code + * top-xaod $ROOTCOREBIN/data/TopAnalysis/validation-cuts.txt $ROOTCOREBIN/data/TopAnalysis/input-13TeV-fondueworld.txt + * @endcode + * + * Some example selections are provided in: + * + * @code + * share/nocuts.txt + * share/dil-cuts.txt + * share/ljets-cuts.txt + * share/validation-cuts.txt + * @endcode + * + * @section tc The code + * + * For object selection you probably want to look at the TopObjectSelectionTools + * package and for event selection the TopEventSelectionTools package. + * + * The code is split into a few classes: + * - top::EventSelectionManager: Loads and runs multiple event selections (e.g. e+jets and mu+jets together) + * - top::EventSelection: Performs an event selection with the cuts loaded from file, stores cutflow + * + * an executable: + * - top-xaod.cxx + * + * and a file full of useful stuff (xAOD init, file checking, library loading): + * - Tools.h + * @section userobjects Object selection configuration + * + * The object selection is loaded via the configuration file. You can edit the + * examples that we provide, or write your own (even in your own library) and + * have that loaded at run time by supplying the name of the class. The example + * that we provide are + * - top::ObjectLoaderStandardCuts + * + * Note that the important thing is that they inherit from + * top::ObjectLoaderBase. + * + * @section userevents Event selection configuration + * + * The event selection is loaded via the configuration file. But you should be + * able to write your own tools and have them loaded by supplying the library + * name in the configuration file. + * + * @section useroutput Output file configuration + * + * The output file should be user configurable. If you want to write your own, + * then either base it on one of those or inherit from top::EventSaverBase. + * That said, we provide two "defaults": + * - top::EventSaverFlatNtuple + * - top::EventSaverxAOD + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/nocuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/nocuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..c958a57ad82fcbb0d16fe94d4478a5efa5ceca3b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/nocuts.txt @@ -0,0 +1,72 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TruthBlockInfo False +PDFInfo False + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics Nominal + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +NEvents 2000 + +SELECTION all_2015 +INITIAL +GRL +GOODCALO +PRIVTX +RUN_NUMBER >= 276262 +RUN_NUMBER <= 284484 +EXAMPLEPLOTS +SAVE + +SELECTION all_2016 +INITIAL +GRL +GOODCALO +PRIVTX +RUN_NUMBER >= 297730 +EXAMPLEPLOTS +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/taujets-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/taujets-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d0aa46c2875e69275afb21dbca2567ba556455b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/taujets-cuts.txt @@ -0,0 +1,88 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName TauJets +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics Nominal + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +TauPt 25000 +TauJetIDWP Medium +TauJetIDWPLoose Medium +TauEleBDTWP Loose +TauEleBDTWPLoose Loose +TauEleOLR False +TauEleOLRLoose False + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + +SELECTION taujets +INITIAL +GRL +GOODCALO +PRIVTX +#TRIGDEC HLT_mu26 +MU_N 25000 >= 1 +MU_N 25000 == 1 +EL_N 25000 >= 0 +TAU_N 20000 == 1 +#MU_TRIGGER_MATCH +#EMU_OVERLAP +#JETCLEAN LooseBad +JET_N 25000 >= 1 +#JET_N 25000 >= 2 +#JET_N 25000 >= 3 +#JET_N 25000 >= 4 +#MET+MWT > 60000 +#JET_N_BTAG FixedCutBEff_77 >= 1 +#EXAMPLEPLOTS +NOBADMUON +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-dilepton-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-dilepton-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..b40b4525a4320c7ccb24a9942b0bab83844a5f35 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-dilepton-cuts.txt @@ -0,0 +1,104 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20161101/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20161101/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics All +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + + +HLLHC True + + +######################## +### Di-muon selection +######################## +SELECTION mumu +INITIAL +MU_N 25000 >= 2 +MU_N 25000 == 2 +EL_N 25000 == 0 +MLL > 15000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +SAVE + +######################## +### Di-electron selection +######################## +SELECTION ee +INITIAL +EL_N 25000 >= 2 +EL_N 25000 == 2 +MU_N 25000 == 0 +MLL > 15000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +SAVE + +######################## +### e-mu selection +######################## +SELECTION emu +INITIAL +MU_N 25000 >= 1 +EL_N 25000 >= 1 +MU_N 25000 == 1 +EL_N 25000 == 1 +MLL > 15000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +SAVE + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-ljets-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-ljets-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..253e7de36b02a6ae82e99c44bb0e0187d558cb61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/upgrade-ljets-cuts.txt @@ -0,0 +1,88 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20161101/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20161101/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName None +LargeJetSubstructure None +TauCollectionName None +PhotonCollectionName None + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics All +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + + +HLLHC True + + +######################## +### Muon+jets selection +######################## +SELECTION mujets_upgrade +INITIAL +MU_N 25000 >= 1 +EL_N 25000 == 0 +MU_N 25000 == 1 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +SAVE + +######################## +### Electron+jets selection +######################## +SELECTION ejets_upgrade +INITIAL +EL_N 25000 >= 1 +MU_N 25000 == 0 +EL_N 25000 == 1 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +SAVE + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt new file mode 100644 index 0000000000000000000000000000000000000000..1502a9b738a0bcacbadd82cd0605af042431e939 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt @@ -0,0 +1,340 @@ +LibraryNames libTopEventSelectionTools libTopEventReconstructionTools + +### Good Run List +GRLDir GoodRunsLists +GRLFile data15_13TeV/20160720/physics_25ns_20.7.xml data16_13TeV/20170215/physics_25ns_20.7.xml + +### Pile-up reweighting tool - this is now mandatory +### Now requires only PRWLumiCalcFiles +### No PRWDefaultChannel anymore +### The nominal mc15c PU distribution is now appended to PRWConfigFiles automatically +### Will hence be using mc15c_v2_defaults.NotRecommended.prw.root if nothing is provided for PRWConfigFiles +# PRWConfigFiles TopCorrections/PRW.410000.mc15c.r7725_r7676.root +PRWConfigFiles +PRWLumiCalcFiles GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root +# no PRWDefaultChannel anymore + +ElectronCollectionName Electrons +MuonCollectionName Muons +JetCollectionName AntiKt4EMTopoJets +LargeJetCollectionName AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +LargeRJetPt 200000 +LargeRJetEta 2 +LargeJetSubstructure None +TauCollectionName TauJets +PhotonCollectionName Photons + +TruthCollectionName TruthParticles +TruthJetCollectionName AntiKt4TruthWZJets +TruthLargeRJetCollectionName AntiKt10TruthTrimmedPtFrac5SmallR20Jets +TopPartonHistory ttbar +TopParticleLevel True +TruthBlockInfo False +PDFInfo True + +ObjectSelectionName top::ObjectLoaderStandardCuts +OutputFormat top::EventSaverFlatNtuple +OutputEvents SelectedEvents +OutputFilename output.root +PerfStats No + +Systematics Nominal +JetUncertainties_NPModel 21NP +JetUncertainties_BunchSpacing 25ns +LargeRJESUncertaintyConfig Split23,Tau32WTA + +ElectronID TightLH +ElectronIDLoose MediumLH +ElectronIsolation Gradient +ElectronIsolationLoose None + +PhotonPt 25000 +PhotonEta 2.5 +PhotonID Tight +PhotonIDLoose Loose +PhotonIsolation FixedCutTight +PhotonIsolationLoose FixedCutLoose +PhotonUseRadiativeZ False + +MuonQuality Medium +MuonQualityLoose Medium +MuonIsolation Gradient +MuonIsolationLoose None + +TauPt 25000 +TauJetIDWP Medium +TauJetIDWPLoose Medium +TauEleBDTWP Loose +TauEleBDTWPLoose Loose +TauEleOLR False +TauEleOLRLoose False + +FakesControlRegionDoLooseMC False +OverlapRemovalLeptonDef Tight +ApplyElectronInJetSubtraction False + +UseAodMetaData False +IsAFII False + +BTaggingWP FixedCutBEff_77 + +#NEvents 500 + +######################## +### basic selection with mandatory cuts for reco level +######################## + +SUB BASIC +INITIAL +GRL +GOODCALO +PRIVTX +RECO_LEVEL + +######################## +### definition of the data periods +######################## + +SUB period_2015 +RUN_NUMBER >= 276262 +RUN_NUMBER <= 284484 + +SUB period_2016 +RUN_NUMBER >= 297730 + +######################## +### lepton trigger and offline cuts for reco-level selections +######################## + +SUB EL_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose +EL_N 25000 >= 1 + +SUB EL_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 +EL_N 27000 >= 1 + +SUB MU_2015 +. BASIC +. period_2015 +TRIGDEC HLT_mu20_iloose_L1MU15 HLT_mu50 +MU_N 25000 >= 1 + +SUB MU_2016 +. BASIC +. period_2016 +TRIGDEC HLT_mu26_ivarmedium HLT_mu50 +MU_N 27000 >= 1 + +SUB EM_2015 +. BASIC +. period_2015 +TRIGDEC HLT_e24_lhmedium_L1EM20VH HLT_e60_lhmedium HLT_e120_lhloose HLT_mu20_iloose_L1MU15 HLT_mu50 +EL_N_OR_MU_N 25000 >= 1 + +SUB EM_2016 +. BASIC +. period_2016 +TRIGDEC HLT_e26_lhtight_nod0_ivarloose HLT_e60_lhmedium_nod0 HLT_e140_lhloose_nod0 HLT_mu26_ivarmedium HLT_mu50 +EL_N_OR_MU_N 27000 >= 1 + +######################## +### e+jets selections +######################## + +SUB ejets_basic +EL_N 25000 == 1 +MU_N 25000 == 0 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +JET_N 25000 >= 1 +JET_N 25000 >= 2 +JET_N 25000 >= 3 +JET_N 25000 >= 4 +MET > 30000 +MWT > 30000 +#JET_N_BTAG FixedCutBEff_77 >= 1 +#RECO::KLFITTERRUN kElectron +#KLFITTER > -50.0 +EXAMPLEPLOTS +#PRINT +NOBADMUON + +SELECTION ejets_2015 +. EL_2015 +. ejets_basic +SAVE + +SELECTION ejets_2016 +. EL_2016 +. ejets_basic +SAVE + +SELECTION ejets_particle +PRIVTX +PARTICLE_LEVEL +EL_N 27000 >= 1 +. ejets_basic +SAVE + +######################## +### mu+jets selections +######################## + +SUB mujets_basic +MU_N 25000 == 1 +EL_N 25000 == 0 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +JET_N 25000 >= 1 +JET_N 25000 >= 2 +JET_N 25000 >= 3 +JET_N 25000 >= 4 +MET+MWT > 60000 +#JET_N_BTAG FixedCutBEff_77 >= 1 +#RECO::KLFITTERRUN kMuon +#KLFITTER > -50.0 +EXAMPLEPLOTS +#PRINT +NOBADMUON + +SELECTION mujets_2015 +. MU_2015 +. mujets_basic +SAVE + +SELECTION mujets_2016 +. MU_2016 +. mujets_basic +SAVE + +SELECTION mujets_particle +PRIVTX +PARTICLE_LEVEL +MU_N 27000 >= 1 +. mujets_basic +SAVE + +######################## +### emu selections +######################## + +SUB emu_basic +EL_N 25000 >= 1 +MU_N 25000 >= 1 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +HT > 120000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +EL_N 25000 == 1 +MU_N 25000 == 1 +OS +MLL > 15000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +NOBADMUON + +SELECTION emu_2015 +. EM_2015 +. emu_basic +SAVE + +SELECTION emu_2016 +. EM_2016 +. emu_basic +SAVE + +SELECTION emu_particle +PRIVTX +PARTICLE_LEVEL +EL_N_OR_MU_N 27000 >= 1 +. emu_basic +SAVE + +######################## +### ee selections +######################## + +SUB ee_basic +EL_N 25000 >= 2 +TRIGMATCH +JETCLEAN LooseBad +MET > 60000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +EL_N 25000 == 2 +MU_N 25000 == 0 +OS +MLL > 15000 +MLLWIN 80000 100000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +#JET_N_BTAG FixedCutBEff_77 > 1 +NOBADMUON + +SELECTION ee_2015 +. EL_2015 +. ee_basic +SAVE + +SELECTION ee_2016 +. EL_2016 +. ee_basic +SAVE + +SELECTION ee_particle +PRIVTX +PARTICLE_LEVEL +EL_N 27000 >= 1 +. ee_basic +SAVE + +######################## +### mumu selections +######################## + +SUB mumu_basic +MU_N 25000 >= 2 +TRIGMATCH +#EMU_OVERLAP +JETCLEAN LooseBad +MET > 60000 +JET_N 25000 >= 1 +JET_N 25000 >= 2 +MU_N 25000 == 2 +EL_N 25000 == 0 +OS +MLL > 15000 +MLLWIN 80000 100000 +#TRUTH_MATCH +#JET_N_BTAG FixedCutBEff_77 >= 1 +EXAMPLEPLOTS +#JET_N_BTAG FixedCutBEff_77 > 1 +NOBADMUON + +SELECTION mumu_2015 +. MU_2015 +. mumu_basic +SAVE + +SELECTION mumu_2016 +. MU_2016 +. mumu_basic +SAVE + +SELECTION mumu_particle +PRIVTX +PARTICLE_LEVEL +MU_N 27000 >= 1 +. mumu_basic +SAVE diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d8a21ef32679cf2f98c188ef966feb7ab6493795 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx @@ -0,0 +1,856 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <memory> + +#include "TFile.h" +#include "TTree.h" +#include "TTreeFormula.h" +#include "TSystem.h" + +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#include "xAODRootAccess/TActiveStore.h" + +// bits for I/O performance monitoring +#include "xAODCore/tools/ReadStats.h" +#include "xAODCore/tools/PerfStats.h" +#include "xAODCore/tools/IOStats.h" + +// CutBookKeeping +#include "xAODCutFlow/CutBookkeeper.h" +#include "xAODCutFlow/CutBookkeeperContainer.h" + +#include "TopCorrections/ScaleFactorCalculator.h" +#include "TopCorrections/PDFScaleFactorCalculator.h" + +#include "TopFakes/TopFakesMMWeightCalculator.h" + +#include "TopSystematicObjectMaker/ObjectCollectionMaker.h" + +#include "TopConfiguration/AodMetaDataAccess.h" +#include "TopConfiguration/ConfigurationSettings.h" +#include "TopConfiguration/TopConfig.h" +#include "TopConfiguration/SelectionConfigurationData.h" + +#include "TopAnalysis/EventSelectionManager.h" +#include "TopAnalysis/Tools.h" +#include "TopCPTools/TopToolStore.h" +#include "TopAnalysis/ObjectLoaderBase.h" +#include "TopAnalysis/EventSaverBase.h" + +#include "TopEvent/EventTools.h" +#include "TopEvent/TopEventMaker.h" +#include "TopEvent/SystematicEvent.h" + +#include "TopObjectSelectionTools/TopObjectSelection.h" +#include "TopObjectSelectionTools/EventCleaningSelection.h" + +#include "TopPartons/CalcTtbarPartonHistory.h" +#include "TopPartons/CalcTbbarPartonHistory.h" +#include "TopPartons/CalcTopPartonHistory.h" + +#include "TopParticleLevel/ParticleLevelLoader.h" + +#include "TopDataPreparation/SampleXsection.h" + +#include "TopHLUpgrade/UpgradeObjectLoader.h" + +// to disable the sending of file access statistics +#include "xAODRootAccess/tools/TFileAccessTracer.h" + +/** + * @file The main executable. + * + * @brief Entry point code to perform object and event selection and write-out a + * few histograms and / or a tree in xAOD format. + * + * @return 0 If everything is okay. + */ +int main(int argc, char** argv) { + if (argc != 3) { + std::cout << "Code to perform object and event selection and write-out\n"; + std::cout << "a few histograms and / or a tree in xAOD format.\n"; + std::cout << "Use like:\n"; + std::cout << " " << argv[0] << " cuts.txt input.txt\n"; + std::cout << " cuts.txt - file containing cuts\n"; + std::cout << " input.txt - file containing list of input files\n"; + std::cout << "\n"; + std::cout << "For example\n"; + std::cout << " " << argv[0] << " $ROOTCOREBIN/data/TopAnalysis/nocuts.txt $ROOTCOREBIN/data/TopAnalysis/input-13TeV-fondueworld.txt\n"; + return 1; + } + + // to disable the sending of file access statistics + xAOD::TFileAccessTracer::enableDataSubmission( false ); + + //magic xAOD stuff + //true = fail at even the slightest xaod issue + top::xAODInit(true); + StatusCode::enableFailure(); + + xAOD::TStore store; + + std::cout << "Configuration Files:\n"; + std::string settingsFilename = std::string(argv[1]); + std::cout << " " << settingsFilename << "\n"; + std::cout << " " << std::string(argv[2]) << "\n\n"; + + //load the settings from the input file + auto* const settings = top::ConfigurationSettings::get(); + settings->loadFromFile(settingsFilename); + std::cout << "Configuration:\n"; + std::cout << *settings << "\n"; + + const std::string libraryNames = settings->value("LibraryNames"); + top::loadLibraries(libraryNames); + + // I/O Performance stats? + // Summary gives a summary + // Full gives detailed info on each collection in the file + unsigned int doPerfStats(0); + if (settings->value("PerfStats") == "Summary") + doPerfStats = 1; + + if (settings->value("PerfStats") == "Full") + doPerfStats = 2; + + //load the event selection from the input file + std::string cutsFilename = std::string(settingsFilename); + + //open the files (to check they exist) and count how many events we have + std::vector<std::string> filenames = top::fileList(std::string(argv[2])); + unsigned int totalYield = top::checkFiles(filenames); + + //open output file + std::unique_ptr<TFile> outputFile(TFile::Open((settings->value("OutputFilename") + ".tmp").c_str(), "RECREATE")); + + // A configuration that John can easily understand + // This is not the same as a good configuration + std::shared_ptr<top::TopConfig> topConfig(new top::TopConfig()); + + // load AOD meta-data from all files + bool useAodMetaData = false; + settings->retrieve("UseAodMetaData", useAodMetaData); + if (useAodMetaData) { + std::cout << "Loading meta-data from input files ... " << std::flush; + topConfig->aodMetaData().loadWithFilesFrom(argv[2]); + std::cout << "OK." << std::endl; + } + + //picking the first file was a bad idea because in the derivations it often + //has no events (no CollectionTree). Be sure to pick a file with events in + //it... + // The isMC flag needs to be taken from the xAOD metadata + // We also need something for AFII + { + std::string usethisfile = filenames[0]; + bool atLeastOneFileIsValid(false); + for (const auto& filename : filenames) { + std::unique_ptr<TFile> checkingYieldFile(TFile::Open(filename.c_str())); + + //collection tree means > 0 events + const TTree* const collectionTree = dynamic_cast<TTree* > (checkingYieldFile->Get("CollectionTree")); + if (collectionTree) { + usethisfile = filename; + atLeastOneFileIsValid = true; + break; + } + } + + // If there are no valid files, let's exit cleanly + if (!(atLeastOneFileIsValid || useAodMetaData)) { + std::cout << "No input file contains a CollectionTree -- exiting.\n" + << "Unfortunately, we don't have enough information to prepare an output file for\n" + << "you. If you had turned on 'UseAodMetaData' in your configuration, we could\n" + << "overcome this limitation.\n" << std::endl; + return 1; + } + + std::unique_ptr<TFile> testFile(TFile::Open(usethisfile.c_str())); + + bool const isMC = (useAodMetaData ? + topConfig->aodMetaData().isSimulation() : + top::isFileSimulation(testFile.get(), topConfig->sgKeyEventInfo()) + ); + topConfig->setIsMC(isMC); + + const bool isPrimaryxAOD = top::isFilePrimaryxAOD(testFile.get()); + topConfig->setIsPrimaryxAOD(isPrimaryxAOD); + + const std::string derivationStream = top::getDerivationStream(testFile.get()); + std::cout << "Derivation stream is -> " << derivationStream << std::endl; + topConfig->setDerivationStream(derivationStream); + + if(isMC){ + ///-- Are we using a truth derivation (no reco information)? --/// + ///-- Let's find out in the first event, this could be done better --/// + bool isTruthDxAOD = top::isTruthDxAOD(testFile.get()); + topConfig->setIsTruthDxAOD(isTruthDxAOD); + + if (!isTruthDxAOD && atLeastOneFileIsValid) { + unsigned int DSID = top::getDSID(testFile.get(), topConfig->sgKeyEventInfo()); + topConfig -> setDSID(DSID); + + // now need to get and set the parton shower generator from TopDataPrep + SampleXsection tdp; + const char* const rc = getenv("ROOTCOREBIN"); + std::string filename = std::string(rc) + "/data/TopDataPreparation/XSection-MC15-13TeV.data"; + + if (!tdp.readFromFile(filename.c_str())) { + std::cout << "ERROR::TopDataPreparation - could not read file \n"; + std::cout << filename << "\n"; + exit(1); + } + + int ShowerIndex = tdp.getShoweringIndex(DSID); + std::cout << "DSID: " << DSID << "\t" << "ShowerIndex: " << ShowerIndex << std::endl; + topConfig->setMapIndex(ShowerIndex); + } + } + } //close and delete the ptr to testFile + + // Pass the settings file to the TopConfig + topConfig->setConfigSettings(settings); + + //In rel 19 we had a function to guess Class or Branch Access. + //In rel20 just use branch (quicker) + // In rel 20.7, need to go back to class access + xAOD::TEvent xaodEvent(xAOD::TEvent::kClassAccess); + + // Setup all asg::AsgTools + top::TopToolStore topTools("top::TopToolStore"); + top::check(topTools.setProperty("config", topConfig), + "Failed to setProperty of topTools"); + top::check(topTools.initialize() , "Failed to initialize topTools"); + // EventCleaningSelection + // Decorates EventInfo with GRL decision (always true for MC) + // Evaluates all triggers requested from all selections + // Trigger matching + // Check for good Tile and LAr calorimeters + // Let's check this passes before running expensive calibrations + // If ANY selection does not request a trigger, we won't veto any events + + std::unique_ptr<top::EventCleaningSelection> eventCleaning( new top::EventCleaningSelection("top::EventCleaningSelection") ); + top::check(eventCleaning->setProperty("config", topConfig), + "Failed to setProperty of triggerGRLSelection" ); + top::check(eventCleaning->initialize(), + "Failed to initialize triggerGRLSelection"); + eventCleaning->setEventSelections(settings->selections()); + + + // Systematic object collection making + std::unique_ptr<top::ObjectCollectionMaker> systObjMaker( new top::ObjectCollectionMaker( "top::ObjectCollectionMaker" ) ); + top::check( systObjMaker->setProperty( "config" , topConfig ) , "Failed to setProperty of systObjMaker" ); + if (!topConfig->isTruthDxAOD()) + top::check( systObjMaker->initialize() , "Failed to initialize systObjMaker" ); + + //setup object definitions + std::unique_ptr<top::TopObjectSelection> objectSelection(top::loadObjectSelection(topConfig)); + objectSelection->print(std::cout); + + //setup event-level cuts + top::EventSelectionManager eventSelectionManager(settings->selections(), outputFile.get(), libraryNames, topConfig); + + //The loader tool for top::ParticleLevelEvent objects + top::ParticleLevelLoader particleLevelLoader( topConfig ); + + // The loader tool for Upgrade objects + top::UpgradeObjectLoader upgradeLoader( topConfig ); + + // Fix the configuration - it now knows about: + // * all objects collections to work with + // * all systematic variations + topConfig->fixConfiguration(); + + + // OK let's printout the TopConfig + std::cout << *topConfig << "\n"; + + //Top parton history for MC events + // This is quite ugly and simple, it will be harmonized with in the future + // along with all other factory methods (it's not a factory method right now) + std::unique_ptr<top::CalcTopPartonHistory> topPartonHistory(nullptr); + if(settings->value("TopPartonHistory") == "ttbar"){ + topPartonHistory = std::unique_ptr<top::CalcTopPartonHistory> ( new top::CalcTtbarPartonHistory( "top::CalcTtbarPartonHistory" ) ); + top::check(topPartonHistory->setProperty( "config" , topConfig ) , "Failed to setProperty of top::CalcTtbarPartonHistory"); + } + else if(settings->value("TopPartonHistory") == "tb"){ + topPartonHistory = std::unique_ptr<top::CalcTopPartonHistory> ( new top::CalcTbbarPartonHistory( "top::CalcTbbarPartonHistory" ) ); + top::check(topPartonHistory->setProperty( "config" , topConfig ) , "Failed to setProperty of top::CalcTbbarPartonHistory"); + } + + //LHAPDF SF calculation + std::unique_ptr<top::PDFScaleFactorCalculator> PDF_SF(nullptr); + PDF_SF = std::unique_ptr<top::PDFScaleFactorCalculator> (new top::PDFScaleFactorCalculator( "top::PDFScaleFactorCalculator" ) ); + if ( topConfig->doLHAPDF() ){ + top::check( PDF_SF->setProperty( "config", topConfig ), "Failed to set config for PDF SF Calculator" ); + top::check( PDF_SF->initialize(), "Failed to initialize PDF SF calculator" ); + } + + + // make top::Event objects + std::unique_ptr<top::TopEventMaker> topEventMaker( new top::TopEventMaker( "top::TopEventMaker" ) ); + top::check(topEventMaker->setProperty( "config" , topConfig ) , "Failed to setProperty of top::TopEventMaker"); + // Debug messages? + // topEventMaker.msg().setLevel(MSG::DEBUG); + + std::unique_ptr<top::ScaleFactorCalculator> topScaleFactors( new top::ScaleFactorCalculator("top::ScaleFactorCalculator") ); + top::check(topScaleFactors->setProperty( "config" , topConfig ) , "Failed to setProperty of top::ScaleFactorCalculator"); + top::check(topScaleFactors->initialize(),"Failed to initialize top::ScaleFactorCalculator"); + + ///-- weights for matrix-method fakes estimate --/// + std::unique_ptr<top::TopFakesMMWeightCalculator> topfakesMMWeights(nullptr); + if (!topConfig->isMC() && topConfig->doLooseEvents() && topConfig->doFakesMMWeights()) { + topfakesMMWeights = std::unique_ptr<top::TopFakesMMWeightCalculator>( new top::TopFakesMMWeightCalculator() ); + top::check(topfakesMMWeights->setProperty( "config" , topConfig ) , "Failed to setProperty of top::TopFakesMMWeightCalculator"); + top::check(topfakesMMWeights->initialize(),"Failed to initialize top::TopFakesMMWeightCalculator"); + for (auto sel : settings->selections()) { + top::check(topfakesMMWeights->setSelectionConfigs(sel.m_name, eventSelectionManager.GetFakesMMConfigs(sel.m_name)),"Failed to set the selection FakesMMConfigs for selection"+sel.m_name); + } + } + + //A list of extra branches that we create in this code and want to save + std::vector<std::string> extraBranches; + eventSelectionManager.addExtraBranches(extraBranches); + + //output file format (and any user-modified code) + std::unique_ptr<top::EventSaverBase> eventSaver(top::loadEventSaver(topConfig)); + eventSaver->initialize(topConfig, outputFile.get(), extraBranches); + + // save sum of weights before derivations + outputFile->cd(); + TTree* sumWeights = new TTree("sumWeights", ""); + float totalEventsWeighted = 0; + std::vector<float> totalEventsWeighted_LHE3; + std::vector<double> totalEventsWeighted_LHE3_temp;// having doubles is necessary in case of re-calculation of the sum of weights on the fly + std::vector<std::string> names_LHE3; + bool recalc_LHE3 = false; + int dsid = 0; + ULong64_t totalEvents = 0; + ULong64_t totalEventsInFiles = 0; + sumWeights->Branch("dsid", &dsid); + sumWeights->Branch("totalEventsWeighted", &totalEventsWeighted); + if (topConfig->doMCGeneratorWeights()) {// the main problem is that we don't have the list of names a priori + sumWeights->Branch("totalEventsWeighted_mc_generator_weights", &totalEventsWeighted_LHE3); + sumWeights->Branch("names_mc_generator_weights", &names_LHE3); + } + sumWeights->Branch("totalEvents", &totalEvents, "totalEvents/l"); + + TTree* sumPdfWeights = 0; + std::unordered_map<std::string, std::vector<float> *> totalEventsPdfWeighted; + int dsidPdf = 0; + bool pdfMetadataExists = false; + if (topConfig->doLHAPDF()) { + sumPdfWeights = new TTree("PDFsumWeights", ""); + sumPdfWeights->Branch("dsid", &dsidPdf); + for (const auto &pdf_set : topConfig->LHAPDFSets()) { + totalEventsPdfWeighted[pdf_set] = new std::vector<float>(); + sumPdfWeights->Branch(pdf_set.c_str(), totalEventsPdfWeighted[pdf_set]); + } + } + + //the analysis loop + std::cout << "Starting event loop\n"; + + // Performance stats + if (doPerfStats > 0) + xAOD::PerfStats::instance().start(); // start Perfstats timer + + unsigned int totalYieldSoFar = 0; + unsigned int skippedEventsSoFar = 0; + unsigned int eventSavedReco(0),eventSavedRecoLoose(0),eventSavedTruth(0),eventSavedParticle(0); + for (const auto& filename : filenames) { + if (topConfig->numberOfEventsToRun() != 0 && totalYieldSoFar >= topConfig->numberOfEventsToRun() ) break; + std::cout << "Opening " << filename << std::endl; + std::unique_ptr<TFile> inputFile(TFile::Open(filename.c_str())); + + // the derivation framework is making files with an empty collection tree + // which TEvent can now handle + // However, at least for data, this is causing problems with the trigger menu + // skip the file, after the meta data access above + const TTree* const collectionTree = dynamic_cast<TTree* > (inputFile->Get("CollectionTree")); + if (!collectionTree && !topConfig->isMC()) { + std::cout << "No CollectionTree found, skipping file\n"; + continue; + } + + top::check(xaodEvent.readFrom(inputFile.get()), "xAOD::TEvent readFrom failed"); + + //Get some of event weights before derivation + double initialSumOfWeightsInThisFile = 0; + ULong64_t initialEvents = 0; + + // vector of LH3 weights and teir names + std::vector<float> initialSumOfWeights_mc_generator_weightsInThisFile; + std::vector<std::string> initialSumOfWeights_mc_generator_namesInThisFile; + + // vector of PDF weights and their names + std::vector<float> initialSumOfWeights_pdf_weightsInThisFile; + std::vector<std::string> initialSumOfWeights_pdf_namesInThisFile; + + // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/AnalysisMetadata#Event_Bookkeepers + const xAOD::CutBookkeeperContainer* cutBookKeepers = 0; + // Try to get the cut bookkeepers. + // <tom.neep@cern.ch> (4/4/16): Not there in DAOD_TRUTH1? + // If we can't get them and we are running on TRUTH then carry on, + // but anything else is bad! + if (!xaodEvent.retrieveMetaInput(cutBookKeepers, "CutBookkeepers")) { + top::check(topConfig->isTruthDxAOD(), + "Failed to retrieve cut book keepers"); + } else { + int maxCycle = -1; + std::vector<int> maxCycle_LH3;// for LHE3 weights + // for the sum of number of events and of mc event weights + for ( auto cbk : *cutBookKeepers ) { + // skip RDO and ESD numbers, which are nonsense; and + // skip the derivation number, which is the one after skimming + // we want the primary xAOD numbers + if (cbk->inputStream() == "StreamAOD" && cbk->name() == "AllExecutedEvents") { + double sumOfEventWeights = cbk->sumOfEventWeights(); + ULong64_t nEvents = cbk->nAcceptedEvents(); + if (cbk->cycle() > maxCycle) { + initialSumOfWeightsInThisFile = sumOfEventWeights; + initialEvents = nEvents; + maxCycle = cbk->cycle(); + } + } + else if (cbk->inputStream() == "StreamAOD" && cbk->name().find("LHE3Weight_") != std::string::npos + && topConfig->doMCGeneratorWeights()) { + double sumOfEventWeights = cbk->sumOfEventWeights(); + std::string name=cbk->name(); + name.erase(0,11); // remove the "LHE3Weight_" + // is it a new name? If yes append it to the vector of names + // if not no need, but we must check the corresponding entry for the sum of weights exist + auto pos_name = std::find(initialSumOfWeights_mc_generator_namesInThisFile.begin(), + initialSumOfWeights_mc_generator_namesInThisFile.end(),name); + if (pos_name == initialSumOfWeights_mc_generator_namesInThisFile.end()) { + initialSumOfWeights_mc_generator_namesInThisFile.push_back(name); + initialSumOfWeights_mc_generator_weightsInThisFile.push_back(sumOfEventWeights); + maxCycle_LH3.push_back(cbk->cycle()); + } + else if (cbk->cycle() > maxCycle_LH3.at(pos_name-initialSumOfWeights_mc_generator_namesInThisFile.begin())) { + initialSumOfWeights_mc_generator_weightsInThisFile.at(pos_name-initialSumOfWeights_mc_generator_namesInThisFile.begin()) = sumOfEventWeights; + maxCycle_LH3.at(pos_name-initialSumOfWeights_mc_generator_namesInThisFile.begin()) = cbk->cycle(); + } + } + else continue; + } + } + totalEventsWeighted += initialSumOfWeightsInThisFile; + totalEvents += initialEvents; + + // now we must fill two vectors in sync + if (topConfig->doMCGeneratorWeights()) { + if (totalEventsWeighted_LHE3.size() != 0 ) { + if (totalEventsWeighted_LHE3.size() != initialSumOfWeights_mc_generator_weightsInThisFile.size() + || names_LHE3.size() != initialSumOfWeights_mc_generator_namesInThisFile.size() + || names_LHE3.size() != totalEventsWeighted_LHE3.size() ) { + std::cout << "Ouch: strange inconsistency of vector sizes in sum of LHE3 weights calculation. There is an issue somewhere." << std::endl; + std::cout << "Exiting...." << std::endl; + std::exit(1); + } + for (unsigned int i_genweights = 0; i_genweights < initialSumOfWeights_mc_generator_namesInThisFile.size(); i_genweights++) { + if (names_LHE3.at(i_genweights) != initialSumOfWeights_mc_generator_namesInThisFile.at(i_genweights)) { + std::cout << "Ouch: strange inconsistency in the vector of weight names in sum of LHE3 weights calculation. There is an issue somewhere." << std::endl; + std::cout << "Exiting...." << std::endl; + std::exit(1); + } + else { + totalEventsWeighted_LHE3.at(i_genweights) + = totalEventsWeighted_LHE3.at(i_genweights) + + initialSumOfWeights_mc_generator_weightsInThisFile.at(i_genweights); + } + } + } + else { + for (unsigned int i_genweights = 0; i_genweights < initialSumOfWeights_mc_generator_namesInThisFile.size(); i_genweights++) { + names_LHE3.push_back(initialSumOfWeights_mc_generator_namesInThisFile.at(i_genweights)); + totalEventsWeighted_LHE3.push_back(initialSumOfWeights_mc_generator_weightsInThisFile.at(i_genweights)); + } + } + if (!names_LHE3.empty()) { + std::cout << "The sum of weights for the following LHE3 weights were retrieved from the input file:"<<std::endl; + for (std::string s : names_LHE3) std::cout<<s<<" "; + std::cout<< std::endl; + } + else { + std::cout << "No sum of LHE3 weights could be found in meta-data. Will try to recompute these sums."<<std::endl; + std::cout << "It will only work on un-skimmed derivations, and it will be impossible to know the name of these weights."<<std::endl; + recalc_LHE3 = true; + } + } + + const unsigned int entries = xaodEvent.getEntries(); + totalEventsInFiles += entries; + unsigned int firstEvent = 0; + if(topConfig->numberOfEventsToSkip() > skippedEventsSoFar){ + firstEvent = topConfig->numberOfEventsToSkip()-skippedEventsSoFar; + skippedEventsSoFar += entries < firstEvent ? entries : firstEvent; + } + for (unsigned int entry = firstEvent; entry < entries; ++entry, ++totalYieldSoFar) { + + if (topConfig->numberOfEventsToRun() != 0 && totalYieldSoFar >= topConfig->numberOfEventsToRun() ) break; + + if (entry % 100 == 0) + std::cout << " Processing event " << totalYieldSoFar << " / " << totalYield << " (current file: " << entry << " / " << entries << ")" << std::endl; + + // clear the TStore - get rid of the last events objects + xAOD::TActiveStore::store()->clear(); + // increment the event + xaodEvent.getEntry(entry); + + // Pile up and MC event weight - used to normalize the cut flows + float mcEventWeight(1.),pileupWeight(1.),zvtxWeight(1.); + if (topConfig->isMC()) + mcEventWeight = topScaleFactors->mcEventWeight(); + + if (topConfig->doPileupReweighting() && !topConfig->isTruthDxAOD()) { + top::check(topScaleFactors->executePileup(), "Failed to execute pileup reweighting"); + pileupWeight = topScaleFactors->pileupWeight(); + } + + + // get mc channel number + // to save the sum of weights + if (totalYieldSoFar == 0 && topConfig->isMC()) { + const xAOD::EventInfo *ei(nullptr); + top::check(xaodEvent.retrieve(ei, topConfig->sgKeyEventInfo()), + "xAOD::TEvent retrieve failed to get EventInfo"); + + //mcChannelNumber only available in MC simulation + if (ei->eventType(xAOD::EventInfo::IS_SIMULATION)) { + dsid = ei->mcChannelNumber(); + dsidPdf = ei->mcChannelNumber(); + } + } + + ///-- Truth events --/// + if (topConfig->isMC()) { + + // Save, if requested, MC truth block, PDFInfo, TopPartons + // This will be saved for every event + + // Run topPartonHistory + if (topConfig->doTopPartonHistory()) + top::check( topPartonHistory->execute() , "Failed to execute topPartonHistory" ); + + // calculate PDF weights + if( topConfig->doLHAPDF() ) + top::check( PDF_SF->execute(), + "Failed to execute PDF SF"); + + eventSaver->saveTruthEvent(); + ++eventSavedTruth; + + // Upgrade analysis - only for truth DAODs when asking to do upgrade studies + if (topConfig->isTruthDxAOD() && topConfig->HLLHC()) { + top::ParticleLevelEvent upgradeEvent = upgradeLoader.load(); + + //event selection + const bool saveEventInOutputFile = eventSelectionManager.applyUpgradeLevel( upgradeEvent ); + + if ( saveEventInOutputFile ) { + eventSaver->saveUpgradeEvent( upgradeEvent ); + } + } + + // Particle level analysis, saved only for truth events passing fiducial selection + + // -------------------------------------------------- + // If the truth loader is active, perform truth loading. + if ( particleLevelLoader.active() && !topConfig->HLLHC() ){ + // -------------------------------------------------- + // Get the top::TruthEvent for the current event + top::ParticleLevelEvent particleLevelEvent = particleLevelLoader.load(); + + //event selection + const bool saveEventInOutputFile = eventSelectionManager.applyParticleLevel( particleLevelEvent ); + + if ( saveEventInOutputFile ) { + eventSaver->saveParticleLevelEvent( particleLevelEvent ); + ++eventSavedParticle; + } + } + + } + if (totalYieldSoFar == 0 && topConfig->isMC() && topConfig->doLHAPDF()) { + const xAOD::TruthEventContainer* truthEvent(nullptr); + top::check( xaodEvent.retrieve(truthEvent, topConfig->sgKeyTruthEvent()) , "Failed to retrieve truth PDF info" ); + for( auto tePtr : *truthEvent ) { + for (auto &pdf : totalEventsPdfWeighted) { + if( tePtr->isAvailable< std::vector<float> >("AnalysisTop_"+pdf.first+"_Weights") ) { + pdf.second->resize(tePtr->auxdata< std::vector<float> >("AnalysisTop_"+pdf.first+"_Weights").size()); + } + } + } + } + // on the first event, set the size of the vector of sum of LHE3 weights in case it needs to be calculated on the fly + if (topConfig->isMC() && topConfig->doMCGeneratorWeights()) { + const xAOD::TruthEventContainer* truthEvent(nullptr); + top::check( xaodEvent.retrieve(truthEvent, topConfig->sgKeyTruthEvent()) , "Failed to retrieve LHE3 weights from truth event" ); + unsigned int weightsSize = truthEvent->at(0)->weights().size(); + if (recalc_LHE3) { + if (totalYieldSoFar == 0) { + totalEventsWeighted_LHE3_temp.resize(weightsSize); + for (unsigned int i_LHE3 = 0; i_LHE3<weightsSize; i_LHE3++) { + totalEventsWeighted_LHE3_temp.at(i_LHE3) = truthEvent->at(0)->weights().at(i_LHE3); + } + names_LHE3.resize(weightsSize); + std::fill(names_LHE3.begin(),names_LHE3.end(),"?"); + } + else { + for (unsigned int i_LHE3 = 0; i_LHE3<weightsSize; i_LHE3++) { + totalEventsWeighted_LHE3_temp.at(i_LHE3) = totalEventsWeighted_LHE3_temp.at(i_LHE3) + truthEvent->at(0)->weights().at(i_LHE3); + } + } + } + else if (weightsSize != names_LHE3.size()) {// don't recalc sum of weights, but cross-check the size of the vectors + std::cout << "Ouch: strange inconsistency in the sum of LHE3 weights vectors from the meta-data and the vector of LHE3 weights in the TruthEventContainer." << std::endl; + std::cout << "It should be the same; since it's not, it's pointless to continue."; + std::cout << "Exiting...." << std::endl; + std::exit(1); + } + } + ///-- End of Truth events -- start of reconstruction level events --/// + if (topConfig->isTruthDxAOD()) + continue; + + + ///-- We veto events that do not pass the GRL, trigger or have bad calorimeters --/// + ///-- No point calibrating and cutting on events that fail these cuts --/// + ///-- We only apply a veto if ALL selectors request a cut --/// + ///-- And if the user selects "OutputEvents SelectedEvents" --/// + + ///-- Count initial events --/// + eventSelectionManager.countInitial(mcEventWeight,pileupWeight,zvtxWeight); + + ///-- Does event pass the GRL? (always true for MC) --/// + ///-- Only veto events when ALL user selectors request GRL --/// + bool passGRLVeto = eventCleaning->applyGRL(); + if (!passGRLVeto) + continue; + eventSelectionManager.countGRL(mcEventWeight,pileupWeight,zvtxWeight); + + ///-- Are the Tile and LAr calorimeters in a good state? (always true for MC) --/// + ///-- Only veto events when ALL user selectors request GOODCALO --/// + bool passGoodCalo = eventCleaning->applyGoodCalo(); + if (!passGoodCalo) + continue; + eventSelectionManager.countGoodCalo(mcEventWeight,pileupWeight,zvtxWeight); + + ///-- Do we have a Primary Vertex? --/// + ///-- Only veto events when ALL user selectors request PRIVTX -- /// + bool passPriVtx = eventCleaning->applyPrimaryVertex(); + if (!passPriVtx) + continue; + eventSelectionManager.countPrimaryVertex(mcEventWeight,pileupWeight,zvtxWeight); + + ///-- Wondering which triggers are available ??? --/// + ///-- Uncomment this line and get ready for a LOT of output --/// + // eventCleaning->printTriggers(); + + ///-- Does event pass any trigger ? --/// + ///-- Only veto events when ALL user selectors request TRIGDEC --/// + ///-- And all trigger fail --/// + bool passAnyTriggerVeto = eventCleaning->applyTrigger(); + if (!passAnyTriggerVeto) + continue; + + ///-- Calibrate objects and make all required systematic copies --/// + top::check( systObjMaker->execute() , "Failed to execute systObjMaker" ); + + ///-- Object selection (e.g. good electrons, muons, jets etc.). Event selection cuts comes later --/// + top::check( objectSelection->execute() , "Failed to execute objectSelection" ); + + ///-- Recalculate MissingET based on object selection --/// + top::check( systObjMaker->recalculateMET() , "Failed to recalculateMET with systObjMaker" ); + + ///-- Scale Factor calculation --/// + if (topConfig->isMC()) + top::check( topScaleFactors->execute() , "Failed to calculate scale factors" ); + + if (!topConfig->doLooseTreeOnly()) { + ///-- Loop over all systematics and make a "top::Event" for each --/// + const xAOD::SystematicEventContainer* allSystematics = topEventMaker->systematicEvents( topConfig->sgKeyTopSystematicEvents() ); + for (auto currentSystematic : *allSystematics) { + ///-- Make a top::Event --/// + top::Event topEvent = topEventMaker->makeTopEvent( *currentSystematic ); + ///-- Apply event selection --/// + const bool passAnyEventSelection = eventSelectionManager.apply(topEvent,*currentSystematic ); + currentSystematic->auxdecor<char>(topConfig->passEventSelectionDecoration()) = passAnyEventSelection ? 1 : 0; + topEvent.m_saveEvent = passAnyEventSelection; + ///-- Save event - we defer to eventSaver the decision to write or not --/// + eventSaver->saveEvent(topEvent); + + ///-- For printout at the end of job, only count nominal events --/// + if (passAnyEventSelection && currentSystematic->hashValue() == topConfig->nominalHashValue()) + ++eventSavedReco; + } + ///-- End loop over all calibration systematics --/// + } + ///-- End of tight events --/// + + if (topConfig->doLooseEvents()) { + ///-- Loop over all Loose systematics and make a "top::Event" for each --/// + const xAOD::SystematicEventContainer* allSystematicsLoose = topEventMaker->systematicEvents( topConfig->sgKeyTopSystematicEventsLoose() ); + for (auto currentSystematic : *allSystematicsLoose) { + ///-- Make a top::Event --/// + top::Event topEvent = topEventMaker->makeTopEvent( *currentSystematic ); + ///-- Apply event selection --/// + const bool passAnyEventSelection = eventSelectionManager.apply(topEvent,*currentSystematic ); + currentSystematic->auxdecor<char>(topConfig->passEventSelectionDecoration()) = passAnyEventSelection ? 1 : 0; + topEvent.m_saveEvent = passAnyEventSelection; + ///-- weights for matrix-method fakes estimate, only for nominal --/// + if (!topConfig->isMC() && topConfig->doFakesMMWeights() && currentSystematic->hashValue() == topConfig->nominalHashValue()) { + top::check( topfakesMMWeights->execute(&topEvent) , "Failed to execute fakes mmweight calculation"); + } + ///-- Save event - we defer to eventSaver the decision to write or not --/// + eventSaver->saveEvent(topEvent); + + ///-- For printout at the end of job, only count nominal events --/// + if (passAnyEventSelection && currentSystematic->hashValue() == topConfig->nominalHashValue()) + ++eventSavedRecoLoose; + } + ///-- End loop over all loose calibration systematics --/// + } + ///-- End of loose events --/// + + ///-- Needed for xAOD output, all systematics go into the same TTree --/// + eventSaver->saveEventToxAOD(); + + } //loop over events in current file + + // do it at the end, so we can get the DS id from the first event + // notice this is different from the normal sum of weights: all entries matter, not only the highest per file + if (topConfig->doLHAPDF()) { + bool pdfInCBK = false; + if (xaodEvent.retrieveMetaInput( cutBookKeepers, "CutBookkeepers" )) { + // try to get the first entry + std::string pdf_set = totalEventsPdfWeighted.begin()->first; + std::string p = pdf_set+"_0"; + for ( auto cbk : *cutBookKeepers ) { + std::string pdfName = cbk->name(); + if (p != pdfName) continue; + pdfMetadataExists = true; + pdfInCBK = true; + // reload to set iterator back to original state + if (!xaodEvent.retrieveMetaInput(cutBookKeepers, "CutBookkeepers")) {} + break; + } + } + // if the pdf info was in the CBK the PDFSumOfWeights retrieve never happens, + // and cutBookKeepers, will keep its reference to the main CBK + if (!pdfInCBK) { // only try this if the info is not in the CBK -- this is legacy stuff + if (!xaodEvent.retrieveMetaInput( cutBookKeepers, "PDFSumOfWeights" )) { + pdfMetadataExists = false; + } + } + if (pdfMetadataExists && topConfig->saveLHAPDFEvent() && topConfig->baseLHAPDF().empty()) { + // just make a copy of it, but not all derivations have it, so just ignore it if it is not there + for (auto &pdfentry : totalEventsPdfWeighted) { + std::string pdf_set = pdfentry.first; + for (size_t n = 0; n < totalEventsPdfWeighted[pdf_set]->size(); ++n) { + std::string p = pdf_set+"_"+std::to_string(n); + bool foundPdf = false; + for ( auto cbk : *cutBookKeepers ) { + std::string pdfName = cbk->name(); + if (p != pdfName) + continue; + totalEventsPdfWeighted[pdf_set]->at(n) = cbk->sumOfEventWeights(); + foundPdf = true; + break; + } + if (!foundPdf) { // asked for PDF weighting, the PDF metadata exists, but this particular PDF is missing + // crash hard + std::cout << "The force is not strong with us, young Padawan ..." << std::endl; + std::cout << "You want to save weights to do PDF reweighting using '" << pdf_set << "', which I figure has " << totalEventsPdfWeighted[pdf_set]->size() << " sets on it." << std::endl; + std::cout << "There is metadata information for the sum of MC*PDF weights in PDFSumOfWeights, but none seem to refer to '" << p << "' therefore I do not know how to estimate the sum of weights before acceptance for this configuration." << std::endl; + std::cout << "May the force be with you in your next attempt." << std::endl; + std::exit(1); + } + } + } + sumPdfWeights->Fill(); + } + } //doLHAPDF + + } //loop over files + + //finish + std::cout << "\n"; + + if (doPerfStats > 0) + xAOD::PerfStats::instance().stop(); // Stop the PerfStats timer + + if( topConfig->doLHAPDF() ) top::check( PDF_SF->finalize() , "Failed to finalize PDF SF" ); + + // this fills the sum of weights + // if the list of input files has more than + // one type of dataset (ie: the first file is ttbar and the second one + // is W+jets), then the Fill statement below needs to come in the end of + // each file's processing instead ... but why would you do that?! + if (recalc_LHE3) {// in case the sum of LHE3 weight has been re-calculated with double (but we need floats in the end) + for (double d:totalEventsWeighted_LHE3_temp) totalEventsWeighted_LHE3.push_back(d); + } + sumWeights->Fill(); + outputFile->cd(); + + if (topConfig->doLHAPDF()) { + // Save sum of weights of PDF variations + // Only do this if the metadata is not available + if (totalEventsInFiles != totalEvents && !pdfMetadataExists) { + std::cout << "These are not the droids you are looking for." << std::endl; + std::cout << "There are " << totalEventsInFiles << " events in the input files, but the metadata tells me there were " << totalEvents << "before skimming." << std::endl; + std::cout << "This means you are running on skimmed derivations. You also want me to do PDF reweighting, but no PDF metadata exists!" << std::endl; + std::cout << "I don't know how to tell you the sum of MC*PDF weights before skimming. I will explode now in 3, 2, 1 ..." << std::endl; + std::exit(1); + } + // save recomputed sum weights + if( (!topConfig->baseLHAPDF().empty() || !pdfMetadataExists) ) { + for( auto& pdf_result : topConfig->getLHAPDFResults() ) + *(totalEventsPdfWeighted[pdf_result.first]) = pdf_result.second; + sumPdfWeights->Fill(); + } + } //doLHAPDF + + outputFile->cd(); + eventSelectionManager.finalise(); + eventSaver->finalize(); + outputFile->Close(); + bool outputFileGood = !outputFile->TestBit(TFile::kWriteError); + if (outputFileGood) { + if (gSystem->Rename(outputFile->GetName(), settings->value("OutputFilename").c_str()) != 0) + outputFileGood = false; + } + + if (!topConfig->isTruthDxAOD()) { + std::cout << "\nEvents saved to output file nominal reconstruction tree: " << eventSavedReco << "\n"; + if (topConfig->doLooseEvents()) + std::cout << "Events saved to output file nominal Loose reconstruction tree: " << eventSavedRecoLoose << "\n"; + } + if (topConfig->isMC()) { + std::cout << "Events saved to output file truth tree : "<<eventSavedTruth << "\n"; + if (particleLevelLoader.active()) { + std::cout << "Events saved to output file particle level tree : "<<eventSavedParticle << "\n"; + } + } + std::cout << "Total sum-of-weights (for normalization) : " + << totalEventsWeighted + << std::endl; + + //print some xAOD performance info + if (doPerfStats == 1) + xAOD::IOStats::instance().stats().Print("Summary"); + if (doPerfStats == 2) + xAOD::IOStats::instance().stats().Print(); + + if (!outputFileGood) { + std::cout << "ERROR: an I/O error occured while attempting to save the output file." << std::endl; + return 1; + } + + return 0; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b668c35c20bea05f48570359b1281ee81f2938e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt @@ -0,0 +1,107 @@ +# Auto-generated on: 2017-03-08 14:47:34.346308 + +# Declare the name of this package: +atlas_subdir( TopCPTools None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODRootAccess + AsgTools + AthContainers + PATCore + PATInterfaces + TrigConfInterfaces + TrigConfxAOD + TrigDecisionTool + TriggerMatchingTool + TrigTauMatching + GoodRunsLists + ElectronPhotonFourMomentumCorrection + ElectronPhotonSelectorTools + ElectronEfficiencyCorrection + ElectronPhotonShowerShapeFudgeTool + PhotonEfficiencyCorrection + MuonMomentumCorrections + MuonSelectorTools + MuonEfficiencyCorrections + TauAnalysisTools + CalibrationDataInterface + xAODBTaggingEfficiency + JetCalibTools + JetCPInterfaces + JetUncertainties + JetInterface + JetMomentTools + JetSelectorTools + JetResolution + METInterface + METUtilities + IsolationSelection + IsolationCorrections + PathResolver + TopConfiguration + TopEvent + PileupReweighting + AssociationUtils + JetJvtEfficiency + PMGTools + InDetTrackSystematicsTools ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g -std=c++14 ) + +# Build a library that other components can link against: +atlas_add_library( TopCPTools Root/*.cxx Root/*.h Root/*.icc + TopCPTools/*.h TopCPTools/*.icc TopCPTools/*/*.h + TopCPTools/*/*.icc + PUBLIC_HEADERS TopCPTools + LINK_LIBRARIES xAODRootAccess + AsgTools + AthContainers + PATCoreLib + PATInterfaces + TrigConfInterfaces + TrigConfxAODLib + TrigDecisionToolLib + TriggerMatchingToolLib + TrigTauMatchingLib + GoodRunsListsLib + ElectronPhotonFourMomentumCorrectionLib + ElectronPhotonSelectorToolsLib + ElectronEfficiencyCorrectionLib + ElectronPhotonShowerShapeFudgeToolLib + PhotonEfficiencyCorrectionLib + MuonMomentumCorrectionsLib + MuonSelectorToolsLib + MuonEfficiencyCorrectionsLib + TauAnalysisToolsLib + CalibrationDataInterfaceLib + xAODBTaggingEfficiencyLib + JetCalibToolsLib + JetCPInterfaces + JetUncertaintiesLib + JetInterface + JetMomentToolsLib + JetSelectorToolsLib + JetResolutionLib + METInterface + METUtilitiesLib + IsolationSelectionLib + IsolationCorrectionsLib + PathResolver + TopConfiguration + TopEvent + PileupReweightingLib + AssociationUtilsLib + JetJvtEfficiencyLib + PMGToolsLib + InDetTrackSystematicsToolsLib + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..47cdda921fead0679b3e952d8b932b4f80147825 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx @@ -0,0 +1,441 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopEgammaCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Egamma include(s): +#include "ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h" +#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h" +#include "ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h" +#include "ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h" +#include "ElectronPhotonSelectorTools/AsgElectronChargeIDSelectorTool.h" +#include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h" +#include "ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h" +#include "PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h" + +namespace top { + +EgammaCPTools::EgammaCPTools(const std::string& name) : + asg::AsgTool(name), + m_electronEffTriggerFile("SetMe"), + m_electronEffTriggerLooseFile("SetMe"), + m_electronEffSFTriggerFile("SetMe"), + m_electronEffSFTriggerLooseFile("SetMe"), + m_electronEffSFRecoFile("SetMe"), + m_electronEffSFIDFile("SetMe"), + m_electronEffSFIDLooseFile("SetMe"), + m_electronEffSFIsoFile("SetMe"), + m_electronEffSFIsoLooseFile("SetMe"), + m_electronEffSFChargeIDFile("SetMe") { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "EgammaCalibrationAndSmearingTool" , m_egammaCalibrationAndSmearingTool ); + declareProperty( "ElectronEffTrigger" , m_electronEffTrigger ); + declareProperty( "ElectronEffTriggerLoose" , m_electronEffTriggerLoose ); + declareProperty( "ElectronEffSFTrigger" , m_electronEffSFTrigger ); + declareProperty( "ElectronEffSFTriggerLoose" , m_electronEffSFTriggerLoose ); + declareProperty( "ElectronEffReco" , m_electronEffSFReco ); + declareProperty( "ElectronEffID" , m_electronEffSFID ); + declareProperty( "ElectronEffIDLoose" , m_electronEffSFIDLoose ); + declareProperty( "ElectronEffIso" , m_electronEffSFIso ); + declareProperty( "ElectronEffIsoLoose" , m_electronEffSFIsoLoose ); + declareProperty( "ElectronEffChargeID" , m_electronEffSFChargeID ); + + declareProperty( "PhotonIsEMSelectorLoose" , m_photonLooseIsEMSelector); + declareProperty( "PhotonIsEMSelectorMedium" , m_photonMediumIsEMSelector); + declareProperty( "PhotonIsEMSelectorTight" , m_photonTightIsEMSelector); +} + +StatusCode EgammaCPTools::initialize() { + ATH_MSG_INFO("top::EgammaCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::EgammaCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (m_config->usePhotons() || m_config->useElectrons()) { + if (m_config->makeAllCPTools()) {// skiping calibrations on mini-xAODs + top::check(setupCalibration(), "Failed to setup Egamma calibration tools"); + } + if (m_config->isMC()) {// scale-factors are only for MC + top::check(setupScaleFactors(), "Failed to setup Egamma scale-factor tools"); + } + } + else { + ATH_MSG_INFO("top::EgammaCPTools: no need to initialise anything since using neither electrons nor photons"); + } + return StatusCode::SUCCESS; +} + + +StatusCode EgammaCPTools::setupCalibration() { + // Setup electron and photon calibration tools + // List of tools include: + // - EgammaCalibrationAndSmearingTool + // - Electron Charge ID Selector tool + // - Photon shower shape fudge tool + // - Photon efficiency correction tool + using IEgammaCalibTool = CP::IEgammaCalibrationAndSmearingTool; + const std::string egamma_calib_name = "CP::EgammaCalibrationAndSmearingTool"; + if (asg::ToolStore::contains<IEgammaCalibTool>(egamma_calib_name)) { + m_egammaCalibrationAndSmearingTool = asg::ToolStore::get<IEgammaCalibTool>(egamma_calib_name); + } else { + IEgammaCalibTool* egammaCalibrationAndSmearingTool = new CP::EgammaCalibrationAndSmearingTool(egamma_calib_name); + top::check(asg::setProperty(egammaCalibrationAndSmearingTool, + "ESModel", "es2016data_mc15c"), + "Failed to set ESModel for " + egamma_calib_name); + top::check(asg::setProperty(egammaCalibrationAndSmearingTool, + "decorrelationModel", + m_config->egammaSystematicModel()), + "Failed to set decorrelationModel for " + egamma_calib_name); + + if(m_config->isAFII()) + top::check(asg::setProperty(egammaCalibrationAndSmearingTool, + "useAFII", 1), + "Failed to useAFII to true for" + egamma_calib_name); + + top::check(egammaCalibrationAndSmearingTool->initialize(), + "Failed to initialize " + egamma_calib_name); + m_egammaCalibrationAndSmearingTool = egammaCalibrationAndSmearingTool; + } + + // - Electron Charge ID Selector Tool + // The only supported working point is Medium with 97% integrated efficiency + // Note: this working point is to be applied on top of MediumLLH + d0z0 cuts + isolFixedCutTight + // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ElectronChargeFlipTaggerTool + std::string toolName="ECIDS_medium"; + AsgElectronChargeIDSelectorTool* electronChargeIDSelectorTool = new AsgElectronChargeIDSelectorTool(toolName); + std::string trainingfile="ElectronPhotonSelectorTools/ChargeID/ECIDS_20161125for2017Moriond.root"; + float BDT_OP=-0.28087; //Set your operating point with the table above. + top::check( electronChargeIDSelectorTool->setProperty("TrainingFile",trainingfile) , "Failed to setProperty" ); + top::check( electronChargeIDSelectorTool->setProperty("CutOnBDT",BDT_OP) , "Failed to setProperty" ); + top::check( electronChargeIDSelectorTool->initialize() , "Failed to initialize" ); + + // The terribly named ElectronPhotonShowerShapeFudgeTool... + // We apply this only to photons to correct the shower shape + // This should only be applied on MC + using IFudgeTool = IElectronPhotonShowerShapeFudgeTool; + const std::string fudgeName = "PhotonFudgeTool"; + if (asg::ToolStore::contains<IFudgeTool>(fudgeName)) { + m_photonFudgeTool = asg::ToolStore::get<IFudgeTool>(fudgeName); + } else { + IFudgeTool* fudge_tool = new ElectronPhotonShowerShapeFudgeTool(fudgeName); + // Set Preselection to 21 (was 16) according to http://cern.ch/go/trk9 + // for MC15 samples, which are based on a geometry derived from GEO-21 from 2015+2016 data + top::check(asg::setProperty(fudge_tool, "Preselection", 21), + "Failed to set " + fudgeName + " property: Preselection"); + top::check(fudge_tool->initialize(), + "Failed to initialize PhotonFudgeTool"); + m_photonFudgeTool = fudge_tool; + } + + // The photon efficiency SF tool + bool af2 = m_config->isAFII(); + int data_type = 0; // Data + if (m_config->isMC()) { + data_type = 1; // Full sim + if (af2) { + data_type = 3; // AF2 + } + } + + // The file to make the tool with. + std::string file_base = "PhotonEfficiencyCorrection/"; + std::string file_map = file_base + "2015_2016/rel20.7/Moriond2017_v1/map0.txt"; + file_map = PathResolverFindCalibFile(file_map); + std::string file_con = ""; + std::string file_unc = ""; + if (af2) { + // for AFII we keep using the previous recommendations + file_base += "v1/efficiencySF.offline.Tight.2015.13TeV.rel20.AFII."; + file_con = file_base; // Conv file + file_unc = file_base; // Unconv file + file_con += "con.v01.root"; + file_con = PathResolverFindCalibFile(file_con); + file_unc += "unc.v01.root"; + file_unc = PathResolverFindCalibFile(file_unc); + } + + using IPhotonEffTool = IAsgPhotonEfficiencyCorrectionTool; + const std::string photonSFName = "AsgPhotonEfficiencyCorrectionTool"; // to retrieve ID Eff scale factors + if (asg::ToolStore::contains<IPhotonEffTool>(photonSFName)) { + m_photonEffSF = asg::ToolStore::get<IPhotonEffTool>(photonSFName); + } else { + if (m_config->isMC()) { // Seem to only be able to setup the tool for MC + IPhotonEffTool* photonEffSF = new AsgPhotonEfficiencyCorrectionTool(photonSFName); + if (!af2) { + top::check(asg::setProperty(photonEffSF, + "MapFilePath", + file_map), + "Failed to set MapFilePath for " + photonSFName); + } else { + top::check(asg::setProperty(photonEffSF, + "CorrectionFileNameConv", + file_con), + "Failed to set CorrectionFileNameConv for " + photonSFName); + top::check(asg::setProperty(photonEffSF, + "CorrectionFileNameUnconv", + file_unc), + "Failed to set CorrectionFileNameUnconv for " + photonSFName); + } + top::check(asg::setProperty(photonEffSF, "ForceDataType", data_type), + "Failed to set ForceDataType for " + photonSFName); + top::check(photonEffSF->initialize(), + "Failed to initialize " + photonSFName); + m_photonEffSF = photonEffSF; + } + } + + // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/IsolationSF2016Moriond#Radiative_Z_low_ET + // To retrieve Isolation Eff scale factors + // N.B. Naming for isolation working points for AsgPhotonEfficiencyCorrectionTool isolation scale factors + // are different than those for the IsolationCorrectionTool (preceded by FixedCut) + std::set<std::string> photon_isolations = {"TightCaloOnly", + "Tight", + "Loose"}; + for (const std::string& isoWP : photon_isolations) { + std::string photonIsoSFName = "AsgPhotonEfficiencyCorrectionTool_IsoSF" + isoWP; + if (!asg::ToolStore::contains<IPhotonEffTool>(photonIsoSFName)) { + if (m_config->isMC() && !af2) { // only available for full simulation + IPhotonEffTool* photonIsoSFTool = new AsgPhotonEfficiencyCorrectionTool(photonIsoSFName); + top::check(asg::setProperty(photonIsoSFTool, + "MapFilePath", + file_map), + "Failed to set MapFilePath for " + photonIsoSFName); + top::check(asg::setProperty(photonIsoSFTool, "ForceDataType", data_type), + "Failed to set ForceDataType for " + photonIsoSFName); + top::check(asg::setProperty(photonIsoSFTool, "UseRadiativeZSF_mediumPT", m_config->photonUseRadiativeZ()), + "Failed to set useRadiativeZSF_mediumPT for " + photonIsoSFName); + top::check(asg::setProperty(photonIsoSFTool, "IsoWP", isoWP), + "Failed to set IsoWP for " + photonIsoSFName); + top::check(photonIsoSFTool->initialize(), + "Failed to initialize " + photonIsoSFName); + m_photonIsoSFTools.push_back(photonIsoSFTool); + } + } + } + return StatusCode::SUCCESS; +} + +StatusCode EgammaCPTools::setupScaleFactors() { + // Don't need for data, return SUCCESS straight away + if (!m_config->isMC()) return StatusCode::SUCCESS; + ///-- Scale factors --/// + + std::string electron_data_dir = "ElectronEfficiencyCorrection/"; + ///-- Reco SFs doesn't depend on WP --/// + std::string electronID = m_config->electronID(); + electronID.replace(electronID.find("LH"), 2, "LLH"); // that way people do not have to change their cuts file + std::string electronIDLoose = m_config->electronIDLoose(); + electronIDLoose.replace(electronIDLoose.find("LH"), 2, "LLH"); // that way people do not have to change their cuts file + + m_electronEffSFRecoFile = electronSFFilePath("reco"); + m_electronEffSFIDFile = electronSFFilePath("ID", electronID); + m_electronEffSFTriggerFile = electronSFFilePath("triggerSF", electronID, + m_config->electronIsolation()); + if (m_electronEffSFTriggerFile.empty()) { + m_electronEffSFTriggerFile = electronSFFilePath("triggerSF", electronID, + "None"); + } + m_electronEffTriggerFile = electronSFFilePath("triggerEff", electronID, + m_config->electronIsolation()); + if (m_electronEffTriggerFile.empty()) { + m_electronEffTriggerFile = electronSFFilePath("triggerEff", electronID, + "None"); + } + if (m_config->electronIsolation() != "None") { + m_electronEffSFIsoFile = electronSFFilePath("isolation", electronID, + m_config->electronIsolation()); + } + // Loose SFs + m_electronEffSFIDLooseFile = electronSFFilePath("ID", electronIDLoose); + m_electronEffSFTriggerLooseFile = electronSFFilePath("triggerSF", electronIDLoose, + m_config->electronIsolationLoose()); + if (m_electronEffSFTriggerLooseFile.empty()) { + m_electronEffSFTriggerLooseFile = electronSFFilePath("triggerSF", electronIDLoose, + "None"); + } + m_electronEffTriggerLooseFile = electronSFFilePath("triggerEff", electronIDLoose, + m_config->electronIsolationLoose()); + if (m_electronEffTriggerLooseFile.empty()) { + m_electronEffTriggerLooseFile = electronSFFilePath("triggerEff", electronIDLoose, + "None"); + } + if (m_config->electronIsolationLoose() != "None") { + m_electronEffSFIsoLooseFile = electronSFFilePath("isolation", electronIDLoose, + m_config->electronIsolationLoose()); + } + // for the moment only for MediumLH and FixedCutTight isolation + // either at Tight or Loose level + if ( ( electronIDLoose == "MediumLLH" && m_config->electronIsolationLoose() == "FixedCutTight" ) + || ( electronID == "MediumLLH" && m_config->electronIsolation() == "FixedCutTight" ) ) { + m_electronEffSFChargeIDFile = electronSFFilePath("ChargeID", "MediumLLH", + "FixedCutTight"); + } + + // The tools want the files in vectors: remove this with function + std::vector<std::string> inRecoSF {m_electronEffSFRecoFile}; + std::vector<std::string> inIDSF {m_electronEffSFIDFile}; + std::vector<std::string> inTriggerSF {m_electronEffSFTriggerFile}; + std::vector<std::string> inTrigger {m_electronEffTriggerFile}; + + std::vector<std::string> inIDSFLoose {m_electronEffSFIDLooseFile}; + std::vector<std::string> inTriggerSFLoose {m_electronEffSFTriggerLooseFile}; + std::vector<std::string> inTriggerLoose {m_electronEffTriggerLooseFile}; + std::vector<std::string> inChargeID {m_electronEffSFChargeIDFile}; + + /********************************************************************** + * Electron Isolation + * Some WPs aren't supported at the moment... + * As people want to use e.g. LooseLH electrons, we will allow + * everything to procede without the isolation SFs, although they + * should be careful and have to set ElectronIsoSFs False in their config + **********************************************************************/ + std::vector< std::string > inIso; + std::vector< std::string > inIsoLoose; + + if (m_config->electronIsolation() != "None") { + if (m_electronEffSFIsoFile.empty()) { + ATH_MSG_WARNING("Electron isolation configuration not found"); + if (m_config->electronIsoSFs()) { + ATH_MSG_WARNING("If you really want to run with this electron " + "ID/Isolation setup then you can add:" + "\tElectronIsoSFs False\tto your config file"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Isolation SFs will be set to 1.0"); + } else { + inIso.push_back( m_electronEffSFIsoFile ); + } + } + if (m_config->electronIsolationLoose() != "None") { + if (m_electronEffSFIsoLooseFile.empty()) { + ATH_MSG_WARNING("Loose Electron isolation configuration not found"); + if (m_config->electronIsoSFs()) { + ATH_MSG_WARNING("If you really want to run with this (loose) " + "electron ID/Isolation setup then you can add:" + "\tElectronIsoSFs False\tto your config file"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Loose Isolation SFs will be set to 1.0"); + } else { + inIsoLoose.push_back( m_electronEffSFIsoLooseFile ); + } + } + + // data type + // 0 : Data + // 1 : MC FullSim + // 3 : MC AFII + int dataType(0); + if (m_config->isMC()) { + dataType = (m_config->isAFII()) ? 3 : 1; + } + + const std::string elSFPrefix = "AsgElectronEfficiencyCorrectionTool_"; + + // Reco SFs + m_electronEffSFReco = setupElectronSFTool(elSFPrefix + "Reco", inRecoSF, dataType); + // Trigger SFs + m_electronEffSFTrigger = setupElectronSFTool(elSFPrefix + "TriggerSF", inTriggerSF, dataType); + m_electronEffSFTriggerLoose = setupElectronSFTool(elSFPrefix + "TriggerSFLoose", inTriggerSFLoose, dataType); + // Trigger Efficiencies (wow- this is bad naming!) + m_electronEffTrigger = setupElectronSFTool(elSFPrefix + "Trigger", inTrigger, dataType); + m_electronEffTriggerLoose = setupElectronSFTool(elSFPrefix + "TriggerLoose", inTriggerLoose, dataType); + // ID SFs + m_electronEffSFID = setupElectronSFTool(elSFPrefix + "ID", inIDSF, dataType); + m_electronEffSFIDLoose = setupElectronSFTool(elSFPrefix + "IDLoose", inIDSFLoose, dataType); + // Isolation SFs + m_electronEffSFIso = setupElectronSFTool(elSFPrefix + "Iso", inIso, dataType); + m_electronEffSFIsoLoose = setupElectronSFTool(elSFPrefix + "IsoLoose", inIsoLoose, dataType); + + // ChargeID SFs (if using Electron Charge ID Selector Tool) + // for the moment only for MediumLH and FixedCutTight isolation + // either at Tight or Loose level + if ( ( electronIDLoose == "MediumLLH" && m_config->electronIsolationLoose() == "FixedCutTight" ) + || ( electronID == "MediumLLH" && m_config->electronIsolation() == "FixedCutTight" ) ) { + // Charge Id efficiency scale factor + m_electronEffSFChargeID = setupElectronSFTool(elSFPrefix + "ChargeID", inChargeID, dataType); + + // Charge flip correction: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EgammaChargeMisIdentificationTool + CP::ElectronChargeEfficiencyCorrectionTool* ChargeMisIDCorrections = new CP::ElectronChargeEfficiencyCorrectionTool("ElectronChargeEfficiencyCorrection"); + //top::check( ChargeMisIDCorrections->setProperty("OutputLevel", MSG::VERBOSE ) , "Failed to setProperty" ); + top::check( ChargeMisIDCorrections->setProperty("CorrectionFileName", "ElectronEfficiencyCorrection/2015_2016/rel20.7/Moriond_February2017_v1/charge_misID/ChargeCorrectionSF.Medium_FixedCutTightIso_CFTMedium.root") , "Failed to setProperty" ); + top::check( ChargeMisIDCorrections->initialize() , "Failed to setProperty" ); + } + return StatusCode::SUCCESS; +} + + +IAsgElectronEfficiencyCorrectionTool* +EgammaCPTools::setupElectronSFTool(const std::string& name, const std::vector<std::string>& file_list, int data_type) { + IAsgElectronEfficiencyCorrectionTool* tool = nullptr; + if (asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool>(name)) { + tool = asg::ToolStore::get<IAsgElectronEfficiencyCorrectionTool>(name); + } else { + if (!file_list.empty()) { // If the file list is empty do nothing + tool = new AsgElectronEfficiencyCorrectionTool(name); + top::check(asg::setProperty(tool, "CorrectionFileNameList", file_list), + "Failed to set CorrectionFileNameList to " + name); + top::check(asg::setProperty(tool, "ForceDataType", data_type), + "Failed to set ForceDataType to " + name); + top::check(asg::setProperty(tool, "CorrelationModel", "TOTAL"), + "Failed to set CorrelationModel to " + name); + top::check(tool->initialize(), "Failed to initialize " + name); + } + } + return tool; +} + +std::string EgammaCPTools::electronSFFilePath(const std::string& type, const std::string& ID, const std::string& isolation) { + const std::string el_calib_path + = "ElectronEfficiencyCorrection/" + "2015_2016/rel20.7/Moriond_February2017_v1/"; + + const std::string ridiculous_trigger_string + = "SINGLE_E_2015_e24_lhmedium_L1EM20VH_" + "OR_e60_lhmedium_" + "OR_e120_lhloose_" + "2016_e26_lhtight_nod0_ivarloose_" + "OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"; + + std::string new_iso = (isolation == "None") ? "" : "_isol" + isolation; + + std::string file_path; + + if (type == "reco") { + file_path = "offline/efficiencySF.offline.RecoTrk.root"; + } else if (type == "ID") { + file_path = "offline/efficiencySF.offline." + ID + "_d0z0_v11.root"; + } else if (type == "isolation") { + file_path = "isolation/efficiencySF.Isolation." + + ID + "_d0z0_v11" + new_iso + ".root"; + } else if (type == "triggerSF") { + file_path = "trigger/efficiencySF." + ridiculous_trigger_string + + "." + ID + "_d0z0_v11" + new_iso + ".root"; + } else if (type == "triggerEff") { + file_path = "trigger/efficiency." + ridiculous_trigger_string + + "." + ID + "_d0z0_v11" + new_iso + ".root"; + } else if (type == "ChargeID") { + if (ID != "MediumLLH") ATH_MSG_WARNING("Only Medium WP available at the moment " + ID); + file_path = "charge_misID/efficiencySF.ChargeID.MediumLLH_d0z0_v11_isolFixedCutTight_MediumCFT.root"; + } else { + ATH_MSG_ERROR("Unknown electron SF type"); + } + return PathResolverFindCalibFile(el_calib_path + file_path); +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopFlavorTaggingCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopFlavorTaggingCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b15c3df0a5f68c3adba1985d97be0036c5322e2e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopFlavorTaggingCPTools.cxx @@ -0,0 +1,271 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopFlavorTaggingCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +#include "xAODBTaggingEfficiency/BTaggingEfficiencyTool.h" +#include "xAODBTaggingEfficiency/BTaggingSelectionTool.h" + +namespace top { + +FlavorTaggingCPTools::FlavorTaggingCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); +} + +StatusCode FlavorTaggingCPTools::initialize() { + ATH_MSG_INFO("top::FlavorTaggingCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::FlavorTaggingCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->useJets()) { + ATH_MSG_INFO("top::FlavorTaggingCPTools: no need to initialise anything since not using jets"); + return StatusCode::SUCCESS; + } + + m_tagger = "MV2c10"; + m_cdi_file = "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-2017-04-24_v1.root"; + m_efficiency_maps = "410000;410004;410500;410187;410021"; + + // working points for calo jets + m_calo_WPs_calib = {"FixedCutBEff_60", + "FixedCutBEff_70", + "FixedCutBEff_77", + "FixedCutBEff_85", + "Continuous" }; + m_calo_WPs = m_calo_WPs_calib; + m_calo_WPs.push_back("FlatBEff_30");// some other WPs are defined in addition to the calibrated ones + m_calo_WPs.push_back("FlatBEff_40"); + m_calo_WPs.push_back("FlatBEff_50"); + m_calo_WPs.push_back("FlatBEff_60"); + m_calo_WPs.push_back("FlatBEff_70"); + m_calo_WPs.push_back("FlatBEff_77"); + m_calo_WPs.push_back("FlatBEff_85"); + m_calo_WPs.push_back("FixedCutBEff_30"); + m_calo_WPs.push_back("FixedCutBEff_50"); + m_calo_WPs.push_back("FixedCutBEff_80"); + m_calo_WPs.push_back("FixedCutBEff_90"); + + // working points for track jets (AntiKt2) + m_trackAntiKt2_WPs_calib = {"FixedCutBEff_60", + "FixedCutBEff_70", + "FixedCutBEff_77", + "FixedCutBEff_85", + "Continuous" }; + m_trackAntiKt2_WPs = m_trackAntiKt2_WPs_calib; + m_trackAntiKt2_WPs.push_back("FixedCutBEff_30");// some other WPs are defined in addition to the calibrated ones + m_trackAntiKt2_WPs.push_back("FixedCutBEff_50"); + m_trackAntiKt2_WPs.push_back("FixedCutBEff_80"); + m_trackAntiKt2_WPs.push_back("FixedCutBEff_90"); + + // working points for track jets (AntiKt4) + m_trackAntiKt4_WPs_calib = {"FixedCutBEff_70", + "FixedCutBEff_77" }; + m_trackAntiKt4_WPs = m_trackAntiKt4_WPs_calib; + m_trackAntiKt4_WPs.push_back("FixedCutBEff_60");// some other WPs are defined in addition to the calibrated ones + m_trackAntiKt4_WPs.push_back("FixedCutBEff_85"); + m_trackAntiKt4_WPs.push_back("FixedCutBEff_30"); + m_trackAntiKt4_WPs.push_back("FixedCutBEff_50"); + m_trackAntiKt4_WPs.push_back("FixedCutBEff_80"); + m_trackAntiKt4_WPs.push_back("FixedCutBEff_90"); + + const std::string calib_file_path = PathResolverFindCalibFile(m_cdi_file); + const std::string excludedSysts = m_config->bTagSystsExcludedFromEV()=="none"?"":m_config->bTagSystsExcludedFromEV(); + + //------------------------------------------------------------ + // Loop through all the different working points we have and create a + // BTaggingSelectionTool and corresponding BTaggingEfficiencyTool if the working point is calibrated. + //------------------------------------------------------------ + + // special stuff to use AntiKt4EMTopoJets scale-factors and tagger WPs when using AntiKt4EMPFlowJets or AntiKt4LCTopoJets, for which no SF is yet available + std::string caloJets_collection = m_config->sgKeyJets(); + if (caloJets_collection == "AntiKt4EMPFlowJets" || caloJets_collection == "AntiKt4LCTopoJets" || caloJets_collection == "AntiKt4EMTopoNoElJets") { + ATH_MSG_WARNING("top::FlavorTaggingCPTools::initialize" ); + std::cout << " No b-tagging calibration available for jet collection " << caloJets_collection << std::endl; + std::cout << " We'll use the calibration for AntiKt4EMTopoJets instead" << std::endl; + std::cout << " Be carefull!!" << std::endl; + caloJets_collection = "AntiKt4EMTopoJets"; + } + // check if the WP requested by the user are available, and if yes, initialize the tools + // loop through all btagging WPs requested + for (auto btagWP : m_config->bTagWP()) { + if(std::find(m_calo_WPs.begin(), m_calo_WPs.end(), btagWP) == m_calo_WPs.end()) { + ATH_MSG_WARNING("top::FlavorTaggingCPTools::initialize" ); + std::cerr << " b-tagging WP: " << btagWP << " not supported for jet collection " << m_config->sgKeyJets() << std::endl; + std::cerr << " it will therefore be ignored" << std::endl; + } + else { + //------------------------------------------------------------ + // Setup BTaggingSelectionTool + //------------------------------------------------------------ + std::string btagsel_tool_name = "BTaggingSelectionTool_"+btagWP+"_"+m_config->sgKeyJets(); + BTaggingSelectionTool* btagsel = new BTaggingSelectionTool(btagsel_tool_name); + top::check(btagsel->setProperty("TaggerName", m_tagger), + "Failed to set b-tagging selecton tool TaggerName"); + top::check(btagsel->setProperty("JetAuthor", caloJets_collection), + "Failed to set b-tagging selection JetAuthor"); + top::check(btagsel->setProperty("FlvTagCutDefinitionsFileName", + m_cdi_file), + "Failed to set b-tagging selection tool CDI file"); + top::check(btagsel->setProperty("OperatingPoint", btagWP), + "Failed to set b-tagging selection tool OperatingPoint"); + top::check(btagsel->setProperty("MinPt", + static_cast<double>(m_config->jetPtcut())), + "Failed to set b-tagging selection tool MinPt"); + top::check(btagsel->setProperty("MaxEta", + static_cast<double>(m_config->jetEtacut())), + "Failed to set b-tagging selection tool MaxEta"); + top::check(btagsel->initialize(), + "Failed to initialize b-tagging selection tool"); + m_btagging_selection_tools.push_back(btagsel); + + if(std::find( m_calo_WPs_calib.begin(), + m_calo_WPs_calib.end(), btagWP) == m_calo_WPs_calib.end()) { + ATH_MSG_WARNING("top::FlavorTaggingCPTools::initialize" ); + std::cerr << " b-tagging WP: " << btagWP << " is not calibrated for jet collection " << m_config->sgKeyJets() << std::endl; + std::cerr << " it will therefore be ignored for the scale-factors, although the tagging decisions will be saved" << std::endl; + } + else { + //------------------------------------------------------------ + // Setup BTaggingEfficiencyTool + //------------------------------------------------------------ + std::string btageff_tool_name = "BTaggingEfficiencyTool_"+btagWP+"_"+m_config->sgKeyJets(); + BTaggingEfficiencyTool* btageff = new BTaggingEfficiencyTool(btageff_tool_name); + top::check(btageff->setProperty("TaggerName", m_tagger), + "Failed to set b-tagging TaggerName"); + top::check(btageff->setProperty("OperatingPoint", btagWP), + "Failed to set b-tagging OperatingPoint"); + top::check(btageff->setProperty("JetAuthor", caloJets_collection), + "Failed to set b-tagging JetAuthor"); + top::check(btageff->setProperty("EfficiencyFileName", calib_file_path), + "Failed to set path to b-tagging CDI file"); + top::check(btageff->setProperty("ScaleFactorFileName", calib_file_path), + "Failed to set path to b-tagging CDI file"); + top::check(btageff->setProperty("ScaleFactorBCalibration", m_config->bTaggingCalibration_B()), + "Failed to set b-tagging calibration (B): "+m_config->bTaggingCalibration_B()); + top::check(btageff->setProperty("ScaleFactorCCalibration", m_config->bTaggingCalibration_C()), + "Failed to set b-tagging calibration (C): "+m_config->bTaggingCalibration_C()); + // using same calibration for T as for C + top::check(btageff->setProperty("ScaleFactorTCalibration", m_config->bTaggingCalibration_C()), + "Failed to set b-tagging calibration (T): "+m_config->bTaggingCalibration_C()); + top::check(btageff->setProperty("ScaleFactorLightCalibration", m_config->bTaggingCalibration_Light()), + "Failed to set b-tagging calibration (Light): "+m_config->bTaggingCalibration_Light()); + for (auto jet_flav : m_jet_flavors) { + top::check(btageff->setProperty("Efficiency"+jet_flav+"Calibrations", m_efficiency_maps), + "Failed to set "+jet_flav+"-calibrations efficiency maps"); + } + top::check(btageff->setProperty("ExcludeFromEigenVectorTreatment", excludedSysts), + "Failed to set b-tagging systematics to exclude from EV treatment"); + top::check(btageff->initialize(), "Failed to initialize "+btagWP); + m_btagging_efficiency_tools.push_back(btageff); + m_config->setBTagWP_calibrated(btagWP); + } + m_config->setBTagWP_available(btagWP); + } + + if (m_config->useTrackJets()) { + std::vector<std::string> track_WPs = {}; + std::vector<std::string> track_WPs_calib = {}; + if (m_config->sgKeyTrackJets() == "AntiKt2PV0TrackJets") { + track_WPs = m_trackAntiKt2_WPs; + track_WPs_calib = m_trackAntiKt2_WPs_calib; + } + else if (m_config->sgKeyTrackJets() == "AntiKt4PV0TrackJets") { + track_WPs = m_trackAntiKt4_WPs; + track_WPs_calib = m_trackAntiKt4_WPs_calib; + } + + if(std::find(track_WPs.begin(), track_WPs.end(), btagWP) == track_WPs.end()) { + ATH_MSG_WARNING("top::FlavorTaggingCPTools::initialize" ); + std::cerr << " b-tagging WP: " << btagWP << " not supported for jet collection " << m_config->sgKeyTrackJets() << std::endl; + std::cerr << " it will therefore be ignored" << std::endl; + } + else { + //------------------------------------------------------------ + // Setup BTaggingSelectionTool + //------------------------------------------------------------ + std::string btagsel_tool_name = "BTaggingSelectionTool_"+btagWP+"_"+m_config->sgKeyTrackJets(); + BTaggingSelectionTool* btagsel = new BTaggingSelectionTool(btagsel_tool_name); + top::check(btagsel->setProperty("TaggerName", m_tagger), + "Failed to set b-tagging selecton tool TaggerName"); + top::check(btagsel->setProperty("JetAuthor", m_config->sgKeyTrackJets()), + "Failed to set b-tagging selection JetAuthor"); + top::check(btagsel->setProperty("FlvTagCutDefinitionsFileName", + m_cdi_file), + "Failed to set b-tagging selection tool CDI file"); + top::check(btagsel->setProperty("OperatingPoint", btagWP), + "Failed to set b-tagging selection tool OperatingPoint"); + top::check(btagsel->setProperty("MinPt", + static_cast<double>(m_config->jetPtcut())), + "Failed to set b-tagging selection tool MinPt"); + top::check(btagsel->setProperty("MaxEta", + static_cast<double>(m_config->jetEtacut())), + "Failed to set b-tagging selection tool MaxEta"); + top::check(btagsel->initialize(), + "Failed to initialize b-tagging selection tool"); + m_btagging_selection_tools.push_back(btagsel); + + if(std::find( track_WPs_calib.begin(), + track_WPs_calib.end(), btagWP) == track_WPs_calib.end()) { + ATH_MSG_WARNING("top::FlavorTaggingCPTools::initialize" ); + std::cerr << " b-tagging WP: " << btagWP << " is not calibrated for jet collection " << m_config->sgKeyTrackJets() << std::endl; + std::cerr << " it will therefore be ignored for the scale-factors, although the tagging decisions will be saved" << std::endl; + } + else { + //------------------------------------------------------------ + // Setup BTaggingEfficiencyTool + //------------------------------------------------------------ + std::string btageff_tool_name = "BTaggingEfficiencyTool_"+btagWP+"_"+m_config->sgKeyTrackJets(); + BTaggingEfficiencyTool* btageff = new BTaggingEfficiencyTool(btageff_tool_name); + top::check(btageff->setProperty("TaggerName", m_tagger), + "Failed to set b-tagging TaggerName"); + top::check(btageff->setProperty("OperatingPoint", btagWP), + "Failed to set b-tagging OperatingPoint"); + top::check(btageff->setProperty("JetAuthor", m_config->sgKeyTrackJets()), + "Failed to set b-tagging JetAuthor"); + top::check(btageff->setProperty("EfficiencyFileName", calib_file_path), + "Failed to set path to b-tagging CDI file"); + top::check(btageff->setProperty("ScaleFactorFileName", calib_file_path), + "Failed to set path to b-tagging CDI file"); + top::check(btageff->setProperty("ScaleFactorBCalibration", m_config->bTaggingCalibration_B()), + "Failed to set b-tagging calibration (B): "+m_config->bTaggingCalibration_B()); + top::check(btageff->setProperty("ScaleFactorCCalibration", m_config->bTaggingCalibration_C()), + "Failed to set b-tagging calibration (C): "+m_config->bTaggingCalibration_C()); + // using same calibration for T as for C + top::check(btageff->setProperty("ScaleFactorTCalibration", m_config->bTaggingCalibration_C()), + "Failed to set b-tagging calibration (T): "+m_config->bTaggingCalibration_C()); + top::check(btageff->setProperty("ScaleFactorLightCalibration", m_config->bTaggingCalibration_Light()), + "Failed to set b-tagging calibration (Light): "+m_config->bTaggingCalibration_Light()); + for (auto jet_flav : m_jet_flavors) { + top::check(btageff->setProperty("Efficiency"+jet_flav+"Calibrations", m_efficiency_maps), + "Failed to set "+jet_flav+"-calibrations efficiency maps"); + } + top::check(btageff->setProperty("ExcludeFromEigenVectorTreatment", excludedSysts), + "Failed to set b-tagging systematics to exclude from EV treatment"); + top::check(btageff->initialize(), "Failed to initialize "+btagWP); + m_btagging_efficiency_tools.push_back(btageff); + m_config->setBTagWP_calibrated_trkJet(btagWP); + } + m_config->setBTagWP_available_trkJet(btagWP); + } + } + } + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopGhostTrackCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopGhostTrackCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..65b026849d931c8826b1a88557e360b8810febbb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopGhostTrackCPTools.cxx @@ -0,0 +1,174 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopGhostTrackCPTools.h" + +#include <map> +#include <string> +#include <utility> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + + +namespace top { + +GhostTrackCPTools::GhostTrackCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); +} + +StatusCode GhostTrackCPTools::initialize() { + ATH_MSG_INFO("top::GhostTrackCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::GhostTrackCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->useJets() || !m_config->useJetGhostTrack()) { + ATH_MSG_INFO("top::GhostTrackCPTools: no need to initialise anything since not using jets or tracks ghost-matched to jets"); + return StatusCode::SUCCESS; + } + + if (!m_config->makeAllCPTools()) { + ATH_MSG_INFO("top::GhostTrackCPTools: no need to initialise for mini-xAOD"); + return StatusCode::SUCCESS; + } + + // This defines the run period (ranges) that are used by the + // InDet::InDetTrackBiasingTool. The following inputs are possible: + // - No / empty input: Use the maximum range, that is [0; + // UInt32_t::max) as allowed run number value range. Initialise + // the tool with run number 0 (which will use 2015 precriptions). + // - A single run number: Configure the tool with this run number + // and to not apply checks / selection on the random run number of + // the actual events. + // - At least two values: Use this to define adjacent ranges, each + // of which is processed using a unique instance of the tool which + // was initialised using the lower bound of the range. From an + // input of size n, n-1 ranges are formed. The i-th element is the + // lower bound (incl) of the i-th range; the (i+1)-th element is + // the upper bound (excl) of the i-th range. + m_runPeriods = {276262, 297730, 300909, 999999}; + + m_config->runPeriodJetGhostTrack(m_runPeriods); + + top::check(setupSmearingTool(), "Failed to setup track smearing tools"); + top::check(setupBiasingTools(), "Failed to setup track biasing tools"); + top::check(setupTruthFilterTool(), "Failed to setup truth filter tools"); + top::check(setupJetTrackFilterTool(), "Failed to setup track filter tools"); + + return StatusCode::SUCCESS; +} + +StatusCode GhostTrackCPTools::setupSmearingTool(){ + + if (asg::ToolStore::contains<InDet::InDetTrackSmearingTool>(m_smearingToolName)){ + m_smearingTool = asg::ToolStore::get<InDet::InDetTrackSmearingTool>(m_smearingToolName); + } else { + auto tool = new InDet::InDetTrackSmearingTool(m_smearingToolName); + top::check(tool->initialize(), "Failure to initialize InDetTrackSmearingTool"); + m_smearingTool = tool; + ATH_MSG_INFO(" Creating smearing tool "+m_smearingToolName ); + } + return StatusCode::SUCCESS; +} + +StatusCode GhostTrackCPTools::setupBiasingTools() { + + top::check(not m_runPeriods.empty(), "Assertion failed"); + + // Two cases are possible: + // - Either a single run number was specified to the runPeriods + // parameter in which case we'll use exactly that run number, or + // - at least two numbers have been specified, which then define + // (potentially multiple) run number ranges. + + if (m_runPeriods.size() == 1){ + m_runPeriods.resize(1); + + const std::string biasToolName{m_biasToolPrefix + "_" + std::to_string(m_runPeriods[0])}; + + if (asg::ToolStore::contains<InDet::InDetTrackBiasingTool>(biasToolName)){ + m_biasingTool[0] = asg::ToolStore::get<InDet::InDetTrackBiasingTool>(biasToolName); + } else { + auto tool = new InDet::InDetTrackBiasingTool(biasToolName); + top::check(tool->setProperty("runNumber", m_runPeriods[0]), + "Failure to setProperty runNumber of InDetTrackBiasingTool "+biasToolName); + top::check(tool->initialize(), + "Failure to initialize InDetTrackBiasingTool "+biasToolName); + m_biasingTool[0] = tool; + } + ATH_MSG_INFO(" Creating biasing tool to calibrate for run#=" << m_runPeriods[0] <<": "+biasToolName ); + + } else { + m_biasingTool.resize(m_runPeriods.size() - 1); + for (std::size_t i=0; i<m_runPeriods.size() - 1; ++i){ + const std::string biasToolName{m_biasToolPrefix + + "_" + std::to_string(m_runPeriods[i]) + + "_" + std::to_string(m_runPeriods[i + 1])}; + ATH_MSG_INFO(" Creating biasing tool to calibrate for period [" << m_runPeriods[i] << ", " << m_runPeriods[i + 1] << "): "<<biasToolName ); + if (asg::ToolStore::contains<InDet::InDetTrackBiasingTool>(biasToolName)){ + m_biasingTool[i] = + asg::ToolStore::get<InDet::InDetTrackBiasingTool>(biasToolName); + } else { + auto tool = new InDet::InDetTrackBiasingTool(biasToolName); + top::check(tool->setProperty("runNumber", m_runPeriods[i]), + "Failure to setProperty runNumber of InDetTrackBiasingTool "+biasToolName); + top::check(tool->initialize(), + "Failure to initialize InDetTrackBiasingTool "+biasToolName); + m_biasingTool[i] = tool; + } + } + } + return StatusCode::SUCCESS; +} + +StatusCode GhostTrackCPTools::setupTruthFilterTool(){ + + if (asg::ToolStore::contains<InDet::InDetTrackTruthOriginTool>(m_truthOriginToolName)){ + m_truthOriginTool = asg::ToolStore::get<InDet::InDetTrackTruthOriginTool>(m_truthOriginToolName); + } else { + auto tool = new InDet::InDetTrackTruthOriginTool(m_truthOriginToolName); + top::check(tool->initialize(), + "Failure to initialize InDetTrackTruthOriginTool "+m_truthOriginToolName); + m_truthOriginTool = tool; + ATH_MSG_INFO(" Creating truth origin tool "+m_truthOriginToolName ); + } + + if (asg::ToolStore::contains<InDet::InDetTrackTruthFilterTool>(m_truthFilterToolName)){ + m_truthFilterTool = asg::ToolStore::get<InDet::InDetTrackTruthFilterTool>(m_truthFilterToolName); + } else { + auto tool = new InDet::InDetTrackTruthFilterTool(m_truthFilterToolName); + top::check(tool->setProperty("trackOriginTool", + ToolHandle<InDet::IInDetTrackTruthOriginTool>{&(* m_truthOriginTool)}), + "Failed to setProperty trackOriginTool of InDetTrackTruthFilterTool "+m_truthFilterToolName); + top::check(tool->initialize(), + "Failure to initialize InDetTrackTruthFilterTool "+m_truthFilterToolName); + m_truthFilterTool = tool; + ATH_MSG_INFO(" Creating truth filter tool "+m_truthFilterToolName ); + } + return StatusCode::SUCCESS; +} + +StatusCode GhostTrackCPTools::setupJetTrackFilterTool(){ + + if (asg::ToolStore::contains<InDet::JetTrackFilterTool>(m_jetTrackFilterToolName)){ + m_jetTrackFilterTool = asg::ToolStore::get<InDet::JetTrackFilterTool>(m_jetTrackFilterToolName); + } else { + auto tool = new InDet::JetTrackFilterTool(m_jetTrackFilterToolName); + top::check(tool->initialize(), "Failure to initialize JetTrackFilterTool"); + m_jetTrackFilterTool = tool; + ATH_MSG_INFO(" Creating jet track filter tool" ); + } + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7d9bc98441bb3e61ca607cbb5cc1aa63205e2422 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopIsolationCPTools.cxx @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopIsolationCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Isolation include(s): +#include "IsolationSelection/IsolationSelectionTool.h" +#include "IsolationCorrections/IsolationCorrectionTool.h" + +namespace top { + +IsolationCPTools::IsolationCPTools(const std::string& name) : + asg::AsgTool(name), + m_isolationCalibFile("IsolationSelection/v1/MC15_Z_Jpsi_cutMap.root"){ + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "IsolationCorrectionTool" , m_isolationCorr); +} + +StatusCode IsolationCPTools::initialize() { + ATH_MSG_INFO("top::IsolationCPTools initialize..."); + + if (!m_config->makeAllCPTools()) { + ATH_MSG_INFO("top::IsolationCPTools: no need to initialise for mini-xAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->useElectrons() && m_config->useMuons()) { + ATH_MSG_INFO("top::IsolationCPTools: no need to initialise since neither using electrons nor muons"); + return StatusCode::SUCCESS; + } + top::check(setupIsolation(), "Failed to setup Isolation tools"); + return StatusCode::SUCCESS; +} + +StatusCode IsolationCPTools::setupIsolation() { + // needed both for electrons and photons to apply the leakage correction, + // [http://cern.ch/go/j6Lx] + std::string iso_corr_tool_name = "CP::IsolationCorrectionTool"; + if (asg::ToolStore::contains<CP::IIsolationCorrectionTool>(iso_corr_tool_name)) { + m_isolationCorr = asg::ToolStore::get<CP::IIsolationCorrectionTool>(iso_corr_tool_name); + } else { + CP::IIsolationCorrectionTool* isolationCorr = new CP::IsolationCorrectionTool(iso_corr_tool_name); + top::check(asg::setProperty(isolationCorr, "IsMC", m_config->isMC()), + "Failed to setProperty"); // if MC, else false + top::check(isolationCorr->initialize(), "Failed to initialize"); + + m_isolationCorr = isolationCorr; + } + + // Muon Isolation WPs + std::set<std::string> muon_isolations = {"LooseTrackOnly", "Loose", + "Gradient", "GradientLoose", + "FixedCutTightTrackOnly", + "FixedCutLoose"}; + // Electron Isolation WPs include all of those defined for + // muons + FixedCutTight + std::set<std::string> electron_isolations; + electron_isolations.insert(muon_isolations.begin(), muon_isolations.end()); + electron_isolations.insert("FixedCutTight"); + // Photon Isolation WPs + std::set<std::string> photon_isolations = {"FixedCutTightCaloOnly", + "FixedCutTight", + "FixedCutLoose"}; + + std::set<std::string> all_isolations; + all_isolations.insert(muon_isolations.begin(), muon_isolations.end()); + all_isolations.insert(electron_isolations.begin(), electron_isolations.end()); + all_isolations.insert(photon_isolations.begin(), photon_isolations.end()); + + for (const std::string& isoWP : all_isolations) { + std::string tool_name = "CP::IsolationTool_"+isoWP; + if (!asg::ToolStore::contains<CP::IIsolationSelectionTool>(tool_name)) { + CP::IIsolationSelectionTool* iso_tool = new CP::IsolationSelectionTool(tool_name); + top::check(asg::setProperty(iso_tool, "CalibFileName", m_isolationCalibFile), + "Failed to set CalibFileName for " + tool_name); + if (electron_isolations.find(isoWP) != electron_isolations.end()) + top::check(asg::setProperty(iso_tool, "ElectronWP", isoWP), + "Failed to set electron WP for " + tool_name); + if (muon_isolations.find(isoWP) != muon_isolations.end()) + top::check(asg::setProperty(iso_tool, "MuonWP", isoWP), + "Failed to set muon WP for " + tool_name); + if (photon_isolations.find(isoWP) != photon_isolations.end()) + top::check(asg::setProperty(iso_tool, "PhotonWP", isoWP), + "Failed to set photon WP for " + tool_name); + top::check(iso_tool->initialize(), "Failed to initialize " + tool_name); + m_isolationTools.push_back(iso_tool); + } + } + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80ccb2b803934308aacdef2e1bf7adeccb9f3d96 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx @@ -0,0 +1,499 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopJetMETCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Jet include(s): +#include "JetCalibTools/JetCalibrationTool.h" +#include "JetUncertainties/JetUncertaintiesTool.h" +#include "JetMomentTools/JetVertexTaggerTool.h" +#include "JetMomentTools/JetForwardJvtTool.h" +#include "JetSelectorTools/JetCleaningTool.h" +#include "JetResolution/JERTool.h" +#include "JetResolution/JERSmearingTool.h" +#include "JetJvtEfficiency/JetJvtEfficiency.h" + +// MET include(s): +#include "METUtilities/METMaker.h" +#include "METUtilities/METSystematicsTool.h" + +namespace top { + +JetMETCPTools::JetMETCPTools(const std::string& name) : + asg::AsgTool(name), + + m_jetJVT_ConfigFile("JVTlikelihood_20140805.root"), + + // Updated to December 2016 recommendations + // config names are the same for Data and FS, for EM or LC jets + m_jetAntiKt4_Data_ConfigFile("JES_data2016_data2015_Recommendation_Dec2016.config"), + m_jetAntiKt4_Data_CalibSequence("JetArea_Residual_Origin_EtaJES_GSC_Insitu"), + + m_jetAntiKt4_MCFS_ConfigFile("JES_data2016_data2015_Recommendation_Dec2016.config"), + m_jetAntiKt4_MCFS_CalibSequence("JetArea_Residual_Origin_EtaJES_GSC"), + + // AFII is different - still June 2015 pre-recommendations + m_jetAntiKt4_MCAFII_ConfigFile("JES_MC15Prerecommendation_AFII_June2015.config"), + m_jetAntiKt4_MCAFII_CalibSequence("JetArea_Residual_Origin_EtaJES_GSC"), + + // Particle-Flow jets, August 2016 recommendations, no GSC + m_jetAntiKt4_PFlow_MCFS_ConfigFile("JES_MC15cRecommendation_PFlow_Aug2016.config"), + m_jetAntiKt4_PFlow_MCFS_CalibSequence("JetArea_Residual_EtaJES_GSC") { + + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "JetCalibrationTool" , m_jetCalibrationTool ); + declareProperty( "JetCalibrationToolLargeR" , m_jetCalibrationToolLargeR ); + + declareProperty( "JetUncertaintiesTool" , m_jetUncertaintiesTool); + declareProperty( "JetUncertaintiesToolReducedNPScenario1" , m_jetUncertaintiesToolReducedNPScenario1 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario2" , m_jetUncertaintiesToolReducedNPScenario2 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario3" , m_jetUncertaintiesToolReducedNPScenario3 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario4" , m_jetUncertaintiesToolReducedNPScenario4 ); + + declareProperty( "JetCleaningToolLooseBad" , m_jetCleaningToolLooseBad ); + declareProperty( "JetCleaningToolTightBad" , m_jetCleaningToolTightBad ); + + declareProperty( "JetJERTool" , m_jetJERTool ); + declareProperty( "JetJERSmearingTool" , m_jetJERSmearingTool ); + declareProperty( "JetUpdateJvtTool" , m_jetUpdateJvtTool ); + + declareProperty( "JES_data2016_data2015_Recommendation_Dec2016.config", m_jetAntiKt4_MCFS_ConfigFile); + declareProperty( "JetCalibrationSequenceFS", m_jetAntiKt4_MCFS_CalibSequence ); + + declareProperty( "JES_MC15cRecommendation_PFlow_Aug2016.config", m_jetAntiKt4_PFlow_MCFS_ConfigFile); + declareProperty( "JetArea_Residual_EtaJES_GSC", m_jetAntiKt4_PFlow_MCFS_CalibSequence ); + + declareProperty( "met_maker" , m_met_maker ); + declareProperty( "met_systematics" , m_met_systematics ); +} + +StatusCode JetMETCPTools::initialize() { + ATH_MSG_INFO("top::JetMETCPTools initialize..."); + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::JetMETCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (m_config->useJets()) { + if (m_config->makeAllCPTools()) {// skiping calibrations on mini-xAODs + top::check(setupJetsCalibration(), "Failed to setup jet calibration tools"); + } + // JVT tool needed for both MC and data (for both selection and SFs) + top::check(setupJetsScaleFactors(), "Failed to setup jet scale-factor tools"); + } + + if (m_config->useLargeRJets()) + top::check(setupLargeRJetsCalibration(), "Failed to setup large-R jet calibration"); + + if (m_config->makeAllCPTools()) {// MET not needed on mini-xAODs + top::check(setupMET(), "Failed to setup MET tools"); + } + + return StatusCode::SUCCESS; +} + +StatusCode JetMETCPTools::setupJetsCalibration() { + + // Release 21 specific + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ApplyJetCalibration2016#Calibrating_jets_in_Release_21 + if(m_release_series == 25){ + ATH_MSG_INFO("Updating configuration options for Rel21"); + // Data + m_jetAntiKt4_Data_ConfigFile = "JES_data2016_data2015_Recommendation_Dec2016_rel21.config"; + m_jetAntiKt4_Data_CalibSequence = "JetArea_Residual_EtaJES_GSC_Insitu"; + // FS EM/LC + m_jetAntiKt4_MCFS_ConfigFile = "JES_data2016_data2015_Recommendation_Dec2016_rel21.config"; + m_jetAntiKt4_MCFS_CalibSequence = "JetArea_Residual_EtaJES_GSC"; + // AFII EM/LC + m_jetAntiKt4_MCAFII_ConfigFile = ""; // No Rel21 + m_jetAntiKt4_MCAFII_CalibSequence = ""; + // FS PFlow + m_jetAntiKt4_PFlow_MCFS_ConfigFile = "JES_MC15cRecommendation_PFlow_Aug2016.config"; // MC15c? + m_jetAntiKt4_PFlow_MCFS_CalibSequence = "JetArea_Residual_EtaJES_GSC"; + // Note there are suggestions for PFlow in Data + // JES_MC15cRecommendation_PFlow_Aug2016.config + // JetArea_Residual_EtaJES_GSC + } + + // Get jet calibration name and erase "Jets" from the end + std::string caloJets_collection = m_config->sgKeyJets(); + std::string jetCalibrationName; + if (caloJets_collection == "AntiKt4EMTopoNoElJets"){ + jetCalibrationName="AntiKt4EMTopoJets"; + } + else{ + jetCalibrationName = caloJets_collection ; + } + jetCalibrationName.erase(jetCalibrationName.length() - 4); + + // In case of using JMS calibration + if ( m_config->jetCalibSequence() == "JMS" ) { + m_jetAntiKt4_MCFS_ConfigFile.erase(m_jetAntiKt4_MCFS_ConfigFile.length() - 7);//erase ".config" at the end + m_jetAntiKt4_MCFS_ConfigFile += "_JMS.config"; + m_jetAntiKt4_MCFS_CalibSequence += "_JMS"; + } + + ///-- Calibration --/// + if (asg::ToolStore::contains<IJetCalibrationTool>("JetCalibrationTool")) { + m_jetCalibrationTool = asg::ToolStore::get<IJetCalibrationTool>("JetCalibrationTool"); + } else { + std::string calibConfig, calibSequence; + if (m_config->isMC()) { + if (m_config->isAFII()) { + calibConfig = m_jetAntiKt4_MCAFII_ConfigFile; + calibSequence = m_jetAntiKt4_MCAFII_CalibSequence; + } else { + calibConfig = m_jetAntiKt4_MCFS_ConfigFile; + calibSequence = m_jetAntiKt4_MCFS_CalibSequence; + } + } else { + calibConfig = m_jetAntiKt4_Data_ConfigFile; + calibSequence = m_jetAntiKt4_Data_CalibSequence; + } + if (m_config->useParticleFlowJets()) { + calibConfig = m_jetAntiKt4_PFlow_MCFS_ConfigFile; + calibSequence = m_jetAntiKt4_PFlow_MCFS_CalibSequence; + } + + JetCalibrationTool* jetCalibrationTool = new JetCalibrationTool("JetCalibrationTool"); + top::check(asg::setProperty(jetCalibrationTool, "JetCollection", jetCalibrationName), + "Failed to set JetCollection " + jetCalibrationName); + top::check(asg::setProperty(jetCalibrationTool, "ConfigFile", calibConfig), + "Failed to set ConfigFile " + calibConfig); + top::check(asg::setProperty(jetCalibrationTool, "CalibSequence", calibSequence), + "Failed to set CalibSequence " + calibSequence); + top::check(asg::setProperty(jetCalibrationTool, "IsData", !m_config->isMC()), + "Failed to set IsData " + !m_config->isMC()); + + top::check(jetCalibrationTool->initializeTool(jetCalibrationName), + "Failed to initialize JetCalibrationTool"); + m_jetCalibrationTool = jetCalibrationTool; + } + + ///-- Update JVT --/// + const std::string jvt_update_name = "JetUpdateJvtTool"; + if (asg::ToolStore::contains<IJetUpdateJvt>(jvt_update_name)) { + m_jetUpdateJvtTool = asg::ToolStore::get<IJetUpdateJvt>(jvt_update_name); + } else { + IJetUpdateJvt* jetUpdateJvtTool = new JetVertexTaggerTool(jvt_update_name); + top::check(asg::setProperty(jetUpdateJvtTool, "JVTFileName", "JetMomentTools/" + m_jetJVT_ConfigFile), + "Failed to set JVTFileName for JetUpdateJvtTool"); + top::check(jetUpdateJvtTool->initialize(), "Failed to initialize"); + m_jetUpdateJvtTool = jetUpdateJvtTool; + } + + ///-- Update fJVT --/// + const std::string fjvt_tool_name = "fJVTTool"; + if (asg::ToolStore::contains<IJetModifier>(fjvt_tool_name)) { + m_fjvtTool = asg::ToolStore::get<IJetModifier>(fjvt_tool_name); + } else { + IJetModifier* fJVTTool = new JetForwardJvtTool(fjvt_tool_name); + top::check(asg::setProperty(fJVTTool, "JvtMomentName", "AnalysisTop_JVT"), + "Failed to set JvtMomentName for JetForwardJvtTool"); + // following instructions from: + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/METUtilities#MET_with_forward_JVT + if (m_config->fwdJetAndMET() == "fJVT") { + top::check(asg::setProperty(fJVTTool, "CentralMaxPt", 60e3), + "Failed to set CentralMaxPt for JetForwardJvtTool"); + } + top::check(fJVTTool->initialize(), "Failed to initialize " + fjvt_tool_name); + m_fjvtTool = fJVTTool; + } + + // TODO(tom.neep@cern.ch): Currently we don't have uncertainties for + // particle flow jets, so return successfully + // here. Keep an eye on this in the future. + // Also: no jet cleaning for particle-flow jets. + if (m_config->useParticleFlowJets()) + return StatusCode::SUCCESS; + + ///-- Jet Cleaning Tools --/// + m_jetCleaningToolLooseBad = setupJetCleaningTool("LooseBad"); + m_jetCleaningToolTightBad = setupJetCleaningTool("TightBad"); + + // Uncertainties + // Is our MC full or fast simulation? + std::string MC_type = (m_config->isAFII()) ? "AFII" : "MC15"; + + std::string conference = "Moriond2017"; + + // Are we doing multiple JES for the reduced NP senarios? + if (!m_config->doMultipleJES()) { + m_jetUncertaintiesTool + = setupJetUncertaintiesTool("JetUncertaintiesTool", + jetCalibrationName, MC_type, + "JES_2016/" + + conference + +"/JES2016_" + + m_config->jetUncertainties_NPModel() + + ".config",nullptr); + } else { + m_jetUncertaintiesToolReducedNPScenario1 + = setupJetUncertaintiesTool("JetUncertaintiesToolReducedNPScenario1", + jetCalibrationName, MC_type, + "JES_2016/" + + conference + + "/JES2016_SR_Scenario1.config",nullptr); + m_jetUncertaintiesToolReducedNPScenario2 + = setupJetUncertaintiesTool("JetUncertaintiesToolReducedNPScenario2", + jetCalibrationName, MC_type, + "JES_2016/" + + conference + + "/JES2016_SR_Scenario2.config",nullptr); + m_jetUncertaintiesToolReducedNPScenario3 + = setupJetUncertaintiesTool("JetUncertaintiesToolReducedNPScenario3", + jetCalibrationName, MC_type, + "JES_2016/" + + conference + + "/JES2016_SR_Scenario3.config",nullptr); + m_jetUncertaintiesToolReducedNPScenario4 + = setupJetUncertaintiesTool("JetUncertaintiesToolReducedNPScenario4", + jetCalibrationName, MC_type, + "JES_2016/" + + conference + + "/JES2016_SR_Scenario4.config",nullptr); + } + + // JER Tool + if (asg::ToolStore::contains<IJERTool>("JetJERTool")) { + m_jetJERTool = asg::ToolStore::get<IJERTool>("JetJERTool"); + } else { + IJERTool* jetJERTool = new JERTool("JetJERTool"); + top::check(asg::setProperty(jetJERTool, "CollectionName", "AntiKt4EMTopoJets"), + "Failed to set CollectionName to JetJERTool"); + top::check(jetJERTool->initialize(), "Failed to initialize"); + m_jetJERTool = jetJERTool; + } + + // JER Smearing + const std::string jersmear_name = "JetJERSmearingTool"; + if (asg::ToolStore::contains<IJERSmearingTool>(jersmear_name)) { + m_jetJERSmearingTool = asg::ToolStore::get<IJERSmearingTool>(jersmear_name); + } else { + IJERSmearingTool* jetJERSmearingTool = new JERSmearingTool(jersmear_name); + top::check(asg::setProperty(jetJERSmearingTool, "JERTool" , m_jetJERTool), + "Failed to JERTool to " + jersmear_name); + top::check(asg::setProperty(jetJERSmearingTool, "ApplyNominalSmearing", false), + "Failed to ApplyNominalSmearing for " + jersmear_name); + top::check(asg::setProperty(jetJERSmearingTool, "isMC", m_config->isMC()), + "Failed to isMC to " + jersmear_name); + top::check(asg::setProperty(jetJERSmearingTool, "SystematicMode", m_config->jetJERSmearingModel()), + "Failed to SystematicMode for " + jersmear_name); + top::check(jetJERSmearingTool->initialize(), + "Failed to initialize " + jersmear_name); + m_jetJERSmearingTool = jetJERSmearingTool; + } + + return StatusCode::SUCCESS; +} + +StatusCode JetMETCPTools::setupLargeRJetsCalibration() { + std::string jetCalibrationNameLargeR = m_config->sgKeyLargeRJets(); + // erase "Jets" from the end + jetCalibrationNameLargeR.erase(jetCalibrationNameLargeR.length() - 4); + + if (asg::ToolStore::contains<IJetCalibrationTool>("JetCalibrationToolLargeR")) { + m_jetCalibrationToolLargeR = asg::ToolStore::get<IJetCalibrationTool>("JetCalibrationToolLargeR"); + } else { + // Only a single calib config/sequence for MC and data + // so just put it here for now. + std::string calibConfigLargeR = ""; + const std::string calibChoice = m_config->largeRJESJMSConfig(); + if (calibChoice == "CombinedMass") { + calibConfigLargeR = "JES_MC15recommendation_FatJet_Nov2016_QCDCombinationUncorrelatedWeights.config"; + } + else if (calibChoice == "CaloMass") { + calibConfigLargeR = "JES_MC15recommendation_FatJet_June2015.config"; + } + else { + ATH_MSG_ERROR("Unknown largeRJESJMSConfig "+calibChoice); + return StatusCode::FAILURE; + } + const std::string calibSequenceLargeR = "EtaJES_JMS"; + + JetCalibrationTool* jetCalibrationToolLargeR + = new JetCalibrationTool("JetCalibrationToolLargeR"); + top::check(asg::setProperty(jetCalibrationToolLargeR, "JetCollection", jetCalibrationNameLargeR), + "Failed to set JetCollection " + jetCalibrationNameLargeR); + top::check(asg::setProperty(jetCalibrationToolLargeR, "ConfigFile", calibConfigLargeR), + "Failed to set ConfigFile " + calibConfigLargeR); + top::check(asg::setProperty(jetCalibrationToolLargeR, "CalibSequence", calibSequenceLargeR), + "Failed to set CalibSequence " + calibSequenceLargeR); + top::check(asg::setProperty(jetCalibrationToolLargeR, "IsData", !m_config->isMC()), + "Failed to set IsData " + !m_config->isMC()); + + top::check(jetCalibrationToolLargeR->initializeTool(jetCalibrationNameLargeR), + "Failed to initialize JetCalibrationToolLargeR"); + m_jetCalibrationToolLargeR = jetCalibrationToolLargeR; + } + + // Moriond2017 uncertainty recommendations: + // names = "UJ_2016/Moriond2017/UJ2016_CaloMass_strong.config" // strong,medium,weak + // names = "UJ_2016/Moriond2017/UJ2016_CombinedMass_strong.config" // strong,medium,weak + + std::string conference(""); + std::string configDir(""); + std::vector<std::string>* variables = nullptr; + std::string largeRJES_config = m_config->largeRJESUncertaintyConfig(); + std::string MC_type = "MC15"; + + conference = "Moriond2017"; + configDir = "UJ_2016"; + MC_type += "c"; + + variables = new std::vector<std::string>; + variables->push_back("pT"); + std::string variable; + size_t pos_end = 0; + while( (pos_end = largeRJES_config.find(",")) != std::string::npos) { + variable = largeRJES_config.substr(0,pos_end); + variables->push_back(variable); + largeRJES_config.erase(0,pos_end+1); + } + variables->push_back(largeRJES_config); + + largeRJES_config = m_config->largeRJESJMSConfig(); + if (largeRJES_config.find("UJ2016_") != 0) largeRJES_config.insert(0, "UJ2016_"); + + m_jetUncertaintiesToolLargeR_strong + = setupJetUncertaintiesTool("JetUncertaintiesToolLargeR_Strong", + jetCalibrationNameLargeR, MC_type, + configDir+"/"+conference + + "/"+largeRJES_config+"_strong.config",variables); + m_jetUncertaintiesToolLargeR_medium + = setupJetUncertaintiesTool("JetUncertaintiesToolLargeR_Medium", + jetCalibrationNameLargeR, MC_type, + configDir+"/"+conference + + "/"+largeRJES_config+"_medium.config",variables); + m_jetUncertaintiesToolLargeR_weak + = setupJetUncertaintiesTool("JetUncertaintiesToolLargeR_Weak", + jetCalibrationNameLargeR, MC_type, + configDir+"/"+conference + + "/"+largeRJES_config+"_weak.config",variables); + + if (variables) delete variables; + return StatusCode::SUCCESS; +} + +StatusCode JetMETCPTools::setupJetsScaleFactors() { + // <tom.neep@cern.ch> Added 16th Feb 2016. + // Jet JVT tool - can be used for both selection and for SFs + // Since we use this for jet selection we also need it for data + const std::string jvt_tool_name = "JetJvtEfficiencyTool"; + const std::string JVT_SFFile = + (m_config->sgKeyJets()=="AntiKt4LCTopoJets")? + "JetJvtEfficiency/Moriond2017/JvtSFFile_LC.root": + "JetJvtEfficiency/Moriond2017/JvtSFFile_EM.root";// default is EM jets + if (asg::ToolStore::contains<CP::IJetJvtEfficiency>(jvt_tool_name)) { + m_jetJvtTool = asg::ToolStore::get<CP::IJetJvtEfficiency>(jvt_tool_name); + } else { + CP::JetJvtEfficiency* jetJvtTool = new CP::JetJvtEfficiency(jvt_tool_name); + // Medium WP default for EM or LC jets; special WP for PFlow jets + top::check(jetJvtTool->setProperty("WorkingPoint", (m_config->useParticleFlowJets())?"PFlow":"Medium"), + "Failed to set JVT WP"); + top::check(jetJvtTool->setProperty("SFFile", JVT_SFFile), + "Failed to set JVT SFFile name"); + top::check(jetJvtTool->setProperty("JetJvtMomentName", "AnalysisTop_JVT"), + "Failed to set JVT decoration name"); + top::check(jetJvtTool->setProperty("TruthLabel", "AnalysisTop_isHS"), + "Failed to set JVT TruthLabel decoration name"); + top::check(jetJvtTool->initialize(), "Failed to initialize JVT tool"); + m_jetJvtTool = jetJvtTool; + } + return StatusCode::SUCCESS; +} + +StatusCode JetMETCPTools::setupMET() +{ + if ( asg::ToolStore::contains<IMETMaker>("met::METMaker") ) { + m_met_maker = asg::ToolStore::get<IMETMaker>("met::METMaker"); + } else { + met::METMaker* metMaker = new met::METMaker("met::METMaker"); + top::check( metMaker->setProperty("JetJvtMomentName", "AnalysisTop_JVT"), "Failed to set METMaker JVT moment name" ); + // following instructions from: + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EtmissRecommendationsRel20p7Temp#Working_Points_NEW + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/METUtilities#MET_with_forward_JVT + if (m_config->fwdJetAndMET() == "Tight") { + top::check( metMaker->setProperty("JetSelection", "Tight"), "Failed to set METMaker JetSelection to Tight" ); + } + else if (m_config->fwdJetAndMET() == "fJVT") { + top::check( metMaker->setProperty("JetRejectionDec", "passFJVT"), "Failed to set METMaker JetRejectionDec to passFJVT" ); + } + top::check( metMaker->initialize() , "Failed to initialize" ); + metMaker->msg().setLevel( MSG::INFO ); + m_met_maker = metMaker; + } + + if ( asg::ToolStore::contains<IMETSystematicsTool>("met::METSystematicsTool") ) { + m_met_systematics = asg::ToolStore::get<IMETSystematicsTool>("met::METSystematicsTool"); + } else { + met::METSystematicsTool* metSyst = new met::METSystematicsTool("met::METSystematicsTool"); + + top::check( metSyst->setProperty("ConfigSoftTrkFile", "TrackSoftTerms.config"), "Failed to set property" ); + + // Turn off soft calo term systematics... if left on we get some warnings + top::check( metSyst->setProperty("ConfigSoftCaloFile", "" ), "Failed to set property" ); + top::check( metSyst->initialize() , "Failed to initialize" ); + m_met_systematics = metSyst; + } + + + return StatusCode::SUCCESS; +} + +ICPJetUncertaintiesTool* +JetMETCPTools::setupJetUncertaintiesTool(const std::string& name, + const std::string& jet_def, + const std::string& mc_type, + const std::string& config_file, + std::vector<std::string>* variables) { + ICPJetUncertaintiesTool* tool = nullptr; + if (asg::ToolStore::contains<ICPJetUncertaintiesTool>(name)) { + tool = asg::ToolStore::get<ICPJetUncertaintiesTool>(name); + } else { + tool = new JetUncertaintiesTool(name); + top::check(asg::setProperty(tool, "JetDefinition", jet_def), + "Failed to set JetDefinition for " + name); + top::check(asg::setProperty(tool, "MCType", mc_type), + "Failed to set MCType for " + name); + top::check(asg::setProperty(tool, "ConfigFile", config_file), + "Failed to set ConfigFile for " + name); + if (variables != nullptr){ + top::check(asg::setProperty(tool, "VariablesToShift", *variables), + "Failed to set VariablesToShift for LargeR Jes Uncertainty "+ name); + } + top::check(tool->initialize(), "Failed to initialize " + name); + } + return tool; +} + +IJetSelector* JetMETCPTools::setupJetCleaningTool(const std::string& WP) { + IJetSelector* tool = nullptr; + std::string name = "JetCleaningTool" + WP; + if (asg::ToolStore::contains<IJetSelector>(name)) { + tool = asg::ToolStore::get<IJetSelector>(name); + } else { + tool = new JetCleaningTool(name); + top::check(asg::setProperty(tool, "CutLevel", WP), + "Failed to set CutLevel to " + WP + " for " + name); + top::check(asg::setProperty(tool, "DoUgly", false), + "Failed to set DoUgly for " + name); + top::check(tool->initialize(), "Failed to initialize " + name); + } + return tool; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6b26f420da28348a767cf97efd7723e81462c634 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx @@ -0,0 +1,261 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopMuonCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Muon include(s): +#include "MuonMomentumCorrections/MuonCalibrationAndSmearingTool.h" +#include "MuonSelectorTools/MuonSelectionTool.h" +#include "MuonEfficiencyCorrections/MuonTriggerScaleFactors.h" +#include "MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h" + +namespace top { + +MuonCPTools::MuonCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "MuonCalibrationAndSmearingTool" , m_muonCalibrationAndSmearingTool ); + declareProperty( "MuonSelectionTool" , m_muonSelectionTool ); + declareProperty( "MuonSelectionToolLoose" , m_muonSelectionToolLoose ); + declareProperty( "MuonSelectionToolVeryLooseVeto" , m_muonSelectionToolVeryLooseVeto ); + + declareProperty( "MuonEfficiencyCorrectionsTool" , m_muonEfficiencyCorrectionsTool ); + declareProperty( "MuonEfficiencyCorrectionsToolLoose" , m_muonEfficiencyCorrectionsToolLoose ); + declareProperty( "MuonEfficiencyCorrectionsToolIso" , m_muonEfficiencyCorrectionsToolIso ); + declareProperty( "MuonEfficiencyCorrectionsToolLooseIso" , m_muonEfficiencyCorrectionsToolLooseIso ); +} + +StatusCode MuonCPTools::initialize() { + ATH_MSG_INFO("top::MuonCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::MuonCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->useMuons()) { + ATH_MSG_INFO("top::MuonCPTools: no need to initialise anything since not using muons"); + return StatusCode::SUCCESS; + } + + if (m_config->makeAllCPTools()) {// skiping calibrations on mini-xAODs + top::check(setupCalibration(), "Failed to setup Muon calibration tools"); + } + if (m_config->isMC()) {// scale-factors are only for MC + top::check(setupScaleFactors(), "Failed to setup Muon scale-factor tools"); + } + return StatusCode::SUCCESS; +} + +StatusCode MuonCPTools::setupCalibration() { + ///-- Calibration and smearing --/// + using IMuCalibSmearTool = CP::IMuonCalibrationAndSmearingTool; + const std::string mu_calib_smearing_name = "CP::MuonCalibrationAndSmearingTool"; + if (asg::ToolStore::contains<IMuCalibSmearTool>(mu_calib_smearing_name)) { + m_muonCalibrationAndSmearingTool + = asg::ToolStore::get<IMuCalibSmearTool>(mu_calib_smearing_name); + } else { + IMuCalibSmearTool* muonCalibrationAndSmearingTool + = new CP::MuonCalibrationAndSmearingTool(mu_calib_smearing_name); + top::check(muonCalibrationAndSmearingTool->initialize(), + "Failed to initialize " + mu_calib_smearing_name); + m_muonCalibrationAndSmearingTool = muonCalibrationAndSmearingTool; + } + + ///-- Selection --/// + m_muonSelectionTool = setupMuonSelectionTool("CP::MuonSelectionTool", + m_config->muonQuality(), + m_config->muonEtacut()); + m_muonSelectionToolLoose = setupMuonSelectionTool("CP::MuonSelectionToolLoose", + m_config->muonQualityLoose(), + m_config->muonEtacut()); + // the following is needed to make sure all muons for which d0sig is calculated are at least Loose + m_muonSelectionToolVeryLooseVeto = setupMuonSelectionTool("CP::MuonSelectionToolVeryLooseVeto", + "Loose", + 2.5); + return StatusCode::SUCCESS; +} + +StatusCode MuonCPTools::setupScaleFactors() { + // Setup muon SF tools + // However if we are running on data- we don't need these, + // so carry on. + if (!m_config->isMC()) + return StatusCode::SUCCESS; + /************************************************************ + * + * Muon Scale Factors: + * muonSF = trigSF*effSF*isoSF*TTVASF + * + ************************************************************/ + + // Muon SF tools now require you to have setup an instance of + // the pileup reweighting tool! + // If we haven't set it up then tell the user this and exit. + if (!m_config->doPileupReweighting()) { + ATH_MSG_ERROR("\nThe Muon SF tools now require that you have" + " previously setup an instance of " + "the pileup reweighting tool.\n\n" + "To do this set the options:\n\n\t" + "PRWLumiCalcFiles\n and \n\tPRWConfigFiles \n\n" + "in your config file."); + return StatusCode::FAILURE; + } + + /************************************************************ + * Trigger Scale Factors: + * setup trigger SFs for nominal and 'loose' muon WPs + * recommendation for EOYE not to pass any isolation to tool + * as SFs very similar for all WPs. + ************************************************************/ + + m_muonTriggerScaleFactors_2015 + = setupMuonTrigSFTool("CP::MuonTriggerScaleFactors_2015", + m_config->muonQuality(), "2015"); + m_muonTriggerScaleFactorsLoose_2015 + = setupMuonTrigSFTool("CP::MuonTriggerScaleFactorsLoose_2015", + m_config->muonQualityLoose(), "2015"); + m_muonTriggerScaleFactors_2016 + = setupMuonTrigSFTool("CP::MuonTriggerScaleFactors_2016", + m_config->muonQuality(), "2016"); + m_muonTriggerScaleFactorsLoose_2016 + = setupMuonTrigSFTool("CP::MuonTriggerScaleFactorsLoose_2016", + m_config->muonQualityLoose(), "2016"); + + + /************************************************************ + * Efficiency Scale Factors: + * setup muon efficiency SFs for the nominal and + * 'loose' muon WPs. + ************************************************************/ + m_muonEfficiencyCorrectionsTool + = setupMuonSFTool("CP::MuonEfficiencyScaleFactorsTool", + m_config->muonQuality()); + + m_muonEfficiencyCorrectionsToolLoose + = setupMuonSFTool("CP::MuonEfficiencyScaleFactorsToolLoose", + m_config->muonQualityLoose()); + + /************************************************************ + * Isolation Scale Factors: + * setup muon isolation SFs for the nominal and 'loose' + * muons + * + * Note: if isolation WP is None, then don't setup the tool + ************************************************************/ + // If we don't want isolation then we don't need the tool + if (m_config->muonIsolation() != "None") { + // Add iso as a suffix (see above for consistency between tools :) ) + std::string muon_isolation = m_config->muonIsolation(); + muon_isolation += "Iso"; + m_muonEfficiencyCorrectionsToolIso + = setupMuonSFTool("CP::MuonEfficiencyScaleFactorsToolIso", + muon_isolation); + } + + // Do we have isolation on our loose muons? If not no need for the tool... + if (m_config->muonIsolationLoose() != "None") { + // Add iso as a suffix (see above for consistency between tools :) ) + // Note: now loose isolation + std::string muon_isolation = m_config->muonIsolationLoose(); + muon_isolation += "Iso"; + m_muonEfficiencyCorrectionsToolLooseIso = + setupMuonSFTool("CP::MuonEfficiencyScaleFactorsToolLooseIso", + muon_isolation); + } + + /************************************************************ + * Muon TTVA SF: + * Track-to-vertex association. This depends on whether or + * not we apply the tracking groups recommended impact + * parameter cuts to associate muon to vertex. + ************************************************************/ + m_muonEfficiencyCorrectionsToolTTVA + = setupMuonSFTool("CP::MuonEfficiencyScaleFactorsToolTTVA", + "TTVA"); + + return StatusCode::SUCCESS; +} + +CP::IMuonSelectionTool* +MuonCPTools::setupMuonSelectionTool(const std::string& name, const std::string& quality, double max_eta) { + std::map<std::string, int> muon_quality_map = { + {"Tight" , 0}, {"Medium", 1}, {"Loose", 2}, {"VeryLoose", 3}}; + int qual_int; + try { + qual_int = muon_quality_map.at(quality); + } catch (const std::out_of_range& oor_exc) { + ATH_MSG_ERROR("\n Invalid muon quality (" + + quality + ") for " + name + + ". Valid options are: " + " \n\t- Tight" + " \n\t- Medium" + " \n\t- Loose" + " \n\t- VeryLoose"); + throw; // Re-throw + } + + CP::IMuonSelectionTool* tool = nullptr; + if (asg::ToolStore::contains<CP::IMuonSelectionTool>(name)) { + tool = asg::ToolStore::get<CP::IMuonSelectionTool>(name); + } else { + tool = new CP::MuonSelectionTool(name); + top::check(asg::setProperty(tool, "MuQuality", qual_int), + "Failed to set MuQuality for " + name); + top::check(asg::setProperty(tool, "MaxEta", max_eta), + "Failed to set MaxEta for " + name); + top::check(tool->initialize(), "Failed to initialize " + name); + } + return tool; +} + + +CP::IMuonTriggerScaleFactors* +MuonCPTools::setupMuonTrigSFTool(const std::string& name, const std::string& quality, const std::string& year) { + CP::IMuonTriggerScaleFactors* tool = nullptr; + if (asg::ToolStore::contains<CP::IMuonTriggerScaleFactors>(name)) { + tool = asg::ToolStore::get<CP::IMuonTriggerScaleFactors>(name); + } else { + tool = new CP::MuonTriggerScaleFactors(name); + top::check(asg::setProperty(tool, "MuonQuality", quality), + "Failed to set MuonQuality for " + name); + top::check(asg::setProperty(tool, "Year", year), + "Failed to set Year for " + name); + std::string MC_version = "mc15c"; + top::check(asg::setProperty(tool, "MC", MC_version), + "Failed to set MC for " + name); + top::check(tool->initialize(), "Failed to init. " + name); + } + return tool; +} + + +CP::IMuonEfficiencyScaleFactors* +MuonCPTools::setupMuonSFTool(const std::string& name, const std::string& WP) { + CP::IMuonEfficiencyScaleFactors* tool = nullptr; + if (asg::ToolStore::contains<CP::IMuonEfficiencyScaleFactors>(name)) { + tool = asg::ToolStore::get<CP::MuonEfficiencyScaleFactors>(name); + } else { + tool = new CP::MuonEfficiencyScaleFactors(name); + top::check(asg::setProperty(tool, "WorkingPoint", WP), + "Failed to set WP for " + name + " tool"); + top::check(tool->initialize(), + "Failed to set initialize " + name); + } + return tool; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOtherCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOtherCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f90263bece1f467080d5a7ebb710fde72cd4a441 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOtherCPTools.cxx @@ -0,0 +1,147 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopOtherCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// GRL include(s): +#include "GoodRunsLists/GoodRunsListSelectionTool.h" + +// Pileup Reweighting include(s): +#include "PileupReweighting/PileupReweightingTool.h" + +namespace top { + +OtherCPTools::OtherCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "GRLTool" , m_grlTool ); +} + +StatusCode OtherCPTools::initialize() { + ATH_MSG_INFO("top::OtherCPTools initialize..."); + + if (!m_config->isMC() || m_config->PileupUseGRLTool()) + top::check(setupGRL(), "Failed to setup GRL tool"); + + if (m_config->doPileupReweighting()) + top::check(setupPileupReweighting(), "Failed to setup pile-up reweighting"); + + if (m_config->isMC()) + top::check(setupPMGTools(), "Failed to setup PMG tools"); + + return StatusCode::SUCCESS; +} + +StatusCode OtherCPTools::setupGRL() { + using IGRLTool = IGoodRunsListSelectionTool; + const std::string grl_tool_name = "GoodRunsListSelectionTool"; + if (asg::ToolStore::contains<IGRLTool>(grl_tool_name)) { + m_grlTool = asg::ToolStore::get<IGRLTool>(grl_tool_name); + } else { + if (!m_config->grlFile().size()) { + // do not configure GRL tool + std::cout << "No GRL files provided. " + "Will NOT setup GoodRunsListSelectionTool." << std::endl; + return StatusCode::SUCCESS; + } + + IGRLTool* grlTool = new GoodRunsListSelectionTool(grl_tool_name); + std::vector<std::string> names = {}; + std::string grlDir = m_config->grlDir(); + if (grlDir.size()) grlDir += "/"; + for (const std::string& grl : m_config->grlFile()) { + names.push_back(PathResolverFindCalibFile(grlDir + grl)); + } + + top::check(asg::setProperty(grlTool, "GoodRunsListVec", names), + "GRLSelector failed to set GRL"); + top::check( grlTool->initialize() , + "Failed to initialize GRLSelectionTool" ); + m_grlTool = grlTool; + } + return StatusCode::SUCCESS; +} + +StatusCode OtherCPTools::setupPileupReweighting() { + const std::string prw_tool_name = "CP::PileupReweightingTool"; + if (asg::ToolStore::contains<CP::IPileupReweightingTool>(prw_tool_name)) { + m_pileupReweightingTool = asg::ToolStore::get<CP::IPileupReweightingTool>(prw_tool_name); + } else { + CP::IPileupReweightingTool* pileupReweightingTool + = new CP::PileupReweightingTool(prw_tool_name); + + std::vector<std::string> pileup_config = m_config->PileupConfig(); + for (std::string& s : pileup_config) + s = PathResolverFindCalibFile(s); + + // now using by default the nominal mc15c definition - the config file is appended to the list provided by the user + ATH_MSG_INFO("Now appending the default pile-up profile mc15c_v2_defaults.NotRecommended.prw.root to list of PRW config files."); + ATH_MSG_INFO("This is required because we can't provide a default channel number anymore."); + pileup_config.push_back(PathResolverFindCalibFile("dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root")); + + std::vector<std::string> pileup_lumi_calc = m_config->PileupLumiCalc(); + for (std::string& s : pileup_lumi_calc) + s = PathResolverFindCalibFile(s); + + if (m_config->PileupUseGRLTool()) + top::check(asg::setProperty(pileupReweightingTool, "GRLTool", m_grlTool), + "Failed to give GRLtool to pileup reweighting tool"); + + // Config file is not needed on Data + // see "Just random run numbers and lumi corrections" + // case in twiki page below + // However, the tool would spit out warnings for Data if we didn't supply ConfigFiles. + top::check(asg::setProperty(pileupReweightingTool, "ConfigFiles", pileup_config), + "Failed to set pileup reweighting config files"); + + top::check(asg::setProperty(pileupReweightingTool, "LumiCalcFiles", pileup_lumi_calc), + "Failed to set pileup reweighting lumicalc files"); + // see [http://cern.ch/go/hx7d] + top::check(asg::setProperty(pileupReweightingTool, "DataScaleFactor", 1/1.09), + "Failed to set pileup reweighting data scale factor"); + top::check(asg::setProperty(pileupReweightingTool, "DataScaleFactorUP", 1.0), + "Failed to set pileup reweighting data scale factor up"); + top::check(asg::setProperty(pileupReweightingTool, "DataScaleFactorDOWN", 1/1.18), + "Failed to set pileup reweighting data scale factor down"); + top::check(pileupReweightingTool->initialize(), + "Failed to initialize pileup reweighting tool"); + + m_pileupReweightingTool = pileupReweightingTool; + } + return StatusCode::SUCCESS; +} + + +StatusCode OtherCPTools::setupPMGTools() { + // Setup any PMG tools + // Currently only a single tool for reweighting + // Sherpa 2.2 V+jets samples based on the number of truth jets + const std::string name = "PMGSherpa22VJetsWeightTool"; + PMGTools::PMGSherpa22VJetsWeightTool* tool = nullptr; + if (asg::ToolStore::contains<PMGTools::PMGSherpa22VJetsWeightTool>(name)) { + tool = asg::ToolStore::get<PMGTools::PMGSherpa22VJetsWeightTool>(name); + } else { + tool = new PMGTools::PMGSherpa22VJetsWeightTool(name); + top::check(asg::setProperty(tool, "TruthJetContainer", + m_config->sgKeyTruthJets()), + "Failed to set TruthJetContainer to " + name); + top::check(tool->initialize(), "Failed to initialize " + name); + } + m_pmg_sherpa22_vjets_tool = tool; + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOverlapRemovalCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOverlapRemovalCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..706e8b9021d4240adffd8d25a6eed42388b4ee3c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopOverlapRemovalCPTools.cxx @@ -0,0 +1,187 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopOverlapRemovalCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Overlap removal includes: +#include "AssociationUtils/OverlapRemovalInit.h" +#include "AssociationUtils/OverlapRemovalTool.h" + +namespace top { + +OverlapRemovalCPTools::OverlapRemovalCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); +} + +StatusCode OverlapRemovalCPTools::initialize() { + ATH_MSG_INFO("top::OverlapRemovalCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::OverlapRemovalCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->makeAllCPTools()) { + ATH_MSG_INFO("top::OverlapRemovalCPTools: no need to initialise for mini-xAOD"); + return StatusCode::SUCCESS; + } + + top::check(setupOverlapRemoval(), "Failed to setup Overlap Removal"); + return StatusCode::SUCCESS; +} + +StatusCode OverlapRemovalCPTools::setupOverlapRemoval() { + // Allowed overlap removal options + std::set<std::string> allowed_OR_procedures = {"recommended", "jetmuApplyRelPt", "harmonized", + "Boosted", "BoostedSlidingDREl", "BoostedSlidingDRMu", "BoostedSlidingDRElMu", "noTauJetOLR"}; + std::string OR_procedure = m_config->overlapRemovalProcedure(); + + // If the requested OR procedure is unknown then fail. + // This is mostly to avoid me writing 'harmonised' by mistake ;) + if (allowed_OR_procedures.find(OR_procedure) + == allowed_OR_procedures.end()) { + ATH_MSG_ERROR(OR_procedure << " is not a valid option.\n" + "Valid options are currently: " + "recommended [default], jetmuApplyRelPt, harmonized, " + "Boosted, BoostedSlidingDREl, BoostedSlidingDRMu, BoostedSlidingDRElMu, noTauJetOLR"); + return StatusCode::FAILURE; + } + + ATH_MSG_INFO("Overlap removal procedure = " << OR_procedure); + +// ORUtils::ORFlags OR_flags("OverlapRemovalTool", +// "passPreORSelection"); + ORUtils::ORFlags OR_flags("OverlapRemovalTool", + "ORToolDecoration"); + + OR_flags.doElectrons = m_config->useElectrons(); + OR_flags.doMuons = m_config->useMuons(); + OR_flags.doJets = m_config->useJets(); + OR_flags.doTaus = m_config->useTaus(); + OR_flags.doPhotons = m_config->usePhotons(); + if (OR_procedure == "Boosted" || + OR_procedure == "BoostedSlidingDREl" || + OR_procedure == "BoostedSlidingDRMu" || + OR_procedure == "BoostedSlidingDRElMu") { + OR_flags.boostedLeptons = true; + } + OR_flags.doFatJets = (m_config->useLargeRJets() && m_config->doLargeJetOverlapRemoval()); + + const float floatMax = std::numeric_limits<float>::max(); + + top::check(ORUtils::recommendedTools(OR_flags, m_ORtoolBox), + "Failed to setup OR Tool box"); + if (OR_procedure == "harmonized") { + if (m_config->useMuons() && m_config->useElectrons()) + top::check(m_ORtoolBox.eleMuORT.setProperty("RemoveCaloMuons", false), + "Failed to set RemoveCaloMuons in eleMuORT"); + if (m_config->useMuons() && m_config->useJets()) { + top::check(m_ORtoolBox.muJetORT.setProperty("MuJetPtRatio", floatMax), + "Failed to set MuJetPtRatio in muJetORT"); + top::check(m_ORtoolBox.muJetORT.setProperty("MuJetTrkPtRatio", floatMax), + "Failed to set MuJetTrkPtRatio in muJetORT"); + top::check(m_ORtoolBox.muJetORT.setProperty("UseGhostAssociation", false), + "Failed to set UseGhostAssociation in muJetORT"); + top::check(m_ORtoolBox.muJetORT.setProperty("InnerDR", 0.4), + "Failed to set InnerDR in muJetORT"); + } + } + else if (OR_procedure == "jetmuApplyRelPt") { + top::check(m_ORtoolBox.muJetORT.setProperty("ApplyRelPt", true), + "Failed to set ApplyRelPt in muJetORT"); + } + else if ( OR_procedure == "BoostedSlidingDREl" || + OR_procedure == "BoostedSlidingDRMu" || + OR_procedure == "BoostedSlidingDRElMu") { + if ( m_config->useElectrons() && m_config->useJets() && + (OR_procedure == "BoostedSlidingDREl" || OR_procedure == "BoostedSlidingDRElMu") ) { + top::check(m_ORtoolBox.eleJetORT.setProperty("UseSlidingDR", true), + "Failed to setSliding DR in ElJetORT"); + top::check(m_ORtoolBox.eleJetORT.setProperty("InnerDR", 0.0), + "Failed to setting inner radius equal to 0.0 in EleJetORT"); + } + if ( m_config->useMuons() && m_config->useJets() && + (OR_procedure == "BoostedSlidingDRMu" || OR_procedure == "BoostedSlidingDRElMu") ) { + top::check(m_ORtoolBox.muJetORT.setProperty("UseSlidingDR", true), + "Failed to setSliding DR in MuJetORT"); + top::check(m_ORtoolBox.muJetORT.setProperty("InnerDR", 0.0), + "Failed to setting inner radius equal to 0.0 in MuJetORT"); + } + } + else if( OR_procedure == "noTauJetOLR"){ + top::check(m_ORtoolBox.tauJetORT.setProperty("DR", 0.0), + "Failed to set DR in TauJetORT to zero"); + } + top::check(m_ORtoolBox.initialize(), + "Failed to initialize overlap removal tools"); + m_overlapRemovalTool = std::move(m_ORtoolBox.masterTool); + + OR_flags.masterName = "OverlapRemovalToolLoose"; +// OR_flags.inputLabel = "passPreORSelectionLoose"; + OR_flags.inputLabel = "ORToolDecorationLoose"; + + top::check(ORUtils::recommendedTools(OR_flags, m_ORtoolBox_Loose), + "Failed to setup OR Tool box"); + if (OR_procedure == "harmonized") { + if (m_config->useMuons() && m_config->useElectrons()) + top::check(m_ORtoolBox_Loose.eleMuORT.setProperty("RemoveCaloMuons", + false), + "Failed to set RemoveCaloMuons in eleMuORT"); + if (m_config->useMuons() && m_config->useJets()) { + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("MuJetPtRatio", floatMax), + "Failed to set MuJetPtRatio in muJetORT"); + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("MuJetTrkPtRatio", floatMax), + "Failed to set MuJetTrkPtRatio in muJetORT"); + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("UseGhostAssociation", false), + "Failed to set UseGhostAssociation in muJetORT"); + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("InnerDR", 0.4), + "Failed to set InnerDR in muJetORT"); + } + } + else if (OR_procedure == "jetmuApplyRelPt") { + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("ApplyRelPt", false), + "Failed to set ApplyRelPt in muJetORT"); + } + else if ( OR_procedure == "BoostedSlidingDREl" || + OR_procedure == "BoostedSlidingDRMu" || + OR_procedure == "BoostedSlidingDRElMu") { + if ( m_config->useElectrons() && m_config->useJets() && + (OR_procedure == "BoostedSlidingDREl" || OR_procedure == "BoostedSlidingDRElMu") ) { + top::check(m_ORtoolBox_Loose.eleJetORT.setProperty("UseSlidingDR", true), + "Failed to setSliding DR in ElJetORT"); + top::check(m_ORtoolBox_Loose.eleJetORT.setProperty("InnerDR", 0.0), + "Failed to setting inner radius equal to 0.0 in EleJetORT"); + } + if ( m_config->useMuons() && m_config->useJets() && + (OR_procedure == "BoostedSlidingDRMu" || OR_procedure == "BoostedSlidingDRElMu") ) { + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("UseSlidingDR", true), + "Failed to setSliding DR in MuJetORT"); + top::check(m_ORtoolBox_Loose.muJetORT.setProperty("InnerDR", 0.0), + "Failed to setting inner radius equal to 0.0 in MuJetORT"); + } + } + else if( OR_procedure == "noTauJetOLR"){ + top::check(m_ORtoolBox_Loose.tauJetORT.setProperty("DR", 0.0), + "Failed to set DR in TauJetORT to zero"); + } + top::check(m_ORtoolBox_Loose.initialize(), + "Failed to initialize loose overlap removal tools"); + m_overlapRemovalTool_Loose = std::move(m_ORtoolBox_Loose.masterTool); + + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTauCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTauCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..250e78f39100483e975283f7379e97f3089dcaf9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTauCPTools.cxx @@ -0,0 +1,301 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopTauCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Tau include(s): +#include "TauAnalysisTools/TauSelectionTool.h" +#include "TauAnalysisTools/TauSmearingTool.h" +#include "TauAnalysisTools/TauEfficiencyCorrectionsTool.h" +#include "TauAnalysisTools/TauTruthMatchingTool.h" +#include "TauAnalysisTools/Enums.h" + +namespace top { + +TauCPTools::TauCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "TauSmearingTool" , m_tauSmearingTool ); +} + +StatusCode TauCPTools::initialize() { + ATH_MSG_INFO("top::TauCPTools initialize..."); + + if (m_config->isTruthDxAOD()) { + ATH_MSG_INFO("top::TauCPTools: no need to initialise anything on truth DxAOD"); + return StatusCode::SUCCESS; + } + + if (!m_config->useTaus()) { + ATH_MSG_INFO("top::TauCPTools: no need to initialise anything since not using taus"); + return StatusCode::SUCCESS; + } + + if (m_config->makeAllCPTools()) {// skiping calibrations on mini-xAODs + top::check(setupCalibration(), "Failed to setup Tau calibration tools"); + } + if (m_config->isMC()) {// scale-factors are only for MC + top::check(setupScaleFactors(), "Failed to setup Tau scale-factor tools"); + } + return StatusCode::SUCCESS; +} + +StatusCode TauCPTools::setupCalibration() { + /************************************************************ + * + * Setup the tools needed for Tau Analysis + * ---------------------------------------- + * + * TauSelectionTool: + * to select taus + * TauEfficiencyCorrectionTool: + * to apply efficiency corrections + * (this is setup with the selection tool) + * TauSmearingTool: + * to calibrate and smear taus + * + ************************************************************/ + + //============================================================ + // Convert tau jet IDWP string to int + // see: [http://cern.ch/go/z6cq] + // Updated: using enums from TauAnalysisTools package + //============================================================ + + auto tau_JetIDWP_to_enum = [](const std::string& s) { + if (s == "None") return TauAnalysisTools::JETIDNONE; + if (s == "Loose") return TauAnalysisTools::JETIDBDTLOOSE; + if (s == "Medium") return TauAnalysisTools::JETIDBDTMEDIUM; + if (s == "Tight") return TauAnalysisTools::JETIDBDTTIGHT; + if (s == "LooseNotMedium") return TauAnalysisTools::JETIDBDTLOOSENOTMEDIUM; + if (s == "LooseNotTight") return TauAnalysisTools::JETIDBDTLOOSENOTTIGHT; + if (s == "MediumNotTight") return TauAnalysisTools::JETIDBDTMEDIUMNOTTIGHT; + if (s == "NotLoose") return TauAnalysisTools::JETIDBDTNOTLOOSE; + + // If we haven't found the correct WP, then return -1 + return TauAnalysisTools::JETIDNONEUNCONFIGURED; + }; + + // convert taujetIDWP from string to int and check it's valid + int tauJetIDWP = tau_JetIDWP_to_enum(m_config->tauJetIDWP()); + top::check(tauJetIDWP >= 0, m_config->tauJetIDWP() + " is not a valid tau WP"); + + // convert taujetIDWPLoose from string to int and check it's valid + int tauJetIDWPLoose = tau_JetIDWP_to_enum(m_config->tauJetIDWPLoose()); + top::check(tauJetIDWPLoose >= 0, m_config->tauJetIDWPLoose() + " is not a valid tau WP"); + + auto tau_EleBDTWP_to_enum = [](const std::string& s) { + if (s == "None") return TauAnalysisTools::ELEIDNONE; + if (s == "Loose") return TauAnalysisTools::ELEIDBDTLOOSE; + if (s == "Medium") return TauAnalysisTools::ELEIDBDTMEDIUM; + if (s == "Tight") return TauAnalysisTools::ELEIDBDTTIGHT; + + // If we haven't found the correct WP, then return -1 + return TauAnalysisTools::ELEIDNONEUNCONFIGURED; + }; + + // convert tauEleBDTWP from string to int and check it's valid + int tauEleBDTWP = tau_EleBDTWP_to_enum(m_config->tauEleBDTWP()); + top::check(tauEleBDTWP >= 0, m_config->tauEleBDTWP() + " is not a valid tau WP"); + + // convert tauEleBDTWPLoose from string to int and check it's valid + int tauEleBDTWPLoose = tau_EleBDTWP_to_enum(m_config->tauEleBDTWPLoose()); + top::check(tauEleBDTWPLoose >= 0, m_config->tauEleBDTWPLoose() + " is not a valid tau WP"); + + const std::vector<float> absEtaRegion = {0., 1.37, 1.37, 1.52, 1.52, 2.5}; + const double absCharge = 1.; + const std::vector<size_t> nTracks = {1,3}; + + //============================================================ + // PathResolve tau config files. If set to default then + // set to empty string. + //============================================================ + + std::string tauJetConfigFile = m_config->tauJetConfigFile(); + if (tauJetConfigFile != "Default") + tauJetConfigFile = PathResolverFindCalibFile(tauJetConfigFile); + else + tauJetConfigFile.clear(); + std::string tauJetConfigFileLoose = m_config->tauJetConfigFileLoose(); + if (tauJetConfigFileLoose != "Default") + tauJetConfigFileLoose = PathResolverFindCalibFile(tauJetConfigFileLoose); + else + tauJetConfigFileLoose.clear(); + + // bitmap in case not using the config files + //WARNING: if we add more configurable cuts, they need to be added in this list + // a priori we alway apply these cuts below + int iSelectionCuts = 0; + iSelectionCuts |= TauAnalysisTools::CutPt; + iSelectionCuts |= TauAnalysisTools::CutAbsEta; + iSelectionCuts |= TauAnalysisTools::CutAbsCharge; + iSelectionCuts |= TauAnalysisTools::CutNTrack; + iSelectionCuts |= TauAnalysisTools::CutJetIDWP; + iSelectionCuts |= TauAnalysisTools::CutEleBDTWP; + + //WARNING the CutEleOLR is special, and has to be added only in the map if needed + int iSelectionCutsLoose = iSelectionCuts; + if (m_config->tauEleOLR()) iSelectionCuts |= TauAnalysisTools::CutEleOLR; + if (m_config->tauEleOLRLoose()) iSelectionCutsLoose |= TauAnalysisTools::CutEleOLR; + + //============================================================ + // Nominal Tau Selection + //============================================================ + + + // Alias long tool names + using ITauSelTool = TauAnalysisTools::ITauSelectionTool; + using ITauEffCorrTool = TauAnalysisTools::ITauEfficiencyCorrectionsTool; + // Names of tools here for a little clarity + std::string tauSelName = "TauAnalysisTools::TauSelectionTool"; + std::string tauEffCorrName = "TauAnalysisTools::TauEfficiencyCorrectionsTool"; + + ///-- Setup the tau selection tool --/// + if (asg::ToolStore::contains<ITauSelTool>(tauSelName)) { + m_tauSelectionTool = asg::ToolStore::get<ITauSelTool>(tauSelName); + } else { + ITauSelTool* tauSelectionTool = new TauAnalysisTools::TauSelectionTool(tauSelName); + if (!tauJetConfigFile.empty()) { + top::check(asg::setProperty(tauSelectionTool, "ConfigPath",tauJetConfigFile), + "Failed to set tau selection tool configuration path"); + top::check(asg::setProperty(tauSelectionTool, "OutputLevel", MSG::DEBUG), + "Failed to set tau OutputLevel"); + } else { + // set the ConfigPath to empty value is no file was provided (otherwise it creates conflicts) + top::check(asg::setProperty(tauSelectionTool, "ConfigPath", ""), + "Failed to set tau selection tool configuration path"); + top::check(asg::setProperty(tauSelectionTool, "OutputLevel", MSG::DEBUG), + "Failed to set tau OutputLevel"); + //WARNING: if we add more configurable cuts, they need to be added in the iSelectionCuts (see above) + top::check(asg::setProperty(tauSelectionTool, "SelectionCuts", iSelectionCuts), + "Failed to set tau SelectionCuts"); + top::check(asg::setProperty(tauSelectionTool, "PtMin", static_cast<double>(m_config->tauPtcut()/1e3)), + "Failed to set tau pT cut"); + top::check(asg::setProperty(tauSelectionTool, "AbsEtaRegion", absEtaRegion), + "Failed to set tau AbsEtaRegion"); + top::check(asg::setProperty(tauSelectionTool, "AbsCharge", absCharge), + "Failed to set tau AbsCharge"); + top::check(asg::setProperty(tauSelectionTool, "NTracks", nTracks), + "Failed to set tau NTracks"); + top::check(asg::setProperty(tauSelectionTool, "JetIDWP", tauJetIDWP), + "Failed to set tau JetIDWP"); + top::check(asg::setProperty(tauSelectionTool, "EleBDTWP", tauEleBDTWP), + "Failed to set tau EleBDTWP"); + top::check(asg::setProperty(tauSelectionTool, "EleOLR", m_config->tauEleOLR()), + "Failed to set tau-electron overlap removal in tau selection tool"); + } + top::check(tauSelectionTool->initialize(), "Failed to initialize tauSelectionTool"); + m_tauSelectionTool = tauSelectionTool; + + ///-- Setup the EfficiencyCorrectionsTool while seting up the selection tool --/// + if (asg::ToolStore::contains<ITauEffCorrTool>(tauEffCorrName)) { + m_tauEffCorrTool = asg::ToolStore::get<ITauEffCorrTool>(tauEffCorrName); + } else { + ITauEffCorrTool* tauEffCorrTool + = new TauAnalysisTools::TauEfficiencyCorrectionsTool(tauEffCorrName); + top::check(asg::setProperty(tauEffCorrTool, "TauSelectionTool", m_tauSelectionTool), + "Failed to set TauSelectionTool for " + tauEffCorrName); + top::check(tauEffCorrTool->initialize() , "Failed to initialize"); + m_tauEffCorrTool = tauEffCorrTool; + } + } + + //============================================================ + // 'Loose' Tau Selection + //============================================================ + + ///-- Names of tools here for a little clarity --/// + std::string tauSelNameLoose = "TauAnalysisTools::TauSelectionToolLoose"; + std::string tauEffCorrNameLoose = "TauAnalysisTools::TauEfficiencyCorrectionsToolLoose"; + + ///-- Setup the tau selection tool --/// + if (asg::ToolStore::contains<ITauSelTool>(tauSelNameLoose)) { + m_tauSelectionToolLoose = asg::ToolStore::get<ITauSelTool>(tauSelNameLoose); + } else { + ITauSelTool* tauSelectionTool = new TauAnalysisTools::TauSelectionTool(tauSelNameLoose); + if (!tauJetConfigFileLoose.empty()) { + top::check(asg::setProperty(tauSelectionTool, "ConfigPath",tauJetConfigFileLoose), + "Failed to set tau selection tool configuration path"); + top::check(asg::setProperty(tauSelectionTool, "OutputLevel", MSG::DEBUG), + "Failed to set tau OutputLevel"); + } else { + // set the ConfigPath to empty value is no file was provided (otherwise it creates conflicts) + top::check(asg::setProperty(tauSelectionTool, "ConfigPath", ""), + "Failed to set tau selection tool configuration path"); + top::check(asg::setProperty(tauSelectionTool, "OutputLevel", MSG::DEBUG), + "Failed to set tau OutputLevel"); + //WARNING: if we add more configurable cuts, they need to be added in the iSelectionCuts (see above) + top::check(asg::setProperty(tauSelectionTool, "SelectionCuts", iSelectionCutsLoose), + "Failed to set tau SelectionCuts"); + top::check(asg::setProperty(tauSelectionTool, "PtMin", static_cast<double>(m_config->tauPtcut()/1e3)), + "Failed to set tau pT cut"); + top::check(asg::setProperty(tauSelectionTool, "AbsEtaRegion", absEtaRegion), + "Failed to set loose tau AbsEtaRegion"); + top::check(asg::setProperty(tauSelectionTool, "AbsCharge", absCharge), + "Failed to set loose tau AbsCharge"); + top::check(asg::setProperty(tauSelectionTool, "NTracks", nTracks), + "Failed to set loose tau NTracks"); + top::check(asg::setProperty(tauSelectionTool, "JetIDWP", tauJetIDWPLoose), + "Failed to set loose tau JetIDWP"); + top::check(asg::setProperty(tauSelectionTool, "EleBDTWP", tauEleBDTWPLoose), + "Failed to set loose tau EleBDTWP"); + top::check(asg::setProperty(tauSelectionTool, "EleOLR", m_config->tauEleOLRLoose()), + "Failed to set tau-electron overlap removal in loose tau selection tool"); + } + top::check(tauSelectionTool->initialize(), "Failed to initialize tauSelectionTool"); + m_tauSelectionToolLoose = tauSelectionTool; + + ///-- Setup the EfficiencyCorrectionsTool while seting up the selection tool --/// + if (asg::ToolStore::contains<ITauEffCorrTool>(tauEffCorrNameLoose)) { + m_tauEffCorrTool = asg::ToolStore::get<ITauEffCorrTool>(tauEffCorrNameLoose); + } else { + ITauEffCorrTool* tauEffCorrTool + = new TauAnalysisTools::TauEfficiencyCorrectionsTool(tauEffCorrNameLoose); + top::check(asg::setProperty(tauEffCorrTool, "TauSelectionTool", m_tauSelectionToolLoose), + "Failed to set TauSelectionTool for " + tauEffCorrNameLoose); + top::check(tauEffCorrTool->initialize() , "Failed to initialize"); + m_tauEffCorrToolLoose = tauEffCorrTool; + } + } + + ///-- Calibration and smearing --/// + std::string tauSmearName = "TauAnalysisTools::TauSmearingTool"; + if (asg::ToolStore::contains<TauAnalysisTools::ITauSmearingTool>(tauSmearName)) { + m_tauSmearingTool = asg::ToolStore::get<TauAnalysisTools::ITauSmearingTool>(tauSmearName); + } else { + TauAnalysisTools::TauSmearingTool* tauSmearingTool = new TauAnalysisTools::TauSmearingTool(tauSmearName); + if (m_config->applyTauMVATES()) { + top::check(tauSmearingTool->setProperty("ApplyMVATES", true) , "Failed to enable MVA TES for tau smearing tool"); + } + top::check(tauSmearingTool->initialize() , "Failed to initialize"); + m_tauSmearingTool = tauSmearingTool; + } + + return StatusCode::SUCCESS; +} + +StatusCode TauCPTools::setupScaleFactors() { + /** + * + * Fill this in at some point... + * + * ...or maybe we don't need to + * + **/ + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopToolStore.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopToolStore.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e3033990983b5e7f1361aa4c50ae8023d0518c04 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopToolStore.cxx @@ -0,0 +1,142 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopToolStore.cxx 803886 2017-04-27 21:27:58Z iconnell $ +#include "TopCPTools/TopToolStore.h" + +#include <vector> +#include <string> +#include <limits> +#include <set> +#include <map> +#include <cstdlib> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +namespace top { + +TopToolStore::TopToolStore( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr) { + declareProperty( "config" , m_config ); +} + +StatusCode TopToolStore::initialize() { + ATH_MSG_INFO("top::TopToolStore initialize..."); + + std::string release_series = ""; + const char* rel_temp = std::getenv("ROOTCORE_RELEASE_SERIES"); + if (rel_temp) { + release_series = std::string(rel_temp); + } else { + ATH_MSG_WARNING("Can not access ROOTCORE_RELEASE_SERIES"); + } + + ATH_MSG_INFO( "Release variable : "+release_series ); + + if (release_series == "23") { + ATH_MSG_INFO("Setting release series to 2.3"); + m_release_series = 23; + } else if (release_series == "24") { + m_release_series = 24; + ATH_MSG_INFO("Setting release series to 2.4"); + } else if (release_series == "25" ){ + m_release_series = 25; + ATH_MSG_INFO("Setting release series to 2.6"); + } else { + m_release_series = 24; + ATH_MSG_WARNING("Unknown release series, assuming 2.4"); + } + + m_trigger_CP_tools = std::make_unique<top::TriggerCPTools>("top::TriggerCPTools"); + top::check(m_trigger_CP_tools->setProperty("config", m_config), + "Failed to share config with trigger CP tools"); + top::check(m_trigger_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with trigger CP tools"); + top::check(m_trigger_CP_tools->initialize(), + "Failed to initialize trigger tools"); + + m_other_CP_tools = std::make_unique<top::OtherCPTools>("top::OtherCPTools"); + top::check(m_other_CP_tools->setProperty("config", m_config), + "Failed to share config with other CP tools"); + top::check(m_other_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with other CP tools"); + top::check(m_other_CP_tools->initialize(), + "Failed to initialize other tools"); + + m_egamma_CP_tools = std::make_unique<top::EgammaCPTools>("top::EgammaCPTools"); + top::check(m_egamma_CP_tools->setProperty("config", m_config), + "Failed to share config with egamma CP tools"); + top::check(m_egamma_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with egamma CP tools"); + top::check(m_egamma_CP_tools->initialize(), + "Failed to initialize egamma tools"); + + m_muon_CP_tools = std::make_unique<top::MuonCPTools>("top::MuonCPTools"); + top::check(m_muon_CP_tools->setProperty("config", m_config), + "Failed to share config with muon CP tools"); + top::check(m_muon_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with muon CP tools"); + top::check(m_muon_CP_tools->initialize(), + "Failed to initialize muon tools"); + + m_tau_CP_tools = std::make_unique<top::TauCPTools>("top::TauCPTools"); + top::check(m_tau_CP_tools->setProperty("config", m_config), + "Failed to share config with tau CP tools"); + top::check(m_tau_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with tau CP tools"); + top::check(m_tau_CP_tools->initialize(), + "Failed to initialize tau tools"); + + m_flavor_tagging_CP_tools = std::make_unique<top::FlavorTaggingCPTools>("top::FlavorTaggingCPTools"); + top::check(m_flavor_tagging_CP_tools->setProperty("config", m_config), + "Failed to share config with flavour tagging CP tools"); + top::check(m_flavor_tagging_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with flavour tagging CP tools"); + top::check(m_flavor_tagging_CP_tools->initialize(), + "Failed to initialize flavor tagging tools"); + + m_jetMET_CP_tools = std::make_unique<top::JetMETCPTools>("top::JetMETCPTools"); + top::check(m_jetMET_CP_tools->setProperty("config", m_config), + "Failed to share config with Jet/MET CP tools"); + top::check(m_jetMET_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with Jet/MET CP tools"); + top::check(m_jetMET_CP_tools->initialize(), + "Failed to initialize Jet/MET tools"); + + m_isolation_CP_tools = std::make_unique<top::IsolationCPTools>("top::IsolationCPTools"); + top::check(m_isolation_CP_tools->setProperty("config", m_config), + "Failed to share config with isolation CP tools"); + top::check(m_isolation_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with isolation CP tools"); + top::check(m_isolation_CP_tools->initialize(), + "Failed to initialize isolation tools"); + + m_OR_CP_tools = std::make_unique<top::OverlapRemovalCPTools>("top::OverlapRemovalCPTools"); + top::check(m_OR_CP_tools->setProperty("config", m_config), + "Failed to share config with overlap removal CP tools"); + top::check(m_OR_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with overlap removal CP tools"); + top::check(m_OR_CP_tools->initialize(), + "Failed to initialize overlap removal tools"); + + m_ghost_track_CP_tools = std::make_unique<top::GhostTrackCPTools>("top::GhostTrackCPTools"); + top::check(m_ghost_track_CP_tools->setProperty("config", m_config), + "Failed to share config with ghost track CP tools"); + top::check(m_ghost_track_CP_tools->setProperty("release_series", m_release_series), + "Failed to release_series series with ghost track CP tools"); + top::check(m_ghost_track_CP_tools->initialize(), + "Failed to initialize ghost track tools"); + + return StatusCode::SUCCESS; +} + +StatusCode TopToolStore::finalize() { + ATH_MSG_INFO("top::TopToolStore finalize"); + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5028e3e0a21ca508d69f0f135d3e3076fa1a1100 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCPTools/TopTriggerCPTools.h" + +#include <map> +#include <string> + +// Top includes +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +// Trigger include(s): +#include "TrigConfxAOD/xAODConfigTool.h" +#include "TriggerMatchingTool/MatchingTool.h" +#include "TrigTauMatching/TrigTauMatching.h" + +namespace top { + +TriggerCPTools::TriggerCPTools(const std::string& name) : + asg::AsgTool(name) { + declareProperty("config", m_config); + declareProperty("release_series", m_release_series ); + + declareProperty( "TrigConfigTool", m_trigConfTool ); + declareProperty( "TrigDecisionTool", m_trigDecisionTool ); + declareProperty( "TrigMatchTool", m_trigMatchTool ); +} + +StatusCode TriggerCPTools::initialize() { + ATH_MSG_INFO("top::TriggerCPTools initialize..."); + + if (m_config->makeAllCPTools()) { + if (!m_config->isTruthDxAOD()) { + ///-- The configuration tool --/// + const std::string trig_config_name = "TrigConf::xAODConfigTool"; + if ( asg::ToolStore::contains<TrigConf::ITrigConfigTool>(trig_config_name) ) { + m_trigConfTool = asg::ToolStore::get<TrigConf::ITrigConfigTool>(trig_config_name); + } else { + TrigConf::xAODConfigTool* configTool = new TrigConf::xAODConfigTool(trig_config_name); + top::check( configTool->initialize() , "Failed to initialize trigger config tool" ); + m_trigConfTool = configTool; + } + + ///-- The decision tool --/// + const std::string trig_decision_name = "Trig::TrigDecisionTool"; + if ( asg::ToolStore::contains<Trig::TrigDecisionTool>(trig_decision_name) ) { + m_trigDecisionTool = asg::ToolStore::get<Trig::TrigDecisionTool>(trig_decision_name); + } else { + Trig::TrigDecisionTool* trigDecTool = new Trig::TrigDecisionTool(trig_decision_name); + top::check( trigDecTool->setProperty("ConfigTool", m_trigConfTool ) , "Failed to setProperty" ); + top::check( trigDecTool->setProperty("TrigDecisionKey", "xTrigDecision") , "Failed to setProperty" ); + top::check( trigDecTool->initialize() , "Failed to initialize trigger decision tool" ); + m_trigDecisionTool = trigDecTool; + } + + // Trigger matching tool + const std::string trig_match_name = "Trig::MatchingTool"; + if (asg::ToolStore::contains<Trig::IMatchingTool>(trig_match_name)) { + m_trigMatchTool = asg::ToolStore::get<Trig::IMatchingTool>(trig_match_name); + } else { + Trig::MatchingTool* trigMatchTool = new Trig::MatchingTool(trig_match_name); + top::check(trigMatchTool->setProperty("TrigDecisionTool", m_trigDecisionTool), + "Failed to set trigger decision tool to trigger matching tool"); + top::check(trigMatchTool->initialize(), + "Failed to initialize trig. matching tool"); + m_trigMatchTool = trigMatchTool; + } + + ///-- Tau matching --/// + if( m_config->useTaus() ){ + const std::string tauMatchName = "Trig::TrigTauMatchingTool"; + if ( asg::ToolStore::contains<Trig::ITrigTauMatchingTool>(tauMatchName) ) { + m_trigMatchTauTool = asg::ToolStore::get<Trig::ITrigTauMatchingTool>(tauMatchName); + } + else { + Trig::TrigTauMatchingTool* trigMatchTauTool = new Trig::TrigTauMatchingTool(tauMatchName); + top::check( trigMatchTauTool->setProperty("TrigDecisionTool", m_trigDecisionTool), + "Failed to set trig dec tool for tau matching" ); + top::check( trigMatchTauTool->initialize(), + "Failed to initialize tau trigger matching tool" ); + m_trigMatchTauTool = trigMatchTauTool; + } + } + } + else { + ATH_MSG_INFO("top::TriggerCPTools: no need to initialise anything on truth DxAOD"); + } + } + else { + ATH_MSG_INFO("top::TriggerCPTools: no need to initialise anything in mini-xAOD mode"); + } + + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopEgammaCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopEgammaCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..cf642421236e50fbfb831d279137dc3a2f4baced --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopEgammaCPTools.h @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPEGAMMACPTOOLS_H_ +#define TOPCPTOOLS_TOPEGAMMACPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Egamma include(s): +#include "ElectronPhotonFourMomentumCorrection/IEgammaCalibrationAndSmearingTool.h" +#include "ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h" +#include "ElectronPhotonShowerShapeFudgeTool/IElectronPhotonShowerShapeFudgeTool.h" +#include "PhotonEfficiencyCorrection/IAsgPhotonEfficiencyCorrectionTool.h" +#include "ElectronPhotonSelectorTools/IAsgPhotonIsEMSelector.h" + +namespace top { + +class TopConfig; + +class EgammaCPTools final : public asg::AsgTool { + public: + explicit EgammaCPTools(const std::string& name); + virtual ~EgammaCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::string m_electronEffTriggerFile; + std::string m_electronEffTriggerLooseFile; + std::string m_electronEffSFTriggerFile; + std::string m_electronEffSFTriggerLooseFile; + std::string m_electronEffSFRecoFile; + std::string m_electronEffSFIDFile; + std::string m_electronEffSFIDLooseFile; + std::string m_electronEffSFIsoFile; + std::string m_electronEffSFIsoLooseFile; + std::string m_electronEffSFChargeIDFile; + + ToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_egammaCalibrationAndSmearingTool; + + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFTrigger; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFTriggerLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffTrigger; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffTriggerLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFReco; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFID; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIDLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIso; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIsoLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFChargeID; + + ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_photonFudgeTool; + ToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_photonEffSF; + ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> m_photonIsoSFTools; + + ToolHandle<IAsgPhotonIsEMSelector> m_photonTightIsEMSelector; + ToolHandle<IAsgPhotonIsEMSelector> m_photonMediumIsEMSelector; + ToolHandle<IAsgPhotonIsEMSelector> m_photonLooseIsEMSelector; + + + + StatusCode setupCalibration(); + StatusCode setupScaleFactors(); + + IAsgElectronEfficiencyCorrectionTool* + setupElectronSFTool(const std::string& name, const std::vector<std::string>& file_list, int data_type); + + // Helper function to deal with path resolving the + // egamma groups very long file names for SFs and efficiencies. + std::string electronSFFilePath(const std::string& type, const std::string& ID = "", const std::string& isolation = ""); + + +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPEGAMMACPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopFlavorTaggingCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopFlavorTaggingCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..44ef30105db319a3fa300f4548a303d85e6a2c89 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopFlavorTaggingCPTools.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPFLAVORTAGGINGCPTOOLS_H_ +#define TOPCPTOOLS_TOPFLAVORTAGGINGCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +#include "TopConfiguration/TopConfig.h" + +// Flavor tagging include(s): +#include "xAODBTaggingEfficiency/IBTaggingEfficiencyTool.h" +#include "xAODBTaggingEfficiency/IBTaggingSelectionTool.h" + +namespace top { + +class TopConfig; + +class FlavorTaggingCPTools final : public asg::AsgTool { + public: + explicit FlavorTaggingCPTools(const std::string& name); + virtual ~FlavorTaggingCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::string m_tagger = ""; + std::string m_cdi_file = ""; + std::string m_efficiency_maps; + const std::vector<std::string> m_jet_flavors = {"B", "C", "T", "Light"}; + std::vector<std::string> m_calo_WPs_calib; + std::vector<std::string> m_calo_WPs; + std::vector<std::string> m_trackAntiKt2_WPs_calib; + std::vector<std::string> m_trackAntiKt2_WPs; + std::vector<std::string> m_trackAntiKt4_WPs_calib; + std::vector<std::string> m_trackAntiKt4_WPs; + // Some tools here + ToolHandleArray<IBTaggingEfficiencyTool> m_btagging_efficiency_tools; + ToolHandleArray<IBTaggingSelectionTool> m_btagging_selection_tools; +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPFLAVORTAGGINGCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopGhostTrackCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopGhostTrackCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..9cbc57f50c248a432a621b546eebf41c26a122c6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopGhostTrackCPTools.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPGHOSTTRACKCPTOOLS_H_ +#define TOPCPTOOLS_TOPGHOSTTRACKCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Tracking include(s): +#include "InDetTrackSystematicsTools/InDetTrackSystematics.h" +#include "InDetTrackSystematicsTools/InDetTrackSmearingTool.h" +#include "InDetTrackSystematicsTools/InDetTrackBiasingTool.h" +#include "InDetTrackSystematicsTools/InDetTrackTruthFilterTool.h" +#include "InDetTrackSystematicsTools/InDetTrackTruthOriginTool.h" +#include "InDetTrackSystematicsTools/JetTrackFilterTool.h" + + +namespace top { + +class TopConfig; + +class GhostTrackCPTools final : public asg::AsgTool { + public: + explicit GhostTrackCPTools(const std::string& name); + virtual ~GhostTrackCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::vector<std::uint32_t> m_runPeriods; + + const std::string m_smearingToolName{"top::GhostTrackCPTools::InDetTrackSmearingTool"}; + const std::string m_biasToolPrefix{"top::GhostTrackCPTools::InDetTrackBiasingTool"}; + const std::string m_truthOriginToolName{"top::GhostTrackCPTools::InDetTrackTruthOriginTool"}; + const std::string m_truthFilterToolName{"top::GhostTrackCPTools::InDetTrackTruthFilterTool"}; + const std::string m_jetTrackFilterToolName{"top::GhostTrackCPTools::JetTrackFilterTool"}; + + ToolHandle<InDet::InDetTrackSmearingTool> m_smearingTool; + ToolHandle<InDet::InDetTrackTruthOriginTool> m_truthOriginTool; + ToolHandle<InDet::InDetTrackTruthFilterTool> m_truthFilterTool; + ToolHandle<InDet::JetTrackFilterTool> m_jetTrackFilterTool; + + std::vector<ToolHandle<InDet::InDetTrackBiasingTool> > m_biasingTool; + + StatusCode setupSmearingTool(); + StatusCode setupBiasingTools(); + StatusCode setupTruthFilterTool(); + StatusCode setupJetTrackFilterTool(); + +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPGHOSTTRACKCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopIsolationCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopIsolationCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..86d416765d2efe44de58202c6f6c7ae338ffdf45 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopIsolationCPTools.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPISOLATIONCPTOOLS_H_ +#define TOPCPTOOLS_TOPISOLATIONCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Isolation include(s): +#include "IsolationSelection/IIsolationSelectionTool.h" +#include "IsolationCorrections/IIsolationCorrectionTool.h" + +namespace top { + +class TopConfig; + +class IsolationCPTools final : public asg::AsgTool { + public: + explicit IsolationCPTools(const std::string& name); + virtual ~IsolationCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::string m_isolationCalibFile; + + ToolHandle<CP::IIsolationCorrectionTool> m_isolationCorr; + ToolHandleArray<CP::IIsolationSelectionTool> m_isolationTools; + + StatusCode setupIsolation(); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPISOLATIONCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopJetMETCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopJetMETCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..cf55a3545aec334b8d64ca589dd96cff44e4a898 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopJetMETCPTools.h @@ -0,0 +1,106 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPJETMETCPTOOLS_H_ +#define TOPCPTOOLS_TOPJETMETCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Jet include(s): +#include "JetCalibTools/IJetCalibrationTool.h" +#include "JetCPInterfaces/ICPJetUncertaintiesTool.h" +#include "JetInterface/IJetUpdateJvt.h" +#include "JetInterface/IJetSelector.h" +#include "JetInterface/IJetModifier.h" +#include "JetResolution/IJERTool.h" +#include "JetResolution/IJERSmearingTool.h" +#include "JetJvtEfficiency/IJetJvtEfficiency.h" + +// MET include(s): +#include "METInterface/IMETMaker.h" +#include "METInterface/IMETSystematicsTool.h" + +namespace top { + +class TopConfig; + +class JetMETCPTools final : public asg::AsgTool { + public: + explicit JetMETCPTools(const std::string& name); + virtual ~JetMETCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::string m_jetJVT_ConfigFile; + + std::string m_jetAntiKt4_Data_ConfigFile; + std::string m_jetAntiKt4_Data_CalibSequence; + + std::string m_jetAntiKt4_MCFS_ConfigFile; + std::string m_jetAntiKt4_MCFS_CalibSequence; + + std::string m_jetAntiKt4_MCAFII_ConfigFile; + std::string m_jetAntiKt4_MCAFII_CalibSequence; + + std::string m_jetAntiKt4_PFlow_MCFS_ConfigFile; + std::string m_jetAntiKt4_PFlow_MCFS_CalibSequence; + + ToolHandle<IJetCalibrationTool> m_jetCalibrationTool; + ToolHandle<IJetCalibrationTool> m_jetCalibrationToolLargeR; + + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_strong; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_medium; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_weak; + + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario1; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario2; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario3; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario4; + + ToolHandle<IJetSelector> m_jetCleaningToolLooseBad; + ToolHandle<IJetSelector> m_jetCleaningToolTightBad; + + ToolHandle<IJERTool> m_jetJERTool; + ToolHandle<IJERSmearingTool> m_jetJERSmearingTool; + ToolHandle<IJetUpdateJvt> m_jetUpdateJvtTool; + ToolHandle<IJetModifier> m_fjvtTool; + + ToolHandle<CP::IJetJvtEfficiency> m_jetJvtTool; + + ToolHandle<IMETMaker> m_met_maker; + ToolHandle<IMETSystematicsTool> m_met_systematics; + + + + StatusCode setupJetsCalibration(); + StatusCode setupLargeRJetsCalibration(); + StatusCode setupJetsScaleFactors(); + StatusCode setupMET(); + + ICPJetUncertaintiesTool* + setupJetUncertaintiesTool(const std::string& name, + const std::string& jet_def, + const std::string& mc_type, + const std::string& config_file, + std::vector<std::string>* variables); + + IJetSelector* setupJetCleaningTool(const std::string& WP); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPJETMETCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopMuonCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopMuonCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..c5b921dcac642ca792da32ac6b35da6fbd6646fe --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopMuonCPTools.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPMUONCPTOOLS_H_ +#define TOPCPTOOLS_TOPMUONCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Muon include(s): +#include "MuonMomentumCorrections/IMuonCalibrationAndSmearingTool.h" +#include "MuonSelectorTools/IMuonSelectionTool.h" +#include "MuonEfficiencyCorrections/IMuonTriggerScaleFactors.h" +#include "MuonEfficiencyCorrections/IMuonEfficiencyScaleFactors.h" + +namespace top { + +class TopConfig; + +class MuonCPTools final : public asg::AsgTool { + public: + explicit MuonCPTools(const std::string& name); + virtual ~MuonCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_muonCalibrationAndSmearingTool; + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolLoose; + // the following is needed to make sure all muons for which d0sig is calculated are at least Loose + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolVeryLooseVeto; + + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactors_2015; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactorsLoose_2015; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactors_2016; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactorsLoose_2016; + + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsTool; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolLoose; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolIso; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolLooseIso; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolTTVA; + + + + StatusCode setupCalibration(); + StatusCode setupScaleFactors(); + + CP::IMuonSelectionTool* + setupMuonSelectionTool(const std::string& name, const std::string& quality, double max_eta); + + CP::IMuonTriggerScaleFactors* + setupMuonTrigSFTool(const std::string& name, const std::string& quality, const std::string& year); + + CP::IMuonEfficiencyScaleFactors* + setupMuonSFTool(const std::string& name, const std::string& WP); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPMUONCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOtherCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOtherCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..ff31a0d349a14208f47a2196d2cbbf8f6a17e547 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOtherCPTools.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPOTHERCPTOOLS_H_ +#define TOPCPTOOLS_TOPOTHERCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// GRL include(s): +#include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h" + +// Pileup Reweighting include(s): +#include "AsgAnalysisInterfaces/IPileupReweightingTool.h" + +// PMG Tools +#include "PMGTools/PMGSherpa22VJetsWeightTool.h" + +namespace top { + +class TopConfig; + +class OtherCPTools final : public asg::AsgTool { + public: + explicit OtherCPTools(const std::string& name); + virtual ~OtherCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + ToolHandle<IGoodRunsListSelectionTool> m_grlTool; + ToolHandle<CP::IPileupReweightingTool> m_pileupReweightingTool; + ToolHandle<PMGTools::PMGSherpa22VJetsWeightTool> m_pmg_sherpa22_vjets_tool; + + StatusCode setupGRL(); + StatusCode setupPileupReweighting(); + StatusCode setupPMGTools(); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPOTHERCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOverlapRemovalCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOverlapRemovalCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..f37987143de8bf48040474c07c91dd37776d7cb6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopOverlapRemovalCPTools.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPOVERLAPREMOVALCPTOOLS_H_ +#define TOPCPTOOLS_TOPOVERLAPREMOVALCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Overlap removal includes: +#include "AssociationUtils/IOverlapRemovalTool.h" +#include "AssociationUtils/ToolBox.h" + +namespace top { + +class TopConfig; + +class OverlapRemovalCPTools final : public asg::AsgTool { + public: + explicit OverlapRemovalCPTools(const std::string& name); + virtual ~OverlapRemovalCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + ORUtils::ToolBox m_ORtoolBox; + ORUtils::ToolBox m_ORtoolBox_Loose; + asg::AnaToolHandle<ORUtils::IOverlapRemovalTool> m_overlapRemovalTool; + asg::AnaToolHandle<ORUtils::IOverlapRemovalTool> m_overlapRemovalTool_Loose; + + StatusCode setupOverlapRemoval(); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPOVERLAPREMOVALCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTauCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTauCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..685c3101b4fbc34327c42489c1d585ed167c41d8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTauCPTools.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPTAUCPTOOLS_H_ +#define TOPCPTOOLS_TOPTAUCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Tau include(s): +#include "TauAnalysisTools/ITauSelectionTool.h" +#include "TauAnalysisTools/ITauSmearingTool.h" +#include "TauAnalysisTools/ITauEfficiencyCorrectionsTool.h" + +namespace top { + +class TopConfig; + +class TauCPTools final : public asg::AsgTool { + public: + explicit TauCPTools(const std::string& name); + virtual ~TauCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + ToolHandle<TauAnalysisTools::ITauSelectionTool> m_tauSelectionTool; + ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_tauEffCorrTool; + + ToolHandle<TauAnalysisTools::ITauSelectionTool> m_tauSelectionToolLoose; + ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_tauEffCorrToolLoose; + + ToolHandle<TauAnalysisTools::ITauSmearingTool> m_tauSmearingTool; + + StatusCode setupCalibration(); + StatusCode setupScaleFactors(); +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPTAUCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopToolStore.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopToolStore.h new file mode 100644 index 0000000000000000000000000000000000000000..ae7f5a0b9800d0dc39ef84c23f1aed5a30a1e660 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopToolStore.h @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopToolStore.h 802731 2017-04-11 16:35:41Z tpelzer $ +#ifndef ANALYSISTOP_TOPCPTOOLS_TOPTOOLSTORE_H +#define ANALYSISTOP_TOPCPTOOLS_TOPTOOLSTORE_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TopToolStore + * Configure all asg::AsgTools and place into asg::ToolStore + * This will allow other tools and algorithms to retrieve the tools + * This means that we can share tools and only configure them once + * + * $Revision: 802731 $ + * $Date: 2017-04-11 18:35:41 +0200 (Tue, 11 Apr 2017) $ + * + **/ + +// system include(s): +#include <vector> +#include <memory> + +// Top includes +#include "TopCPTools/TopGhostTrackCPTools.h" +#include "TopCPTools/TopFlavorTaggingCPTools.h" +#include "TopCPTools/TopEgammaCPTools.h" +#include "TopCPTools/TopMuonCPTools.h" +#include "TopCPTools/TopIsolationCPTools.h" +#include "TopCPTools/TopTauCPTools.h" +#include "TopCPTools/TopJetMETCPTools.h" +#include "TopCPTools/TopTriggerCPTools.h" +#include "TopCPTools/TopOverlapRemovalCPTools.h" +#include "TopCPTools/TopOtherCPTools.h" + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/AnaToolHandle.h" + +namespace top{ + + // Forward declaration(s): + class TopConfig; + + class OverlapRemovalCPTools; + class OtherCPTools; + class FlavorTaggingCPTools; + class TriggerCPTools; + class EgammaCPTools; + class MuonCPTools; + class IsolationCPTools; + class TauCPTools; + class JetMETCPTools; + + class TopToolStore final : public asg::AsgTool { + public: + explicit TopToolStore( const std::string& name ); + virtual ~TopToolStore() {} + + TopToolStore(const TopToolStore& rhs) = delete; + TopToolStore(TopToolStore&& rhs) = delete; + TopToolStore& operator=(const TopToolStore& rhs) = delete; + + StatusCode initialize(); + StatusCode finalize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + std::unique_ptr<top::OverlapRemovalCPTools> m_OR_CP_tools; + std::unique_ptr<top::OtherCPTools> m_other_CP_tools; + std::unique_ptr<top::FlavorTaggingCPTools> m_flavor_tagging_CP_tools; + std::unique_ptr<top::TriggerCPTools> m_trigger_CP_tools; + std::unique_ptr<top::EgammaCPTools> m_egamma_CP_tools; + std::unique_ptr<top::MuonCPTools> m_muon_CP_tools; + std::unique_ptr<top::IsolationCPTools> m_isolation_CP_tools; + std::unique_ptr<top::TauCPTools> m_tau_CP_tools; + std::unique_ptr<top::JetMETCPTools> m_jetMET_CP_tools; + std::unique_ptr<top::GhostTrackCPTools> m_ghost_track_CP_tools; + }; + +} // namespace + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTriggerCPTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTriggerCPTools.h new file mode 100644 index 0000000000000000000000000000000000000000..5a62acbfc49cfcefdb670bfb651c4a4b39f37384 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/TopCPTools/TopTriggerCPTools.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCPTOOLS_TOPTRIGGERCPTOOLS_H_ +#define TOPCPTOOLS_TOPTRIGGERCPTOOLS_H_ + +// Include what you use +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "AsgTools/ToolHandleArray.h" +#include "AsgTools/AnaToolHandle.h" + +// Trigger include(s): +#include "TrigConfInterfaces/ITrigConfigTool.h" +#include "TrigDecisionTool/TrigDecisionTool.h" +#include "TriggerMatchingTool/IMatchingTool.h" +#include "TrigTauMatching/ITrigTauMatching.h" + +namespace top { + +class TopConfig; + +class TriggerCPTools final : public asg::AsgTool { + public: + explicit TriggerCPTools(const std::string& name); + virtual ~TriggerCPTools() {} + + StatusCode initialize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + int m_release_series = 24; // Default to 2.4 + + ToolHandle<TrigConf::ITrigConfigTool> m_trigConfTool; + ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; + ToolHandle<Trig::IMatchingTool> m_trigMatchTool; + ToolHandle<Trig::ITrigTauMatchingTool> m_trigMatchTauTool; + +}; +} // namespace top + +#endif // TOPCPTOOLS_TOPTRIGGERCPTOOLS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..003402bab383a9d9bd704952436befa982e09a60 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/cmt/Makefile.RootCore @@ -0,0 +1,26 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + +PACKAGE = TopCPTools +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = -g -std=c++14 +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = + +PACKAGE_DEP = xAODRootAccess AsgTools AthContainers PATCore PATInterfaces TrigConfInterfaces TrigConfxAOD TrigDecisionTool TriggerMatchingTool TrigTauMatching GoodRunsLists ElectronPhotonFourMomentumCorrection ElectronPhotonSelectorTools ElectronEfficiencyCorrection ElectronPhotonShowerShapeFudgeTool PhotonEfficiencyCorrection MuonMomentumCorrections MuonSelectorTools MuonEfficiencyCorrections TauAnalysisTools CalibrationDataInterface xAODBTaggingEfficiency JetCalibTools JetCPInterfaces JetUncertainties JetInterface JetMomentTools JetSelectorTools JetResolution METInterface METUtilities IsolationSelection IsolationCorrections PathResolver TopConfiguration TopEvent PileupReweighting AssociationUtils JetJvtEfficiency PMGTools InDetTrackSystematicsTools + +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_NOGRID = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 +PACKAGE_REFLEX = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..40fc8c714216072ae14018e554fb08773b4fb5de --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt @@ -0,0 +1,37 @@ +# Auto-generated on: 2017-03-08 14:47:35.608258 + +# Declare the name of this package: +atlas_subdir( TopConfiguration None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + PATInterfaces ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) +find_package( Boost REQUIRED COMPONENTS iostreams ) + +message( STATUS "${Boost_LIBRARIES}" ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopConfiguration _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopConfiguration Root/*.cxx Root/*.h Root/*.icc + TopConfiguration/*.h TopConfiguration/*.icc TopConfiguration/*/*.h + TopConfiguration/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopConfiguration + LINK_LIBRARIES PATInterfaces + ${ROOT_LIBRARIES} + ${Boost_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS}) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Install the python modules from the package +atlas_install_python_modules( python/*.py ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/AodMetaDataAccess.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/AodMetaDataAccess.cxx new file mode 100644 index 0000000000000000000000000000000000000000..621dd8fb92694fde900753e367f77b24e59935fa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/AodMetaDataAccess.cxx @@ -0,0 +1,145 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopConfiguration/AodMetaDataAccess.h" + +#include <algorithm> +#include <cassert> +#include <cstdlib> +#include <memory> +#include <sys/types.h> +#include <sys/wait.h> +#include <string> +#include <unistd.h> +#include <utility> +#include <vector> + +#include <boost/algorithm/string.hpp> +#include <boost/iostreams/device/file_descriptor.hpp> +#include <boost/iostreams/stream.hpp> +#include <boost/scope_exit.hpp> + + +namespace top { + + +AodMetaDataAccess::AodMetaDataAccess() : m_data(nullptr) { } + + +AodMetaDataAccess::~AodMetaDataAccess() { + delete m_data; +} + + +void AodMetaDataAccess::loadWithFilesFrom(std::string const & fileListPath) { + + char const * rootCoreBin = getenv("ROOTCOREBIN"); + assert(rootCoreBin && rootCoreBin[0]); + std::string exePath(rootCoreBin); + if (exePath.back() != '/') + exePath.append("/"); + exePath.append("python/TopConfiguration/AodMetaDataReader.py"); + + int pipefd[2] = { -1, -1 }; + if (pipe(pipefd) == -1) + throw std::runtime_error("pipe() failed"); + int pid = fork(); + if (pid == -1) { + std::for_each(pipefd, pipefd+2, close); + throw std::runtime_error("fork() failed"); + } + + if (pid == 0) { + close(pipefd[0]); + if (dup2(pipefd[1], STDOUT_FILENO) != -1) + execlp(exePath.c_str(), "AodMetaDataReader.py", "--format", "plain", "--files-from", fileListPath.c_str(), nullptr); + perror("popen(AodMetaDataReader.py)"); + _exit(1); + } + + BOOST_SCOPE_EXIT(pid) { + int status; + while (waitpid(pid, &status, 0) == -1 && errno == EINTR); + } BOOST_SCOPE_EXIT_END + close(pipefd[1]); + + boost::iostreams::stream<boost::iostreams::file_descriptor_source> stream(pipefd[0], boost::iostreams::close_handle); + + auto * data = new std::map< std::string, std::map< std::string, std::string > >(); // FIXME memory leak on exception + bool eof = false; + for (std::string line; std::getline(stream, line); ) { + if (eof) + throw std::runtime_error("received data from AodMetaDataReader after end-of-stream marker"); + if (line.empty()) { + eof = true; + } + else { + std::vector<std::string> tokens; + boost::split(tokens, line, boost::is_any_of("\t")); + if (tokens.size() != 3) + throw std::runtime_error("received malformed record from AodMetaDataReader"); + auto & folder = (*data)[tokens[0]]; + bool inserted = folder.insert(std::make_pair(tokens[1], tokens[2])).second; + if (!inserted) + throw std::runtime_error("received duplicate entry from AodMetaDataReader"); + } + } + if (!eof) + throw std::runtime_error("data stream from AodMetaDataReader not properly terminated"); + m_data = data; +} + + +std::string AodMetaDataAccess::get(std::string const & folderName, std::string const & keyName) const { + if (m_data == nullptr) + throw std::logic_error("meta-data not loaded"); + auto it1 = m_data->find(folderName); + if (it1 == m_data->end()) + throw std::logic_error("the folderName "+folderName+" does not exist in the metadata"); + auto const & folder = it1->second; + auto it2 = folder.find(keyName); + if (it2 == folder.end()) + throw std::logic_error("the keyName "+keyName+" does not exist in the metadata"); + + return m_data->at(folderName).at(keyName); +} + + +std::string AodMetaDataAccess::get(std::string const & folderName, std::string const & keyName, std::string const & defaultValue) const { + if (m_data == nullptr) + throw std::logic_error("meta-data not loaded"); + auto it1 = m_data->find(folderName); + if (it1 == m_data->end()) + return defaultValue; + auto const & folder = it1->second; + auto it2 = folder.find(keyName); + if (it2 == folder.end()) + return defaultValue; + return it2->second; +} + + +bool AodMetaDataAccess::valid() const { + return (m_data != nullptr); +} + + +bool AodMetaDataAccess::isSimulation() const { + auto projectName = get("/TagInfo", "project_name"); + if (boost::equals(projectName, "IS_SIMULATION")) + return true; + if (boost::starts_with(projectName, "data")) + return false; + throw std::invalid_argument("unrecognized value in meta-data entry for key 'project_name'"); +} + +bool AodMetaDataAccess::isAFII() const{ + if (!isSimulation()) return false; // No need to check if not MC + auto simulatorName = get("/Simulation/Parameters","Simulator"); + if (boost::equals(simulatorName, "ATLFASTII")) // AFII will have this simulator + return true; + else return false; // Otherwise must be FullSim +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1b6547af72c40df4ecf838258f05bcbd050e141 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx @@ -0,0 +1,492 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopConfiguration/ConfigurationSettings.h" + +#include <algorithm> +#include <cstdlib> +#include <fstream> +#include <sstream> +#include <iomanip> +#include <iostream> +#include <boost/algorithm/string.hpp> +#include <boost/algorithm/string/trim_all.hpp> + +namespace top { + +ConfigurationSettings* ConfigurationSettings::m_instance = 0; + +ConfigurationSettings::ConfigurationSettings() : m_configured(false) { + registerParameter("ElectronCollectionName", "Name of the Electron container"); + registerParameter("MuonCollectionName", "Name of the Muon container"); + registerParameter("PhotonCollectionName", "Name of the Photon container"); + registerParameter("JetCollectionName", "Name of the Jet container"); + registerParameter("LargeJetCollectionName", "Name of the large-R Jet container"); + registerParameter("LargeJetSubstructure", "Setup to use when applying grooming on the large-R jet"); + registerParameter("TrackJetCollectionName", "Name of the track Jet container","None"); + registerParameter("TauCollectionName", "Name of the Tau container"); + registerParameter("JetGhostTrackDecoName", "Name of the jet decoration that holds the ghost-associated track.", "None"); + + registerParameter("TruthCollectionName", "Name of the Truth container"); + registerParameter("TruthElectronCollectionName", "Name of the Truth Electron container", "TruthElectrons" ); + registerParameter("TruthMuonCollectionName", "Name of the Truth Muon container", "TruthMuons"); + registerParameter("TruthPhotonCollectionName", "Name of the Truth Photon container", "None"); + registerParameter("TruthMETCollectionName", "Name of the Truth MET container", "MET_Truth"); + registerParameter("TruthJetCollectionName", "Name of the Truth Jet container"); + registerParameter("TruthLargeRJetCollectionName", "Name of the Truth Large R Jet container", "None"); + + registerParameter("applyTTVACut", "Decide if to apply lepton z0/d0 cuts", "True"); + + registerParameter("GRLDir","Location of GRL File","TopAnalysis"); + registerParameter("GRLFile","Name of GRL File", " "); + + registerParameter("DumpBtagSystsInSystTrees", "Dump systematics-shifted b-tagging SFs in systematic TTrees, True or False (default: False)","False"); + + registerParameter("ElectronID", "Type of electron. IsEM : Loose, Medium, Tight or Likelihood LooseAndBLayerLH, MediumLH, TightLH","TightLH"); + registerParameter("ElectronIDLoose", "Type of electron for background. IsEM : Loose, Medium, Tight or Likelihood LooseAndBLayerLH, MediumLH, TightLH","MediumLH"); + registerParameter("ElectronPt", "Electron pT cut for object selection (in MeV). Default 25 GeV.", "25000."); + registerParameter("EgammaSystematicModel","Egamma Systematic model : FULL_v1 , FULL_ETACORRELATED_v1 , 1NP_v1 (default)","1NP_v1"); + registerParameter("ElectronIsolation","Isolation to use : Gradient, GradientLoose, FixedCutTight, FixedCutTightTrackOnly, FixedCutLoose, LooseTrackOnly, Loose, Tight, None","Gradient"); + registerParameter("ElectronIsolationLoose","Isolation to use : Gradient, GradientLoose, FixedCutTight, FixedCutTightTrackOnly, FixedCutLoose, LooseTrackOnly, Loose, Tight, None","None"); + registerParameter("ElectronIsoSFs", "True/False. Set to False to allow unsupported ID/isolation WP combinations to be used.", "True"); + registerParameter("ElectronVetoLArCrack", "True/False. Set to False to disable LAr crack veto (not recommended).", "True"); + + registerParameter("PhotonPt", "Photon pT cut for object selection (in MeV). Default 25 GeV.", "25000."); + registerParameter("PhotonEta", "Absolute Photon eta cut for object selection. Default 2.5.", "2.5"); + registerParameter("PhotonID","Type of photon. Definition to use : Tight, Loose and None.","Tight"); + registerParameter("PhotonIDLoose","Type of photon for background. Definition to use : Tight, Loose, None.","Loose"); + registerParameter("PhotonIsolation","Isolation to use : FixedCutTight, FixedCutLoose, None.","FixedCutTight"); + registerParameter("PhotonIsolationLoose","Isolation to use : FixedCutTight, FixedCutLoose, None.","FixedCutLoose"); + registerParameter("PhotonUseRadiativeZ", "True/False. Set to True to enable photon radiative Z up to 100 GeV.", "False"); + + registerParameter("MuonPt", "Muon pT cut for object selection (in MeV). Default 25 GeV.", "25000"); + registerParameter("MuonEta", "Absolute Muon eta cut for object selection. Default 2.5.", "2.5" ); + registerParameter("MuonQuality", "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight", "Medium"); + registerParameter("MuonQualityLoose", "Muon quality cut for object selection. Options are VeryLoose, Loose, Medium (default) and Tight", "Medium"); + registerParameter("MuonIsolation","Isolation to use : Gradient, GradientLoose, Tight, Loose, LooseTrackOnly, FixedCutTightTrackOnly, FixedCutLoose, None","Gradient"); + registerParameter("MuonIsolationLoose","Isolation to use : Gradient, GradientLoose, Tight, Loose, LooseTrackOnly, FixedCutTightTrackOnly, FixedCutLoose, None","None"); + registerParameter("UseAntiMuons", "Use AntiMuons for fake estimate. Default: false", "false"); + + registerParameter("JetPt", "Jet pT cut for object selection (in MeV). Default 25 GeV.", "25000."); + registerParameter("JetEta", "Absolute Jet eta cut for object selection. Default 2.5.", "2.5" ); + registerParameter("FwdJetAndMET", "Forward jet selection and corresponding MET calculation." + "Default (does nothing on forward jets), fJVT (apply fJVT cut if pT<50GeV and |eta|>2.5), Tight (requires pT>30GeV if |eta|>2.5).", "Default"); + registerParameter("JetUncertainties_BunchSpacing", + "25ns (default) or 50ns - for JetUncertainties", + "25ns"); +// registerParameter("JetUncertainties_NPModel","AllNuisanceParameters, 19NP or 3NP (default) - for JetUncertainties","3NP"); + registerParameter("JetUncertainties_NPModel","AllNuisanceParameters, 29NP_ByCategory, or 21NP (default) - for JetUncertainties","21NP"); + registerParameter("LargeRSmallRCorrelations", + "Do large-small R jet correlation systematics - True or False (default)", + "False"); + registerParameter("JetJERSmearingModel","Full (inc data smearing) or Simple (default)","Simple"); + registerParameter("JetCalibSequence","Jet calibaration sequence, GSC (default) or JMS","GSC"); + registerParameter("JVTinMETCalculation", "Perfom a JVT cut on the jets in the MET recalculation? True (default) or False.", "True" ); + + registerParameter("JSF", "Used for top mass analysis, default is 1.0", "1.0"); + registerParameter("bJSF", "Used for top mass analysis, default is 1.0", "1.0"); + + registerParameter("LargeRJetPt", "Track Jet pT cut for object selection (in MeV). Default 7 GeV.", "25000."); + registerParameter("LargeRJetEta", "Absolute large-R jet eta cut for object selection. Default 2.0.", "2.0" ); + registerParameter("LargeRJESUncertaintyConfig", + "Variables to be varied with JES uncertainties. Options:D2Beta1,Tau21WTA,Tau32WTA,Split12,Split23,Qw ( default Split23,Tau32WTA)", + "Split23,Tau32WTA"); + registerParameter("LargeRJESJMSConfig", + "Calibration for large-R JES/JMS. CombinedMass or CaloMass (default CombinedMass).", + "CombinedMass"); + + registerParameter("TrackJetPt", "Track Jet pT cut for object selection (in MeV). Default 7 GeV.", "7000."); + registerParameter("TrackJetEta", "Absolute Track Jet eta cut for object selection. Default 2.5.", "2.5" ); + + registerParameter("RCJetPt", "Reclustered Jet pT cut for object selection (in MeV). Default 100000 MeV.", "100000."); + registerParameter("RCJetEta", "Reclustered Jet eta cut for object selection. Default 2.0.", "2.0"); + registerParameter("RCJetTrim", "Reclustered Jet trimming cut for object selection. Default 0.05.", "0.05"); + registerParameter("RCJetRadius", "Reclustered Jet radius for object selection. Default 1.0", "1.0"); + registerParameter("UseRCJets", "Use Reclustered Jets. Default False.", "False"); + + registerParameter("VarRCJetPt", "Reclustered Jet (variable-R) pT cut for object selection (in MeV). Default 100000 MeV.", "100000."); + registerParameter("VarRCJetEta", "Reclustered Jet (variable-R) eta cut for object selection. Default 2.0.", "2.0"); + registerParameter("VarRCJetTrim", "Reclustered Jet (variable-R) trimming cut for object selection. Default 0.05.", "0.05"); + registerParameter("VarRCJetMaxRadius", "Reclustered Jet (variable-R) max. radius cut for object selection. Default 1.0", "1.0"); + registerParameter("VarRCJetRho", "Reclustered Jet (variable-R) list of rho values (). Default 2.", "2"); + registerParameter("VarRCJetMassScale", "Reclustered Jet (variable-R) list of mass scale values (m_w,m_z,m_h,m_t). By default use all.", "m_w,m_z,m_h,m_t"); + registerParameter("UseVarRCJets", "Use Reclustered Jets (Variable-R Jets). Default False.", "False"); + + registerParameter("TauPt", + "Pt cut applied to both tight and loose taus (in MeV)." + "Default 25 GeV.", + "25000"); + registerParameter("TauJetIDWP", + "Tau jet IDWP (None, Loose, Medium, Tight, LooseNotMedium, LooseNotTight, MediumNotTight, NotLoose)." + "Default Medium.", + "Medium"); + registerParameter("TauJetIDWPLoose", + "Loose Tau jet IDWP (None, Loose, Medium, Tight, LooseNotMedium, LooseNotTight, MediumNotTight, NotLoose)." + "Default None.", + "Medium"); + registerParameter("TauEleBDTWP", + "Tau electron BDT WP (None, Loose, Medium, Tight)." + "Default Loose.", + "Loose"); + registerParameter("TauEleBDTWPLoose", + "Loose Tau electron BDT WP (None, Loose, Medium, Tight)." + "Default Loose.", + "Loose"); + registerParameter("TauEleOLR", + "Apply tau-electron overlap removal (True/False)." + "Default False", + "False"); + registerParameter("TauEleOLRLoose", + "Apply loose tau-electron overlap removal (True/False)." + "Default False", + "False"); + registerParameter("TauJetConfigFile", + "Config file to configure tau selection. " + "If anything other than 'Default'" + "then all cuts are taken from the " + "config file rather than other options.", + "Default"); + registerParameter("TauJetConfigFileLoose", + "Config file to configure loose tau selection. " + "If anything other than 'Default'" + "then all cuts are taken from the " + "config file rather than other options.", + "Default"); + registerParameter("ApplyTauMVATES", + "Apply new Tau energy calibration based on substructure information and regression, True or False (default).", + "False"); + + registerParameter("Systematics", "What to run? Nominal (just the nominal), All(do all systematics) " , "Nominal"); + + registerParameter("LibraryNames", "Names of any libraries that need loading"); + registerParameter("UseAodMetaData", "Whether to read xAOD meta-data from input files (default: False)", "False"); + registerParameter("ObjectSelectionName", "Code used to define objects, e.g. ObjectLoaderStandardCuts"); + registerParameter("OutputFormat", "Format, can be user defined, e.g. top::EventSaverFlatNtuple"); + registerParameter("OutputEvents", "AllEvents (saves all events + decison bits), SelectedEvents (saves only the events passing your cuts)"); + registerParameter("OutputFilename", "The file that will contain the output histograms and trees"); + registerParameter("OutputFileSetAutoFlushZero", "setAutoFlush(0) on EventSaverFlatNtuple for ANALYSISTO-44 workaround. Default False","False"); + + registerParameter("EventVariableSaveList", "The list of event variables to save (EventSaverxAODNext only).", "runNumber.eventNumber.eventTypeBitmask.averageInteractionsPerCrossing"); + registerParameter("PhotonVariableSaveList", "The list of photon variables to save (EventSaverxAODNext only).", "pt.eta.phi.m.charge.ptvarcone20.topoetcone20.passPreORSelection"); + registerParameter("ElectronVariableSaveList", "The list of electron variables to save (EventSaverxAODNext only).", "pt.eta.phi.m.charge.ptvarcone20.topoetcone20.passPreORSelection"); + registerParameter("MuonVariableSaveList", "The list of muon variables to save (EventSaverxAODNext only).", "pt.eta.phi.m.author.charge.ptvarcone30.topoetcone20.muonType.passPreORSelection"); + registerParameter("TauVariableSaveList", "The list of tau variables to save (EventSaverxAODNext only).", "pt.eta.phi.m.charge.passPreORSelection"); + registerParameter("JetVariableSaveList", "The list of jet variables to save (EventSaverxAODNext only).", "pt.eta.phi.m.passPreORSelection.btaggingLink.HadronConeExclTruthLabelID"); + registerParameter("BTagVariableSaveList", "The list of b-tag variables to save (EventSaverxAODNext only).", "MV2c20_discriminant"); + + registerParameter("NEvents", "The number of events that you want to run on (for testing). If 0 then all events are run.", "0"); + registerParameter("FirstEvent", "The number of events that you want to skip (for testing). If 0 then no events are skipped.", "0"); + registerParameter("PerfStats"," I/O Performance printouts. None, Summary or Full" , "None"); + registerParameter("IsAFII", "Define if you are running over a fastsim sample: True or False", " "); + + registerParameter("FakesControlRegionDoLooseMC","Run Loose events on MC : True (study fakes control regions), False (regular analysis)", "False"); + + registerParameter("FakesMMWeights","Calculate matrix-method weights for fake prompt leptons estimate : True (calculate weights), False (does nothing)", "False"); + registerParameter("FakesMMDir","Directory of files containing efficiencies for fake prompt leptons estimate - default is $ROOTCOREBIN/data/TopFakes", "$ROOTCOREBIN/data/TopFakes"); + registerParameter("FakesMMDebug","Enables debug mode for matrix-method weight calculation: True, False (default)", "False"); + + registerParameter("OverlapRemovalLeptonDef","Run overlap removal on : Tight (top default) or Loose (not top default) lepton definitions", "Tight"); + registerParameter("DoLooseTreeOnly","Only dumps the Loose trees (and activate them for MC): True or False (default)", "False"); + registerParameter("ApplyTightSFsInLooseTree","In Loose trees, calculate lepton SFs with tight leptons only, and considering they are tight: True or False (default)", "False"); + registerParameter("ApplyElectronInJetSubtraction","Subtract electrons close to jets for boosted analysis : True or False(top default)", "False"); + registerParameter("TopPartonHistory","ttbar, tb, False (default)", "False"); + + registerParameter("TopParticleLevel", "Perform particle level selection? True or False", "False"); + registerParameter("DoParticleLevelOverlapRemoval", + "Perform overlap removal at particle level? True (default), False, or any combination (comma separated) of MuonJet, ElectronJet, JetPhoton", + "True"); + + registerParameter("PDFInfo","Do you want the PDF info? True (in truth tree), Nominal (save to the nominal tree if passes selection) or False (nothing, default)", "False"); + registerParameter("MCGeneratorWeights","Do you want the OTF-computed MC generator weights (if available)? True (in truth tree), Nominal (save to the nominal tree if passes selection) or False (nothing, default)", "False"); + registerParameter("TruthBlockInfo","Do you want to dump the full Truth block info? True or False", "False"); + + registerParameter("TruthElectronPt", "Electron pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000"); + registerParameter("TruthElectronEta", "Absolute electron eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5" ); + + registerParameter("TruthMuonPt", "Muon pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000"); + registerParameter("TruthMuonEta", "Absolute Muon eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5" ); + + registerParameter("TruthPhotonPt", + "Photon pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", + "25000"); + registerParameter("TruthPhotonEta", + "Absolute Photon eta cut for [Particle Level / Truth] object selection. Default 2.5.", + "2.5" ); + registerParameter("TruthPhotonOrigin", + "Potential origin of [Particle Level / Truth] photons. Comma separated list of particle origin values as given by MCTruthClassifier (string names).", + "WBoson,ZBoson,SinglePhot,Higgs,HiggsMSSM,WZMSSM,PromptPhot,SUSY,UndrPhot,FSRPhot" ); + registerParameter("TruthPhotonIsolation", + "Configuration option for isolation applied to [Particle Level / Truth] photons. " + "This can be False / None (isolation requirement disabled), " + "True (use default isolation), " + "or a configuration in the format `VAR CUT`, where VAR is one of the isolation variables and CUT is the cut applied as `VAR / pt < CUT`.", + "ptcone30 0.1"); + + + registerParameter("TruthJetPt", "Jet pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000"); + registerParameter("TruthJetEta", "Absolute Jet eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5" ); + + registerParameter("TruthLargeRJetPt", "Large R Jet pT cut for [Particle Level / Truth] object selection (in MeV). Default 25 GeV.", "25000"); + registerParameter("TruthLargeRJetEta", "Absolute Large R Jet eta cut for [Particle Level / Truth] object selection. Default 2.5.", "2.5" ); + + registerParameter("LHAPDFSets", "List of PDF sets to calculate weights for, seperated by spaces, use LHAPDF names e.g CT10nlo NNPDF30_nlo_as_0118 MMHT2014nlo68cl", " " ); + registerParameter("LHAPDFEventWeights", "Save per event weights for all PDF sets/members: True (lots of info in truth tree!), Nominal (save to the nominal tree if passes selection) or False (nothing, default).", "False" ); + registerParameter("LHAPDFBaseSet", "Base PDF set used to recalculate XF1,XF2 values if they are zero. Will be added to LHAPDFSets.", " " ); + + registerParameter("BTaggingWP", + "b-tagging WPs to calculate SF for." + " Can be either a list of cut values written as in " + "the CDI files e.g. -0_4434 (default), or as -0.4434." + " More conviniently it can be a percentage: e.g. 77%.", + "-0_4434"); + + registerParameter("BTaggingSystExcludedFromEV", + "User-defined list of b-tagging systematics to be dextracted from eigenvector decomposition, separated by semi-colons (none by default)", + "none"); + + registerParameter("BTaggingCalibrationB", + "The calibration to use for the b-tagging SFs (B-jets)." + " Default 'default'", + "default"); + + registerParameter("BTaggingCalibrationC", + "The calibration to use for the b-tagging SFs (C- and T-jets)." + " Default 'default'", + "default"); + + registerParameter("BTaggingCalibrationLight", + "The calibration to use for the b-tagging SFs (Light-jets)." + " Default 'default'", + "default"); + + registerParameter("PRWConfigFiles", "List of PU config files, seperated by spaces (nothing by default)", " "); + registerParameter("PRWLumiCalcFiles", "List of PU lumicalc files, seperated by spaces (nothing by default)", " "); + registerParameter("PRWUseGRLTool", "Pass the GRL tool to the PU reweighting tool (False by default)", "False"); + registerParameter("PRWMuDependent", + "Use mu dependent random run numbers for MC. " + "True or False (default True)", + "True"); + + registerParameter("MuonTriggerSF", "Muon trigger SFs to calculate", "HLT_mu20_iloose_L1MU15_OR_HLT_mu50"); + + registerParameter("KLFitterTransferFunctionsPath","Select the transfer functions to use","8TeV/ttbar/mc12_LCJets_v1"); + registerParameter("KLFitterJetSelectionMode","kLeadingFour , kLeadingFive , kBtagPriorityFourJets , kBtagPriorityFiveJets","kBtagPriorityFourJets"); + registerParameter("KLFitterBTaggingMethod","Recommend use kNotag or kVetoNoFit - see KLFitter TWiki","kNotag"); + registerParameter("KLFitterLH", "Select likelihood depending on signal, ttbar or ttH.", "ttbar"); + registerParameter("KLFitterTopMassFixed","Fix the mass of the top quark? True or False","True"); + registerParameter("KLFitterSaveAllPermutations","Save All permutations to the output file (False will save only the best)","False"); + + registerParameter("DynamicKeys", "Additional dynamic key list seperated by ,", ""); + + registerParameter("OverlapRemovalProcedure", "Overlap removal procedure to be used. Options include:" + " recommended [default], jetmuApplyRelPt, harmonized," + " Boosted, BoostedSlidingDREl, BoostedSlidingDRMu, BoostedSlidingDRElMu, noTauJetOLR", + "recommended" + ); + + registerParameter("LargeJetOverlapRemoval", "Perform overlap removal including large-R jets. True or False (default: False).", "False"); + + registerParameter("HLLHC", + "Set to run HL-LHC studies," + "True or False (default False)", + "False"); +} + +ConfigurationSettings* ConfigurationSettings::get() { + if (!m_instance) + m_instance = new ConfigurationSettings(); + + return m_instance; +} + +void ConfigurationSettings::loadFromFile(const std::string& filename) { + std::ifstream input(filename.c_str()); + + if (!input) { + std::cout << "Configuration file does not exist, " << filename << std::endl; + std::cout << "Can't continue" << std::endl; + exit(1); + } + + struct SelectionData { + std::string name; + bool isSub; + std::vector<std::string> cuts; + }; + std::string line; + std::vector<SelectionData> selections; + + //for the key-value pairs + while (std::getline( input, line )) { + std::string newstring(line); + //std::cout << newstring << '\n'; + + if (newstring.find("#") != std::string::npos) + newstring = newstring.substr(0, newstring.find("#")); + + // remove (multiple) spaces hanging around relevant information + boost::algorithm::trim_all(newstring); + if (newstring.empty()) + continue; + + // handle start of a (sub)selection (implies end of key-value section) + if (boost::algorithm::starts_with(newstring, "SELECTION ")) { + selections.push_back({newstring.substr(10), false, {}}); + continue; + } + if (boost::algorithm::starts_with(newstring, "SUB ")) { + selections.push_back({newstring.substr(4), true, {}}); + continue; + } + + if (!selections.empty()) { + // read body of (sub)selection + auto & sel = selections.back(); + if (boost::algorithm::starts_with(newstring, ". ")) { + // source another (sub)selection here + auto subselName = newstring.substr(2); + auto subselIt = std::find_if(selections.rbegin(), selections.rend(), + [subselName](SelectionData const & sel){ return (subselName == sel.name); }); + if (subselIt == selections.rend()) + throw std::invalid_argument("ConfigurationSettings: unknown selection: " + subselName); + sel.cuts.insert(sel.cuts.end(), subselIt->cuts.begin(), subselIt->cuts.end()); + } + else { + sel.cuts.push_back(newstring); + } + continue; + } + + // parse key-value pair + std::istringstream liness(newstring); + std::string key; + std::string value; + + std::getline(liness, key, ' '); //to the space + std::getline(liness, value); //to the end of the line + + auto its = strings_.find(key); + if (its != strings_.end()) { + its->second.m_data = value; + its->second.m_set = true; + } + + //// add dynamic keys + if("DynamicKeys" == key) { + std::vector<std::string> listofkeys; + std::string separator = ","; + std::string::size_type start = 0, end = 0; + while ((end = value.find(separator, start)) != std::string::npos) { + std::string token = value.substr(start, end - start); + if(token.size()) listofkeys.push_back(token); + start = end + 1; + } + + std::string lasttoken = value.substr(start); + if(lasttoken.size()) listofkeys.push_back(lasttoken); + + for(auto par : listofkeys) { + registerParameter(par, "Dynamic parameter", ""); + } + } + } + + for (auto & sel : selections) { + if (sel.isSub) + continue; + m_selections.push_back({sel.name, sel.cuts}); + } + + input.close(); + m_configured = true; +} + + void ConfigurationSettings::registerParameter(const std::string& name, const std::string& message, const std::string& default_val) { + StringData data; + data.m_data = default_val; + data.m_human_explanation = message; + data.m_set = (default_val.empty() ? false : true); + strings_[name] = data; +} + +const std::string& ConfigurationSettings::value(const std::string& key) const { + //This class never has loadFromFile called + if (!m_configured) { + std::string message = "ConfigurationSettings: Not correctly configured\n"; + message.append("You need to call top::ConfigurationSettings::get()->loadFromFile(filename)\n"); + message.append("Early in your program\n"); + throw std::invalid_argument(message); + } + + std::map<std::string, StringData>::const_iterator its = strings_.find(key); + //The string is not in the map + if (its == strings_.end()) { + throw std::invalid_argument("ConfigurationSettings: The variable doesn't exist in the code " + key); + } + + //In the map, but never set to anything + if (!its->second.m_set) { + throw std::invalid_argument("ConfigurationSettings: You never set a value for " + key); + } + + return its->second.m_data; +} + +bool ConfigurationSettings::configured() const { + return m_configured; +} + +const std::map<std::string, StringData>& ConfigurationSettings::stringData() const { + return strings_; +} + +const std::vector<SelectionConfigurationData> ConfigurationSettings::selections() const { + return m_selections; +} + +bool ConfigurationSettings::retrieve(std::string const & key, bool & value) const { + using boost::trim; + using boost::equals; + using boost::iequals; + auto stringValue = ConfigurationSettings::get()->value(key); + trim(stringValue); + if (equals(stringValue, "")) { + return false; + } + if (iequals(stringValue, "false") or iequals(stringValue, "0") or iequals(stringValue, "n") or iequals(stringValue, "no") or iequals(stringValue, "off")) { + value = false; + return true; + } + if (iequals(stringValue, "true") or iequals(stringValue, "1") or iequals(stringValue, "y") or iequals(stringValue, "yes") or iequals(stringValue, "on")) { + value = true; + return true; + } + throw std::invalid_argument(std::string("expected boolean value for configuration setting ") + key); +} + +} + +std::ostream& operator<<(std::ostream& os, const top::SelectionConfigurationData& data) { + os << " - " << data.m_name << "\n"; + for (const auto& cutname : data.m_cutnames) + os << " " << cutname << "\n"; + + return os; +} + +std::ostream& operator<<(std::ostream& os, const top::ConfigurationSettings& settings) { + for (std::map<std::string, top::StringData >::const_iterator its = settings.stringData().begin(); its != settings.stringData().end(); ++its) { + std::stringstream s; + s << "\"" << its->first << "\""; + + std::stringstream s2; + s2 << "\"" << its->second.m_data << "\""; + os << std::setw(40) << std::left << s.str() << " : " << std::setw(35) << s2.str() << " - " << std::right << its->second.m_human_explanation << "\n"; + } + + //for (const auto& selection : settings.selections()) + // os << selection << "\n"; + + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..28d0ad31aa1c4f1593be2025ddc4aee2a7187156 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/LinkDef.h @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopConfiguration/TopPersistentSettings.h" + +#ifdef __CINT__ +#pragma extra_include "TopConfiguration/TopPersistentSettings.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class top::TopPersistentSettings+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx new file mode 100644 index 0000000000000000000000000000000000000000..feaa8e28a7c7d0e26787bab4a11034d36aba3637 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx @@ -0,0 +1,2391 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopConfig.cxx 803103 2017-04-18 17:30:51Z tpelzer $ +#include "TopConfiguration/TopConfig.h" +#include "TopConfiguration/AodMetaDataAccess.h" +#include "TopConfiguration/ConfigurationSettings.h" +#include <algorithm> +#include <iterator> +#include <sstream> +#include <stdexcept> + +#include <boost/algorithm/string.hpp> + +#include "TopConfiguration/Tokenize.h" + +namespace top{ + + TopConfig::TopConfig() : + // Prevent any more configuration + m_configFixed(false), + m_makeAllCPTools(true), + + // Use which objects + m_usePhotons(false), + m_useElectrons(false), + m_useMuons(false), + m_useAntiMuons(false), + m_useTaus(false), + m_useJets(false), + m_useLargeRJets(false), + m_useTrackJets(false), + m_useRCJets(false), + m_useVarRCJets(false), + m_useJetGhostTrack(false), + + m_useTruthParticles(false), + m_useTruthElectrons(false), + m_useTruthMuons(false), + m_useTruthPhotons(false), + m_useTruthJets(false), + m_useTruthLargeRJets(false), + m_useTruthMET(false), + + m_applyTTVACut(true), + + m_jetSubstructureName("None"), + + // Do systematics? - this needs many more configuration options + m_systematics("SetMe"), + /// special syst config + m_nominalSystName("Nominal"), + m_allSystName("All"), + + m_DSID(-1), + m_MapIndex(0), + // Is MC + m_isMC(false), + // Is AFII + m_isAFII(false), + // Is Primary xAOD + m_isPrimaryxAOD(false), + // Is Truth xAOD + m_isTruthDxAOD(false), + // Derivation name + m_derivationStream("SetMe"), + // Do loose events + m_doLooseEvents(false), + // Do fakes MM weights calculation + m_doFakesMMWeights(false), + // Directory of efficiency files for MM fake estimate + m_FakesMMDir("$ROOTCOREBIN/data/TopFakes"), + // Directory of efficiency files for MM fake estimate + m_doFakesMMDebug(false), + // Apply overlap removal on loose lepton definitons - not the top recommendation, for studies only + m_doOverlapRemovalOnLooseLeptonDef(false), + // do overlap removal also with large-R jets + // (using whatever procedure is used in the official tools) + m_doLargeJetOverlapRemoval(false), + // Only dumps the *_Loose trees - also on MC + m_doLooseTreeOnly(false), + // In the *_Loose trees, lepton SFs are calculated considering + // tight ID and isolation instead of loose + // Only tight leptons are considered in the event SF calculation + m_applyTightSFsInLooseTree(false), + // For boosted analysis + m_applyElectronInJetSubtraction(false), + // Write Truth block info + m_doTruthBlockInfo(false), + // Write Truth PDF info + m_doTruthPDFInfo(false), + m_doTruthPDFInfoInNominalTrees(false), + // Write MC generator weights + m_doMCGeneratorWeights(false), + m_doMCGeneratorWeightsInNominalTrees(false), + // Top Parton History + m_doTopPartonHistory(false), + m_isTopPartonHistoryRegisteredInNtuple(false), + + m_doTopParticleLevel(false), + m_doParticleLevelOverlapRemovalMuJet(true), + m_doParticleLevelOverlapRemovalElJet(true), + m_doParticleLevelOverlapRemovalJetPhoton(false), + + // KLFitter + m_doKLFitter(false), + m_KLFitterTransferFunctionsPath("SetMe"), + m_KLFitterJetSelectionMode("SetMe"), + m_KLFitterBTaggingMethod("SetMe"), + m_KLFitterLH("SetMe"), + m_KLFitterTopMassFixed(true), + m_KLFitterSaveAllPermutations(false), + + // PseudoTop + m_doPseudoTop(false), + + // StoreGate / TStore keys + m_sgKeyDummy("SetMe"), + m_sgKeyEventInfo("EventInfo"), + m_sgKeyPrimaryVertices("PrimaryVertices"), + m_sgKeyPhotons("SetMe"), + m_sgKeyElectrons("SetMe"), + m_sgKeyMuons("SetMe"), + m_sgKeyTaus("SetMe"), + m_sgKeyJets("SetMe"), + m_sgKeyLargeRJets("SetMe"), + m_sgKeyTrackJets("SetMe"), + m_sgKeyMissingEt("MET"), + m_sgKeyMissingEtLoose("LooseMET"), + m_sgKeyInDetTrackParticles("InDetTrackParticles"), + + m_sgKeyTruthEvent("TruthEvents"), + m_sgKeyMCParticle("SetMe"), + m_sgKeyTruthPhotons("TruthPhotons"), + m_sgKeyTruthElectrons("TruthElectrons"), + m_sgKeyTruthMuons("TruthMuons"), + m_sgKeyTruthTaus("TruthTaus"), + m_sgKeyTruthJets("SetMe"), + m_sgKeyTruthLargeRJets("SetMe"), + m_sgKeyTruthMET("MET_Truth"), + m_sgKeyTopPartonHistory("TopPartonHistory"), + + m_sgKeyTopSystematicEvents("TopSystematicEvents"), + m_sgKeyTopSystematicEventsLoose("TopSystematicEventsLoose"), + m_passEventSelectionDecoration("passEventSelection"), + m_decoKeyJetGhostTrack("GhostTrack"), + + // special: allow to dump the systematics-shifted b-tagging SFs in the systematics trees + m_dumpBtagSystsInSystTrees(false), + + // Electron configuration + m_egammaSystematicModel("1NP_v1"), + m_electronID("SetMe"), + m_electronIDLoose("SetMe"), + m_electronVetoLArCrack(true), + m_electronPtcut(25000.), + m_electronIsolation("SetMe"), + m_electronIsolationLoose("SetMe"), + m_electronIsoSFs(true), + m_electronIDDecoration("SetMe"), + m_electronIDLooseDecoration("SetMe"), + + // Muon configuration + m_muonPtcut(25000.), + m_muonEtacut(2.5), + m_muonQuality("SetMe"), + m_muonQualityLoose("SetMe"), + m_muonIsolation("SetMe"), + m_muonIsolationLoose("SetMe"), + + // Jet configuration + m_jetPtcut(25000.), + m_jetEtacut(2.5), + m_fwdJetAndMET("Default"), + m_jetUncertainties_BunchSpacing("25ns"), + m_jetUncertainties_NPModel("AllNuisanceParameters"), + m_doMultipleJES(false), + m_jetJERSmearingModel("Simple"), + m_jetCalibSequence("GSC"), + m_doJVTInMETCalculation(true), + + m_largeRJetPtcut(25000.), + m_largeRJetEtacut(2.5), + m_largeRJESUncertaintyConfig("SetMe"), + m_largeRJESJMSConfig("SetMe"), + + m_trackJetPtcut(7000.0), + m_trackJetEtacut(2.5), + + m_JSF(1.0), + m_bJSF(1.0), + + // Tau configuration + /** + m_tauJetID("SetMe"), + m_tauJetIDBkg("SetMe"), + m_tauEVetoID("SetMe"), + m_tauVetoLArCrack(false), + m_tauPtcut(20000.), + **/ + // Applying new tau energy calibration + m_applyTauMVATES(false), + + // [[[----------------------------------------------- + // Particle Level / Truth Configuration + m_truth_electron{ 25000., 2.5, true, false }, + m_truth_muon{ 25000., 2.5, true, false }, + m_truth_photon{ 25000., 2.5, "SET_ME", "SET_ME" }, + m_truth_jet{ 25000., 2.5 }, + // -----------------------------------------------]]] + + // HL LHC studies + m_HLLHC(false), + + // Selections + m_allSelectionNames(nullptr), + // Trigger + m_allTriggers(nullptr), + m_electronTriggers(nullptr), + m_muonTriggers(nullptr), + m_tauTriggers(nullptr), + + // Where the sum of event weights + // before derivation framework is kept + m_sumOfEventWeightsMetaData("CutBookkeepersAux.sumOfEventWeights"), + + // Object Selector name + m_objectSelectionName("SetMe"), + // Output Format + m_outputFormat("SetMe"), + // Output Events + m_outputEvents("SetMe"), + m_saveOnlySelectedEvents(true), + m_outputFileSetAutoFlushZero(false), + + // Number of events to run on (only for testing) + m_numberOfEventsToRun(0), + + // Number of events to skip (only for testing) + m_numberOfEventsToSkip(0), + + m_aodMetaData(new AodMetaDataAccess()), + + // Systematics + m_nominalHashValue(0), + + m_systHashPhotons(nullptr), + m_systHashElectrons(nullptr), + m_systHashMuons(nullptr), + m_systHashTaus(nullptr), + m_systHashJets(nullptr), + m_systHashLargeRJets(nullptr), + m_systHashTrackJets(nullptr), + m_systHashMET(nullptr), + + m_systHashAll(nullptr), + m_list_systHashAll(nullptr), + m_systHash_electronInJetSubtraction(nullptr), + m_list_systHash_electronInJetSubtraction(nullptr), + + + m_systMapPhotons(nullptr), + m_systMapElectrons(nullptr), + m_systMapMuons(nullptr), + m_systMapTaus(nullptr), + m_systMapJets(nullptr), + m_systMapLargeRJets(nullptr), + m_systMapTrackJets(nullptr), + m_systMapMET(nullptr), + + m_systSgKeyMapPhotons(nullptr), + m_systSgKeyMapElectrons(nullptr), + m_systSgKeyMapMuons(nullptr), + m_systSgKeyMapTaus(nullptr), + m_systSgKeyMapJets(nullptr), + m_systSgKeyMapJets_electronInJetSubtraction(nullptr), + m_systSgKeyMapJetsLoose_electronInJetSubtraction(nullptr), + m_systSgKeyMapLargeRJets(nullptr), + m_systSgKeyMapTrackJets(nullptr), + m_systSgKeyMapMET(nullptr), + + m_systAllSgKeyMapPhotons(nullptr), + m_systAllSgKeyMapElectrons(nullptr), + m_systAllSgKeyMapMuons(nullptr), + m_systAllSgKeyMapTaus(nullptr), + m_systAllSgKeyMapJets(nullptr), + m_systAllSgKeyMapLargeRJets(nullptr), + m_systAllSgKeyMapTrackJets(nullptr), + m_systAllSgKeyMapElectrons_electronInJetSubtraction(nullptr), + m_systAllSgKeyMapJets_electronInJetSubtraction(nullptr), + m_systAllSgKeyMapJetsLoose_electronInJetSubtraction(nullptr), + + m_systAllSgKeyMapPhotonsTDS(nullptr), + m_systAllSgKeyMapPhotonsTDSAux(nullptr), + m_systAllSgKeyMapElectronsTDS(nullptr), + m_systAllSgKeyMapElectronsTDSAux(nullptr), + m_systAllSgKeyMapMuonsTDS(nullptr), + m_systAllSgKeyMapMuonsTDSAux(nullptr), + m_systAllSgKeyMapTausTDS(nullptr), + m_systAllSgKeyMapTausTDSAux(nullptr), + m_systAllSgKeyMapJetsTDS(nullptr), + m_systAllSgKeyMapJetsTDSAux(nullptr), + m_systAllSgKeyMapLargeRJetsTDS(nullptr), + m_systAllSgKeyMapLargeRJetsTDSAux(nullptr), + m_systAllSgKeyMapTrackJetsTDS(nullptr), + m_systAllSgKeyMapTrackJetsTDSAux(nullptr), + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS(nullptr), + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux(nullptr), + m_systAllSgKeyMapJets_electronInJetSubtractionTDS(nullptr), + m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux(nullptr), + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS(nullptr), + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux(nullptr), + + m_systSgKeyMapMissingET(nullptr), + m_systSgKeyMapMissingETLoose(nullptr), + + m_sgKeyKLFitter("KLFitterResults"), + m_systSgKeyMapKLFitter(nullptr), + m_systSgKeyMapKLFitterLoose(nullptr), + + m_sgKeyPseudoTop("PseudoTopResult"), + m_systSgKeyMapPseudoTop(nullptr), + m_systMapJetGhostTrack(nullptr), + m_systDecoKeyMapJetGhostTrack(nullptr), + + m_systAllTTreeNames(nullptr), + m_systPersistantAllTTreeNames(nullptr), + m_systAllTTreeIndex(nullptr), + m_systAllTTreeLooseIndex(nullptr) + { + m_allSelectionNames = std::shared_ptr<std::vector<std::string>> ( new std::vector<std::string> ); + + m_systHashPhotons = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashElectrons = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashMuons = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashTaus = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashJets = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashLargeRJets = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashTrackJets = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_systHashMET = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + + m_systHashAll = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_list_systHashAll = std::shared_ptr<std::list<std::size_t>> ( new std::list<std::size_t> ); + m_systHash_electronInJetSubtraction = std::shared_ptr<std::unordered_set<std::size_t>> ( new std::unordered_set<std::size_t> ); + m_list_systHash_electronInJetSubtraction = std::shared_ptr<std::list<std::size_t>> ( new std::list<std::size_t> ); + + m_systMapPhotons = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapElectrons = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapMuons = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapTaus = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapJets = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapLargeRJets = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapTrackJets = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systMapMET = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + + m_systSgKeyMapPhotons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapElectrons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapMuons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapTaus = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapJets_electronInJetSubtraction = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapJetsLoose_electronInJetSubtraction = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapLargeRJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapTrackJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapMET = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systAllSgKeyMapPhotons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapElectrons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapMuons = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTaus = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapLargeRJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTrackJets = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systAllSgKeyMapElectrons_electronInJetSubtraction + = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJets_electronInJetSubtraction + = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJetsLoose_electronInJetSubtraction + = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systAllSgKeyMapPhotonsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapPhotonsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapElectronsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapElectronsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapMuonsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapMuonsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTausTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTausTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJetsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJetsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapLargeRJetsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapLargeRJetsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTrackJetsTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapTrackJetsTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJets_electronInJetSubtractionTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + + m_systSgKeyMapMissingET = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapMissingETLoose = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systSgKeyMapKLFitter = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systSgKeyMapKLFitterLoose = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systSgKeyMapPseudoTop = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systMapJetGhostTrack = std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> ( new std::unordered_map<std::size_t,CP::SystematicSet> ); + m_systDecoKeyMapJetGhostTrack = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + + m_systAllTTreeNames = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systPersistantAllTTreeNames = std::shared_ptr<std::unordered_map<std::size_t,std::string>> ( new std::unordered_map<std::size_t,std::string> ); + m_systAllTTreeIndex = std::shared_ptr<std::unordered_map<std::size_t,unsigned int>> ( new std::unordered_map<std::size_t,unsigned int> ); + m_systAllTTreeLooseIndex = std::shared_ptr<std::unordered_map<std::size_t,unsigned int>> ( new std::unordered_map<std::size_t,unsigned int> ); + + // Nominal has value + CP::SystematicSet nominal; + m_nominalHashValue = nominal.hash(); + } + + void TopConfig::setConfigSettings( top::ConfigurationSettings* const& settings ) + { + // Selections + const std::vector<top::SelectionConfigurationData> allSelections = settings->selections(); + for (auto sel : allSelections) { + m_allSelectionNames->push_back( sel.m_name ); + } + + // set GRL file + this->setGrlDir( settings->value("GRLDir") ); + this->setGrlFile( settings->value("GRLFile") ); + + //we need storegate keys so people can pick different collections / met / jets etc. + this->sgKeyPhotons( settings->value("PhotonCollectionName") ); + this->sgKeyElectrons( settings->value("ElectronCollectionName") ); + this->sgKeyMuons( settings->value("MuonCollectionName") ); + this->sgKeyTaus( settings->value("TauCollectionName") ); + this->sgKeyJets( settings->value("JetCollectionName") ); + this->sgKeyLargeRJets( settings->value("LargeJetCollectionName") ); + this->sgKeyTrackJets( settings->value("TrackJetCollectionName") ); + this->jetSubstructureName( settings->value("LargeJetSubstructure") ); + this->decoKeyJetGhostTrack( settings->value("JetGhostTrackDecoName") ); + + if(settings->value("applyTTVACut") == "False") + this->m_applyTTVACut = false; + + if (this->isMC()) { + this->sgKeyMCParticle( settings->value("TruthCollectionName") ); + this->sgKeyTruthElectrons( settings->value("TruthElectronCollectionName") ); + this->sgKeyTruthMuons( settings->value("TruthMuonCollectionName") ); + this->sgKeyTruthPhotons( settings->value("TruthPhotonCollectionName") ); + this->sgKeyTruthMET( settings->value("TruthMETCollectionName") ); + this->sgKeyTruthJets( settings->value("TruthJetCollectionName") ); + this->sgKeyTruthLargeRJets( settings->value("TruthLargeRJetCollectionName") ); + + // Dump truth block + if (settings->value("TruthBlockInfo") == "True") + this->setTruthBlockInfo(); + + // Save the Truth PDF information + if (settings->value("PDFInfo") == "True") { + this->setTruthPDFInfo(); + } + else if (settings->value("PDFInfo") == "Nominal") { + // Save the Truth PDF information in the reco-level tree instead of the truth-level one + this->setTruthPDFInfo(); + this->setTruthPDFInfoInNominalTrees(); + } + + // Save the MC generator weights + if (settings->value("MCGeneratorWeights") == "True") { + this->setMCGeneratorWeights(); + } + else if (settings->value("MCGeneratorWeights") == "Nominal") { + // Save the Truth PDF information in the reco-level tree instead of the truth-level one + this->setMCGeneratorWeights(); + this->setMCGeneratorWeightsInNominalTrees(); + } + + // Save the Top Parton History + if (this->useTruthParticles() && settings->value("TopPartonHistory") != "False") + this->setTopPartonHistory(); + + // Perform particle-level selection and save particle level objects + if ( settings->value("TopParticleLevel") == "True" ){ + this->setTopParticleLevel(); + } + // Particle-level OR + if (settings->value("DoParticleLevelOverlapRemoval") == "True"){ + // Value True -> Do all ORs + this->setParticleLevelOverlapRemovalElJet(true); + this->setParticleLevelOverlapRemovalMuJet(true); + this->setParticleLevelOverlapRemovalJetPhoton(true); + } else if (settings->value("DoParticleLevelOverlapRemoval") == "False"){ + // Value False -> Do not perform any OR. + this->setParticleLevelOverlapRemovalElJet(false); + this->setParticleLevelOverlapRemovalMuJet(false); + this->setParticleLevelOverlapRemovalJetPhoton(false); + } else { + // Explicitly specify the possible OR values. + std::vector<std::string> tokens; + tokenize(settings->value("DoParticleLevelOverlapRemoval"), tokens, ","); + while (tokens.size()){ + const auto & token = tokens.back(); + + if (token == "MuonJet"){ + this->setParticleLevelOverlapRemovalMuJet(true); + } else if (token == "ElectronJet"){ + this->setParticleLevelOverlapRemovalElJet(true); + } else if (token == "JetPhoton"){ + this->setParticleLevelOverlapRemovalJetPhoton(true); + } else { + throw std::runtime_error{"TopConfig: Option DoParticleLevelOverlapRemoval: Invalid Token"}; + } + + // Remove the last token in the container. + tokens.pop_back(); + } + } + + + // check if you are running over AFII samples + // only check the configuration file if the AodMetaData is not instatiated + if(m_aodMetaData->valid()){ + try{ + auto simulatorName = m_aodMetaData->get("/Simulation/Parameters","Simulator"); + bool aodMetaDataIsAFII = m_aodMetaData->isAFII(); + std::cout << "AodMetaData :: Simulation Type " << simulatorName << " -> " << "Setting IsAFII to " << aodMetaDataIsAFII << std::endl; + this->setIsAFII(aodMetaDataIsAFII); + } + catch(std::logic_error aodMetaDataError){ + std::cout << "An error was encountered handling AodMetaData : " << aodMetaDataError.what() << std::endl; + std::cout << "We will attempt to read the IsAFII flag from your config." << std::endl; + this->ReadIsAFII(settings); + } + } + else{ + this->ReadIsAFII(settings); + } + // Special mode to run Loose events on MC for the purposes + // of determining the Fakes control regions + // Not for regular analysis users + // If you use this option, and are not part of the Fakes sub-group, you just joined! + // Please report your studies in the top-fakes meetings! + if (settings->value("FakesControlRegionDoLooseMC") == "True") + this->FakesControlRegionDetermination_setDoLooseEventsOnMC_notForRegularUsers(); + } + + if (!this->isMC()) { + m_doLooseEvents = true; + if (settings->value("FakesMMWeights") == "True") { + this->setFakesMMWeightsCalculation(); + std::string dir = settings->value("FakesMMDir"); + if (dir != "") + this->setFakesMMDir(dir); + if (settings->value("FakesMMDebug") == "True") + this->setFakesMMDebug(); + } + } + + // Object Selection Name + this->objectSelectionName( settings->value("ObjectSelectionName") ); + // Output Format + this->outputFormat( settings->value("OutputFormat") ); + // Output Events + this->outputEvents( settings->value("OutputEvents") ); + // SetAutoFlush(0) on EventSaverFlatNtuple for ANALYSISTO-44 workaround + m_outputFileSetAutoFlushZero = false; + if (settings->value( "OutputFileSetAutoFlushZero" ) == "True") + m_outputFileSetAutoFlushZero = true; + + // The systematics want much much more configuration options..... + this->systematics( settings->value("Systematics") ); + + // special: allow to dump the systematics-shifted b-tagging SFs in the systematics trees + if (settings->value( "DumpBtagSystsInSystTrees" ) == "True") + this->dumpBtagSystsInSystTrees(true); + + // Electron configuration + this->egammaSystematicModel( settings->value("EgammaSystematicModel") ); + this->electronID( settings->value("ElectronID") ); + this->electronIDLoose( settings->value("ElectronIDLoose") ); + this->electronIsolation( settings->value("ElectronIsolation") ); + this->electronIsolationLoose( settings->value("ElectronIsolationLoose") ); + this->electronPtcut( std::stof(settings->value("ElectronPt")) ); + if( settings->value("ElectronIsoSFs") == "False" ) + this->m_electronIsoSFs = false; + + m_electronIDDecoration = "AnalysisTop_" + m_electronID; + m_electronIDLooseDecoration = "AnalysisTop_" + m_electronIDLoose; + + // Photon configuration + this->photonPtcut( std::stof(settings->value("PhotonPt")) ); + this->photonEtacut( std::stof(settings->value("PhotonEta")) ); + this->photonIdentification( settings->value("PhotonID") ); + this->photonIdentificationLoose( settings->value("PhotonIDLoose") ); + this->photonIsolation( settings->value("PhotonIsolation") ); + this->photonIsolationLoose( settings->value("PhotonIsolationLoose") ); + if( settings->value("PhotonUseRadiativeZ") == "True" ) + this->m_photon_configuration.useRadiativeZ = true; + + // Muon configuration + this->muonPtcut( std::stof(settings->value("MuonPt")) ); + this->muonEtacut( std::stof(settings->value("MuonEta")) ); + this->muonQuality( settings->value("MuonQuality") ); + this->muonQualityLoose( settings->value("MuonQualityLoose") ); + this->muonIsolation( settings->value("MuonIsolation") ); + this->muonIsolationLoose( settings->value("MuonIsolationLoose") ); + + if (settings->value("UseAntiMuons") == "True") + this->m_useAntiMuons = true; + + + //tau configuration + this->tauPtcut(std::stof(settings->value("TauPt"))); + this->tauJetIDWP(settings->value("TauJetIDWP")); + this->tauJetIDWPLoose(settings->value("TauJetIDWPLoose")); + this->tauEleBDTWP(settings->value("TauEleBDTWP")); + this->tauEleBDTWPLoose(settings->value("TauEleBDTWPLoose")); + this->tauEleOLR((settings->value("TauEleOLR") == "True")); + this->tauEleOLRLoose((settings->value("TauEleOLRLoose") == "True")); + this->tauJetConfigFile(settings->value("TauJetConfigFile")); + this->tauJetConfigFileLoose(settings->value("TauJetConfigFileLoose")); + this->applyTauMVATES((settings->value("ApplyTauMVATES") == "True")); + + // Jet configuration + this->jetPtcut( std::stof(settings->value("JetPt")) ); + this->jetEtacut( std::stof(settings->value("JetEta")) ); + this->fwdJetAndMET( settings->value("FwdJetAndMET") ); + this->jetUncertainties_BunchSpacing( settings->value("JetUncertainties_BunchSpacing") ); + this->jetUncertainties_NPModel( settings->value("JetUncertainties_NPModel") ); + this->jetJERSmearingModel( settings->value("JetJERSmearingModel") ); + this->jetCalibSequence( settings->value("JetCalibSequence") ); + this->doJVTinMET( (settings->value("JVTinMETCalculation") == "True" ? true : false) ); + this->m_largeRSmallRCorrelations = settings->value("LargeRSmallRCorrelations") == "True" ? true : false; + + this->largeRJetPtcut( std::stof(settings->value("LargeRJetPt")) ); + this->largeRJetEtacut( std::stof(settings->value("LargeRJetEta")) ); + this->largeRJESUncertaintyConfig( settings->value("LargeRJESUncertaintyConfig") ); + this->largeRJESJMSConfig( settings->value("LargeRJESJMSConfig") ); + + this->trackJetPtcut( std::stof(settings->value("TrackJetPt")) ); + this->trackJetEtacut( std::stof(settings->value("TrackJetEta")) ); + + // Jet configuration reclustered jets + this->RCJetPtcut(std::stof(settings->value("RCJetPt")) ); + this->RCJetEtacut(std::stof(settings->value("RCJetEta")) ); + this->RCJetTrimcut(std::stof(settings->value("RCJetTrim")) ); + this->RCJetRadius(std::stof(settings->value("RCJetRadius")) ); + if (settings->value("UseRCJets") == "True" || settings->value("UseRCJets") == "true") + this->m_useRCJets = true; + + this->VarRCJetPtcut(std::stof(settings->value("VarRCJetPt")) ); + this->VarRCJetEtacut(std::stof(settings->value("VarRCJetEta")) ); + this->VarRCJetTrimcut(std::stof(settings->value("VarRCJetTrim")) ); + this->VarRCJetMaxRadius(std::stof(settings->value("VarRCJetMaxRadius")) ); + this->VarRCJetRho(settings->value("VarRCJetRho")); + this->VarRCJetMassScale(settings->value("VarRCJetMassScale")); + if (settings->value("UseVarRCJets") == "True" || settings->value("UseVarRCJets") == "true") + this->m_useVarRCJets = true; + + // for top mass analysis, per default set to 1.0! + m_JSF = std::stof(settings->value("JSF")); + m_bJSF = std::stof(settings->value("bJSF")); + + // If parameter exists remove electron crack veto + if (settings->value("ElectronVetoLArCrack") == "False") + this->removeElectronVetoLArCrack(); + + // By default the top group does overlap removal on the tight lepton definitions + // If you use this you are going off piste and need to report + // your findings to the top reconstruction meeting + if (settings->value("OverlapRemovalLeptonDef") == "Loose") + this->setOverlapRemovalOnLooseLeptonDef(); + + m_overlap_removal_procedure = settings->value("OverlapRemovalProcedure"); + + // do overlap removal also with large-R jets + // (using whatever procedure is used in the official tools) + if (settings->value("LargeJetOverlapRemoval") == "True") { + this->setLargeJetOverlapRemoval();// only usefull in case of MC + } + + // Only dumps the *_Loose trees - also on MC + // Usefull if you want your tight selection to be a subset of loose + if (settings->value("DoLooseTreeOnly") == "True") { + this->setLooseTreeOnly(); + if (this->isMC())// in case of MC *_Loose trees have to be activated + this->FakesControlRegionDetermination_setDoLooseEventsOnMC_notForRegularUsers(); + } + + // In the *_Loose trees, lepton SFs are calculated considering + // tight ID and isolation instead of loose + // Only tight leptons are considered in the event SF calculation + if (settings->value("ApplyTightSFsInLooseTree") == "True") { + if (this->isMC()) + this->setApplyTightSFsInLooseTree();// only usefull in case of MC + } + + // Apply Electron In Jet Subtraction - boosted analysis + if (settings->value("ApplyElectronInJetSubtraction") == "True") + this->setApplyElectronInJetSubtraction(); + + // Set Number of events to run on (for testing) + this->numberOfEventsToRun( std::stoi(settings->value("NEvents")) ); + + // Set Number of the first Event to run skip (for testing) + this->numberOfEventsToSkip( std::stoi(settings->value("FirstEvent")) ); + + // [[[----------------------------------------------- + //; Particle Level / Truth Configuration + this->truth_electron_PtCut( std::stof( settings->value( "TruthElectronPt" ) ) ); + this->truth_electron_EtaCut( std::stof( settings->value( "TruthElectronEta" ) ) ); + + this->truth_muon_PtCut( std::stof( settings->value( "TruthMuonPt" ) ) ); + this->truth_muon_EtaCut( std::stof( settings->value( "TruthMuonEta" ) ) ); + + this->truth_photon_PtCut( std::stof( settings->value( "TruthPhotonPt" ) ) ); + this->truth_photon_EtaCut( std::stof( settings->value( "TruthPhotonEta" ) ) ); + // The TruthPhoton Origin and Isolation parameters are validated inside the + // TopParticleLevel Loader Class. + this->truth_photon_Origin( settings->value( "TruthPhotonOrigin" ) ); + this->truth_photon_Isolation( settings->value( "TruthPhotonIsolation" ) ); + + this->truth_jet_PtCut( std::stof( settings->value( "TruthJetPt" ) ) ); + this->truth_jet_EtaCut( std::stof( settings->value( "TruthJetEta" ) ) ); + + this->truth_jet_largeR_PtCut( std::stof( settings->value( "TruthLargeRJetPt" ) ) ); + this->truth_jet_largeR_EtaCut( std::stof( settings->value( "TruthLargeRJetEta" ) ) ); + + // -----------------------------------------------]]] + + // Upgrade studies + if(settings->value("HLLHC")=="True") this->HLLHC( true ); + + // LHAPDF Reweighting configuration + std::istringstream lha_pdf_ss(settings->value( "LHAPDFSets" )); + std::copy( std::istream_iterator<std::string>(lha_pdf_ss), + std::istream_iterator<std::string>(), + std::back_inserter(m_lhapdf_options.pdf_set_names) ); + + // if provided, it will be used to recompute XF1,XF2 (if any is zero) + const std::string LHAPDFBase = settings->value("LHAPDFBaseSet"); + if( LHAPDFBase.find_first_not_of(' ') != std::string::npos ) { + // should only set one base PDF set + if( LHAPDFBase.find(' ') != std::string::npos ) + std::cout << "LHAPDFBaseSet: " << LHAPDFBase + << " <<<<< only one PDF set allowed for recomputing XF1,XF2 !!!" << std::endl; + m_lhapdf_options.baseLHAPDF = LHAPDFBase; + } + // if not already present, add to the list of PDF sets + if( ! m_lhapdf_options.baseLHAPDF.empty() && + !(std::find(m_lhapdf_options.pdf_set_names.begin(), + m_lhapdf_options.pdf_set_names.end(), + m_lhapdf_options.baseLHAPDF) != m_lhapdf_options.pdf_set_names.end()) ) + m_lhapdf_options.pdf_set_names.push_back(m_lhapdf_options.baseLHAPDF); + + if( m_lhapdf_options.pdf_set_names.size() && this->isMC() ) + m_lhapdf_options.doLHAPDF = true; + + if( m_lhapdf_options.pdf_set_names.size() && this->isMC() && settings->value("LHAPDFEventWeights") == "True" ) { + m_lhapdf_options.save_per_event = true; + } + else if( m_lhapdf_options.pdf_set_names.size() && this->isMC() && settings->value("LHAPDFEventWeights") == "Nominal" ) { + m_lhapdf_options.save_per_event = true; + m_lhapdf_options.doLHAPDFInNominalTrees = true; + } + + + // now get all Btagging WP from the config file, and store them properly in a map. + // Need function to compare the cut value with the WP and vice versa + + std::istringstream str_btagging_WP(settings->value( "BTaggingWP" )); + + std::vector<std::string> all_btagging_WP; + std::copy( std::istream_iterator<std::string>(str_btagging_WP), + std::istream_iterator<std::string>(), + std::back_inserter(all_btagging_WP) ); + + // loop through all btagging WPs requested + for (auto tag : all_btagging_WP) { + std::cout << "TopConfig: ==================================================> " << tag << std::endl; + std::string formatedWP = FormatedWP(tag); + // take care that no WP is taken twice + if ( std::find(m_chosen_btaggingWP.begin(), m_chosen_btaggingWP.end(), formatedWP) == m_chosen_btaggingWP.end() ) { + m_chosen_btaggingWP.push_back(formatedWP); + std::cout << "chosen btagging WP ===============================================> " << m_chosen_btaggingWP.back() << std::endl; + } else { + std::cout << "WP " << formatedWP << " aldready choosen" << std::endl; + } + } + + m_btagging_calibration_B = settings->value("BTaggingCalibrationB"); + m_btagging_calibration_C = settings->value("BTaggingCalibrationC"); + m_btagging_calibration_Light = settings->value("BTaggingCalibrationLight"); + m_bTagSystsExcludedFromEV = settings->value( "BTaggingSystExcludedFromEV" ); + + /************************************************************ + * + * Loop through all suplied config files and make into a + * vector if we have at least one config and at least one + * lumi calc file (and is MC) then apply PU reweighting + * Note: PathResolving done in TopCPTools. + * + ***********************************************************/ + + std::istringstream pileup_config_ss(settings->value( "PRWConfigFiles" )); + std::copy( std::istream_iterator<std::string>(pileup_config_ss), + std::istream_iterator<std::string>(), + std::back_inserter(m_pileup_reweighting.config_files) ); + + std::istringstream pileup_lumi_ss(settings->value( "PRWLumiCalcFiles" )); + std::copy( std::istream_iterator<std::string>(pileup_lumi_ss), + std::istream_iterator<std::string>(), + std::back_inserter(m_pileup_reweighting.lumi_calc_files) ); + + m_pileup_reweighting.mu_dependent = (settings->value("PRWMuDependent") == "True"); + + // now even if the user don't provide a PRWConfigFiles, PRW is done on MC, using the default calibration file + if ( m_pileup_reweighting.lumi_calc_files.size() > 0 ) { + m_pileup_reweighting.apply = true; + } + + if ( m_pileup_reweighting.apply && m_grlFile.size() > 0 && settings->value("PRWUseGRLTool") == "True" ) + m_pileup_reweighting.use_grl_tool = true; + + // TRUTH derivations do not contain pile-up weights + if(m_isTruthDxAOD) + m_pileup_reweighting.apply = false; + + /************************************************************ + * + * Muon trigger SF configuration + * see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MCPAnalysisGuidelinesMC15#How_to_retrieve_the_SF + * for the various trigger strings allowed + * + ************************************************************/ + + m_muon_trigger_SF = settings->value( "MuonTriggerSF" ); + + ///-- KLFitter settings --/// + m_KLFitterTransferFunctionsPath = settings->value( "KLFitterTransferFunctionsPath" ); + m_KLFitterJetSelectionMode = settings->value( "KLFitterJetSelectionMode" ); + m_KLFitterBTaggingMethod = settings->value( "KLFitterBTaggingMethod" ); + m_KLFitterLH = settings->value( "KLFitterLH" ); + + if (settings->value( "KLFitterTopMassFixed" ) == "True") + m_KLFitterTopMassFixed = true; + if (settings->value( "KLFitterTopMassFixed" ) == "False") + m_KLFitterTopMassFixed = false; + if (settings->value( "KLFitterSaveAllPermutations" ) == "True") + m_KLFitterSaveAllPermutations = true; + if (settings->value( "KLFitterSaveAllPermutations" ) == "False") + m_KLFitterSaveAllPermutations = false; + + + + + } + + void TopConfig::setGrlDir( const std::string& s ) + { + if (!m_configFixed) { + m_grlDir = s; + m_grlDir.erase(remove_if(m_grlDir.begin(), m_grlDir.end(), isspace), m_grlDir.end()); + } + } + + void TopConfig::setGrlFile(const std::string& s) { + if (!m_configFixed) { + std::istringstream grl_files_ss(s); + std::vector<std::string> temp_grls = {}; + std::copy(std::istream_iterator<std::string>(grl_files_ss), + std::istream_iterator<std::string>(), + std::back_inserter(temp_grls)); + // m_grlFile = s; + for (std::string grl : temp_grls) { + grl.erase(remove_if(grl.begin(), grl.end(), isspace), grl.end()); + m_grlFile.push_back(grl); + } + } + } + + void TopConfig::jetUncertainties_NPModel( const std::string& s ) + { + if (!m_configFixed) { + m_jetUncertainties_NPModel = s; + m_doMultipleJES = false; + if (m_jetUncertainties_NPModel == "3NP") { + m_doMultipleJES = true; + } + } + } + + void TopConfig::sgKeyMCParticle(const std::string& s) + { + if (!m_configFixed) { + m_useTruthParticles = false; + if (s != "None") + m_useTruthParticles = true; + + m_sgKeyMCParticle = s; + } + } + + void TopConfig::sgKeyPhotons(const std::string& s) + { + if (!m_configFixed) { + m_usePhotons = false; + if (s != "None") + m_usePhotons = true; + + m_sgKeyPhotons = s; + } + } + + void TopConfig::sgKeyElectrons(const std::string& s) + { + if (!m_configFixed){ + m_useElectrons = false; + if (s != "None") + m_useElectrons = true; + + m_sgKeyElectrons = s; + } + } + + + void TopConfig::sgKeyMuons(const std::string& s) + { + if(!m_configFixed){ + m_useMuons = false; + if (s != "None") + m_useMuons = true; + + m_sgKeyMuons = s; + } + } + + void TopConfig::sgKeyTaus(const std::string& s) + { + if(!m_configFixed){ + m_useTaus = false; + if (s != "None") + m_useTaus = true; + + m_sgKeyTaus = s; + } + } + + void TopConfig::sgKeyJets(const std::string& s) + { + if (!m_configFixed){ + m_useJets = false; + if (s != "None") + m_useJets = true; + + // If anti-kt4 pflow jets then... + if (s == "AntiKt4EMPFlowJets" ) + m_useParticleFlowJets = true; + + m_sgKeyJets = s; + } + } + + void TopConfig::sgKeyLargeRJets(const std::string& s) + { + if(!m_configFixed){ + m_useLargeRJets = false; + if (s != "None") + m_useLargeRJets = true; + + m_sgKeyLargeRJets = s; + } + } + + void TopConfig::sgKeyTrackJets(const std::string& s) + { + if(!m_configFixed){ + m_useTrackJets = false; + if (s != "None") + m_useTrackJets = true; + + m_sgKeyTrackJets = s; + } + } + + void TopConfig::sgKeyTruthElectrons(const std::string& s) + { + if(!m_configFixed){ + m_useTruthElectrons = false; + if (s != "None") + m_useTruthElectrons = true; + + m_sgKeyTruthElectrons = s; + } + } + + void TopConfig::sgKeyTruthMuons(const std::string& s) + { + if(!m_configFixed){ + m_useTruthMuons = false; + if (s != "None") + m_useTruthMuons = true; + + m_sgKeyTruthMuons = s; + } + } + + void TopConfig::sgKeyTruthPhotons(const std::string& s) + { + if(!m_configFixed){ + m_useTruthPhotons = false; + if (s != "None"){ + m_useTruthPhotons = true; + } + + m_sgKeyTruthPhotons = s; + } + } + + void TopConfig::sgKeyTruthMET(const std::string& s) + { + if(!m_configFixed){ + m_useTruthMET = false; + if (s != "None") + m_useTruthMET = true; + + m_sgKeyTruthMET = s; + } + } + + void TopConfig::sgKeyTruthJets(const std::string& s) + { + if(!m_configFixed){ + m_useTruthJets = false; + if (s != "None") + m_useTruthJets = true; + + m_sgKeyTruthJets = s; + } + } + + void TopConfig::sgKeyTruthLargeRJets(const std::string& s) + { + if(!m_configFixed){ + m_useTruthLargeRJets = false; + if (s != "None") + m_useTruthLargeRJets = true; + + m_sgKeyTruthLargeRJets = s; + } + } + + void TopConfig::decoKeyJetGhostTrack(const std::string & key) + { + if (!m_configFixed) { + m_useJetGhostTrack = false; + if (key != "None") + m_useJetGhostTrack = true; + + m_decoKeyJetGhostTrack = key; + } + } + + // setting the run periods for ghost track + // even if configuration is fixed - could be changed later + void TopConfig::runPeriodJetGhostTrack(const std::vector<std::uint32_t> & vect) + { + if (m_useJetGhostTrack == true) + m_jetGhostTrackRunPeriods = vect; + } + + void TopConfig::setBTaggingSFSysts( std::string WP, const std::set<std::string>& btagging_SF_names, bool isTrackJet ) + { + + //this avoids code duplication + std::unordered_map<std::string,std::set<std::string>>& base_names = isTrackJet ? bTag_base_names_trkJet : bTag_base_names; + std::unordered_map<std::string,std::set<std::string>>& named_systs = isTrackJet ? bTag_named_systs_trkJet : bTag_named_systs; + std::unordered_map<std::string,unsigned int>& eigen_B = isTrackJet ? bTag_eigen_B_trkJet : bTag_eigen_B; + std::unordered_map<std::string,unsigned int>& eigen_C = isTrackJet ? bTag_eigen_C_trkJet : bTag_eigen_C; + std::unordered_map<std::string,unsigned int>& eigen_light = isTrackJet ? bTag_eigen_light_trkJet : bTag_eigen_light; + + //names of all systematics + base_names[WP] = btagging_SF_names; + //initialise named systematics to empty set + named_systs[WP] = { }; + // initialise number of eigenvectors + eigen_B[WP] = 0; + eigen_C[WP] = 0; + eigen_light[WP] = 0; + // loop on systematic names + for( const auto& SF_name : base_names.at(WP) ){ + if ( SF_name.find("_Eigen_B_") != std::string::npos ) + eigen_B.at(WP)++; + else if ( SF_name.find("_Eigen_C_") != std::string::npos ) + eigen_C.at(WP)++; + else if ( SF_name.find("_Eigen_Light_") != std::string::npos ) + eigen_light.at(WP)++; + else named_systs[WP].insert(SF_name); + } + } + + std::string TopConfig::FormatedWP(std::string raw_WP) { + // just to have some backward compatibility... + if (raw_WP=="60%") return "FixedCutBEff_60"; + else if (raw_WP=="70%") return "FixedCutBEff_70"; + else if (raw_WP=="77%") return "FixedCutBEff_77"; + else if (raw_WP=="85%") return "FixedCutBEff_85"; + else return raw_WP; + } + + void TopConfig::setBTagWP_available( std::string btagging_WP ) { + m_available_btaggingWP.push_back(btagging_WP); + } + + void TopConfig::setBTagWP_available_trkJet( std::string btagging_WP ) { + m_available_btaggingWP_trkJet.push_back(btagging_WP); + } + + void TopConfig::setBTagWP_calibrated( std::string btagging_WP ) { + m_calibrated_btaggingWP.push_back(btagging_WP); + } + + void TopConfig::setBTagWP_calibrated_trkJet( std::string btagging_WP ) { + m_calibrated_btaggingWP_trkJet.push_back(btagging_WP); + } + + + void TopConfig::addLHAPDFResult( const std::string& pdf_name, + std::vector<float> sum_of_weights ){ + + m_lhapdf_options.pdf_results[ pdf_name ] = sum_of_weights; + + } + + void TopConfig::outputEvents(const std::string& s) + { + if (!m_configFixed) { + m_outputEvents = s; + if (m_outputEvents == "AllEvents") { + m_saveOnlySelectedEvents = false; + } + } + } + + /// syst helper functions + bool TopConfig::isSystNominal(const std::string& syst) const{ + return boost::iequals(syst, m_nominalSystName); + } + + bool TopConfig::isSystAll(const std::string& syst) const{ + return boost::iequals(syst, m_allSystName); + } + + bool TopConfig::getSystematicsList(const std::string& syststr, std::set<std::string>& systList) const{ + + if(isSystAll(syststr) || isSystNominal(syststr)) return true; + + if( syststr.find(" ") != std::string::npos ){ + std::cout << "ERROR getSystematicsList: systematic string can't contain white spaces" << std::endl; + return false; + } + + std::string separator = ","; + std::string::size_type start = 0, end = 0; + while ((end = syststr.find(separator, start)) != std::string::npos) { + std::string token = syststr.substr(start, end - start); + if(token.size()) systList.insert(token); + start = end + 1; + } + std::string lasttoken = syststr.substr(start); + if(lasttoken.size()) systList.insert(lasttoken); + + return true; + + } + + bool TopConfig::contains(const std::set<std::string>& systList, const std::string& name) const{ + return systList.find(name) != systList.end(); + } + + + // set systematics + void TopConfig::systematicsPhotons( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashPhotons->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapPhotons->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapPhotons->insert( std::make_pair( s.hash() , m_sgKeyPhotons + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsElectrons( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashElectrons->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_list_systHash_electronInJetSubtraction->push_back( s.hash() ); + m_systMapElectrons->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapElectrons->insert( std::make_pair( s.hash() , m_sgKeyElectrons + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + m_list_systHash_electronInJetSubtraction->sort(); + m_list_systHash_electronInJetSubtraction->unique(); + } + } + + void TopConfig::systematicsMuons( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashMuons->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapMuons->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapMuons->insert( std::make_pair( s.hash() , m_sgKeyMuons + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsTaus( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashTaus->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapTaus->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapTaus->insert( std::make_pair( s.hash() , m_sgKeyTaus + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsJets( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashJets->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_list_systHash_electronInJetSubtraction->push_back( s.hash() ); + m_systMapJets->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapJets->insert( std::make_pair( s.hash() , m_sgKeyJets + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + m_list_systHash_electronInJetSubtraction->sort(); + m_list_systHash_electronInJetSubtraction->unique(); + } + } + + void TopConfig::systematicsLargeRJets( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashLargeRJets->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapLargeRJets->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapLargeRJets->insert( std::make_pair( s.hash() , m_sgKeyLargeRJets + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsTrackJets( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashTrackJets->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapTrackJets->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapTrackJets->insert( std::make_pair( s.hash() , m_sgKeyTrackJets + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsMET( const std::list<CP::SystematicSet>& syst) + { + if( !m_configFixed ){ + for( auto s : syst ){ + m_systHashMET->insert( s.hash() ); + m_list_systHashAll->push_back( s.hash() ); + m_systMapMET->insert( std::make_pair( s.hash() , s ) ); + m_systSgKeyMapMET->insert( std::make_pair( s.hash() , m_sgKeyLargeRJets + "_" + s.name() ) ); + } + m_list_systHashAll->sort(); + m_list_systHashAll->unique(); + } + } + + void TopConfig::systematicsJetGhostTrack( const std::list<CP::SystematicSet>& syst) { + if( !m_configFixed ){ + // Add the nominal (for reporting purposes). + (* m_systMapJetGhostTrack)[m_nominalHashValue] = {}; + (* m_systDecoKeyMapJetGhostTrack)[m_nominalHashValue] = m_decoKeyJetGhostTrack; + m_jetGhostTrackSystematics.push_back(""); + + for(auto s : syst){ + (* m_systMapJetGhostTrack)[s.hash()] = s; + (* m_systDecoKeyMapJetGhostTrack)[s.hash()] = m_decoKeyJetGhostTrack + "_" + s.name(); + m_jetGhostTrackSystematics.push_back(s.name()); + } + + // Ensure that elements are unique. + std::sort(m_jetGhostTrackSystematics.begin(), + m_jetGhostTrackSystematics.end()); + auto last = std::unique(m_jetGhostTrackSystematics.begin(), + m_jetGhostTrackSystematics.end()); + m_jetGhostTrackSystematics.erase(last, + m_jetGhostTrackSystematics.end()); + } + } + + + void TopConfig::fixConfiguration() + { + std::cout<<std::endl; + std::cout<<std::endl; + std::cout<<"TopConfig::fixConfiguration()"<<std::endl; + std::cout<<std::endl; + std::cout<<std::endl; + // Prevent the user from changing anything + // Yes, this is deliberate + m_configFixed = true; + + // copy hash values in m_systHashAll_list + // into m_systHashAll + // The std::unordered_set is faster + for (std::list<std::size_t>::const_iterator i=m_list_systHashAll->begin();i!=m_list_systHashAll->end();++i) { + m_systHashAll->insert( (*i) ); + } + // same for m_systHash_electronInJetSubtraction + for (std::list<std::size_t>::const_iterator i=m_list_systHash_electronInJetSubtraction->begin();i!=m_list_systHash_electronInJetSubtraction->end();++i) { + m_systHash_electronInJetSubtraction->insert( (*i) ); + } + + + // Setup StoreGate keys for TopEvent/SingleSystEvent + // Let's do ALL string manipulation here, never do it per event + std::string nominalPhotons("SetMe"); + std::string nominalElectrons("SetMe"); + std::string nominalMuons("SetMe"); + std::string nominalTaus("SetMe"); + std::string nominalJets("SetMe"); + std::string nominalLargeRJets("SetMe"); + std::string nominalTrackJets("SetMe"); + std::string nominal("nominal"); + std::string tds("TDS"); + std::string tdsAux("TDSAux."); + + // Figure out the nominal object collection names + std::unordered_map<std::size_t,std::string>::const_iterator ph = m_systSgKeyMapPhotons->find( m_nominalHashValue ); + if (ph != m_systSgKeyMapPhotons->end()) { + nominalPhotons = (*ph).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator el = m_systSgKeyMapElectrons->find( m_nominalHashValue ); + if (el != m_systSgKeyMapElectrons->end()) { + nominalElectrons = (*el).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator mu = m_systSgKeyMapMuons->find( m_nominalHashValue ); + if (mu != m_systSgKeyMapMuons->end()) { + nominalMuons = (*mu).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator tau = m_systSgKeyMapTaus->find( m_nominalHashValue ); + if (tau != m_systSgKeyMapTaus->end()) { + nominalTaus = (*tau).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator jet = m_systSgKeyMapJets->find( m_nominalHashValue ); + if (jet != m_systSgKeyMapJets->end()) { + nominalJets = (*jet).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator largeRJet = m_systSgKeyMapLargeRJets->find( m_nominalHashValue ); + if (largeRJet != m_systSgKeyMapLargeRJets->end()) { + nominalLargeRJets = (*largeRJet).second; + } + + std::unordered_map<std::size_t,std::string>::const_iterator trackJet = m_systSgKeyMapTrackJets->find( m_nominalHashValue ); + if (trackJet != m_systSgKeyMapTrackJets->end()) { + nominalTrackJets = (*trackJet).second; + } + + for (std::unordered_set<std::size_t>::const_iterator i=m_systHashAll->begin();i!=m_systHashAll->end();++i) { + + std::unordered_map<std::size_t,std::string>::const_iterator ph = m_systSgKeyMapPhotons->find( *i ); + if (ph != m_systSgKeyMapPhotons->end()) { + m_systAllSgKeyMapPhotons->insert( std::make_pair( (*i) , (*ph).second ) ); + } + if (ph == m_systSgKeyMapPhotons->end()) { + m_systAllSgKeyMapPhotons->insert( std::make_pair( (*i) , nominalPhotons ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator el = m_systSgKeyMapElectrons->find( *i ); + if (el != m_systSgKeyMapElectrons->end()) { + m_systAllSgKeyMapElectrons->insert( std::make_pair( (*i) , (*el).second ) ); + } + if (el == m_systSgKeyMapElectrons->end()) { + m_systAllSgKeyMapElectrons->insert( std::make_pair( (*i) , nominalElectrons ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator mu = m_systSgKeyMapMuons->find( *i ); + if (mu != m_systSgKeyMapMuons->end()) { + m_systAllSgKeyMapMuons->insert( std::make_pair( (*i) , (*mu).second ) ); + } + if (mu == m_systSgKeyMapMuons->end()) { + m_systAllSgKeyMapMuons->insert( std::make_pair( (*i) , nominalMuons ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator tau = m_systSgKeyMapTaus->find( *i ); + if (tau != m_systSgKeyMapTaus->end()) { + m_systAllSgKeyMapTaus->insert( std::make_pair( (*i) , (*tau).second ) ); + } + if (tau == m_systSgKeyMapTaus->end()) { + m_systAllSgKeyMapTaus->insert( std::make_pair( (*i) , nominalTaus ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator jet = m_systSgKeyMapJets->find( *i ); + if (jet != m_systSgKeyMapJets->end()) { + m_systAllSgKeyMapJets->insert( std::make_pair( (*i) , (*jet).second ) ); + } + if (jet == m_systSgKeyMapJets->end()) { + m_systAllSgKeyMapJets->insert( std::make_pair( (*i) , nominalJets ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator largeRJet = m_systSgKeyMapLargeRJets->find( *i ); + if (largeRJet != m_systSgKeyMapLargeRJets->end()) { + m_systAllSgKeyMapLargeRJets->insert( std::make_pair( (*i) , (*largeRJet).second ) ); + } + if (largeRJet == m_systSgKeyMapLargeRJets->end()) { + m_systAllSgKeyMapLargeRJets->insert( std::make_pair( (*i) , nominalLargeRJets ) ); + } + + std::unordered_map<std::size_t,std::string>::const_iterator trackJet = m_systSgKeyMapTrackJets->find( *i ); + if (trackJet != m_systSgKeyMapTrackJets->end()) { + m_systAllSgKeyMapTrackJets->insert( std::make_pair( (*i) , (*trackJet).second ) ); + } + if (trackJet == m_systSgKeyMapTrackJets->end()) { + m_systAllSgKeyMapTrackJets->insert( std::make_pair( (*i) , nominalTrackJets ) ); + } + } // Loop over all systematic hash values + + + if (m_applyElectronInJetSubtraction) { + // Loop over all systematic hash values again, this time for electronInJetSubtraction + std::string electronInJetSubtraction_Electrons("electronInJetSubtraction_Electrons_USING_"); + std::string electronInJetSubtraction_Jets("electronInJetSubtraction_Jets_USING_"); + std::string electronInJetSubtraction_JetsLoose("electronInJetSubtraction_JetsLoose_USING_"); + std::string electronInJetSubtraction_nominalElectrons = electronInJetSubtraction_Electrons+nominalElectrons+"_AND_"+nominalJets; + std::string electronInJetSubtraction_nominalJets = electronInJetSubtraction_Jets+nominalElectrons+"_AND_"+nominalJets; + std::string electronInJetSubtraction_nominalJetsLoose = electronInJetSubtraction_JetsLoose+nominalElectrons+"_AND_"+nominalJets; + + for (std::unordered_set<std::size_t>::const_iterator i=m_systHashAll->begin();i!=m_systHashAll->end();++i) { + std::unordered_map<std::size_t,std::string>::const_iterator el = m_systSgKeyMapElectrons->find( *i ); + std::unordered_map<std::size_t,std::string>::const_iterator jet = m_systSgKeyMapJets->find( *i ); + + if (el != m_systSgKeyMapElectrons->end()) { + m_systAllSgKeyMapElectrons_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Electrons+(*el).second+"_AND_"+nominalJets ) ); + m_systAllSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Jets+(*el).second+"_AND_"+nominalJets ) ); + m_systSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Jets+(*el).second+"_AND_"+nominalJets ) ); + + m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_JetsLoose+(*el).second+"_AND_"+nominalJets ) ); + m_systSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_JetsLoose+(*el).second+"_AND_"+nominalJets ) ); + } + if (jet != m_systSgKeyMapJets->end()) { + m_systAllSgKeyMapElectrons_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Electrons+nominalElectrons+"_AND_"+(*jet).second ) ); + m_systAllSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Jets+nominalElectrons+"_AND_"+(*jet).second ) ); + m_systSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_Jets+nominalElectrons+"_AND_"+(*jet).second ) ); + + m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_JetsLoose+nominalElectrons+"_AND_"+(*jet).second ) ); + m_systSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_JetsLoose+nominalElectrons+"_AND_"+(*jet).second ) ); + } + if (el == m_systSgKeyMapElectrons->end() && jet == m_systSgKeyMapJets->end()) { + m_systAllSgKeyMapElectrons_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_nominalElectrons ) ); + m_systAllSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_nominalJets ) ); + m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i) , electronInJetSubtraction_nominalJetsLoose ) ); + } + } // Loop over all systematic hash values + } // electron in jet Subtraction + + + // Tempory data store names + typedef std::unordered_map<std::size_t,std::string>::const_iterator Itr2; + for (Itr2 i=m_systAllSgKeyMapPhotons->begin();i!=m_systAllSgKeyMapPhotons->end();++i) { + m_systAllSgKeyMapPhotonsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapPhotonsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapElectrons->begin();i!=m_systAllSgKeyMapElectrons->end();++i) { + m_systAllSgKeyMapElectronsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapElectronsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapMuons->begin();i!=m_systAllSgKeyMapMuons->end();++i) { + m_systAllSgKeyMapMuonsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapMuonsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapTaus->begin();i!=m_systAllSgKeyMapTaus->end();++i) { + m_systAllSgKeyMapTausTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapTausTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapJets->begin();i!=m_systAllSgKeyMapJets->end();++i) { + m_systAllSgKeyMapJetsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapJetsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapLargeRJets->begin();i!=m_systAllSgKeyMapLargeRJets->end();++i) { + m_systAllSgKeyMapLargeRJetsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapLargeRJetsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapElectrons_electronInJetSubtraction->begin();i!=m_systAllSgKeyMapElectrons_electronInJetSubtraction->end();++i) { + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapTrackJets->begin();i!=m_systAllSgKeyMapTrackJets->end();++i) { + m_systAllSgKeyMapTrackJetsTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapTrackJetsTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapJets_electronInJetSubtraction->begin();i!=m_systAllSgKeyMapJets_electronInJetSubtraction->end();++i) { + m_systAllSgKeyMapJets_electronInJetSubtractionTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + for (Itr2 i=m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->begin();i!=m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->end();++i) { + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS->insert( std::make_pair( (*i).first , (*i).second + tds ) ); + m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux->insert( std::make_pair( (*i).first , (*i).second + tdsAux ) ); + } + + + // TTree names + m_systAllTTreeNames->insert( std::make_pair( m_nominalHashValue , nominal ) ); + typedef std::unordered_map<std::size_t,CP::SystematicSet>::const_iterator Itr; + + if (m_usePhotons) { + for (Itr i=m_systMapPhotons->begin();i!=m_systMapPhotons->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useElectrons) { + for (Itr i=m_systMapElectrons->begin();i!=m_systMapElectrons->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useMuons) { + for (Itr i=m_systMapMuons->begin();i!=m_systMapMuons->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useTaus) { + for (Itr i=m_systMapTaus->begin();i!=m_systMapTaus->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useJets) { + for (Itr i=m_systMapJets->begin();i!=m_systMapJets->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useLargeRJets) { + for (Itr i=m_systMapLargeRJets->begin();i!=m_systMapLargeRJets->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + if (m_useTrackJets) { + for (Itr i=m_systMapTrackJets->begin();i!=m_systMapTrackJets->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + } + for (Itr i=m_systMapMET->begin();i!=m_systMapMET->end();++i) { + m_systAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second.name() ) ); + } + + + + // Missing ET from TTree names + // KLFitter from TTree names + + for (Itr2 i=m_systAllTTreeNames->begin();i!=m_systAllTTreeNames->end();++i) { + if (!m_doLooseTreeOnly) + m_systSgKeyMapMissingET->insert( std::make_pair( (*i).first , m_sgKeyMissingEt + "_" + (*i).second ) ); + if (m_doLooseEvents) + m_systSgKeyMapMissingETLoose->insert( std::make_pair( (*i).first , m_sgKeyMissingEt + "_Loose_" + (*i).second ) ); + + if (!m_doLooseTreeOnly) + m_systSgKeyMapKLFitter->insert( std::make_pair( (*i).first , m_sgKeyKLFitter + "_" + (*i).second ) ); + if (m_doLooseEvents) + m_systSgKeyMapKLFitterLoose->insert( std::make_pair( (*i).first , m_sgKeyKLFitter + "_Loose_" + (*i).second ) ); + + m_systSgKeyMapPseudoTop->insert( std::make_pair( (*i).first , m_sgKeyPseudoTop + "_" + (*i).second ) ); + + } + + + // TTree index + unsigned int TTreeIndex(0); + if (!m_doLooseTreeOnly) { + for (Itr2 i=m_systAllTTreeNames->begin();i!=m_systAllTTreeNames->end();++i) { + m_systAllTTreeIndex->insert( std::make_pair( (*i).first , TTreeIndex ) ); + ++TTreeIndex; + } + } + if (m_doLooseEvents) { + for (Itr2 i=m_systAllTTreeNames->begin();i!=m_systAllTTreeNames->end();++i) { + m_systAllTTreeLooseIndex->insert( std::make_pair( (*i).first , TTreeIndex ) ); + ++TTreeIndex; + } + } + + if (m_makeAllCPTools) { + for (Itr2 i=m_systAllTTreeNames->begin();i!=m_systAllTTreeNames->end();++i) { + m_systPersistantAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second) ); + } + } + + } + + + + + const std::string& TopConfig::sgKeyPhotons( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapPhotons->find( hash ); + if (key != m_systAllSgKeyMapPhotons->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyPhotonsTDS( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapPhotonsTDS->find( hash ); + if (key != m_systAllSgKeyMapPhotonsTDS->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyPhotonsTDSAux( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapPhotonsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapPhotonsTDSAux->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyElectrons( const std::size_t hash ) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectrons->find( hash ); + if (key != m_systAllSgKeyMapElectrons->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectrons_electronInJetSubtraction->find( hash ); + if (key != m_systAllSgKeyMapElectrons_electronInJetSubtraction->end()) { + return (*key).second; + } + } + + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyElectronsTDS( const std::size_t hash ) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectronsTDS->find( hash ); + if (key != m_systAllSgKeyMapElectronsTDS->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS->find( hash ); + if (key != m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS->end()) { + return (*key).second; + } + } + + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyElectronsTDSAux( const std::size_t hash ) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectronsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapElectronsTDSAux->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux->find( hash ); + if (key != m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux->end()) { + return (*key).second; + } + } + + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyElectronsStandAlone( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapElectrons->find( hash ); + if (key != m_systAllSgKeyMapElectrons->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + + const std::string& TopConfig::sgKeyMuons( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapMuons->find( hash ); + if (key != m_systAllSgKeyMapMuons->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyMuonsTDS( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapMuonsTDS->find( hash ); + if (key != m_systAllSgKeyMapMuonsTDS->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyMuonsTDSAux( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapMuonsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapMuonsTDSAux->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTaus( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTaus->find( hash ); + if (key != m_systAllSgKeyMapTaus->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTausTDS( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTausTDS->find( hash ); + if (key != m_systAllSgKeyMapTausTDS->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTausTDSAux( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTausTDSAux->find( hash ); + if (key != m_systAllSgKeyMapTausTDSAux->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyJets( const std::size_t hash , const bool useLooseLeptonJets) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJets->find( hash ); + if (key != m_systAllSgKeyMapJets->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + if (!useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJets_electronInJetSubtraction->find( hash ); + if (key != m_systAllSgKeyMapJets_electronInJetSubtraction->end()) { + return (*key).second; + } + } + if (useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->find( hash ); + if (key != m_systAllSgKeyMapJetsLoose_electronInJetSubtraction->end()) { + return (*key).second; + } + } + } + + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyJetsTDS( const std::size_t hash , const bool useLooseLeptonJets) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJetsTDS->find( hash ); + if (key != m_systAllSgKeyMapJetsTDS->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + if (!useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJets_electronInJetSubtractionTDS->find( hash ); + if (key != m_systAllSgKeyMapJets_electronInJetSubtractionTDS->end()) { + return (*key).second; + } + } + if (useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS->find( hash ); + if (key != m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS->end()) { + return (*key).second; + } + } + } + + return m_sgKeyDummy; + } + + + const std::string& TopConfig::sgKeyJetsTDSAux( const std::size_t hash , const bool useLooseLeptonJets) const + { + if (!m_applyElectronInJetSubtraction) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJetsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapJetsTDSAux->end()) { + return (*key).second; + } + } + + if (m_applyElectronInJetSubtraction) { + if (!useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux->find( hash ); + if (key != m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux->end()) { + return (*key).second; + } + } + if (useLooseLeptonJets) { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux->find( hash ); + if (key != m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux->end()) { + return (*key).second; + } + } + } + + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyJetsStandAlone( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapJets->find( hash ); + if (key != m_systAllSgKeyMapJets->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyLargeRJets( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapLargeRJets->find( hash ); + if (key != m_systAllSgKeyMapLargeRJets->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyLargeRJetsTDS( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapLargeRJetsTDS->find( hash ); + if (key != m_systAllSgKeyMapLargeRJetsTDS->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyLargeRJetsTDSAux( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapLargeRJetsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapLargeRJetsTDSAux->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTrackJets( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTrackJets->find( hash ); + if (key != m_systAllSgKeyMapTrackJets->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTrackJetsTDS( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTrackJetsTDS->find( hash ); + if (key != m_systAllSgKeyMapTrackJetsTDS->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyTrackJetsTDSAux( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systAllSgKeyMapTrackJetsTDSAux->find( hash ); + if (key != m_systAllSgKeyMapTrackJetsTDSAux->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + + const std::string& TopConfig::sgKeyMissingEt( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systSgKeyMapMissingET->find( hash ); + if (key != m_systSgKeyMapMissingET->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyMissingEtLoose( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systSgKeyMapMissingETLoose->find( hash ); + if (key != m_systSgKeyMapMissingETLoose->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyKLFitter( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systSgKeyMapKLFitter->find( hash ); + if (key != m_systSgKeyMapKLFitter->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyKLFitterLoose( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systSgKeyMapKLFitterLoose->find( hash ); + if (key != m_systSgKeyMapKLFitterLoose->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string& TopConfig::sgKeyPseudoTop( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systSgKeyMapPseudoTop->find( hash ); + if (key != m_systSgKeyMapPseudoTop->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + const std::string & TopConfig::decoKeyJetGhostTrack(const std::size_t hash) const { + // If it's in the map, use the mapped value, otherwise use the nominal. + auto it = m_systDecoKeyMapJetGhostTrack->find(hash); + if (it != m_systDecoKeyMapJetGhostTrack->end()){ + return it->second; + } else { + return m_decoKeyJetGhostTrack; + } + } + + + const std::string& TopConfig::systematicName( const std::size_t hash ) const + { + std::unordered_map<std::size_t,std::string>::const_iterator key = m_systPersistantAllTTreeNames + ->find( hash ); + if (key != m_systPersistantAllTTreeNames->end()) { + return (*key).second; + } + return m_sgKeyDummy; + } + + std::shared_ptr<std::unordered_map<std::size_t,std::string>> TopConfig::systSgKeyMapJets(const bool useLooseLeptonJets) const + { + if (m_applyElectronInJetSubtraction) { + if (useLooseLeptonJets) { + return m_systSgKeyMapJetsLoose_electronInJetSubtraction; + } + return m_systSgKeyMapJets_electronInJetSubtraction; + } + return m_systSgKeyMapJets; + } + + // TTree index + unsigned int TopConfig::ttreeIndex( const std::size_t hash ) const + { + unsigned int index(99999); // This will crash the job if not set properly + std::unordered_map<std::size_t,unsigned int>::const_iterator Itr = m_systAllTTreeIndex->find( hash ); + if (Itr != m_systAllTTreeIndex->end()) { + index = (*Itr).second; + } + if (index == 99999) { + std::cout<<"ttreeIndex is crazy, something has gone wrong with the hash value = "<<hash<<std::endl; + } + return index; + } + + unsigned int TopConfig::ttreeIndexLoose( const std::size_t hash ) const + { + unsigned int index(99999); // This will crash the job if not set properly + std::unordered_map<std::size_t,unsigned int>::const_iterator Itr = m_systAllTTreeLooseIndex->find( hash ); + if (Itr != m_systAllTTreeLooseIndex->end()) { + index = (*Itr).second; + } + if (index == 99999) { + std::cout<<"ttreeIndex is crazy, something has gone wrong with the hash value = "<<hash<<std::endl; + } + return index; + } + + const std::vector<std::string>& TopConfig::allTriggers(const std::string& selection) const + { + std::unordered_map<std::string,std::vector<std::string>>::const_iterator key = m_allTriggers->find( selection ); + if (key != m_allTriggers->end()) { + return (*key).second; + } + return m_dummyTrigger; + } + + const std::vector<std::string>& TopConfig::electronTriggers(const std::string& selection) const + { + std::unordered_map<std::string,std::vector<std::string>>::const_iterator key = m_electronTriggers->find( selection ); + if (key != m_electronTriggers->end()) { + return (*key).second; + } + return m_dummyTrigger; + } + + const std::vector<std::string>& TopConfig::muonTriggers(const std::string& selection) const + { + std::unordered_map<std::string,std::vector<std::string>>::const_iterator key = m_muonTriggers->find( selection ); + if (key != m_muonTriggers->end()) { + return (*key).second; + } + return m_dummyTrigger; + } + + const std::vector<std::string>& TopConfig::tauTriggers(const std::string& selection) const + { + std::unordered_map<std::string,std::vector<std::string>>::const_iterator key = m_tauTriggers->find( selection ); + if (key != m_tauTriggers->end()) { + return (*key).second; + } + return m_dummyTrigger; + } + + + ///-- top::TopPersistentSettings allows us to take a snapshot of top::TopConfig --/// + ///-- and save it to a mini-xAOD. We can then re-create the top::TopConfig from file --/// + top::TopPersistentSettings* TopConfig::createPersistentSettings() + { + top::TopPersistentSettings* out = new top::TopPersistentSettings(); + + out->m_isMC = m_isMC; + out->m_isAFII = m_isAFII; + out->m_applyElectronInJetSubtraction = m_applyElectronInJetSubtraction; + out->m_doOverlapRemovalOnLooseLeptonDef = m_doOverlapRemovalOnLooseLeptonDef; + out->m_doKLFitter = m_doKLFitter; + out->m_doPseudoTop = m_doPseudoTop; + + out->m_sgKeyTopSystematicEvents = m_sgKeyTopSystematicEvents; + out->m_sgKeyTopSystematicEventsLoose = m_sgKeyTopSystematicEventsLoose; + + out->m_sgKeyEventInfo = m_sgKeyEventInfo; + out->m_sgKeyPrimaryVertices = m_sgKeyPrimaryVertices; + out->m_sgKeyPhotons = m_sgKeyPhotons; + out->m_sgKeyElectrons = m_sgKeyElectrons; + out->m_sgKeyMuons = m_sgKeyMuons; + out->m_sgKeyTaus = m_sgKeyTaus; + out->m_sgKeyJets = m_sgKeyJets; + out->m_sgKeyLargeRJets = m_sgKeyLargeRJets; + out->m_sgKeyTrackJets = m_sgKeyTrackJets; + out->m_sgKeyMissingEt = m_sgKeyMissingEt; + out->m_sgKeyMissingEtLoose = m_sgKeyMissingEtLoose; + + out->m_electronID = m_electronID; + out->m_electronIDLoose = m_electronIDLoose; + out->m_electronIsolation = m_electronIsolation; + out->m_electronIsolationLoose = m_electronIsolationLoose; + + out->m_muon_trigger_SF = m_muon_trigger_SF; + out->m_muonQuality = m_muonQuality; + out->m_muonQualityLoose = m_muonQualityLoose; + out->m_muonIsolation = m_muonIsolation; + out->m_muonIsolationLoose = m_muonIsolationLoose; + + typedef std::unordered_map<std::size_t,std::string>::const_iterator Itr; + + for (std::vector<std::string>::const_iterator i=m_chosen_btaggingWP.begin();i!=m_chosen_btaggingWP.end();++i) + out->m_chosen_btaggingWP.push_back( *i ); + + for (Itr i=m_systSgKeyMapPhotons->begin();i!=m_systSgKeyMapPhotons->end();++i) + out->m_systSgKeyMapPhotons.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapElectrons->begin();i!=m_systSgKeyMapElectrons->end();++i) + out->m_systSgKeyMapElectrons.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapMuons->begin();i!=m_systSgKeyMapMuons->end();++i) + out->m_systSgKeyMapMuons.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapTaus->begin();i!=m_systSgKeyMapTaus->end();++i) + out->m_systSgKeyMapTaus.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapJets->begin();i!=m_systSgKeyMapJets->end();++i) + out->m_systSgKeyMapJets.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapJets_electronInJetSubtraction->begin();i!=m_systSgKeyMapJets_electronInJetSubtraction->end();++i) + out->m_systSgKeyMapJets_electronInJetSubtraction.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapJetsLoose_electronInJetSubtraction->begin();i!=m_systSgKeyMapJetsLoose_electronInJetSubtraction->end();++i) + out->m_systSgKeyMapJetsLoose_electronInJetSubtraction.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapLargeRJets->begin();i!=m_systSgKeyMapLargeRJets->end();++i) + out->m_systSgKeyMapLargeRJets.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapTrackJets->begin();i!=m_systSgKeyMapTrackJets->end();++i) + out->m_systSgKeyMapTrackJets.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapMissingET->begin();i!=m_systSgKeyMapMissingET->end();++i) + out->m_systSgKeyMapMissingET.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapMissingETLoose->begin();i!=m_systSgKeyMapMissingETLoose->end();++i) + out->m_systSgKeyMapMissingETLoose.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapKLFitter->begin();i!=m_systSgKeyMapKLFitter->end();++i) + out->m_systSgKeyMapKLFitter.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapKLFitterLoose->begin();i!=m_systSgKeyMapKLFitterLoose->end();++i) + out->m_systSgKeyMapKLFitterLoose.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systSgKeyMapPseudoTop->begin();i!=m_systSgKeyMapPseudoTop->end();++i) + out->m_systSgKeyMapPseudoTop.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systDecoKeyMapJetGhostTrack->begin();i!=m_systDecoKeyMapJetGhostTrack->end();++i) + out->m_systDecoKeyMapJetGhostTrack.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=m_systPersistantAllTTreeNames->begin();i!=m_systPersistantAllTTreeNames->end();++i) + out->m_systPersistantAllTTreeNames.insert( std::make_pair( (*i).first , (*i).second ) ); + + for (std::list<std::size_t>::const_iterator i=m_list_systHashAll->begin();i!=m_list_systHashAll->end();++i) + out->m_list_systHashAll.push_back( *i ); + + for (std::list<std::size_t>::const_iterator i=m_list_systHash_electronInJetSubtraction->begin();i!=m_list_systHash_electronInJetSubtraction->end();++i) + out->m_list_systHash_electronInJetSubtraction.push_back( *i ); + + for (std::vector<std::string>::const_iterator i=m_allSelectionNames->begin();i!=m_allSelectionNames->end();++i) + out->m_allSelectionNames.push_back( *i ); + + for (auto i : *m_allTriggers) { + out->m_allTriggers.insert(i); + } + for (auto i : *m_electronTriggers) { + out->m_electronTriggers.insert(i); + } + for (auto i : *m_muonTriggers) { + out->m_muonTriggers.insert(i); + } + + return out; + } + +TopConfig::TopConfig( const top::TopPersistentSettings* settings ) : + // delegate to the default ctor - this is a nice C++11 feature, John likes this a lot + TopConfig() + { + m_makeAllCPTools = false; + m_isMC = settings->m_isMC; + m_isAFII = settings->m_isAFII; + m_applyElectronInJetSubtraction = settings->m_applyElectronInJetSubtraction; + m_doOverlapRemovalOnLooseLeptonDef = settings->m_doOverlapRemovalOnLooseLeptonDef; + m_doKLFitter = settings->m_doKLFitter; + m_doPseudoTop = settings->m_doPseudoTop; + + m_sgKeyTopSystematicEvents = settings->m_sgKeyTopSystematicEvents; + m_sgKeyTopSystematicEventsLoose = settings->m_sgKeyTopSystematicEventsLoose; + + m_sgKeyEventInfo = settings->m_sgKeyEventInfo; + m_sgKeyPrimaryVertices = settings->m_sgKeyPrimaryVertices; + sgKeyPhotons( settings->m_sgKeyPhotons ); + sgKeyElectrons( settings->m_sgKeyElectrons ); + sgKeyMuons( settings->m_sgKeyMuons ); + sgKeyTaus( settings->m_sgKeyTaus ); + sgKeyJets( settings->m_sgKeyJets ); + sgKeyLargeRJets( settings->m_sgKeyLargeRJets ); + sgKeyTrackJets( settings->m_sgKeyTrackJets ); + m_sgKeyMissingEt = settings->m_sgKeyMissingEt; + m_sgKeyMissingEtLoose = settings->m_sgKeyMissingEtLoose; + + m_electronID = settings->m_electronID; + m_electronIDLoose = settings->m_electronIDLoose; + m_electronIsolation = settings->m_electronIsolation; + m_electronIsolationLoose = settings->m_electronIsolationLoose; + + m_muon_trigger_SF = settings->m_muon_trigger_SF; + m_muonQuality = settings->m_muonQuality; + m_muonQualityLoose = settings->m_muonQualityLoose; + m_muonIsolation = settings->m_muonIsolation; + m_muonIsolationLoose = settings->m_muonIsolationLoose; + + for (std::vector<std::string>::const_iterator i=settings->m_chosen_btaggingWP.begin();i!=settings->m_chosen_btaggingWP.end();++i) + m_chosen_btaggingWP.push_back( *i ); + + typedef std::map<std::size_t,std::string>::const_iterator Itr; + + for (Itr i=settings->m_systSgKeyMapPhotons.begin();i!=settings->m_systSgKeyMapPhotons.end();++i) + m_systSgKeyMapPhotons->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapElectrons.begin();i!=settings->m_systSgKeyMapElectrons.end();++i) + m_systSgKeyMapElectrons->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapMuons.begin();i!=settings->m_systSgKeyMapMuons.end();++i) + m_systSgKeyMapMuons->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapTaus.begin();i!=settings->m_systSgKeyMapTaus.end();++i) + m_systSgKeyMapTaus->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapJets.begin();i!=settings->m_systSgKeyMapJets.end();++i) + m_systSgKeyMapJets->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapJets_electronInJetSubtraction.begin();i!=settings->m_systSgKeyMapJets_electronInJetSubtraction.end();++i) + m_systSgKeyMapJets_electronInJetSubtraction->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapJetsLoose_electronInJetSubtraction.begin();i!=settings->m_systSgKeyMapJetsLoose_electronInJetSubtraction.end();++i) + m_systSgKeyMapJetsLoose_electronInJetSubtraction->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapLargeRJets.begin();i!=settings->m_systSgKeyMapLargeRJets.end();++i) + m_systSgKeyMapLargeRJets->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapTrackJets.begin();i!=settings->m_systSgKeyMapTrackJets.end();++i) + m_systSgKeyMapTrackJets->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapMissingET.begin();i!=settings->m_systSgKeyMapMissingET.end();++i) + m_systSgKeyMapMissingET->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapMissingETLoose.begin();i!=settings->m_systSgKeyMapMissingETLoose.end();++i) + m_systSgKeyMapMissingETLoose->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapKLFitter.begin();i!=settings->m_systSgKeyMapKLFitter.end();++i) + m_systSgKeyMapKLFitter->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapKLFitterLoose.begin();i!=settings->m_systSgKeyMapKLFitterLoose.end();++i) + m_systSgKeyMapKLFitterLoose->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systSgKeyMapPseudoTop.begin();i!=settings->m_systSgKeyMapPseudoTop.end();++i) + m_systSgKeyMapPseudoTop->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systDecoKeyMapJetGhostTrack.begin();i!=settings->m_systDecoKeyMapJetGhostTrack.end();++i) + m_systDecoKeyMapJetGhostTrack->insert( std::make_pair( (*i).first , (*i).second ) ); + + for (Itr i=settings->m_systPersistantAllTTreeNames.begin();i!=settings->m_systPersistantAllTTreeNames.end();++i) { + m_systPersistantAllTTreeNames->insert( std::make_pair( (*i).first , (*i).second ) ); + m_systAllTTreeNames->insert(std::make_pair((*i).first, (*i).second)); + } + + for (std::vector<std::size_t>::const_iterator i=settings->m_list_systHashAll.begin();i!=settings->m_list_systHashAll.end();++i) + m_list_systHashAll->push_back( *i ); + + for (std::vector<std::size_t>::const_iterator i=settings->m_list_systHash_electronInJetSubtraction.begin();i!=settings->m_list_systHash_electronInJetSubtraction.end();++i) + m_list_systHash_electronInJetSubtraction->push_back( *i ); + + for (std::vector<std::string>::const_iterator i=settings->m_allSelectionNames.begin();i!=settings->m_allSelectionNames.end();++i) + m_allSelectionNames->push_back( *i ); + + m_allTriggers = std::make_shared<std::unordered_map<std::string, std::vector<std::string> >>(); + m_electronTriggers = std::make_shared<std::unordered_map<std::string, std::vector<std::string> >>(); + m_muonTriggers = std::make_shared<std::unordered_map<std::string, std::vector<std::string> >>(); + + for (auto i : settings->m_allTriggers) { + m_allTriggers->insert(i); + } + for (auto i : settings->m_electronTriggers) { + m_electronTriggers->insert(i); + } + for (auto i : settings->m_muonTriggers) { + m_muonTriggers->insert(i); + } + + fixConfiguration(); + } + + + AodMetaDataAccess & TopConfig::aodMetaData() { + return *m_aodMetaData; + } + + // Place into a private function to allow use without replication of code + void TopConfig::ReadIsAFII(top::ConfigurationSettings* const& settings){ + if (settings->value("IsAFII") == "True") + this->setIsAFII(true); + else if (settings->value("IsAFII") == "False") + this->setIsAFII(false); + else if (settings->value("IsAFII") != " ") + throw std::runtime_error("TopConfig: option IsAFII must be either True or False"); + else if (this->isMC()) + throw std::runtime_error("TopConfig: option IsAFII not set"); + } + +} + +std::ostream& operator<<(std::ostream& os, const top::TopConfig& config) +{ + typedef std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> map_t; + typedef std::unordered_map<std::size_t,CP::SystematicSet>::const_iterator Itr; + + if( config.useJetGhostTrack() ){ + for (const auto & item : config.systematicsJetGhostTrack()){ + os << " Jet Ghost Track Systematic\t\t :: " << item << " \n"; + } + } + + os << "\n"; + os << "top::TopConfig will evaluate the following systematics (saved as TTrees in your ntuple) \n"; + os << "A blank systematic means \"Nominal\" in xAOD. All Nominal calibrations go into the Nominal TTree. \n"; + os << "\n"; + if( config.usePhotons() ){ + map_t syst = config.systMapPhotons(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Photon systematic\t :: " << (*i).second.name() <<" \n"; + } + } + + if( config.useElectrons() ){ + map_t syst = config.systMapElectrons(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Electron systematic\t :: " << (*i).second.name() <<" \n"; + } + } + + if( config.useMuons() ){ + map_t syst = config.systMapMuons(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Muon systematic\t :: " << (*i).second.name() <<" \n"; + } + } + + if( config.useTaus() ){ + map_t syst = config.systMapTaus(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Tau systematic\t :: " << (*i).second.name() <<" \n"; + } + } + + if( config.useJets() ){ + map_t syst = config.systMapJets(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Jet systematic\t\t :: " << (*i).second.name() <<" \n"; + } + } + + if( config.useLargeRJets() ){ + map_t syst = config.systMapLargeRJets(); + for(Itr i=syst->begin();i!=syst->end();++i){ + os << " Large-R Jet systematic\t\t :: " << (*i).second.name() <<" \n"; + } + } + + os << "\n"; + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4b75df76123276f3a14e78e101fdbe6be63f1729 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopConfiguration/TopPersistentSettings.h" + +namespace top{ + TopPersistentSettings::TopPersistentSettings() : + m_isMC(false), + m_isAFII(false), + m_applyElectronInJetSubtraction(false), + m_doOverlapRemovalOnLooseLeptonDef(false), + m_doKLFitter(false), + m_doPseudoTop(false), + m_sgKeyTopSystematicEvents("SetMe"), + m_sgKeyTopSystematicEventsLoose("SetMe"), + + m_sgKeyEventInfo("SetMe"), + m_sgKeyPrimaryVertices("SetMe"), + m_sgKeyPhotons("SetMe"), + m_sgKeyElectrons("SetMe"), + m_sgKeyMuons("SetMe"), + m_sgKeyTaus("SetMe"), + m_sgKeyJets("SetMe"), + m_sgKeyLargeRJets("SetMe"), + m_sgKeyTrackJets("SetMe"), + m_sgKeyMissingEt("SetMe"), + m_sgKeyMissingEtLoose("SetMe"), + + m_electronID("SetMe"), + m_electronIDLoose("SetMe"), + m_electronIsolation("SetMe"), + m_electronIsolationLoose("SetMe"), + + m_muon_trigger_SF("SetMe"), + m_muonQuality("SetMe"), + m_muonQualityLoose("SetMe"), + m_muonIsolation("SetMe"), + m_muonIsolationLoose("SetMe"), + + m_chosen_btaggingWP(), + + m_systSgKeyMapPhotons(), + m_systSgKeyMapElectrons(), + m_systSgKeyMapMuons(), + m_systSgKeyMapTaus(), + m_systSgKeyMapJets(), + m_systSgKeyMapJets_electronInJetSubtraction(), + m_systSgKeyMapJetsLoose_electronInJetSubtraction(), + m_systSgKeyMapLargeRJets(), + m_systSgKeyMapTrackJets(), + m_systSgKeyMapMissingET(), + m_systSgKeyMapMissingETLoose(), + m_systSgKeyMapKLFitter(), + m_systSgKeyMapKLFitterLoose(), + m_systSgKeyMapPseudoTop(), + m_systPersistantAllTTreeNames(), + m_systDecoKeyMapJetGhostTrack(), + + m_list_systHashAll(), + m_list_systHash_electronInJetSubtraction(), + + m_allSelectionNames(), + m_allTriggers(), + m_electronTriggers(), + m_muonTriggers(), + m_tauTriggers() + {} +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/AodMetaDataAccess.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/AodMetaDataAccess.h new file mode 100644 index 0000000000000000000000000000000000000000..d1607a65b30d560dbc6aba206abcbe408ecf3ce2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/AodMetaDataAccess.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPCONFIGURATION_AODMETADATAACCESS_H +#define TOPCONFIGURATION_AODMETADATAACCESS_H + +#include <map> +#include <string> + +namespace top { + +class AodMetaDataAccess { + +public: + + AodMetaDataAccess(); + virtual ~AodMetaDataAccess(); + virtual void loadWithFilesFrom(std::string const & fileListPath); + + /** + * @brief retrieve an AOD meta-data value + * + * @param folderName the folder name, e.g. "/TagInfo" + * @param keyName the key name, e.g. "project_name" + * + * @return the meta-data value as a string + */ + std::string get(std::string const & folderName, std::string const & keyName) const; + + /** + * @brief retrieve an AOD meta-data value + * + * @param folderName the folder name, e.g. "/TagInfo" + * @param keyName the key name, e.g. "project_name" + * + * @return the meta-data value as a string, or @p defaultValue if the meta-data entry does not exist + */ + std::string get(std::string const & folderName, std::string const & keyName, std::string const & defaultValue) const; + + /** + * @brief check whether AOD meta-data has been loaded + * + * @return whether the AOD meta-data has been loaded + */ + bool valid() const; + + /** + * @brief check whether the data are simulated or real + * + * @return true for MC, false for real data + */ + bool isSimulation() const; + + /** + * @brief check whether this sample is simulation, and then check if it was simulated with ATLFASTII + * + * @return true for AFII, false otherwise (FS or Data) + */ + bool isAFII() const; + + +private: + + std::map<std::string, std::map< std::string, std::string > > * m_data; + +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h new file mode 100644 index 0000000000000000000000000000000000000000..385efe8c9cb5838b89d3bf11319162269f860b8d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CONFIGURATIONSETTINGS_H_ +#define CONFIGURATIONSETTINGS_H_ + +#include <vector> +#include <string> +#include <map> + +#include "SelectionConfigurationData.h" +#include "StringData.h" + +namespace top { + +/** + * @brief Hold the configuration information for the whole run. A singleton, + * so only one of these exists. It needs populating with a call to loadFromFile + * early on. Otherwise it'll be full of rubbish and will refuse to run properly + */ +class ConfigurationSettings { +public: + /** + * @brief Design patterns 101. A singleton getter function. + */ + static ConfigurationSettings* get(); + + /** + * @brief The user wants to know the value for the specified key + * + * @param key The string key used to identify this variable. + * + * @return The setting for the given key. + */ + const std::string& value(const std::string& key) const; + + /** + * @brief The user wants to know the boolean value for the specified key + * + * @param key The string key used to identify this variable. + * @param value On success, the setting for the given key (output). + * + * @return Indicates success (i.e. the value was not empty). + * + * Note: an attempt to retrieve a key with a non-boolean values raises an exception. + */ + bool retrieve(std::string const & key, bool & value) const; + + /** + * @brief Have the configuration settings been read from a file? + * + * @return True if configured (call to loadFromFile worked) otherwise false. + */ + bool configured() const; + + /** + * @brief Read the settings from a text file given by. + * + * @param filename The filename to read from. + */ + void loadFromFile(const std::string& filename); + + /** + * @brief All the user input that is stored as strings. + * + * @return a hased-map of the string name to the String data (description etc) + */ + const std::map<std::string, StringData>& stringData() const; + + /** + * @brief Get all the data needed to configure the selections. + * + * @return The selections in a vector. + */ + const std::vector<SelectionConfigurationData> selections() const; + + /** + * @brief Add a variable to the configuration settings. + * + * @param name The key used to refer to this variable. + * @param message A human readable explanation + */ + void registerParameter(const std::string& name, const std::string& message, const std::string& default_val=""); + +private: + ///True if the class has read the settings from a file or something + bool m_configured; + + ///Singletons: Good or bad, you decide. // John says they are bad + static ConfigurationSettings* m_instance; + + ///Hold the configuration data + std::map<std::string, StringData> strings_; + + ///Data used when configuring the selections + std::vector<SelectionConfigurationData> m_selections; + + ///private constructor + ConfigurationSettings(); + + ///Here but not implemented, resulting in a happy compile error if you try and use them + ConfigurationSettings(const ConfigurationSettings&); + + ///Here but not implemented, resulting in a happy compile error if you try and use them + ConfigurationSettings operator=(const ConfigurationSettings&); + +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::ConfigurationSettings& settings); +std::ostream& operator<<(std::ostream& os, const top::SelectionConfigurationData& data); + + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/SelectionConfigurationData.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/SelectionConfigurationData.h new file mode 100644 index 0000000000000000000000000000000000000000..93ab53bf74e0c83e528615e9dbaa616991422f18 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/SelectionConfigurationData.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SELECTIONCONFIGURATIONDATA_H_ +#define SELECTIONCONFIGURATIONDATA_H_ + +#include <string> +#include <vector> + +namespace top { + +/** + * @brief Some configuration data to setup the selections. + * + * My understanding is that we'll only have a single stream of data next year, + * so you might want to run ee, mumu and emu in the same job (i.e. selections). + */ +struct SelectionConfigurationData { + ///The name of the selection, e.g. ee + std::string m_name; + + ///The cuts for this particular selection stored as strings, as read from the text file + std::vector<std::string> m_cutnames; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/StringData.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/StringData.h new file mode 100644 index 0000000000000000000000000000000000000000..117bbd9d525dff0d336ada085e5f48f068f1a6bd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/StringData.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef STRINGDATA_H_ +#define STRINGDATA_H_ + +#include <string> + +namespace top { + +/** + * @brief A little helper to hold the data, a little information that's useful + * to humans and a flag (true) if the settings has been set. + */ +struct StringData { + ///The data set by the user + std::string m_data; + + ///A helpful message that tells the user what's expected here + std::string m_human_explanation; + + ///A flag that lets us know if the user has set something or not. + bool m_set; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/Tokenize.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/Tokenize.h new file mode 100644 index 0000000000000000000000000000000000000000..5561b0d1d620838815d2e757f8fd3624de244c4b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/Tokenize.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: Tokenize.h +// Description: +// Author: Fabian Wilk +// Created: Tue Aug 11 10:12:30 2015 +// +// (c) by The ATLAS Collaboration +// (c) by Fabian Wilk <mail@fabianwilk.de> +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#ifndef _UTILS_TOKENIZE_H_ +#define _UTILS_TOKENIZE_H_ + +#include <string> + +namespace top{ + /*! + * @brief Tokenize an input string using a set of delimiters. + * @tparam Container The type of the output container. + * @param input The input string which is to be tokenized. + * @param output The container onto which the tokens are to be appended. Must + * support an emplace_back function which takes as pointer to const char (the + * string data) and a std::size_t (the string length). + * + * For maximum performance use a non-allocating string in the out container, + * e.g. use `Container = std::vector<std::string_view>` in c++14. + */ + template <typename Container> + void tokenize(const std::string & input, Container & output, + const std::string & delimiters = " ", bool trim_empty = false) { + const auto size = input.size(); + std::string::size_type pos{0}; + std::string::size_type last_pos{0}; + + while (last_pos < size + 1) { + pos = input.find_first_of(delimiters, last_pos); + if (pos == std::string::npos) { + pos = size; + } + + if (pos != last_pos || not trim_empty){ + output.emplace_back(input.data() + last_pos, pos - last_pos); + } + + last_pos = pos + 1; + } + } +} + +#endif /* _UTILS_TOKENIZE_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..97ef94fc5542968e9d4eeaace659e63bb460fb56 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h @@ -0,0 +1,1369 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopConfig.h 803103 2017-04-18 17:30:51Z tpelzer $ +#ifndef ANALYSISTOP_TOPCONFIGURATION_TOPCONFIG_H +#define ANALYSISTOP_TOPCONFIGURATION_TOPCONFIG_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TopConfig + * A simple configuration that is NOT a singleton + * + * $Revision: 803103 $ + * $Date: 2017-04-18 19:30:51 +0200 (Tue, 18 Apr 2017) $ + * + * + **/ + +// System include(s): +#include <memory> +#include <string> +#include <vector> +#include <set> +#include <list> +#include <unordered_map> +#include <unordered_set> +#include <iostream> + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// Persistent settings +#include "TopConfiguration/TopPersistentSettings.h" + +namespace top{ + +class AodMetaDataAccess; +class ConfigurationSettings; + +class TopConfig final { + public: + TopConfig(); + explicit TopConfig( const top::TopPersistentSettings* settings ); + virtual ~TopConfig(){} + + // Delete Standard constructors + TopConfig( const TopConfig& rhs ) = delete; + TopConfig( TopConfig&& rhs ) = delete; + TopConfig& operator=( const TopConfig& rhs ) = delete; + + // create settings to persist to mini-xAOD + top::TopPersistentSettings* createPersistentSettings(); + + void setConfigSettings( top::ConfigurationSettings* const& settings ); + + // Prevent any more configuration + void fixConfiguration(); + + // Make all CP Tools? + inline bool makeAllCPTools() const {return m_makeAllCPTools;} + + // GRL file + void setGrlDir( const std::string& s ); + inline const std::string& grlDir() const {return m_grlDir;} + void setGrlFile( const std::string& s ); + inline const std::vector<std::string> grlFile() const {return m_grlFile;} + + // What objects are we using + inline bool usePhotons() const {return m_usePhotons; } + inline bool useElectrons() const {return m_useElectrons; } + inline bool useMuons() const {return m_useMuons; } + inline bool useTaus() const {return m_useTaus; } + inline bool useJets() const {return m_useJets; } + inline bool useLargeRJets() const {return m_useLargeRJets;} + inline bool useTrackJets() const {return m_useTrackJets; } + inline bool useJetGhostTrack() const {return m_useJetGhostTrack; } + inline bool useRCJets() const {return m_useRCJets;} + inline bool useVarRCJets() const {return m_useVarRCJets;} + + inline bool useParticleFlowJets() const {return m_useParticleFlowJets;} + + inline bool useTruthParticles() const {return m_useTruthParticles;} + inline bool useTruthElectrons() const {return m_useTruthElectrons; } + inline bool useTruthMuons() const {return m_useTruthMuons; } + inline bool useTruthPhotons() const {return m_useTruthPhotons; } + inline bool useTruthJets() const {return m_useTruthJets; } + inline bool useTruthLargeRJets() const {return m_useTruthLargeRJets; } + inline bool useTruthMET() const {return m_useTruthMET; } + + inline bool applyTTVACut() const {return m_applyTTVACut; } + + inline bool useAntiMuons() const {return m_useAntiMuons; }; + + // MC or not MC - this should be set by metadata + inline bool isMC() const {return m_isMC;} + inline void setIsMC(const bool value) {if(!m_configFixed){m_isMC = value;}} + + // AFII? + inline bool isAFII() const {return m_isAFII;} + inline void setIsAFII(const bool value) {if(!m_configFixed){m_isAFII = value;}} + + // Is this a Primary xAOD? + inline bool isPrimaryxAOD() const {return m_isPrimaryxAOD;} + inline void setIsPrimaryxAOD(const bool value) {if(!m_configFixed){m_isPrimaryxAOD = value;}} + + // Is this a Truth DxAOD? + inline bool isTruthDxAOD() const {return m_isTruthDxAOD;} + inline void setIsTruthDxAOD(const bool value) {if(!m_configFixed){m_isTruthDxAOD = value;}} + + // What derivation type is it? + inline std::string getDerivationStream() const { return m_derivationStream;} + inline void setDerivationStream(const std::string value) {if(!m_configFixed){m_derivationStream = value;}} + + inline unsigned int getDSID() const {return m_DSID;} + inline void setDSID(unsigned int value) { + // Check here if this is a sherpa 2.2 V+jets sample + // (see below to set DSIDs) + setIsSherpa22Vjets(value); + m_DSID = value; + } + + // Is this Sherpa 2.2 V+jets? + // (if so then we need to reweight based on num truth jets) + inline bool isSherpa22Vjets() const {return m_is_sherpa_22_vjets;} + inline void setIsSherpa22Vjets(unsigned int dsid) { + // m_is_sherpa_22_vjets = false by default + // Sherpa 2.2 W+jets (from TopDataPrep) + if (dsid >= 363331 && dsid <= 363354) + m_is_sherpa_22_vjets = true; + if (dsid >= 363436 && dsid <= 363483) + m_is_sherpa_22_vjets = true; + // Sherpa 2.2 Z+jets (from TopDataPrep) + if (dsid >= 363102 && dsid <= 363122) + m_is_sherpa_22_vjets = true; + if (dsid >= 363361 && dsid <= 363435) + m_is_sherpa_22_vjets = true; + } + + // map index for MC/MC b-tagging scale factors + inline unsigned int getMapIndex() const {return m_MapIndex;} + inline void setMapIndex(unsigned int value) {m_MapIndex = value;} + + // Do Loose analysis for fakes + // For analysis this should only be run on data, not for MC + // By default you will get a Loose TTree for data and not for MC + inline bool doLooseEvents() const {return m_doLooseEvents;} + + // Do fakes MM weight calculation + inline bool doFakesMMWeights() const {return m_doFakesMMWeights;} + + // Directory of efficiency files for MM fake estimate + inline std::string FakesMMDir() const {return m_FakesMMDir;} + + // DDebug mode for MM fake estimate + inline bool FakesMMDebug() const {return m_doFakesMMDebug;} + + // Special mode to run Loose events on MC for the purposes + // of determining the Fakes control regions + // This is not for regular users, it is for the Fakes sub-group + // or for determining your own control regions + // + // If you are determining your own control regions, you have just joined + // the fakes sub-group, please report your finding in the Fakes meetings + // + // The function name is long and convoluted on purpose, I hope you don't call it by mistake + inline void FakesControlRegionDetermination_setDoLooseEventsOnMC_notForRegularUsers() + {if(!m_configFixed){m_doLooseEvents = true;}} + + // enables calculation of MM weights + // only possible for data loose + // doing it on MC loose is explicitly forbidden + inline void setFakesMMWeightsCalculation() + {m_doFakesMMWeights = true;} + inline void setFakesMMDir(const std::string dir) + {m_FakesMMDir = dir;} + inline void setFakesMMDebug() + {m_doFakesMMDebug = true;} + + // By default the top group does overlap removal on the tight lepton definitions + // If you use this you are going off piste and need to report + // your findings to the top reconstruction meeting + inline void setOverlapRemovalOnLooseLeptonDef() + {if(!m_configFixed){m_doOverlapRemovalOnLooseLeptonDef = true;}} + inline bool doOverlapRemovalOnLooseLeptonDef() const {return m_doOverlapRemovalOnLooseLeptonDef;} + + inline std::string overlapRemovalProcedure() const + {return m_overlap_removal_procedure;} + + // do overlap removal also with large-R jets + // (using whatever procedure is used in the official tools) + inline void setLargeJetOverlapRemoval() + {if(!m_configFixed){m_doLargeJetOverlapRemoval = true;}} + inline bool doLargeJetOverlapRemoval() const {return m_doLargeJetOverlapRemoval;} + + // Only dumps the *_Loose trees - also on MC + // Usefull if you want your tight selection to be a subset of loose + inline void setLooseTreeOnly() + {if(!m_configFixed){m_doLooseTreeOnly = true;}} + inline bool doLooseTreeOnly() const {return m_doLooseTreeOnly;} + + // In the *_Loose trees, lepton SFs are calculated considering + // tight ID and isolation instead of loose + // Only tight leptons are considered in the event SF calculation + inline void setApplyTightSFsInLooseTree() + {if(!m_configFixed){m_applyTightSFsInLooseTree = true;}} + inline bool applyTightSFsInLooseTree() const {return m_applyTightSFsInLooseTree;} + + // Apply Electron In Jet subtraction + // For boosted analysis + inline bool applyElectronInJetSubtraction() const {return m_applyElectronInJetSubtraction;} + inline void setApplyElectronInJetSubtraction() + {if(!m_configFixed){m_applyElectronInJetSubtraction = true;}} + + // Dump truth block info + inline bool doTruthBlockInfo() const {return m_doTruthBlockInfo;} + inline void setTruthBlockInfo() + {if(!m_configFixed){m_doTruthBlockInfo = true;}} + + // Write truth PDF info + inline bool doTruthPDFInfo() const {return m_doTruthPDFInfo;} + inline void setTruthPDFInfo() + {if(!m_configFixed){m_doTruthPDFInfo = true;}} + // Write truth PDF info in reco tree + inline bool doTruthPDFInfoInNominalTrees() const {return m_doTruthPDFInfoInNominalTrees;} + inline void setTruthPDFInfoInNominalTrees() + {if(!m_configFixed){m_doTruthPDFInfoInNominalTrees = true;}} + + // Write MC generator weights + inline bool doMCGeneratorWeights() const {return m_doMCGeneratorWeights;} + inline void setMCGeneratorWeights() + {if(!m_configFixed){m_doMCGeneratorWeights = true;}} + // Write truth PDF info in reco tree + inline bool doMCGeneratorWeightsInNominalTrees() const {return m_doMCGeneratorWeightsInNominalTrees;} + inline void setMCGeneratorWeightsInNominalTrees() + {if(!m_configFixed){m_doMCGeneratorWeightsInNominalTrees = true;}} + + // Top Parton History + inline bool doTopPartonHistory() const {return m_doTopPartonHistory;} + inline void setTopPartonHistory() + {if(!m_configFixed){m_doTopPartonHistory = true;}} + + // Register Top Parton History in flat ntuple + // This doesn't use m_configFixed - this is bad :( + // This is a simple implementation of saving xAOD objects to ntuples + // John has more advanced ideas on how to do this + // This is just a quick fix for now to get the concept working + inline bool isTopPartonHistoryRegisteredInNtuple() const {return m_isTopPartonHistoryRegisteredInNtuple;} + inline void setTopPartonHistoryRegisteredInNtuple() + {m_isTopPartonHistoryRegisteredInNtuple = true;} + + // TopParticleLevel + inline bool doTopParticleLevel() const { return m_doTopParticleLevel; } + inline void setTopParticleLevel() { if ( ! m_configFixed ){ m_doTopParticleLevel = true; } } + + inline bool doParticleLevelOverlapRemovalMuJet() const { return m_doParticleLevelOverlapRemovalMuJet; } + inline bool doParticleLevelOverlapRemovalElJet() const { return m_doParticleLevelOverlapRemovalElJet; } + inline bool doParticleLevelOverlapRemovalJetPhoton() const { return m_doParticleLevelOverlapRemovalJetPhoton; } + inline void setParticleLevelOverlapRemovalMuJet( bool value ) { if ( ! m_configFixed ){ m_doParticleLevelOverlapRemovalMuJet = value; } } + inline void setParticleLevelOverlapRemovalElJet( bool value ) { if ( ! m_configFixed ){ m_doParticleLevelOverlapRemovalElJet = value; } } + inline void setParticleLevelOverlapRemovalJetPhoton( bool value ) { if ( ! m_configFixed ){ m_doParticleLevelOverlapRemovalJetPhoton = value; } } + + // KLFitter + inline bool doKLFitter() const {return m_doKLFitter;} + inline void setKLFitter(){if(!m_configFixed){m_doKLFitter = true;}} + inline const std::string& KLFitterTransferFunctionsPath() const {return m_KLFitterTransferFunctionsPath;} + inline const std::string& KLFitterJetSelectionMode() const {return m_KLFitterJetSelectionMode;} + inline const std::string& KLFitterBTaggingMethod() const {return m_KLFitterBTaggingMethod;} + inline const std::string& KLFitterLH() const {return m_KLFitterLH;} + + inline bool KLFitterTopMassFixed() const {return m_KLFitterTopMassFixed;} + inline bool KLFitterSaveAllPermutations() const {return m_KLFitterSaveAllPermutations;} + + // PseudoTop + inline bool doPseudoTop() const {return m_doPseudoTop;} + inline void setPseudoTop(){if(!m_configFixed){m_doPseudoTop = true;}} + + // Triggers + inline virtual void allTriggers(std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> triggers) + {if(!m_configFixed){m_allTriggers = triggers;}} + + inline virtual void electronTriggers(std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> triggers) + {if(!m_configFixed){m_electronTriggers = triggers;}} + + inline virtual void muonTriggers(std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> triggers) + {if(!m_configFixed){m_muonTriggers = triggers;}} + + inline virtual void tauTriggers(std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> triggers) + {if(!m_configFixed){m_tauTriggers = triggers;}} + + inline std::shared_ptr<std::vector<std::string>> allSelectionNames() const {return m_allSelectionNames;} + virtual const std::vector<std::string>& allTriggers(const std::string& selection) const; + virtual const std::vector<std::string>& electronTriggers(const std::string& selection) const; + virtual const std::vector<std::string>& muonTriggers(const std::string& selection) const; + virtual const std::vector<std::string>& tauTriggers(const std::string& selection) const; + + // StoreGate Keys + virtual void sgKeyMCParticle ( const std::string& s ); + virtual void sgKeyPhotons ( const std::string& s ); + virtual void sgKeyElectrons ( const std::string& s ); + virtual void sgKeyMuons ( const std::string& s ); + virtual void sgKeyTaus ( const std::string& s ); + virtual void sgKeyJets ( const std::string& s ); + virtual void sgKeyLargeRJets ( const std::string& s ); + virtual void sgKeyTrackJets ( const std::string& s ); + + virtual void sgKeyTruthElectrons ( const std::string& s ); + virtual void sgKeyTruthMuons ( const std::string& s ); + virtual void sgKeyTruthPhotons ( const std::string& s ); + virtual void sgKeyTruthMET ( const std::string& s ); + virtual void sgKeyTruthJets ( const std::string& s ); + virtual void sgKeyTruthLargeRJets ( const std::string& s ); + + inline virtual void sgKeyMissingEt ( const std::string& s ){if(!m_configFixed){m_sgKeyMissingEt = s; }} + inline virtual void sgKeyMissingEtLoose ( const std::string& s ){if(!m_configFixed){m_sgKeyMissingEtLoose = s; }} + + inline const std::string& sgKeyEventInfo() const {return m_sgKeyEventInfo; } + inline const std::string& sgKeyPrimaryVertices() const {return m_sgKeyPrimaryVertices;} + inline virtual const std::string& sgKeyPhotons() const {return m_sgKeyPhotons; } + inline virtual const std::string& sgKeyElectrons() const {return m_sgKeyElectrons; } + inline virtual const std::string& sgKeyMuons() const {return m_sgKeyMuons; } + inline virtual const std::string& sgKeyTaus() const {return m_sgKeyTaus; } + inline virtual const std::string& sgKeyJets() const {return m_sgKeyJets; } + inline virtual const std::string& sgKeyLargeRJets() const {return m_sgKeyLargeRJets;} + inline virtual const std::string& sgKeyTrackJets() const {return m_sgKeyTrackJets; } + inline virtual const std::string& sgKeyMissingEt() const {return m_sgKeyMissingEt; } + inline virtual const std::string& sgKeyMissingEtLoose() const {return m_sgKeyMissingEtLoose; } + inline const std::string& sgKeyInDetTrackParticles() const {return m_sgKeyInDetTrackParticles;} + + inline const std::string& sgKeyTruthEvent() const {return m_sgKeyTruthEvent;} + inline virtual const std::string& sgKeyMCParticle() const {return m_sgKeyMCParticle;} + inline const std::string& sgKeyTruthPhotons() const {return m_sgKeyTruthPhotons;} + inline const std::string& sgKeyTruthElectrons() const {return m_sgKeyTruthElectrons;} + inline const std::string& sgKeyTruthMuons() const {return m_sgKeyTruthMuons;} + inline const std::string& sgKeyTruthTaus() const {return m_sgKeyTruthTaus;} + inline virtual const std::string& sgKeyTruthJets() const {return m_sgKeyTruthJets;} + inline virtual const std::string& sgKeyTruthLargeRJets() const {return m_sgKeyTruthLargeRJets;} + inline const std::string& sgKeyTruthMET() const {return m_sgKeyTruthMET;} + inline const std::string& sgKeyTopPartonHistory() const {return m_sgKeyTopPartonHistory;} + + inline const std::string& sgKeyTopSystematicEvents() const {return m_sgKeyTopSystematicEvents;} + inline const std::string& sgKeyTopSystematicEventsLoose() const {return m_sgKeyTopSystematicEventsLoose;} + inline const std::string& passEventSelectionDecoration() const {return m_passEventSelectionDecoration;} + virtual void decoKeyJetGhostTrack(const std::string & key); + inline virtual const std::string & decoKeyJetGhostTrack() const {return m_decoKeyJetGhostTrack;} + virtual void runPeriodJetGhostTrack(const std::vector<std::uint32_t> & vect); + + virtual const std::string& sgKeyPhotons ( const std::size_t hash ) const; + virtual const std::string& sgKeyElectrons ( const std::size_t hash ) const; + virtual const std::string& sgKeyElectronsStandAlone ( const std::size_t hash ) const; + virtual const std::string& sgKeyMuons ( const std::size_t hash ) const; + virtual const std::string& sgKeyTaus + ( const std::size_t hash ) const; + virtual const std::string& sgKeyJets ( const std::size_t hash , const bool useLooseLeptonJets ) const; + virtual const std::string& sgKeyJetsStandAlone ( const std::size_t hash ) const; + virtual const std::string& sgKeyLargeRJets( const std::size_t hash ) const; + virtual const std::string& sgKeyTrackJets ( const std::size_t hash ) const; + virtual const std::string& sgKeyMissingEt ( const std::size_t hash ) const; + virtual const std::string& sgKeyMissingEtLoose ( const std::size_t hash ) const; + + // For top::TopEventMaker + const std::string& sgKeyPhotonsTDS( const std::size_t hash ) const; + const std::string& sgKeyPhotonsTDSAux( const std::size_t hash ) const; + const std::string& sgKeyElectronsTDS( const std::size_t hash ) const; + const std::string& sgKeyElectronsTDSAux( const std::size_t hash ) const; + const std::string& sgKeyMuonsTDS( const std::size_t hash ) const; + const std::string& sgKeyMuonsTDSAux( const std::size_t hash ) const; + const std::string& sgKeyTausTDS( const std::size_t hash ) const; + const std::string& sgKeyTausTDSAux( const std::size_t hash ) const; + const std::string& sgKeyJetsTDS( const std::size_t hash , const bool useLooseLeptonJets ) const; + const std::string& sgKeyJetsTDSAux( const std::size_t hash , const bool useLooseLeptonJets ) const; + const std::string& sgKeyLargeRJetsTDS( const std::size_t hash ) const; + const std::string& sgKeyLargeRJetsTDSAux( const std::size_t hash ) const; + const std::string& sgKeyTrackJetsTDS( const std::size_t hash ) const; + const std::string& sgKeyTrackJetsTDSAux( const std::size_t hash ) const; + + // KLFitter + const std::string& sgKeyKLFitter( const std::size_t hash ) const; + const std::string& sgKeyKLFitterLoose( const std::size_t hash ) const; + + // PseudoTop + const std::string& sgKeyPseudoTop( const std::size_t hash ) const; + const std::string& sgKeyPseudoTop( const std::string ) const; + + // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + // Jet Ghost-Track Systematics + + // The jet decoration name for a given systematic (nominal also possible). + const std::string & decoKeyJetGhostTrack(const std::size_t hash) const; + + // Retrieve names of all (registered) systematics that affect ghost tracks. + const std::vector<std::string> & systematicsJetGhostTrack() const {return m_jetGhostTrackSystematics;} + + // Retrieve run periods for ghost tracks. + const std::vector<std::uint32_t> & runPeriodsJetGhostTrack() const {return m_jetGhostTrackRunPeriods;} + + // Retrieve mapping from systematic hash to CP::SystematicSet. + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapJetGhostTrack() const {return m_systMapJetGhostTrack; } + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + // special: allow to dump the systematics-shifted b-tagging SFs in the systematics trees + inline virtual void dumpBtagSystsInSystTrees( const bool& b ){if(!m_configFixed){m_dumpBtagSystsInSystTrees = b;}} + inline virtual const bool& dumpBtagSystsInSystTrees(){return m_dumpBtagSystsInSystTrees;} + + // Electron configuration + inline virtual void egammaSystematicModel( const std::string& s ){if(!m_configFixed){m_egammaSystematicModel = s;}} + inline virtual void electronID( const std::string& s ){if(!m_configFixed){m_electronID = s;}} + inline virtual void electronIDLoose( const std::string& s ){if(!m_configFixed){m_electronIDLoose = s;}} + inline void removeElectronVetoLArCrack() {if(!m_configFixed){m_electronVetoLArCrack = false;}} + inline virtual void electronVetoLArCrack( const bool b ){if(!m_configFixed){m_electronVetoLArCrack = b;}} + inline virtual void electronPtcut(const float pt) {if(!m_configFixed){m_electronPtcut = pt;}} + inline virtual void electronIsolation(const std::string& iso) {if(!m_configFixed){m_electronIsolation = iso;}} + inline virtual void electronIsolationLoose(const std::string& iso) {if(!m_configFixed){m_electronIsolationLoose = iso;}} + inline virtual void electronIsoSFs(const bool b){if(!m_configFixed){m_electronIsoSFs = b;}} + + inline virtual const std::string& egammaSystematicModel(){return m_egammaSystematicModel;} + inline virtual const std::string& electronID() const {return m_electronID; } + inline virtual const std::string& electronIDLoose() const {return m_electronIDLoose;} + inline virtual bool electronVetoLArCrack() const {return m_electronVetoLArCrack;} + inline virtual float electronPtcut() const {return m_electronPtcut;} + inline virtual const std::string& electronIsolation() const {return m_electronIsolation;} + inline virtual const std::string& electronIsolationLoose() const {return m_electronIsolationLoose;} + inline virtual bool electronIsoSFs() const {return m_electronIsoSFs;} + inline const std::string& electronIDDecoration() const {return m_electronIDDecoration;} + inline const std::string& electronIDLooseDecoration() const {return m_electronIDLooseDecoration;} + + // Photon configuration + inline virtual void photonPtcut(const float pt) {if(!m_configFixed){m_photon_configuration.pt = pt;}} + inline virtual void photonEtacut(const float eta) {if(!m_configFixed){m_photon_configuration.eta = eta;}} + inline virtual void photonIdentification(const std::string& quality) {if(!m_configFixed){m_photon_configuration.identification = quality;}} + inline virtual void photonIdentificationLoose(const std::string& quality) {if(!m_configFixed){m_photon_configuration_loose.identification = quality;}} + inline virtual void photonIsolation(const std::string& quality) {if(!m_configFixed){m_photon_configuration.isolation = quality;}} + inline virtual void photonIsolationLoose(const std::string& quality) {if(!m_configFixed){m_photon_configuration_loose.isolation = quality;}} + inline virtual void photonUseRadiativeZ(const bool b) {if(!m_configFixed){m_photon_configuration.useRadiativeZ = b;}} + + // Muon configuration + inline virtual void muonPtcut(const float pt) {if(!m_configFixed){m_muonPtcut = pt;}} + inline virtual void muonEtacut(const float eta) {if(!m_configFixed){m_muonEtacut = eta;}} + inline virtual void muonQuality(const std::string& quality) {if(!m_configFixed){m_muonQuality = quality;}} + inline virtual void muonQualityLoose(const std::string& quality) {if(!m_configFixed){m_muonQualityLoose = quality;}} + inline virtual void muonIsolation(const std::string& iso) {if(!m_configFixed){m_muonIsolation = iso;}} + inline virtual void muonIsolationLoose(const std::string& iso) {if(!m_configFixed){m_muonIsolationLoose = iso;}} + + inline virtual float muonPtcut() const {return m_muonPtcut;} + inline virtual float muonEtacut() const {return m_muonEtacut;} + inline virtual const std::string& muonQuality() const {return m_muonQuality;} + inline virtual const std::string& muonQualityLoose() const {return m_muonQualityLoose;} + inline virtual const std::string& muonIsolation() const {return m_muonIsolation;} + inline virtual const std::string& muonIsolationLoose() const {return m_muonIsolationLoose;} + + // Jet configuration + inline virtual void jetPtcut(const float pt) {if(!m_configFixed){m_jetPtcut = pt;}} + inline virtual void jetEtacut(const float eta) {if(!m_configFixed){m_jetEtacut = eta;}} + inline virtual void fwdJetAndMET(const std::string& fwd) {if(!m_configFixed){m_fwdJetAndMET = fwd;}} + + inline virtual float jetPtcut() const {return m_jetPtcut;} + inline virtual float jetEtacut() const {return m_jetEtacut;} + inline virtual const std::string& fwdJetAndMET() const {return m_fwdJetAndMET;} + + inline virtual void largeRJetPtcut(const float pt) {if(!m_configFixed){m_largeRJetPtcut = pt;}} + inline virtual void largeRJetEtacut(const float eta) {if(!m_configFixed){m_largeRJetEtacut = eta;}} + inline virtual void largeRJESUncertaintyConfig(const std::string& largeR_config) {if(!m_configFixed){m_largeRJESUncertaintyConfig = largeR_config;}} + inline virtual void largeRJESJMSConfig(const std::string& largeR_config) {if(!m_configFixed){m_largeRJESJMSConfig = largeR_config;}} + inline virtual float largeRJetPtcut() const {return m_largeRJetPtcut;} + inline virtual float largeRJetEtacut() const {return m_largeRJetEtacut;} + inline virtual const std::string& largeRJESUncertaintyConfig() const {return m_largeRJESUncertaintyConfig;} + inline virtual const std::string& largeRJESJMSConfig() const {return m_largeRJESJMSConfig;} + + inline virtual void trackJetPtcut(const float pt) {if(!m_configFixed){m_trackJetPtcut = pt;}} + inline virtual void trackJetEtacut(const float eta) {if(!m_configFixed){m_trackJetEtacut = eta;}} + inline virtual float trackJetPtcut() const {return m_trackJetPtcut;} + inline virtual float trackJetEtacut() const {return m_trackJetEtacut;} + + inline virtual float RCJetPtcut() const {return m_RCJetPtcut;} + inline virtual float RCJetEtacut() const {return m_RCJetEtacut;} + inline virtual float RCJetTrimcut() const {return m_RCJetTrimcut;} + inline virtual float RCJetRadius() const {return m_RCJetRadius;} + + inline virtual void RCJetPtcut(const float pt) {if(!m_configFixed){m_RCJetPtcut = pt;}} + inline virtual void RCJetEtacut(const float eta) {if(!m_configFixed){m_RCJetEtacut = eta;}} + inline virtual void RCJetTrimcut(const float trim) {if(!m_configFixed){m_RCJetTrimcut = trim;}} + inline virtual void RCJetRadius(const float radius) {if(!m_configFixed){m_RCJetRadius = radius;}} + + inline virtual float VarRCJetPtcut() const{return m_VarRCJetPtcut;} + inline virtual float VarRCJetEtacut() const {return m_VarRCJetEtacut;} + inline virtual float VarRCJetTrimcut() const {return m_VarRCJetTrimcut;} + inline virtual float VarRCJetMaxRadius() const {return m_VarRCJetMaxRadius;} + inline virtual const std::string& VarRCJetRho() const {return m_VarRCJetRho;} + inline virtual const std::string& VarRCJetMassScale() const {return m_VarRCJetMassScale;} + + inline virtual void VarRCJetPtcut(const float pt) {if(!m_configFixed){m_VarRCJetPtcut = pt;}} + inline virtual void VarRCJetEtacut(const float eta) {if(!m_configFixed){m_VarRCJetEtacut = eta;}} + inline virtual void VarRCJetTrimcut(const float trim) {if(!m_configFixed){m_VarRCJetTrimcut = trim;}} + inline virtual void VarRCJetMaxRadius(const float radius) {if(!m_configFixed){m_VarRCJetMaxRadius = radius;}} + inline virtual void VarRCJetRho(const std::string& rho) {if(!m_configFixed){m_VarRCJetRho = rho;}} + inline virtual void VarRCJetMassScale(const std::string& mass_scale) {if(!m_configFixed){m_VarRCJetMassScale = mass_scale;}} + + inline virtual void jetUncertainties_BunchSpacing( const std::string& s ){if(!m_configFixed){m_jetUncertainties_BunchSpacing = s;}} + inline virtual const std::string& jetUncertainties_BunchSpacing() const {return m_jetUncertainties_BunchSpacing;} + + virtual void jetUncertainties_NPModel( const std::string& s ); + inline bool doMultipleJES() const {return m_doMultipleJES;} + inline bool doLargeRSmallRCorrelations() const {return m_largeRSmallRCorrelations;} + inline virtual const std::string& jetUncertainties_NPModel() const {return m_jetUncertainties_NPModel;} + + inline virtual void jetJERSmearingModel( const std::string& s ){if(!m_configFixed){m_jetJERSmearingModel = s;}} + inline virtual const std::string& jetJERSmearingModel() const {return m_jetJERSmearingModel;} + + inline virtual void jetCalibSequence( const std::string& s ){if(!m_configFixed){m_jetCalibSequence = s;}} + inline virtual const std::string& jetCalibSequence() const {return m_jetCalibSequence;} + + inline virtual void doJVTinMET( const bool& doJVT ){if(!m_configFixed){m_doJVTInMETCalculation = doJVT;}} + inline virtual bool doJVTinMET() const {return m_doJVTInMETCalculation;} + + inline virtual float JSF() const{return m_JSF;} + inline virtual float bJSF() const{return m_bJSF;} + + // Tau configuration setters + inline virtual void tauPtcut(const float pt) { + if(!m_configFixed) { + m_tau_configuration.pt = pt; + m_tau_configuration_loose.pt = pt; + } + } + inline virtual void tauJetIDWP(const std::string& s) { + if(!m_configFixed) + m_tau_configuration.jetIDWP = s; + } + inline virtual void tauJetIDWPLoose(const std::string& s) { + if(!m_configFixed) + m_tau_configuration_loose.jetIDWP = s; + } + inline virtual void tauEleBDTWP(const std::string& s) { + if(!m_configFixed) + m_tau_configuration.eleBDTWP = s; + } + inline virtual void tauEleBDTWPLoose(const std::string& s) { + if(!m_configFixed) + m_tau_configuration_loose.eleBDTWP = s; + } + inline virtual void tauEleOLR(bool do_tau_ele_olr) { + if(!m_configFixed) + m_tau_configuration.eleOLR = do_tau_ele_olr; + } + inline virtual void tauEleOLRLoose(bool do_tau_ele_olr) { + if(!m_configFixed) + m_tau_configuration_loose.eleOLR = do_tau_ele_olr; + } + inline virtual void tauJetConfigFile(const std::string& s) { + if(!m_configFixed) + m_tau_configuration.fileName = s; + } + inline virtual void tauJetConfigFileLoose(const std::string& s) { + if(!m_configFixed) + m_tau_configuration_loose.fileName = s; + } + // Applying new tau energy calibration + inline virtual void applyTauMVATES(bool apply) { + m_applyTauMVATES = apply; + } + + // Tau configuration getters + inline virtual float tauPtcut() const { + return m_tau_configuration.pt; + } + inline const std::string& tauJetIDWP() const { + return m_tau_configuration.jetIDWP; + } + inline const std::string& tauJetIDWPLoose() const { + return m_tau_configuration_loose.jetIDWP; + } + inline const std::string& tauEleBDTWP() const { + return m_tau_configuration.eleBDTWP; + } + inline const std::string& tauEleBDTWPLoose() const { + return m_tau_configuration_loose.eleBDTWP; + } + inline virtual bool tauEleOLR() { + return m_tau_configuration.eleOLR; + } + inline virtual bool tauEleOLRLoose() { + return m_tau_configuration_loose.eleOLR; + } + inline const std::string& tauJetConfigFile() { + return m_tau_configuration.fileName; + } + inline const std::string& tauJetConfigFileLoose() { + return m_tau_configuration_loose.fileName; + } + // Applying new tau energy calibration + inline bool applyTauMVATES() { + return m_applyTauMVATES; + } + + // photon getters + inline virtual float photonPtcut() const { + return m_photon_configuration.pt; + } + inline virtual float photonEtacut() const { + return m_photon_configuration.eta; + } + inline const std::string& photonIdentification() { + return m_photon_configuration.identification; + } + inline const std::string& photonIdentificationLoose() { + return m_photon_configuration_loose.identification; + } + inline const std::string& photonIsolation() { + return m_photon_configuration.isolation; + } + inline const std::string& photonIsolationLoose() { + return m_photon_configuration_loose.isolation; + } + inline const bool& photonUseRadiativeZ() { + return m_photon_configuration.useRadiativeZ; + } + + // inline const std::string& tauJetID() const {return m_tauJetID;} + // inline const std::string& tauJetIDBkg() const {return m_tauJetIDBkg;} + // inline const std::string& tauEVetoID() const {return m_tauEVetoID;} + // inline virtual bool tauVetoLArCrack() const {return m_tauVetoLArCrack;} + // inline virtual float tauPtcut() const {return m_tauPtcut;} + + // [[[----------------------------------------------- + // Particle Level (Truth) configuration + + // electrons + inline virtual void truth_electron_PtCut( const float pt ) { if ( ! m_configFixed ){ m_truth_electron.PtCut = pt; } } + inline virtual void truth_electron_EtaCut( const float eta ) { if ( ! m_configFixed ){ m_truth_electron.EtaCut = eta; } } + + inline virtual float truth_electron_PtCut() const { return m_truth_electron.PtCut; } + inline virtual float truth_electron_EtaCut() const { return m_truth_electron.EtaCut; } + inline virtual bool truth_electron_NotFromHadron() const { return m_truth_electron.NotFromHadron; } + inline virtual bool truth_electron_TauIsHadron() const { return m_truth_electron.TauIsHadron; } + + // muons + inline virtual void truth_muon_PtCut( const float pt ) { if ( ! m_configFixed ){ m_truth_muon.PtCut = pt; } } + inline virtual void truth_muon_EtaCut( const float eta ) { if ( ! m_configFixed ){ m_truth_muon.EtaCut = eta; } } + + inline virtual float truth_muon_PtCut() const { return m_truth_muon.PtCut; } + inline virtual float truth_muon_EtaCut() const { return m_truth_muon.EtaCut; } + inline virtual bool truth_muon_NotFromHadron() const { return m_truth_muon.NotFromHadron; } + inline virtual bool truth_muon_TauIsHadron() const { return m_truth_muon.TauIsHadron; } + + // photons + inline virtual void truth_photon_PtCut( const float pt ) { if ( ! m_configFixed ){ m_truth_photon.PtCut = pt; } } + inline virtual void truth_photon_EtaCut( const float eta ) { if ( ! m_configFixed ){ m_truth_photon.EtaCut = eta; } } + inline virtual void truth_photon_Origin(const std::string & value) { if ( ! m_configFixed ){ m_truth_photon.Origin = value; } } + inline virtual void truth_photon_Isolation(const std::string & value) { if ( ! m_configFixed ){ m_truth_photon.Isolation = value; } } + + inline virtual float truth_photon_PtCut() const { return m_truth_photon.PtCut; } + inline virtual float truth_photon_EtaCut() const { return m_truth_photon.EtaCut; } + inline virtual const std::string & truth_photon_Origin() const { return m_truth_photon.Origin; } + inline virtual const std::string & truth_photon_Isolation() const { return m_truth_photon.Isolation; } + + // jets + inline virtual void truth_jet_PtCut( const float pt ) { if ( ! m_configFixed ){ m_truth_jet.PtCut = pt; } } + inline virtual void truth_jet_EtaCut( const float eta ) { if ( ! m_configFixed ){ m_truth_jet.EtaCut = eta; } } + + inline virtual float truth_jet_PtCut() const { return m_truth_jet.PtCut; } + inline virtual float truth_jet_EtaCut() const { return m_truth_jet.EtaCut; } + + // large R jets + inline virtual void truth_jet_largeR_PtCut( const float pt ) { if ( ! m_configFixed ){ m_truth_largeRJet.PtCut = pt; } } + inline virtual void truth_jet_largeR_EtaCut( const float eta ) { if ( ! m_configFixed ){ m_truth_largeRJet.EtaCut = eta; } } + + inline virtual float truth_jet_largeR_PtCut() const { return m_truth_largeRJet.PtCut; } + inline virtual float truth_jet_largeR_EtaCut() const { return m_truth_largeRJet.EtaCut; } + + // -----------------------------------------------]]] + + /// HL LHC studies + inline virtual void HLLHC(const bool s) { if(!m_configFixed){m_HLLHC=s;} } + inline virtual bool HLLHC() const {return m_HLLHC;} + + void setBTaggingSFSysts( std::string WP, const std::set<std::string>& btagging_SFs, bool isTrackJet=false ); + + inline virtual std::set<std::string> btagging_namedSysts(std::string WP) const { return bTag_named_systs.at(WP); } + inline virtual unsigned int btagging_num_B_eigenvars(std::string WP) const { return bTag_eigen_B.at(WP); } + inline virtual unsigned int btagging_num_C_eigenvars(std::string WP) const { return bTag_eigen_C.at(WP); } + inline virtual unsigned int btagging_num_Light_eigenvars(std::string WP) const { return bTag_eigen_light.at(WP); } + + inline virtual std::set<std::string> trkjet_btagging_namedSysts(std::string WP) const { return bTag_named_systs_trkJet.at(WP); } + inline virtual unsigned int trkjet_btagging_num_B_eigenvars(std::string WP) const { return bTag_eigen_B_trkJet.at(WP); } + inline virtual unsigned int trkjet_btagging_num_C_eigenvars(std::string WP) const { return bTag_eigen_C_trkJet.at(WP); } + inline virtual unsigned int trkjet_btagging_num_Light_eigenvars(std::string WP) const { return bTag_eigen_light_trkJet.at(WP); } + + // B-tagging WPs requested by user + const std::vector<std::string> bTagWP() const { return m_chosen_btaggingWP;} + // B-tagging systematics requested by user to be excluded from EV treatment, separated by semi-colons + const std::string bTagSystsExcludedFromEV() const { return m_bTagSystsExcludedFromEV;} + + // B-tagging WPs actually available, according to CDI file + // will be set in TopCPTools + void setBTagWP_available( std::string btagging_WP ); + void setBTagWP_available_trkJet( std::string btagging_WP ); + const std::vector<std::string>& bTagWP_available() const { return m_available_btaggingWP;} + const std::vector<std::string>& bTagWP_available_trkJet() const { return m_available_btaggingWP_trkJet;} + // B-tagging WPs actually calibrated, according to CDI file + // will be set in TopCPTools + void setBTagWP_calibrated( std::string btagging_WP ); + void setBTagWP_calibrated_trkJet( std::string btagging_WP ); + const std::vector<std::string>& bTagWP_calibrated() const { return m_calibrated_btaggingWP;} + const std::vector<std::string>& bTagWP_calibrated_trkJet() const { return m_calibrated_btaggingWP_trkJet;} + + std::string FormatedWP(std::string raw_WP); + + const std::string& bTaggingCalibration_B() const + {return m_btagging_calibration_B;}; + const std::string& bTaggingCalibration_C() const + {return m_btagging_calibration_C;}; + const std::string& bTaggingCalibration_Light() const + {return m_btagging_calibration_Light;}; + + // LHAPDF settings + + inline virtual std::vector<std::string> LHAPDFSets(){ return m_lhapdf_options.pdf_set_names; } + inline virtual bool doLHAPDF(){ return m_lhapdf_options.doLHAPDF; } + inline virtual std::string baseLHAPDF() { return m_lhapdf_options.baseLHAPDF; } + inline virtual bool doLHAPDFInNominalTrees(){ return m_lhapdf_options.doLHAPDFInNominalTrees; } + inline virtual bool saveLHAPDFEvent(){ return m_lhapdf_options.save_per_event; } + void addLHAPDFResult( const std::string& pdf_name, + std::vector<float> sum_of_weights ); + + std::unordered_map<std::string, std::vector<float> >& getLHAPDFResults() { return m_lhapdf_options.pdf_results; }; + + + // Pileup Reweighting Settings + bool doPileupReweighting(){ return m_pileup_reweighting.apply;}; + bool PileupUseGRLTool(){ return m_pileup_reweighting.use_grl_tool;}; + + const std::vector<std::string>& PileupConfig(){ return m_pileup_reweighting.config_files; }; + const std::vector<std::string>& PileupLumiCalc(){ return m_pileup_reweighting.lumi_calc_files; }; + + bool PileupMuDependent(){return m_pileup_reweighting.mu_dependent;}; + + inline const std::string& muonTriggerSF() const {return m_muon_trigger_SF;} + + // Where the sum of event weights + // before derivation framework is kept + inline const std::string& sumOfEventWeightsMetaData() const {return m_sumOfEventWeightsMetaData; } + + // Object Selector Name + inline virtual void objectSelectionName(const std::string& s){if(!m_configFixed){m_objectSelectionName = s;}} + inline virtual const std::string& objectSelectionName() const {return m_objectSelectionName;} + // Output Format + inline virtual void outputFormat(const std::string& s){if(!m_configFixed){m_outputFormat = s;}} + inline virtual const std::string& outputFormat() const {return m_outputFormat;} + // Output Events + virtual void outputEvents(const std::string& s); + inline virtual const std::string& outputEvents() const {return m_outputEvents;} + inline bool saveOnlySelectedEvents() const {return m_saveOnlySelectedEvents;} + + // SetAutoFlush(0) on EventSaverFlatNtuple for ANALYSISTO-44 workaround + inline bool outputFileSetAutoFlushZero() const {return m_outputFileSetAutoFlushZero;} + + // Number of events to run on (only for testing) + inline virtual unsigned int numberOfEventsToRun() const { return m_numberOfEventsToRun;} + inline virtual void numberOfEventsToRun(const unsigned int& n_events) {if(!m_configFixed){m_numberOfEventsToRun = n_events;}} + + // Number of events to skip (only for testing) + inline virtual unsigned int numberOfEventsToSkip() const { return m_numberOfEventsToSkip;} + inline virtual void numberOfEventsToSkip(const unsigned int& n_events) {if(!m_configFixed){m_numberOfEventsToSkip = n_events;}} + + // systematics + inline virtual void systematics(const std::string& s) {if(!m_configFixed){m_systematics = s;}} + inline virtual const std::string& systematics() const {return m_systematics;} + + /// syst helper functions + bool isSystNominal(const std::string& syst) const; + bool isSystAll(const std::string& syst) const; + bool getSystematicsList(const std::string& syst, std::set<std::string>& systList) const; + bool contains(const std::set<std::string>& systList, const std::string& name) const; + + virtual void systematicsPhotons ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsElectrons ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsMuons ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsTaus ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsJets ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsLargeRJets ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsTrackJets ( const std::list<CP::SystematicSet>& syst ); + virtual void systematicsMET ( const std::list<CP::SystematicSet>& syst ); + + virtual void systematicsJetGhostTrack ( const std::list<CP::SystematicSet>& syst ); + + inline virtual void jetSubstructureName(const std::string &s) {if(!m_configFixed){ m_jetSubstructureName = s;} } + inline virtual const std::string& jetSubstructureName() const {return m_jetSubstructureName;} + + // Systematic hash values + inline std::size_t nominalHashValue() const {return m_nominalHashValue;} + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashPhotons() const {return m_systHashPhotons; } + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashElectrons() const {return m_systHashElectrons;} + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashMuons() const {return m_systHashMuons; } + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashTaus() const {return m_systHashTaus; } + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashJets() const {return m_systHashJets; } + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashAll() const {return m_systHashAll; } + inline std::shared_ptr<std::unordered_set<std::size_t>> systHashElectronInJetSubtraction() const {return m_systHash_electronInJetSubtraction;} + + // Systematic Maps + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapPhotons() const {return m_systMapPhotons; } + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapElectrons() const {return m_systMapElectrons;} + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapMuons() const {return m_systMapMuons; } + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapTaus() const {return m_systMapTaus; } + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapJets() const {return m_systMapJets; } + inline std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> systMapLargeRJets() const {return m_systMapLargeRJets; } + + // Systematic StoreGate key Maps + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapPhotons() const {return m_systSgKeyMapPhotons; } + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapElectrons() const {return m_systSgKeyMapElectrons; } + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapMuons() const {return m_systSgKeyMapMuons; } + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapTaus() const {return m_systSgKeyMapTaus; } + std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapJets(const bool useLooseLeptonJets) const; + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapLargeRJets() const {return m_systSgKeyMapLargeRJets;} + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systSgKeyMapTrackJets() const {return m_systSgKeyMapTrackJets;} + + // TTree names + inline std::shared_ptr<std::unordered_map<std::size_t,std::string>> systAllTTreeNames() const {return m_systAllTTreeNames;} + const std::string& systematicName( const std::size_t hash ) const; + // TTree index + unsigned int ttreeIndex( const std::size_t hash ) const; + unsigned int ttreeIndexLoose( const std::size_t hash ) const; + + AodMetaDataAccess & aodMetaData(); + AodMetaDataAccess const & aodMetaData() const { return *m_aodMetaData; } + + private: + // Prevent any more configuration + bool m_configFixed; + + // Make all CP Tools, or just the SF + bool m_makeAllCPTools; + + // GRL file + std::string m_grlDir; + std::vector<std::string> m_grlFile = {}; + + // Use which objects + bool m_usePhotons; + bool m_useElectrons; + bool m_useMuons; + bool m_useAntiMuons; + bool m_useTaus; + bool m_useJets; + bool m_useLargeRJets; + bool m_useTrackJets; + bool m_useRCJets; + bool m_useVarRCJets; + + // Ghost Tracks on jets can not really be disabled because they are always + // available. However, we want the systematics to be executed automatically + // whenever the user has "configured" ghost tracks. + bool m_useJetGhostTrack; + + // Are we using particle flow jets + // Need this as some things aren't supported at the moment + // C++11 so nice inline initialization (we should make this consistent) + bool m_useParticleFlowJets = false; + + bool m_useTruthParticles; + bool m_useTruthElectrons; + bool m_useTruthMuons; + bool m_useTruthPhotons; + bool m_useTruthJets; + bool m_useTruthLargeRJets; + bool m_useTruthMET; + + // define if d0/z0 cut should be used at all + bool m_applyTTVACut; + + std::string m_jetSubstructureName; + + // Do systematics? - this needs many more configuration options + std::string m_systematics; + std::string m_nominalSystName; + std::string m_allSystName; + + unsigned int m_DSID; + unsigned int m_MapIndex; + bool m_is_sherpa_22_vjets = false; + + bool m_isMC; + bool m_isAFII; + bool m_isPrimaryxAOD; + bool m_isTruthDxAOD = false; + std::string m_derivationStream; + + // Do loose events? - default for data, MC is special case + bool m_doLooseEvents; + + // Do fakes MM weights calculation? - only for data loose + bool m_doFakesMMWeights; + // Directory of efficiency files for MM fake estimate + std::string m_FakesMMDir; + // Debug mode? + bool m_doFakesMMDebug; + + // By default the top group does overlap removal on + // the tight lepton definitions. + // If you turn this to true you are going off piste and need to report + // your findings to the top reconstruction meeting. + bool m_doOverlapRemovalOnLooseLeptonDef; + + // String to describe which overlap removal procedure is used + // Current options are whether to use the ASG recommended + // overlap removal (recommended) + // procedure, or the one developed by the harmonization + // task force and use throughout 2015 (harmonized) + std::string m_overlap_removal_procedure = "recommended"; + + // do overlap removal also with large-R jets + // (using whatever procedure is used in the official tools) + bool m_doLargeJetOverlapRemoval; + + // Only dumps the *_Loose trees - also on MC + // Usefull if you want your tight selection to be a subset of loose + bool m_doLooseTreeOnly; + + // In the *_Loose trees, lepton SFs are calculated considering + // tight ID and isolation instead of loose + // Only tight leptons are considered in the event SF calculation + bool m_applyTightSFsInLooseTree; + + // Apply Electron In Jet subtraction + // For boosted analysis + bool m_applyElectronInJetSubtraction; + + // Write Truth block info + bool m_doTruthBlockInfo; + + // Write Truth PDF info + bool m_doTruthPDFInfo; + bool m_doTruthPDFInfoInNominalTrees; + + // Write MC generator weights + bool m_doMCGeneratorWeights; + bool m_doMCGeneratorWeightsInNominalTrees; + + // Top Parton History + bool m_doTopPartonHistory; + bool m_isTopPartonHistoryRegisteredInNtuple; + + // Top Particle Level + bool m_doTopParticleLevel; + bool m_doParticleLevelOverlapRemovalMuJet; + bool m_doParticleLevelOverlapRemovalElJet; + bool m_doParticleLevelOverlapRemovalJetPhoton; + + // KLFitter + bool m_doKLFitter; + std::string m_KLFitterTransferFunctionsPath; + std::string m_KLFitterJetSelectionMode; + std::string m_KLFitterBTaggingMethod; + std::string m_KLFitterLH; + bool m_KLFitterTopMassFixed; + bool m_KLFitterSaveAllPermutations; + + // PseudoTop + bool m_doPseudoTop; + + // StoreGate / TStore keys + std::string m_sgKeyDummy; + std::string m_sgKeyEventInfo; + std::string m_sgKeyPrimaryVertices; + std::string m_sgKeyPhotons; + std::string m_sgKeyElectrons; + std::string m_sgKeyMuons; + std::string m_sgKeyTaus; + std::string m_sgKeyJets; + std::string m_sgKeyLargeRJets; + std::string m_sgKeyTrackJets; + std::string m_sgKeyMissingEt; + std::string m_sgKeyMissingEtLoose; + std::string m_sgKeyInDetTrackParticles; + + std::string m_sgKeyTruthEvent; + std::string m_sgKeyMCParticle; + std::string m_sgKeyTruthPhotons; + std::string m_sgKeyTruthElectrons; + std::string m_sgKeyTruthMuons; + std::string m_sgKeyTruthTaus; + std::string m_sgKeyTruthJets; + std::string m_sgKeyTruthLargeRJets; + std::string m_sgKeyTruthMET; + std::string m_sgKeyTopPartonHistory; + + std::string m_sgKeyTopSystematicEvents; + std::string m_sgKeyTopSystematicEventsLoose; + std::string m_passEventSelectionDecoration; + + std::string m_decoKeyJetGhostTrack; + std::vector<std::string> m_jetGhostTrackSystematics; + std::vector<std::uint32_t> m_jetGhostTrackRunPeriods; + + // special: allow to dump the systematics-shifted b-tagging SFs in the systematics trees + bool m_dumpBtagSystsInSystTrees; + + // Electron configuration + std::string m_egammaSystematicModel; + std::string m_electronID; + std::string m_electronIDLoose; + bool m_electronVetoLArCrack; + float m_electronPtcut; + std::string m_electronIsolation; + std::string m_electronIsolationLoose; + bool m_electronIsoSFs; + int m_electron_d0SigCut; + float m_electron_delta_z0; + + std::string m_electronIDDecoration; + std::string m_electronIDLooseDecoration; + + // Muon configuration + float m_muonPtcut; // muon object selection pT cut + float m_muonEtacut; // muon object selection (abs) eta cut + std::string m_muonQuality; // muon quality used in object selection + std::string m_muonQualityLoose; // loose muon quality used in object selection + std::string m_muonIsolation; + std::string m_muonIsolationLoose; + int m_muon_d0SigCut; + float m_muon_delta_z0; + + + // Jet configuration + float m_jetPtcut; // jet object selection pT cut + float m_jetEtacut; // jet object selection (abs) eta cut + std::string m_fwdJetAndMET; // type of treatment of forward jets, including for MET calculation + std::string m_jetUncertainties_BunchSpacing; // 25ns or 50ns + std::string m_jetUncertainties_NPModel; // AllNuisanceParameters, 19NP or 3NP + bool m_doMultipleJES; + bool m_largeRSmallRCorrelations = false; // Add correlations of large/small R jets + std::string m_jetJERSmearingModel; // Full or Simple + std::string m_jetCalibSequence; // GCC or JMS + bool m_doJVTInMETCalculation; + + // Large R jet configuration + float m_largeRJetPtcut; // large R jet object selection pT cut + float m_largeRJetEtacut; // large R jet object selection (abs) eta cut + std::string m_largeRJESUncertaintyConfig; // large R jet JES uncertainty configuration file + // see: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertainties2015PrerecLargeR + std::string m_largeRJESJMSConfig; // large R jet JES/JMS calibration choice - see ANALYSISTO-210 + + // Track jet configuration + float m_trackJetPtcut; // track jet object selection pT cut + float m_trackJetEtacut; // track jet object selection (abs) eta cut + + // Jet configuration for reclustered jets + float m_RCJetPtcut; + float m_RCJetEtacut; + float m_RCJetTrimcut; + float m_RCJetRadius; + + // Jet configuration for variable large-R jets + float m_VarRCJetPtcut; + float m_VarRCJetEtacut; + float m_VarRCJetTrimcut; + float m_VarRCJetMaxRadius; + std::string m_VarRCJetRho; + std::string m_VarRCJetMassScale; + + // these are needed for the top mass analysis, per default should be 1.0 + float m_JSF; + float m_bJSF; + + // Tau configuration + struct { + // filename to load tau configuration from. + // If this is an empty string then take the 'default' + std::string fileName = "Default"; + // The jetIDWP in CamelCase + // see https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauSelectionTool.rst + // for supported WPs + std::string jetIDWP = "Medium"; + // the electron BDTWP + std::string eleBDTWP = "Medium"; + // Whether to perform electron overlap removal + bool eleOLR = false; + // pT cut on taus + float pt = 20000; + } m_tau_configuration, m_tau_configuration_loose; + + // Applying new tau energy calibration + bool m_applyTauMVATES = false; + + // photon configuration + struct { + // pT cut on photons + float pt = 25000; + float eta = 2.5; + std::string isolation = "None"; + std::string identification = "None"; + bool useRadiativeZ = false; + } m_photon_configuration, m_photon_configuration_loose; + + // [[[----------------------------------------------- + // Particle Level (truth) configuration + + // electrons + struct { + float PtCut; // [ParticleLevel / Truth] Electron Object + // Selection minimum pT Cut (Standard ATLAS + // units, [MeV]). + float EtaCut; // [ParticleLevel / Truth] Electron Object + // Selection maximum absolute eta Cut. + bool NotFromHadron; // [ParticleLevel / Truth] Whether to apply the + // 'NotFromHadron' requirement onto the objects. + bool TauIsHadron; // [ParticleLevel / Truth] Whether a tauon is a + // hadron during the 'NotFromHadron' check + } m_truth_electron; + + // muons + struct { + float PtCut; // [ParticleLevel / Truth] Muon Object + // Selection minimum pT Cut (Standard ATLAS + // units, [MeV]). + float EtaCut; // [ParticleLevel / Truth] Muon Object + // Selection maximum absolute eta Cut. + bool NotFromHadron; // [ParticleLevel / Truth] Whether to apply the + // 'NotFromHadron' requirement onto the objects. + bool TauIsHadron; // [ParticleLevel / Truth] Whether a tauon is a + // hadron during the 'NotFromHadron' check + } m_truth_muon; + + // photons + struct { + float PtCut; // [ParticleLevel / Truth] Photon Object + // Selection minimum pT Cut (Standard ATLAS + // units, [MeV]). + float EtaCut; // [ParticleLevel / Truth] Photon Object + // Selection maximum absolute eta Cut. + std::string Origin; // [ParticleLevel / Truth] Photon Object + // Selection truth origin configuration. + std::string Isolation; // [ParticleLevel / Truth] Photon Object + // Selection truth isolation configuration. + } m_truth_photon; + + // normal / large R jets + struct { + float PtCut; // [ParticleLevel / Truth] Jet Object + // Selection minimum pT Cut (Standard ATLAS + // units, [MeV]). + float EtaCut; // [ParticleLevel / Truth] Jet Object + // Selection maximum absolute eta Cut. + } m_truth_jet, m_truth_largeRJet; + + + // -----------------------------------------------]]] + + // Options for upgrade studies + bool m_HLLHC; + + // B-tagging WPs requested by the user + std::vector< std::string > m_chosen_btaggingWP = { }; + // B-tagging systematics requested by user to be excluded from EV treatment, separated by semi-colons + std::string m_bTagSystsExcludedFromEV = ""; + + // list of B-tagging WP actualy available + std::vector<std::string> m_available_btaggingWP; + std::vector<std::string> m_available_btaggingWP_trkJet; + // list of B-tagging WP actualy calibrated + std::vector<std::string> m_calibrated_btaggingWP; + std::vector<std::string> m_calibrated_btaggingWP_trkJet; + + // B-tagging calibration to be used + std::string m_btagging_calibration_B = "default"; + std::string m_btagging_calibration_C = "default"; + std::string m_btagging_calibration_Light = "default"; + + // b-tag SF helpers - one of each per WP + // will be set in the BTagScaleFactorCalculator + // These are the base names of the SF systematics (without __up/__down) + std::unordered_map<std::string,std::set<std::string>> bTag_base_names; + std::unordered_map<std::string,std::set<std::string>> bTag_base_names_trkJet; + // and those of them which are not eigenvectors + std::unordered_map<std::string,std::set<std::string>> bTag_named_systs; + std::unordered_map<std::string,std::set<std::string>> bTag_named_systs_trkJet; + // how many B eigen-variations do we have? + std::unordered_map<std::string,unsigned int> bTag_eigen_B; + std::unordered_map<std::string,unsigned int> bTag_eigen_B_trkJet; + // how many C eigen-variations do we have? + std::unordered_map<std::string,unsigned int> bTag_eigen_C; + std::unordered_map<std::string,unsigned int> bTag_eigen_C_trkJet; + // how many Light eigen-variations do we have? + std::unordered_map<std::string,unsigned int> bTag_eigen_light; + std::unordered_map<std::string,unsigned int> bTag_eigen_light_trkJet; + + // LHAPDF options + struct { + + std::vector<std::string> pdf_set_names = {}; + std::string baseLHAPDF = ""; // used only if XF1*XF2==0 + + // options + bool doLHAPDF = false; + bool doLHAPDFInNominalTrees = false; + + bool save_per_event = false; + + // we pass the results back to config in PDFScaleFactor::finalize + std::unordered_map< std::string, std::vector<float> > pdf_results; + + + } m_lhapdf_options; + + // Pile-up reweighting + struct { + + std::vector<std::string> lumi_calc_files = {}; + + std::vector<std::string> config_files = {}; + + bool apply = false; + + bool use_grl_tool = false; + + // Whether or not to perform mu dependent + // pile-up reweighting. Optional because can + // result in a possible loss of statistics + // that are crucial for things like MVA training. + bool mu_dependent = true; + + } m_pileup_reweighting; + + // Muon Trigger SF configuration + std::string m_muon_trigger_SF; + + + // Selections + std::shared_ptr<std::vector<std::string>> m_allSelectionNames; + // Trigger configuration + // First string is the selection name, second string is the trigger + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> m_allTriggers; + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> m_electronTriggers; + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> m_muonTriggers; + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> m_tauTriggers; + std::vector<std::string> m_dummyTrigger; + + // Where the sum of event weights + // before derivation framework is kept + std::string m_sumOfEventWeightsMetaData; + + // Object Selector name + std::string m_objectSelectionName; + // Output Format + std::string m_outputFormat; + // Output Events + std::string m_outputEvents; + bool m_saveOnlySelectedEvents; + // SetAutoFlush(0) on EventSaverFlatNtuple for ANALYSISTO-44 workaround + bool m_outputFileSetAutoFlushZero; + + // Number of events to run on (for testing) + unsigned int m_numberOfEventsToRun; + + // Number of events to skip (for testing) + unsigned int m_numberOfEventsToSkip; + + // AOD meta-data access service + AodMetaDataAccess * m_aodMetaData; + + // Systematics + std::size_t m_nominalHashValue; + + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashPhotons; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashElectrons; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashMuons; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashTaus; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashJets; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashLargeRJets; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashTrackJets; + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashMET; + + std::shared_ptr<std::unordered_set<std::size_t>> m_systHashAll; + std::shared_ptr<std::list<std::size_t>> m_list_systHashAll; + + std::shared_ptr<std::unordered_set<std::size_t>> m_systHash_electronInJetSubtraction; + std::shared_ptr<std::list<std::size_t>> m_list_systHash_electronInJetSubtraction; + + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapPhotons; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapElectrons; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapMuons; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapTaus; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapJets; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapLargeRJets; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapTrackJets; + std::shared_ptr<std::unordered_map<std::size_t,CP::SystematicSet>> m_systMapMET; + + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapPhotons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapElectrons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapMuons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapTaus; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapJets; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapJets_electronInJetSubtraction; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapJetsLoose_electronInJetSubtraction; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapLargeRJets; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapTrackJets; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapMET; + + // For TopEvent/SingleSystEvent - will return the nominal key if not under variation + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapPhotons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectrons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapMuons; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTaus; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJets; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapLargeRJets; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTrackJets; + // The boosted case is a bit more complex, we need additional collections + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectrons_electronInJetSubtraction; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJets_electronInJetSubtraction; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJetsLoose_electronInJetSubtraction; + + // For top::TopEventMaker + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapPhotonsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapPhotonsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectronsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectronsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapMuonsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapMuonsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTausTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTausTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJetsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJetsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapLargeRJetsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapLargeRJetsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTrackJetsTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapTrackJetsTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectrons_electronInJetSubtractionTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapElectrons_electronInJetSubtractionTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJets_electronInJetSubtractionTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJets_electronInJetSubtractionTDSAux; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDS; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllSgKeyMapJetsLoose_electronInJetSubtractionTDSAux; + + // Missing ET + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapMissingET; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapMissingETLoose; + + // KLFitter + std::string m_sgKeyKLFitter; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapKLFitter; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapKLFitterLoose; + + // PseudoTop + std::string m_sgKeyPseudoTop; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systSgKeyMapPseudoTop; + + // Map from systematic hash to CP::SystematicSet + std::shared_ptr<std::unordered_map<std::size_t, CP::SystematicSet> > m_systMapJetGhostTrack; + // Map from systematic hash to decoration key. + std::shared_ptr<std::unordered_map<std::size_t, std::string> > m_systDecoKeyMapJetGhostTrack; + + // Output TTree names + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systAllTTreeNames; + std::shared_ptr<std::unordered_map<std::size_t,std::string>> m_systPersistantAllTTreeNames; + // Output TTree index + std::shared_ptr<std::unordered_map<std::size_t,unsigned int>> m_systAllTTreeIndex; + std::shared_ptr<std::unordered_map<std::size_t,unsigned int>> m_systAllTTreeLooseIndex; + + // Private function only to simplify the setting of AFII values + void ReadIsAFII(top::ConfigurationSettings* const& settings); + + +}; +} // namespace top + +std::ostream& operator<<(std::ostream& os, const top::TopConfig& config); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h new file mode 100644 index 0000000000000000000000000000000000000000..20d1f3d03d5a9601785ab8216fb1f24053291bd6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h @@ -0,0 +1,100 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPCONFIGURATION_TOPPERSISTENTSETTINGS_H +#define ANALYSISTOP_TOPCONFIGURATION_TOPPERSISTENTSETTINGS_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TopPersistentSettings + * We presist this information into the mini-xAOD + * It allows us to reconstruct the state of the top-xaod code + * + * $Revision: 790409 $ + * $Date: 2016-12-19 01:46:29 +0100 (Mon, 19 Dec 2016) $ + * + * + **/ + +#include "xAODCore/CLASS_DEF.h" +#include <string> +#include <vector> +#include <map> +#include <unordered_map> + +namespace top{ + class TopPersistentSettings{ + public: + TopPersistentSettings(); + virtual ~TopPersistentSettings(){} + + bool m_isMC; + bool m_isAFII; + bool m_applyElectronInJetSubtraction; + bool m_doOverlapRemovalOnLooseLeptonDef; + bool m_doKLFitter; + bool m_doPseudoTop; + + std::string m_sgKeyTopSystematicEvents; + std::string m_sgKeyTopSystematicEventsLoose; + + std::string m_sgKeyEventInfo; + std::string m_sgKeyPrimaryVertices; + std::string m_sgKeyPhotons; + std::string m_sgKeyElectrons; + std::string m_sgKeyMuons; + std::string m_sgKeyTaus; + std::string m_sgKeyJets; + std::string m_sgKeyLargeRJets; + std::string m_sgKeyTrackJets; + std::string m_sgKeyMissingEt; + std::string m_sgKeyMissingEtLoose; + + std::string m_electronID; + std::string m_electronIDLoose; + std::string m_electronIsolation; + std::string m_electronIsolationLoose; + + std::string m_muon_trigger_SF; + std::string m_muonQuality; + std::string m_muonQualityLoose; + std::string m_muonIsolation; + std::string m_muonIsolationLoose; + + std::vector<std::string> m_chosen_btaggingWP; + + std::map<std::size_t,std::string> m_systSgKeyMapPhotons; + std::map<std::size_t,std::string> m_systSgKeyMapElectrons; + std::map<std::size_t,std::string> m_systSgKeyMapMuons; + std::map<std::size_t,std::string> m_systSgKeyMapTaus; + std::map<std::size_t,std::string> m_systSgKeyMapJets; + std::map<std::size_t,std::string> m_systSgKeyMapJets_electronInJetSubtraction; + std::map<std::size_t,std::string> m_systSgKeyMapJetsLoose_electronInJetSubtraction; + std::map<std::size_t,std::string> m_systSgKeyMapLargeRJets; + std::map<std::size_t,std::string> m_systSgKeyMapTrackJets; + std::map<std::size_t,std::string> m_systSgKeyMapMissingET; + std::map<std::size_t,std::string> m_systSgKeyMapMissingETLoose; + std::map<std::size_t,std::string> m_systSgKeyMapKLFitter; + std::map<std::size_t,std::string> m_systSgKeyMapKLFitterLoose; + std::map<std::size_t,std::string> m_systSgKeyMapPseudoTop; + std::map<std::size_t,std::string> m_systPersistantAllTTreeNames; + + std::map<std::size_t,std::string> m_systDecoKeyMapJetGhostTrack; + + std::vector<std::size_t> m_list_systHashAll; + std::vector<std::size_t> m_list_systHash_electronInJetSubtraction; + + std::vector<std::string> m_allSelectionNames; + + std::unordered_map<std::string, std::vector<std::string> > m_allTriggers; + std::unordered_map<std::string, std::vector<std::string> > m_electronTriggers; + std::unordered_map<std::string, std::vector<std::string> > m_muonTriggers; + std::unordered_map<std::string, std::vector<std::string> > m_tauTriggers; + }; +} +// Dictonaries +CLASS_DEF( top::TopPersistentSettings , 117063636 , 1 ) +#endif + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..64b7be31ac308244128f0372bd21f8c071acafc5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopConfiguration + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = -lboost_iostreams + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = Asg_Boost PATInterfaces + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/python/AodMetaDataReader.py b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/python/AodMetaDataReader.py new file mode 100755 index 0000000000000000000000000000000000000000..3f3051837a66b49d2fa42171a36237cb092040cc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/python/AodMetaDataReader.py @@ -0,0 +1,280 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# +# Extract meta-data from xAODs -- without the help of Athena. +# + +import argparse +import array +import ast +import json +import numbers +import os +import pickle +import re +import shutil +import sys +import tempfile + + +if not __name__ == '__main__': + # We can't risk loading our dictionaries into your PyROOT process. So please, use the subprocess + # module and the pickle interface. (If someone asks, we might implement a helper function.) + raise ImportError('AodMetaDataReader cannot be loaded as a module') + + +# supported types of meta-data values (storage type, member name in IOVPayloadContainer, display type) +payloadItemDescs = [ + None, + ('bool', 'm_bool', bool), + ('char', 'm_char', int), + ('unsigned char', 'm_unsignedChar', int), + ('short', 'm_short', int), + ('unsigned short', 'm_unsignedShort', int), + ('int', 'm_int', int), + ('unsigned int', 'm_unsignedInt', int), + ('long', 'm_long', int), + ('unsigned long', 'm_unsignedLong', int), + ('Long64_t', 'm_longLong', int), + ('ULong64_t', 'm_unsignedLongLong', int), + ('float', 'm_float', float), + ('double', 'm_double', float), + ('std::string', 'm_string', str), + ('ULong64_t', 'm_date', int), + ('ULong64_t', 'm_timeStamp', int), +] +# whether the dictionary has been loaded +loadedDictionary = False + + +# create minimal header for reading persistent objects representing xAOD meta-data +def writeDictionaryHeader(f): + f.write(''' +#include <string> +#include <vector> +#include <Rtypes.h> +''') + f.write(''' +class AttrListIndexes { +public: + int getTypeIndex() const { return (m_typeIndex & 0x3f); } + int getNameIndex() const { return (m_typeIndex >> 6); } + int getObjIndex() const { return m_objIndex; } +private: + unsigned short m_typeIndex; + unsigned short m_objIndex; +}; +''') + f.write('struct IOVPayloadContainer_p1 {\n') + f.write(' std::vector<AttrListIndexes> m_attrIndexes;') + for payloadItemDesc in payloadItemDescs: + if not payloadItemDesc: + continue + f.write(' std::vector<%s> %s;\n' % (payloadItemDesc[:2])) + f.write(' std::vector<std::string> m_attrName;') + f.write('};\n') + f.write(''' +struct IOVMetaDataContainer_p1 { + std::string m_folderName; + std::string m_folderDescription; + IOVPayloadContainer_p1 m_payload; +}; +''') + + +# load classes for reading persistent objects representing xAOD meta-data +def loadDictionary(): + global loadedDictionary + if loadedDictionary: + return + loadedDictionary = True + tempPath = tempfile.mkdtemp() + try: + headerPath = os.path.join(tempPath, 'AodMetaData.h') + with open(headerPath, 'wb') as f: + writeDictionaryHeader(f) + ROOT.gROOT.LoadMacro('%s+' % headerPath) + finally: + shutil.rmtree(tempPath, ignore_errors=True) + + +def extractMetaData(path): + folderNames = '/Generation/Parameters', '/Simulation/Parameters', '/Digitization/Parameters', '/TagInfo' + loadDictionary() + f = ROOT.TFile.Open(path) + if not f: + raise RuntimeError('Failed to open file: %s' % repr(path)) + metaData = {} + try: + metaDataTree = f.MetaData + metaDataTree.SetBranchStatus('*', False) + folderNamesFound = [] + for folderName in folderNames: + found = array.array('I', [0]) + metaDataTree.SetBranchStatus(folderName.replace('/', '_'), True, found) + if found[0]: + folderNamesFound.append(folderName) + else: + metaData[folderName] = None + for metaDataRecord in metaDataTree: + for folderName in folderNamesFound: + payload = getattr(metaDataRecord, folderName.replace('/', '_')).m_payload + folderData = {} + for attrIndex in payload.m_attrIndexes: + typeIndex, nameIndex, objIndex = attrIndex.getTypeIndex(), attrIndex.getNameIndex(), attrIndex.getObjIndex() + payloadItemDesc = ( payloadItemDescs[typeIndex] if typeIndex < len(payloadItemDescs) else None ) + key = payload.m_attrName.at(nameIndex) + value = ( payloadItemDesc[2](getattr(payload, payloadItemDesc[1]).at(objIndex)) if payloadItemDesc else TypeError ) + if not key in folderData: + folderData[key] = value + elif not folderData[key] == value: + folderData[key] = ValueError + metaData[folderName] = folderData + finally: + f.Close() + return metaData + + +# merge two meta-data dictionaries +# Conflicting values are set to ValueError. +# Folders/values that exist in one but not another are set to None. +def mergeMetaData(md1, md2): + assert len(md1) == len(md2) + md = {} + for folderName, folderData1 in md1.iteritems(): + folderData2 = md2[folderName] + if folderData1 is None or folderData2 is None: + folderData = None + else: + folderData = dict( (key, None) for key in folderData1 ) + folderData.update( (key, None) for key in folderData2 ) + for key in folderData: + if key in folderData1 and key in folderData2: + if folderData1[key] == folderData2[key]: + folderData[key] = folderData1[key] + else: + folderData[key] = ValueError + md[folderName] = folderData + return md + + +# add derived meta-data for convenience +def augmentMetaData(metaData): + derived = {} + try: + value = metaData['/Generation/Parameters']['HepMCWeightNames'] + mcWeightIndexByName = ast.literal_eval(value) + mcWeightNames = [] + for name, index in mcWeightIndexByName.iteritems(): + if index >= len(mcWeightNames): + mcWeightNames += ( None for _ in xrange(len(mcWeightNames), index + 1) ) + elif not mcWeightNames[index] is None: + raise KeyError('multiple names for HepMCWeight index %d' % index) + mcWeightNames[index] = name + derived['HepMCWeightNames'] = ','.join(mcWeightNames) + except Exception: + # TODO proper error handling + pass + metaData['_derived'] = derived + + +# file-object wrapper around os.dup +def fdup(fileObject): + fd2 = os.dup(fileObject.fileno()) + fileObject2 = None + try: + fileObject2 = os.fdopen(fd2, fileObject.mode, -1) + finally: + if fileObject2 is None: + os.close(fd2) + return fileObject2 + + +# file-object wrapper around os.dup2 +def fdup2(fileObject, fileObject2): + os.dup2(fileObject.fileno(), fileObject2.fileno()) + + +# write out meta-data as tab-separated plain text +def dumpPlain(metaData, out): + for folderName in sorted(metaData): + folderData = metaData[folderName] + if folderData is None: + continue + for key in sorted(folderData): + value = folderData[key] + if isinstance(value, basestring): + pass + elif isinstance(value, numbers.Number): + value = repr(value) + else: + # keys with conflicting/unrecognized values are completely ignored + continue + value = re.sub(r'[^\x21-\x7e]+', ' ', value).strip() + out.write('%s\t%s\t%s\n' % (folderName, key, value)) + out.write('\n') + + +# supported meta-data dumpers +_dumpers = { + 'plain': dumpPlain, + 'pickle': pickle.dump, + 'json': json.dump, + } + + +def main(argv, out): + parser = argparse.ArgumentParser() + parser.add_argument('--format', dest='dumper', action='store', choices=_dumpers.keys()) + parser.add_argument('--pickle', dest='dumper', action='store_const', const='pickle') + parser.add_argument('--files-from', '-T', dest='filesFrom', action='store') + parser.add_argument('--output', dest='outputFile', action='store') + parser.add_argument('files', action='store', nargs='*') + parser.set_defaults(dumper='plain') + options = parser.parse_args(argv[1:]) + + paths = [] + if options.filesFrom: + with open(options.filesFrom, 'r') as f: + for line in f: + paths.extend(filter(None, line.rstrip('\n\r').split(','))) + if options.files: + paths += options.files + dumper = _dumpers[options.dumper] + + path = paths[0] + metaData = extractMetaData(path) + for path in paths[1:]: + metaData = mergeMetaData(metaData, extractMetaData(path)) + + augmentMetaData(metaData) + if options.outputFile: + with tempfile.NamedTemporaryFile(dir=os.path.dirname(options.outputFile), delete=True) as f: + dumper(metaData, f) + f.flush() + os.link(f.name, options.outputFile) + else: + dumper(metaData, out) + out.flush() + + +# load ROOT in batch mode, skip loading of any (possibly conflicting) ROOT dictionaries through rootlogon +def loadROOT(): + args = sys.argv[1:] + try: + sys.argv[1:] = '-b', '-l', '-n' + import ROOT + ROOT.gErrorIgnoreLevel = ROOT.kError + globals()['ROOT'] = ROOT + finally: + sys.argv[1:] = args + + +# acquire copy of stdout, then redirect /dev/null +# (so stray prints by ROOT don't mess up our dumps) +with fdup(sys.stdout) as out: + with open(os.devnull, 'w') as nulout: + fdup2(nulout, sys.stdout) + loadROOT() + main(sys.argv, out) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..197002b3f3b801ba9a231760001047f65f308549 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/share/mainpage.h @@ -0,0 +1,8 @@ +/** + * @page tconfpage TopConfiguration + * + * - top::ConfigurationSettings + * - top::SelectionConfigurationData + * - top::StringData + * - top::TopConfig + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..db669697fa291a4e9a5b043e90d55fc88da8a18b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt @@ -0,0 +1,51 @@ +# Auto-generated on: 2017-03-08 14:47:35.652165 + +# Declare the name of this package: +atlas_subdir( TopCorrections None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODEgamma + xAODMuon + TopEvent + PileupReweighting + ElectronEfficiencyCorrection + MuonEfficiencyCorrections + xAODBTaggingEfficiency + TauAnalysisTools + JetJvtEfficiency + PhotonEfficiencyCorrection + PMGTools ) + +# This package uses LHAPDF: +find_package( Lhapdf ) +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g -std=c++14 ) + +# Build a library that other components can link against: +atlas_add_library( TopCorrections Root/*.cxx Root/*.h Root/*.icc + TopCorrections/*.h TopCorrections/*.icc TopCorrections/*/*.h + TopCorrections/*/*.icc + PUBLIC_HEADERS TopCorrections + LINK_LIBRARIES xAODEgamma + xAODMuon + TopEvent + PileupReweightingLib + ElectronEfficiencyCorrectionLib + MuonEfficiencyCorrectionsLib + xAODBTaggingEfficiencyLib + TauAnalysisToolsLib + JetJvtEfficiencyLib + PhotonEfficiencyCorrectionLib + PMGToolsLib + ${LHAPDF_LIBRARIES} + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + ${LHAPDF_INCLUDE_DIRS}) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/BTagScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/BTagScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1ce0e7a7d723f077d33809bdc57442b5485c0f2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/BTagScaleFactorCalculator.cxx @@ -0,0 +1,202 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: BTagScaleFactorCalculator.cxx 802983 2017-04-16 18:31:29Z tpelzer $ +#include "TopCorrections/BTagScaleFactorCalculator.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODJet/JetContainer.h" +#include <cmath> +#include <algorithm> +#include <functional> + +namespace top{ + + BTagScaleFactorCalculator::BTagScaleFactorCalculator( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + m_nominal( CP::SystematicSet() ) + { + declareProperty( "config" , m_config ); + + } + + StatusCode BTagScaleFactorCalculator::initialize() + { + ATH_MSG_INFO(" top::BTagScaleFactorCalculator initialize" ); + + std::string release_series = ""; + const char* rel_temp = std::getenv("ROOTCORE_RELEASE_SERIES"); + if (rel_temp) { + release_series = std::string(rel_temp); + } else { + ATH_MSG_WARNING("Can not access ROOTCORE_RELEASE_SERIES"); + } + + if (release_series == "23") { + ATH_MSG_INFO("Setting release series to 2.3"); + m_release_series = 23; + } else if (release_series == "24") { + m_release_series = 24; + ATH_MSG_INFO("Setting release series to 2.4"); + } else { + ATH_MSG_WARNING("Unknown release series, assuming 2.4"); + } + + // for calo jets + std::vector<std::string> availableWPs = m_config->bTagWP_available(); + for (auto& WP : availableWPs) { + m_btagSelTools[WP] = "BTaggingSelectionTool_"+WP+"_"+m_config->sgKeyJets(); + top::check( m_btagSelTools[WP].retrieve(), "Failed to retrieve b-tagging Selection tool" ); + if (std::find(m_config->bTagWP_calibrated().begin(), + m_config->bTagWP_calibrated().end(), WP) != m_config->bTagWP_calibrated().end()) {// need scale-factors only for calibrated WPs + m_btagEffTools[WP] = "BTaggingEfficiencyTool_"+WP+"_"+m_config->sgKeyJets(); + top::check( m_btagEffTools[WP].retrieve(), "Failed to retrieve b-tagging Efficiency tool" ); + m_systs[WP] = m_btagEffTools[WP]->affectingSystematics(); + std::set<std::string> base_names = m_systs[WP].getBaseNames(); + m_config->setBTaggingSFSysts( WP, base_names ); + } + } + // for track jets + availableWPs = m_config->bTagWP_available_trkJet(); + for (auto& WP : availableWPs) { + m_trkjet_btagSelTools[WP] = "BTaggingSelectionTool_"+WP+"_"+m_config->sgKeyTrackJets(); + top::check( m_trkjet_btagSelTools[WP].retrieve(), "Failed to retrieve b-tagging Selection tool" ); + if (std::find(m_config->bTagWP_calibrated_trkJet().begin(), + m_config->bTagWP_calibrated_trkJet().end(), WP) != m_config->bTagWP_calibrated_trkJet().end()) {// need scale-factors only for calibrated WPs + m_trkjet_btagEffTools[WP] = "BTaggingEfficiencyTool_"+WP+"_"+m_config->sgKeyTrackJets(); + top::check( m_trkjet_btagEffTools[WP].retrieve(), "Failed to retrieve b-tagging Efficiency tool" ); + m_trkjet_systs[WP] = m_trkjet_btagEffTools[WP]->affectingSystematics(); + std::set<std::string> base_names = m_trkjet_systs[WP].getBaseNames(); + m_config->setBTaggingSFSysts( WP, base_names, true ); + } + } + + return StatusCode::SUCCESS; + } + + + StatusCode BTagScaleFactorCalculator::execute() + { + + top::check( apply( m_config->systSgKeyMapJets(false) ), + "Failed to apply btagging SFs" ); + if( m_config->useTrackJets() ) + top::check( apply( m_config->systSgKeyMapTrackJets(), true ), + "Failed to apply track jet btagging SFs" ); + + return StatusCode::SUCCESS; + + } + + StatusCode BTagScaleFactorCalculator::apply( const std::shared_ptr<std::unordered_map<std::size_t,std::string>>& jet_syst_collections, bool use_trackjets ){ + ///-- Loop over all jet collections --/// + ///-- Lets assume that we're not doing ElectronInJet subtraction --/// + for (auto currentSystematic : *jet_syst_collections) { + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, currentSystematic.second), "failed to retrieve jets"); + + ///-- Tell the SF tools to use the nominal systematic --/// + + /// -- Loop over all jets in each collection --/// + for (auto jetPtr : *jets) { + + bool passSelection(false); + if (jetPtr->isAvailable<char>("passPreORSelection")) { + if (jetPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (jetPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (jetPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + if (passSelection) { + + // now loop over all available WPs + + for( auto& tagWP : (use_trackjets ? m_config->bTagWP_available_trkJet() : m_config->bTagWP_available()) ){ + // skip uncalibrated though available WPs + if (use_trackjets && + std::find(m_config->bTagWP_calibrated_trkJet().begin(), + m_config->bTagWP_calibrated_trkJet().end(), tagWP) + == m_config->bTagWP_calibrated_trkJet().end()) continue; + else if (!use_trackjets && + std::find(m_config->bTagWP_calibrated().begin(), + m_config->bTagWP_calibrated().end(), tagWP) + == m_config->bTagWP_calibrated().end()) continue; + ToolHandle<IBTaggingEfficiencyTool>& btageff = use_trackjets ? m_trkjet_btagEffTools[tagWP] : m_btagEffTools[tagWP]; + ToolHandle<IBTaggingSelectionTool>& btagsel = use_trackjets ? m_trkjet_btagSelTools[tagWP] : m_btagSelTools[tagWP]; + CP::SystematicSet& sysSet = use_trackjets ? m_trkjet_systs[tagWP] : m_systs[tagWP]; + + // need now the DSID to find out which shower was used in the sample + unsigned int MapIndex = m_config -> getMapIndex(); + + btageff -> setMapIndex("Light", MapIndex); + btageff -> setMapIndex("C", MapIndex); + btageff -> setMapIndex("B", MapIndex); + btageff -> setMapIndex("T", MapIndex); + + top::check( btageff->applySystematicVariation(m_nominal), + "Failed to set new b-tagging SF to nominal" ); + + float btag_SF(1.0); + bool isTagged = false;//unused in case of Continuous + if (std::fabs(jetPtr->eta()) < 2.5 ) { + if (tagWP != "Continuous") { + isTagged = btagsel->accept(*jetPtr); + if(isTagged) + top::check( btageff->getScaleFactor(*jetPtr, btag_SF), + "Failed to get nominal b-tagging SF" ); + else + top::check( btageff->getInefficiencyScaleFactor(*jetPtr, btag_SF), + "Failed to get nominal b-tagging SF" ); + } + else { + top::check( btageff->getScaleFactor(*jetPtr, btag_SF), + "Failed to get nominal Continuous b-tagging SF" ); + } + } + jetPtr->auxdecor<float>("btag_SF_"+tagWP+"_nom") = btag_SF; + + ///-- For nominal calibration, vary the SF systematics --/// + if (currentSystematic.first == m_config->nominalHashValue()) { + + for( const auto& variation : sysSet ) { + btag_SF = 1.; + CP::SystematicSet syst_set; + syst_set.insert( variation ); + top::check( btageff->applySystematicVariation(syst_set), + "Failed to set new b-tagging systematic variation "+syst_set.name() ); + if (std::fabs(jetPtr->eta()) < 2.5 ) { + if (tagWP != "Continuous") { + if (isTagged) + top::check( btageff->getScaleFactor(*jetPtr, btag_SF), + "Failed to get b-tagging SF for variation "+syst_set.name() ); + else + top::check( btageff->getInefficiencyScaleFactor(*jetPtr, btag_SF), + "Failed to get b-tagging SF for variation "+syst_set.name() ); + } + else { + top::check( btageff->getScaleFactor(*jetPtr, btag_SF), + "Failed to get Continuous b-tagging SF for variation "+syst_set.name() ); + } + } + jetPtr->auxdecor<float>( "btag_SF_"+tagWP+"_"+variation.name() ) = btag_SF; + } // loop through b-tagging systematic variations + } // Calibration systematic is nominal, so calculate SF systematics + + } + } + } + } + + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3ae5e1323d666daac95e433a4f83a5b28b3ce2ff --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx @@ -0,0 +1,501 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronScaleFactorCalculator.cxx 799556 2017-03-05 19:46:03Z tpelzer $ +#include "TopCorrections/ElectronScaleFactorCalculator.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEgamma/ElectronContainer.h" + + +namespace top{ + + ElectronScaleFactorCalculator::ElectronScaleFactorCalculator( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_systNominal( CP::SystematicSet() ), + m_systTrigger_UP( CP::SystematicSet() ), + m_systTrigger_DOWN( CP::SystematicSet() ), + m_systReco_UP( CP::SystematicSet() ), + m_systReco_DOWN( CP::SystematicSet() ), + m_systID_UP( CP::SystematicSet() ), + m_systID_DOWN( CP::SystematicSet() ), + m_systIso_UP( CP::SystematicSet() ), + m_systIso_DOWN( CP::SystematicSet() ), + m_systChargeID_UP( CP::SystematicSet() ), + m_systChargeID_DOWN( CP::SystematicSet() ), + m_systChargeMisID_STAT_UP( CP::SystematicSet() ), + m_systChargeMisID_STAT_DOWN( CP::SystematicSet() ), + m_systChargeMisID_SYST_UP( CP::SystematicSet() ), + m_systChargeMisID_SYST_DOWN( CP::SystematicSet() ), + + m_electronEffSFTrigger("AsgElectronEfficiencyCorrectionTool_TriggerSF"), + m_electronEffSFTriggerLoose("AsgElectronEfficiencyCorrectionTool_TriggerSFLoose"), + m_electronEffTrigger("AsgElectronEfficiencyCorrectionTool_Trigger"), + m_electronEffTriggerLoose("AsgElectronEfficiencyCorrectionTool_TriggerLoose"), + + m_electronEffSFReco("AsgElectronEfficiencyCorrectionTool_Reco"), + + m_electronEffSFID("AsgElectronEfficiencyCorrectionTool_ID"), + m_electronEffSFIDLoose("AsgElectronEfficiencyCorrectionTool_IDLoose"), + + m_electronEffIso_exists(false), + m_electronEffIsoLoose_exists(false), + m_electronEffSFIso("AsgElectronEfficiencyCorrectionTool_Iso"), + m_electronEffSFIsoLoose("AsgElectronEfficiencyCorrectionTool_IsoLoose"), + m_electronEffChargeID_exists(false), + m_electronEffChargeIDLoose_exists(false), + m_electronEffChargeMisID_exists(false), + m_electronEffChargeMisIDLoose_exists(false), + m_electronEffSFChargeID("AsgElectronEfficiencyCorrectionTool_ChargeID"), + m_electronEffSFChargeIDLoose("AsgElectronEfficiencyCorrectionTool_ChargeIDLoose"), + m_electronEffSFChargeMisID("ElectronChargeEfficiencyCorrection"), + m_electronEffSFChargeMisIDLoose("ElectronChargeEfficiencyCorrectionLoose"), + + m_decor_triggerEff("SetMe"), + m_decor_triggerEff_loose("SetMe"), + m_decor_triggerSF("SetMe"), + m_decor_triggerSF_loose("SetMe"), + m_decor_recoSF("SetMe"), + m_decor_idSF("SetMe"), + m_decor_idSF_loose("SetMe"), + m_decor_isoSF("SetMe"), + m_decor_isoSF_loose("SetMe"), + m_decor_chargeidSF("SetMe"), + m_decor_chargeidSF_loose("SetMe"), + m_decor_chargemisidSF("SetMe"), + m_decor_chargemisidSF_loose("SetMe") + { + declareProperty( "config" , m_config ); + } + + StatusCode ElectronScaleFactorCalculator::initialize() + { + ATH_MSG_INFO(" top::ElectronScaleFactorCalculator initialize" ); + + top::check( m_electronEffSFTrigger.retrieve() , "Failed to retrieve electron SF Tool" ); + top::check( m_electronEffSFTriggerLoose.retrieve() , "Failed to retrieve electron SF Tool" ); + + top::check( m_electronEffSFReco.retrieve() , "Failed to retrieve electron SF Tool" ); + + if ( asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool> ("AsgElectronEfficiencyCorrectionTool_Iso") ){ + m_electronEffIso_exists = true; + top::check( m_electronEffSFIso.retrieve() , "Failed to retrieve electron SF Tool" ); + } + if ( asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool> ("AsgElectronEfficiencyCorrectionTool_IsoLoose") ){ + m_electronEffIsoLoose_exists = true; + top::check( m_electronEffSFIsoLoose.retrieve() , "Failed to retrieve loose electron SF Tool" ); + } + // ChargeID efficiency and Charge mis-identification scale factors: to apply when enabling Electron Charge ID Selector + if ( asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool> ("AsgElectronEfficiencyCorrectionTool_ChargeID") ){ + m_electronEffChargeID_exists = true; // this scale factor currently exists only for MediumLHH electron + top::check( m_electronEffSFChargeID.retrieve() , "Failed to retrieve electron charge flip efficiency SF Tool" ); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_electronEffSFChargeID->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + } + if ( asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool> ("AsgElectronEfficiencyCorrectionTool_ChargeIDLoose") ){ + m_electronEffChargeIDLoose_exists = true; // this scale factor currently exists only for MediumLHH electron + top::check( m_electronEffSFChargeIDLoose.retrieve() , "Failed to retrieve electron charge flip efficiency SF Tool" ); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_electronEffSFChargeIDLoose->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + } + if ( asg::ToolStore::contains<CP::ElectronChargeEfficiencyCorrectionTool> ("ElectronChargeEfficiencyCorrection") && + m_config->doPileupReweighting() ){ // tool requires RandomRunNumber set from it + m_electronEffChargeMisID_exists = true; + top::check( m_electronEffSFChargeMisID.retrieve() , "Failed to retrieve electron charge mis-id SF Tool" ); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_electronEffSFChargeMisID->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + } + if ( asg::ToolStore::contains<CP::ElectronChargeEfficiencyCorrectionTool> ("ElectronChargeEfficiencyCorrectionLoose") && + m_config->doPileupReweighting() ){ // tool requires RandomRunNumber set from it + m_electronEffChargeMisIDLoose_exists = true; + top::check( m_electronEffSFChargeMisIDLoose.retrieve() , "Failed to retrieve electron charge mis-id SF Tool" ); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_electronEffSFChargeMisIDLoose->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + } + + // If the isolation tool doesn't exist then check why... + // valid reasons include you want no isolation or you know you are using an unsupported WP + if( !m_electronEffIso_exists ) + if( m_config->electronIsolation() != "None" ) + if( m_config->electronIsoSFs() ){ // ... check if we want to continue anyway without SFs anyway + ATH_MSG_WARNING( "No electron isolation SFs available. You can run with ElectronIsolation set to None if you don't want isolation, or add:\tElectronIsoSFs False\tto your config file." ); + return StatusCode::FAILURE; + } + + if( !m_electronEffIsoLoose_exists ) // If the electron isolation SFs don't exist + if( m_config->electronIsolationLoose() != "None" ) // If the isolation is not 'None' then... + if( m_config->electronIsoSFs() ){ // ... check if we want to continue anyway without SFs anyway + ATH_MSG_WARNING( "No (loose) electron isolation SFs available. You can run with ElectronIsolationLoose set to None if you don't want isolation, or add:\tElectronIsoSFs False\tto your config file." ); + return StatusCode::FAILURE; + } + + top::check( m_electronEffSFID.retrieve() , "Failed to retrieve electron SF Tool" ); + top::check( m_electronEffSFIDLoose.retrieve() , "Failed to retrieve electron SF Tool" ); + + m_systTrigger_UP.insert( CP::SystematicVariation("EL_EFF_Trigger_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systTrigger_DOWN.insert( CP::SystematicVariation("EL_EFF_Trigger_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systReco_UP.insert( CP::SystematicVariation("EL_EFF_Reco_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systReco_DOWN.insert( CP::SystematicVariation("EL_EFF_Reco_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systID_UP.insert( CP::SystematicVariation("EL_EFF_ID_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systID_DOWN.insert( CP::SystematicVariation("EL_EFF_ID_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systIso_UP.insert( CP::SystematicVariation("EL_EFF_Iso_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systIso_DOWN.insert( CP::SystematicVariation("EL_EFF_Iso_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systIso_UP.insert( CP::SystematicVariation("EL_EFF_Iso_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systIso_DOWN.insert( CP::SystematicVariation("EL_EFF_Iso_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systChargeID_UP.insert( CP::SystematicVariation("EL_EFF_ChargeIDSel_TOTAL_1NPCOR_PLUS_UNCOR" , 1 )); + m_systChargeID_DOWN.insert( CP::SystematicVariation("EL_EFF_ChargeIDSel_TOTAL_1NPCOR_PLUS_UNCOR" , -1 )); + m_systChargeMisID_STAT_UP.insert( CP::SystematicVariation("EL_CHARGEID_STAT" , 1 )); + m_systChargeMisID_STAT_DOWN.insert( CP::SystematicVariation("EL_CHARGEID_STAT" , -1 )); + m_systChargeMisID_SYST_UP.insert( CP::SystematicVariation("EL_CHARGEID_SYStotal" , 1 )); + m_systChargeMisID_SYST_DOWN.insert( CP::SystematicVariation("EL_CHARGEID_SYStotal" , -1 )); + + m_decor_triggerEff = "EL_EFF_Trigger_" + m_config->electronID(); + m_decor_triggerEff_loose = "EL_EFF_Trigger_" + m_config->electronIDLoose(); + m_decor_triggerSF = "EL_SF_Trigger_" + m_config->electronID(); + m_decor_triggerSF_loose = "EL_SF_Trigger_" + m_config->electronIDLoose(); + m_decor_recoSF = "EL_SF_Reco"; + m_decor_idSF = "EL_SF_ID_" + m_config->electronID(); + m_decor_idSF_loose = "EL_SF_ID_" + m_config->electronIDLoose(); + m_decor_isoSF = "EL_SF_Iso_" + m_config->electronIsolation(); + m_decor_isoSF_loose = "EL_SF_Iso_" + m_config->electronIsolationLoose(); + m_decor_chargeidSF = "EL_SF_ChargeID_" + m_config->electronID() + "_" + m_config->electronIsolation(); + m_decor_chargeidSF_loose = "EL_SF_ChargeID_" + m_config->electronIDLoose() + "_" + m_config->electronIsolationLoose(); + m_decor_chargemisidSF = "EL_SF_ChargeMisID_" + m_config->electronID() + "_" + m_config->electronIsolation(); + m_decor_chargemisidSF_loose = "EL_SF_ChargeMisID_" + m_config->electronIDLoose() + "_" + m_config->electronIsolationLoose(); + + return StatusCode::SUCCESS; + } + + + StatusCode ElectronScaleFactorCalculator::execute() + { + ///-- Loop over all electron collections --/// + for (auto currentSystematic : *m_config->systSgKeyMapElectrons()) { + const xAOD::ElectronContainer* electrons(nullptr); + top::check(evtStore()->retrieve(electrons, currentSystematic.second), "failed to retrieve electrons"); + + ///-- Tell the SF tools to use the nominal systematic --/// + top::check(m_electronEffSFTrigger->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFTriggerLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFReco->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffIso_exists ) + top::check(m_electronEffSFIso->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffIsoLoose_exists ) + top::check(m_electronEffSFIsoLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffChargeID_exists ) + top::check(m_electronEffSFChargeID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffChargeIDLoose_exists ) + top::check(m_electronEffSFChargeIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffChargeMisID_exists ) + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + if( m_electronEffChargeMisIDLoose_exists ) + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + + /// -- Loop over all electrons in each collection --/// + for (auto electronPtr : *electrons) { + + /// -- Does the electron pass object selection? --/// + bool passSelection(false); + if (electronPtr->isAvailable<char>("passPreORSelection")) { + if (electronPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (electronPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (electronPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + if (passSelection) { + + double Eff_Trigger(1.), Eff_TriggerLoose(1.); + double SF_Trigger(1.), SF_TriggerLoose(1.); + double SF_Reco(1.); + double SF_ID(1.),SF_IDLoose(1.); + double SF_Isol(1.),SF_IsolLoose(1.); + double SF_ChargeID(1.), SF_ChargeIDLoose(1.); + double SF_ChargeMisID(1.), SF_ChargeMisIDLoose(1.); + + ///-- Get Efficiencies --/// + top::check(m_electronEffTrigger -> getEfficiencyScaleFactor( *electronPtr , Eff_Trigger ) , "Failed to get SF"); + top::check(m_electronEffTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , Eff_TriggerLoose ) , "Failed to get SF"); + + ///-- Get Scale Factors --/// + top::check(m_electronEffSFTrigger -> getEfficiencyScaleFactor( *electronPtr , SF_Trigger ) , "Failed to get SF"); + top::check(m_electronEffSFTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , SF_TriggerLoose ) , "Failed to get SF"); + top::check(m_electronEffSFReco -> getEfficiencyScaleFactor( *electronPtr , SF_Reco ) , "Failed to get SF"); + top::check(m_electronEffSFID -> getEfficiencyScaleFactor( *electronPtr , SF_ID ) , "Failed to get SF"); + top::check(m_electronEffSFIDLoose -> getEfficiencyScaleFactor( *electronPtr , SF_IDLoose ) , "Failed to get SF"); + if( m_electronEffIso_exists ) + top::check(m_electronEffSFIso -> getEfficiencyScaleFactor( *electronPtr , SF_Isol ) , "Failed to get SF"); + if( m_electronEffIsoLoose_exists ) + top::check(m_electronEffSFIsoLoose -> getEfficiencyScaleFactor( *electronPtr , SF_IsolLoose ) , "Failed to get SF"); + if( m_electronEffChargeID_exists ) + top::check(m_electronEffSFChargeID -> getEfficiencyScaleFactor( *electronPtr , SF_ChargeID ) , "Failed to get SF"); + if( m_electronEffChargeIDLoose_exists ) + top::check(m_electronEffSFChargeIDLoose -> getEfficiencyScaleFactor( *electronPtr , SF_ChargeIDLoose ) , "Failed to get SF"); + if( m_electronEffChargeMisID_exists ) + top::check(m_electronEffSFChargeMisID -> getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisID ) , "Failed to get SF"); + if( m_electronEffChargeMisIDLoose_exists ) + top::check(m_electronEffSFChargeMisIDLoose -> getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisIDLoose ) , "Failed to get SF"); + + + ///-- Decorate --/// + electronPtr->auxdecor<float>(m_decor_triggerEff) = Eff_Trigger; + electronPtr->auxdecor<float>(m_decor_triggerEff_loose) = Eff_TriggerLoose; + electronPtr->auxdecor<float>(m_decor_triggerSF) = SF_Trigger; + electronPtr->auxdecor<float>(m_decor_triggerSF_loose) = SF_TriggerLoose; + electronPtr->auxdecor<float>(m_decor_recoSF) = SF_Reco; + electronPtr->auxdecor<float>(m_decor_idSF) = SF_ID; + electronPtr->auxdecor<float>(m_decor_idSF_loose) = SF_IDLoose; + electronPtr->auxdecor<float>(m_decor_isoSF) = SF_Isol; + electronPtr->auxdecor<float>(m_decor_isoSF_loose) = SF_IsolLoose; + electronPtr->auxdecor<float>(m_decor_chargeidSF) = SF_ChargeID; + electronPtr->auxdecor<float>(m_decor_chargeidSF_loose) = SF_ChargeIDLoose; + electronPtr->auxdecor<float>(m_decor_chargemisidSF) = SF_ChargeMisID; + electronPtr->auxdecor<float>(m_decor_chargemisidSF_loose) = SF_ChargeMisIDLoose; + + ///-- For nominal calibration, vary the SF systematics --/// + if (currentSystematic.first == m_config->nominalHashValue()) { + + double EFF_Trigger_UP(1.),EFF_TriggerLoose_UP(1.); + double SF_Trigger_UP(1.),SF_TriggerLoose_UP(1.); + double SF_Reco_UP(1.); + double SF_ID_UP(1.),SF_IDLoose_UP(1.); + double SF_Isol_UP(1.),SF_IsolLoose_UP(1.); + double SF_ChargeID_UP(1.),SF_ChargeIDLoose_UP(1.); + double SF_ChargeMisID_STAT_UP(1.),SF_ChargeMisIDLoose_STAT_UP(1.); + double SF_ChargeMisID_SYST_UP(1.),SF_ChargeMisIDLoose_SYST_UP(1.); + + double EFF_Trigger_DOWN(1.),EFF_TriggerLoose_DOWN(1.); + double SF_Trigger_DOWN(1.),SF_TriggerLoose_DOWN(1.); + double SF_Reco_DOWN(1.); + double SF_ID_DOWN(1.),SF_IDLoose_DOWN(1.); + double SF_Isol_DOWN(1.),SF_IsolLoose_DOWN(1.); + double SF_ChargeID_DOWN(1.),SF_ChargeIDLoose_DOWN(1.); + double SF_ChargeMisID_STAT_DOWN(1.),SF_ChargeMisIDLoose_STAT_DOWN(1.); + double SF_ChargeMisID_SYST_DOWN(1.),SF_ChargeMisIDLoose_SYST_DOWN(1.); + + ///-- Trigger --/// + ///-- Trigger UP --/// + top::check(m_electronEffSFTrigger -> applySystematicVariation( m_systTrigger_UP ),"Failed to set systematic"); + top::check(m_electronEffSFTriggerLoose -> applySystematicVariation( m_systTrigger_UP ),"Failed to set systematic"); + top::check(m_electronEffSFTrigger -> getEfficiencyScaleFactor( *electronPtr , SF_Trigger_UP ) , "Failed to get SF"); + top::check(m_electronEffSFTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , SF_TriggerLoose_UP ) , "Failed to get SF"); + top::check(m_electronEffTrigger -> applySystematicVariation( m_systTrigger_UP ),"Failed to set systematic"); + top::check(m_electronEffTriggerLoose -> applySystematicVariation( m_systTrigger_UP ),"Failed to set systematic"); + top::check(m_electronEffTrigger -> getEfficiencyScaleFactor( *electronPtr , EFF_Trigger_UP ) , "Failed to get SF"); + top::check(m_electronEffTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , EFF_TriggerLoose_UP ) , "Failed to get SF"); + + ///-- Trigger DOWN --/// + top::check(m_electronEffSFTrigger -> applySystematicVariation( m_systTrigger_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFTriggerLoose -> applySystematicVariation( m_systTrigger_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFTrigger -> getEfficiencyScaleFactor( *electronPtr , SF_Trigger_DOWN ) , "Failed to get SF"); + top::check(m_electronEffSFTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , SF_TriggerLoose_DOWN ) , "Failed to get SF"); + top::check(m_electronEffTrigger -> applySystematicVariation( m_systTrigger_DOWN ),"Failed to set systematic"); + top::check(m_electronEffTriggerLoose -> applySystematicVariation( m_systTrigger_DOWN ),"Failed to set systematic"); + top::check(m_electronEffTrigger -> getEfficiencyScaleFactor( *electronPtr , EFF_Trigger_DOWN ) , "Failed to get SF"); + top::check(m_electronEffTriggerLoose -> getEfficiencyScaleFactor( *electronPtr , EFF_TriggerLoose_DOWN ) , "Failed to get SF"); + + + ///-- Trigger reset to nominal --/// + top::check(m_electronEffSFTrigger -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFTriggerLoose -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffTrigger -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffTriggerLoose -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + + + ///-- Reco --/// + ///-- Reco up --/// + top::check( m_electronEffSFReco->applySystematicVariation( m_systReco_UP ) , "Failed to set systematic" ); + top::check( m_electronEffSFReco->getEfficiencyScaleFactor( *electronPtr , SF_Reco_UP ) , "Failed to get SF"); + + ///-- Reco down --/// + top::check( m_electronEffSFReco->applySystematicVariation( m_systReco_DOWN ) , "Failed to set systematic" ); + top::check( m_electronEffSFReco->getEfficiencyScaleFactor( *electronPtr , SF_Reco_DOWN ) , "Failed to get SF"); + + ///-- Reco reset to nominal --/// + top::check( m_electronEffSFReco->applySystematicVariation( m_systNominal ) , "Failed to set systematic" ); + + ///-- ID --/// + ///-- ID UP --/// + top::check(m_electronEffSFID->applySystematicVariation( m_systID_UP ),"Failed to set systematic"); + top::check(m_electronEffSFIDLoose->applySystematicVariation( m_systID_UP ),"Failed to set systematic"); + top::check(m_electronEffSFID->getEfficiencyScaleFactor( *electronPtr , SF_ID_UP ) , "Failed to get SF"); + top::check(m_electronEffSFIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_IDLoose_UP ) , "Failed to get SF"); + ///-- ID DOWN --/// + top::check(m_electronEffSFID->applySystematicVariation( m_systID_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFIDLoose->applySystematicVariation( m_systID_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFID->getEfficiencyScaleFactor( *electronPtr , SF_ID_DOWN ) , "Failed to get SF"); + top::check(m_electronEffSFIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_IDLoose_DOWN ) , "Failed to get SF"); + + ///-- ID reset to nominal --/// + top::check(m_electronEffSFID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + top::check(m_electronEffSFIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + + ///-- Iso --/// + ///-- Iso UP --/// + if( m_electronEffIso_exists ) { + top::check(m_electronEffSFIso -> applySystematicVariation( m_systIso_UP ),"Failed to set systematic"); + top::check(m_electronEffSFIso -> getEfficiencyScaleFactor( *electronPtr , SF_Isol_UP ) , "Failed to get SF"); + ///-- Iso DOWN --/// + top::check(m_electronEffSFIso -> applySystematicVariation( m_systIso_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFIso -> getEfficiencyScaleFactor( *electronPtr , SF_Isol_DOWN ) , "Failed to get SF"); + ///-- Iso reset to nominal --/// + top::check(m_electronEffSFIso -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + if( m_electronEffIsoLoose_exists ) { + top::check(m_electronEffSFIsoLoose -> applySystematicVariation( m_systIso_UP ),"Failed to set systematic"); + top::check(m_electronEffSFIsoLoose -> getEfficiencyScaleFactor( *electronPtr , SF_IsolLoose_UP ) , "Failed to get SF"); + ///-- Iso DOWN --/// + top::check(m_electronEffSFIsoLoose -> applySystematicVariation( m_systIso_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFIsoLoose -> getEfficiencyScaleFactor( *electronPtr , SF_IsolLoose_DOWN ) , "Failed to get SF"); + ///-- Iso reset to nominal --/// + top::check(m_electronEffSFIsoLoose -> applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + + ///-- Charge ID --/// + if( m_electronEffChargeID_exists ) { + ///-- Charge ID UP --/// + top::check(m_electronEffSFChargeID->applySystematicVariation( m_systChargeID_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeID_UP ) , "Failed to get SF"); + ///-- Charge ID DOWN --/// + top::check(m_electronEffSFChargeID->applySystematicVariation( m_systChargeID_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeID_DOWN ) , "Failed to get SF"); + ///-- Charge ID reset to nominal --/// + top::check(m_electronEffSFChargeID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + if( m_electronEffChargeIDLoose_exists ) { + ///-- Charge ID UP --/// + top::check(m_electronEffSFChargeIDLoose->applySystematicVariation( m_systChargeID_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeIDLoose_UP ) , "Failed to get SF"); + ///-- Charge ID DOWN --/// + top::check(m_electronEffSFChargeIDLoose->applySystematicVariation( m_systChargeID_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeIDLoose_DOWN ) , "Failed to get SF"); + ///-- Charge ID reset to nominal --/// + top::check(m_electronEffSFChargeIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + + ///-- Charge Mis ID --/// + if( m_electronEffChargeID_exists ) { + ///-- Charge Mis ID STAT_UP --/// + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systChargeMisID_STAT_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisID_STAT_UP ) , "Failed to get SF"); + ///-- Charge Mis ID STAT_DOWN --/// + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systChargeMisID_STAT_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisID_STAT_DOWN ) , "Failed to get SF"); + ///-- Charge Mis ID SYS_UP --/// + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systChargeMisID_SYST_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisID_SYST_UP ) , "Failed to get SF"); + ///-- Charge Mis ID SYS_DOWN --/// + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systChargeMisID_SYST_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisID->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisID_SYST_DOWN ) , "Failed to get SF"); + ///-- Charge Mis ID reset to nominal --/// + top::check(m_electronEffSFChargeMisID->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + if( m_electronEffChargeIDLoose_exists ) { + ///-- Charge Mis ID STAT_UP --/// + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systChargeMisID_STAT_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisIDLoose_STAT_UP ) , "Failed to get SF"); + ///-- Charge Mis ID STAT_DOWN --/// + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systChargeMisID_STAT_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisIDLoose_STAT_DOWN ) , "Failed to get SF"); + ///-- Charge Mis ID SYS_UP --/// + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systChargeMisID_SYST_UP ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisIDLoose_SYST_UP ) , "Failed to get SF"); + ///-- Charge Mis ID SYS_DOWN --/// + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systChargeMisID_SYST_DOWN ),"Failed to set systematic"); + top::check(m_electronEffSFChargeMisIDLoose->getEfficiencyScaleFactor( *electronPtr , SF_ChargeMisIDLoose_SYST_DOWN ) , "Failed to get SF"); + ///-- Charge Mis ID reset to nominal --/// + top::check(m_electronEffSFChargeMisIDLoose->applySystematicVariation( m_systNominal ),"Failed to set systematic"); + } + + ///-- Decorate --/// + electronPtr->auxdecor<float>(m_decor_triggerEff+"_UP") = EFF_Trigger_UP; + electronPtr->auxdecor<float>(m_decor_triggerEff_loose+"_UP") = EFF_TriggerLoose_UP; + electronPtr->auxdecor<float>(m_decor_triggerSF+"_UP") = SF_Trigger_UP; + electronPtr->auxdecor<float>(m_decor_triggerSF_loose+"_UP") = SF_TriggerLoose_UP; + electronPtr->auxdecor<float>(m_decor_recoSF+"_UP") = SF_Reco_UP; + electronPtr->auxdecor<float>(m_decor_idSF+"_UP") = SF_ID_UP; + electronPtr->auxdecor<float>(m_decor_idSF_loose+"_UP") = SF_IDLoose_UP; + electronPtr->auxdecor<float>(m_decor_isoSF+"_UP") = SF_Isol_UP; + electronPtr->auxdecor<float>(m_decor_isoSF_loose+"_UP") = SF_IsolLoose_UP; + electronPtr->auxdecor<float>(m_decor_chargeidSF+"_UP") = SF_ChargeID_UP; + electronPtr->auxdecor<float>(m_decor_chargeidSF_loose+"_UP") = SF_ChargeIDLoose_UP; + electronPtr->auxdecor<float>(m_decor_chargemisidSF+"_STAT_UP") = SF_ChargeMisID_STAT_UP; + electronPtr->auxdecor<float>(m_decor_chargemisidSF_loose+"_STAT_UP") = SF_ChargeMisIDLoose_STAT_UP; + electronPtr->auxdecor<float>(m_decor_chargemisidSF+"_SYST_UP") = SF_ChargeMisID_SYST_UP; + electronPtr->auxdecor<float>(m_decor_chargemisidSF_loose+"_SYST_UP") = SF_ChargeMisIDLoose_SYST_UP; + + electronPtr->auxdecor<float>(m_decor_triggerEff+"_DOWN") = EFF_Trigger_DOWN; + electronPtr->auxdecor<float>(m_decor_triggerEff_loose+"_DOWN") = EFF_TriggerLoose_DOWN; + electronPtr->auxdecor<float>(m_decor_triggerSF+"_DOWN") = SF_Trigger_DOWN; + electronPtr->auxdecor<float>(m_decor_triggerSF_loose+"_DOWN") = SF_TriggerLoose_DOWN; + electronPtr->auxdecor<float>(m_decor_recoSF+"_DOWN") = SF_Reco_DOWN; + electronPtr->auxdecor<float>(m_decor_idSF+"_DOWN") = SF_ID_DOWN; + electronPtr->auxdecor<float>(m_decor_idSF_loose+"_DOWN") = SF_IDLoose_DOWN; + electronPtr->auxdecor<float>(m_decor_isoSF+"_DOWN") = SF_Isol_DOWN; + electronPtr->auxdecor<float>(m_decor_isoSF_loose+"_DOWN") = SF_IsolLoose_DOWN; + electronPtr->auxdecor<float>(m_decor_chargeidSF+"_DOWN") = SF_ChargeID_DOWN; + electronPtr->auxdecor<float>(m_decor_chargeidSF_loose+"_DOWN") = SF_ChargeIDLoose_DOWN; + electronPtr->auxdecor<float>(m_decor_chargemisidSF+"_STAT_DOWN") = SF_ChargeMisID_STAT_DOWN; + electronPtr->auxdecor<float>(m_decor_chargemisidSF_loose+"_STAT_DOWN") = SF_ChargeMisIDLoose_STAT_DOWN; + electronPtr->auxdecor<float>(m_decor_chargemisidSF+"_SYST_DOWN") = SF_ChargeMisID_SYST_DOWN; + electronPtr->auxdecor<float>(m_decor_chargemisidSF_loose+"_SYST_DOWN") = SF_ChargeMisIDLoose_SYST_DOWN; + + ///-- Debug messages --/// + + ATH_MSG_DEBUG("Electron Trigger Eff = "<<electronPtr->auxdataConst<float>(m_decor_triggerEff) << " + "<< + electronPtr->auxdataConst<float>(m_decor_triggerEff+"_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_triggerEff+"_DOWN") + ); + + ATH_MSG_DEBUG("Electron Trigger MediumLH SF = "<<electronPtr->auxdataConst<float>(m_decor_triggerSF) << " + "<< + electronPtr->auxdataConst<float>(m_decor_triggerSF+"_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_triggerSF+"_DOWN") + ); + + ATH_MSG_DEBUG("Electron Reco SF = "<<electronPtr->auxdataConst<float>(m_decor_recoSF) << " + "<< + electronPtr->auxdataConst<float>(m_decor_recoSF+"_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_recoSF+"_DOWN") + ); + + ATH_MSG_DEBUG("Electron ID SF = "<<electronPtr->auxdataConst<float>(m_decor_idSF) << " + "<< + electronPtr->auxdataConst<float>(m_decor_idSF+"_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_idSF+"_DOWN") + ); + + ATH_MSG_DEBUG("Electron Charge ID SF = "<<electronPtr->auxdataConst<float>(m_decor_chargeidSF) << " + "<< + electronPtr->auxdataConst<float>(m_decor_chargeidSF+"_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_chargeidSF+"_DOWN") + ); + + ATH_MSG_DEBUG("Electron Charge Mis-ID SF = "<<electronPtr->auxdataConst<float>(m_decor_chargemisidSF) << " + "<< + electronPtr->auxdataConst<float>(m_decor_chargemisidSF+"_STAT_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_chargemisidSF+"_STAT_DOWN") << " + "<< + electronPtr->auxdataConst<float>(m_decor_chargemisidSF+"_SYST_UP") << " - "<< + electronPtr->auxdataConst<float>(m_decor_chargemisidSF+"_SYST_DOWN") + ); + + } // Calibration systematic is nominal, so calculate SF systematics + + } + } + } + + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/JetScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/JetScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..837ee1ebc5d9d4eb4761bcf95eb00a1ac29a7104 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/JetScaleFactorCalculator.cxx @@ -0,0 +1,126 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: JetScaleFactorCalculator.cxx 794672 2017-01-31 00:41:04Z tpelzer $ +#include "TopCorrections/JetScaleFactorCalculator.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODJet/JetContainer.h" + + +namespace top { + + JetScaleFactorCalculator::JetScaleFactorCalculator(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + + m_systNominal(CP::SystematicSet()), + m_systUP(CP::SystematicSet()), + m_systDOWN(CP::SystematicSet()), + m_jvt_tool("JetJvtEfficiencyTool") { + declareProperty("config" , m_config); + } + + StatusCode JetScaleFactorCalculator::initialize() { + ATH_MSG_INFO("top::JetScaleFactorCalculator initialize"); + + top::check(m_jvt_tool.retrieve(), "Failed to retrieve JVT tool"); + + m_systUP.insert(CP::SystematicVariation(CP::JvtEfficiencyUp)); + m_systDOWN.insert(CP::SystematicVariation(CP::JvtEfficiencyDown)); + + return StatusCode::SUCCESS; + } + + + StatusCode JetScaleFactorCalculator::execute() { + ///-- Loop over all jet collections --/// + ///-- Lets assume that we're not doing ElectronInJet subtraction --/// + for (auto currentSystematic : *m_config->systSgKeyMapJets(false)) { + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, currentSystematic.second), "failed to retrieve jets"); + + ///-- Tell the SF tools to use the nominal systematic --/// + + /// -- Loop over all jets in each collection --/// + for (auto jetPtr : *jets) { + /// -- Does the jet pass object selection? --/// + // WARNING: this doesn't include the JVT cut anymore + bool passSelection(false); + if (jetPtr->isAvailable<char>("passPreORSelection")) { + if (jetPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (jetPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (jetPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + if (passSelection) { + // Set to nominal first... + top::check(m_jvt_tool->applySystematicVariation(m_systNominal), + "Failed to set JVT nominal SF"); + + float jvtSF(1.); + + if (!jetPtr->isAvailable<char>("passJVT")) { + ATH_MSG_ERROR(" Can't find jet decoration \"passJVT\" - we need it to calculate the jet scale-factors!"); + return StatusCode::FAILURE; + } + + bool passes_jvt = jetPtr->auxdataConst< char >("passJVT"); + + if (passes_jvt) + top::check(m_jvt_tool->getEfficiencyScaleFactor(*jetPtr, jvtSF), + "Failed to getEfficiencyScaleFactor for JVT"); + else { + top::check(m_jvt_tool->getInefficiencyScaleFactor(*jetPtr, jvtSF), + "Failed to getInefficiencyScaleFactor for JVT"); + } + + jetPtr->auxdecor<float>("JET_SF_jvt") = jvtSF; + + ///-- For nominal calibration, vary the SF systematics --/// + if (currentSystematic.first == m_config->nominalHashValue()) { + + float jvtSF_up(1.), jvtSF_down(1.); // made up values + + if (passes_jvt) { + top::check(m_jvt_tool->applySystematicVariation(m_systUP), + "Failed to applySystematicVariation up for JVT"); + top::check(m_jvt_tool->getEfficiencyScaleFactor(*jetPtr, jvtSF_up), + "Failed to get JVT SF (systematic up)"); + top::check(m_jvt_tool->applySystematicVariation(m_systDOWN), + "Failed to applySystematicVariation down for JVT"); + top::check(m_jvt_tool->getEfficiencyScaleFactor(*jetPtr, jvtSF_down), + "Failed to get JVT SF (systematic down)"); + } + else { + top::check(m_jvt_tool->applySystematicVariation(m_systUP), + "Failed to applySystematicVariation up for JVT"); + top::check(m_jvt_tool->getInefficiencyScaleFactor(*jetPtr, jvtSF_up), + "Failed to get JVT SF (systematic up)"); + top::check(m_jvt_tool->applySystematicVariation(m_systDOWN), + "Failed to applySystematicVariation down for JVT"); + top::check(m_jvt_tool->getInefficiencyScaleFactor(*jetPtr, jvtSF_down), + "Failed to get JVT SF (systematic down)"); + } + + ///-- Decorate --/// + jetPtr->auxdecor<float>("JET_SF_jvt_UP") = jvtSF_up; + jetPtr->auxdecor<float>("JET_SF_jvt_DOWN") = jvtSF_down; + } // Calibration systematic is nominal, so calculate SF systematics + + } + } + } + + + return StatusCode::SUCCESS; + } + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9ddd85ef40328f3fda2f494b990c511ef16fc30b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx @@ -0,0 +1,663 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MuonScaleFactorCalculator.cxx 796972 2017-02-14 03:08:26Z tpelzer $ +#include "TopCorrections/MuonScaleFactorCalculator.h" + +#include <string> +#include <vector> +#include <set> + +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODMuon/MuonContainer.h" + +namespace top { + + MuonScaleFactorCalculator::MuonScaleFactorCalculator(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + m_systNominal(CP::SystematicSet()), + + m_muonTriggerScaleFactors_2015("CP::MuonTriggerScaleFactors_2015"), + m_muonTriggerScaleFactorsLoose_2015("CP::MuonTriggerScaleFactorsLoose_2015"), + m_muonTriggerScaleFactors_2016("CP::MuonTriggerScaleFactors_2016"), + m_muonTriggerScaleFactorsLoose_2016("CP::MuonTriggerScaleFactorsLoose_2016"), + + m_muonEfficiencyCorrectionsTool("CP::MuonEfficiencyScaleFactorsTool"), + m_muonEfficiencyCorrectionsToolLoose("CP::MuonEfficiencyScaleFactorsToolLoose"), + m_muonEfficiencyCorrectionsToolIso("CP::MuonEfficiencyScaleFactorsToolIso"), + m_muonEfficiencyCorrectionsToolLooseIso("CP::MuonEfficiencyScaleFactorsToolLooseIso"), + m_muonEfficiencyCorrectionsToolTTVA("CP::MuonEfficiencyScaleFactorsToolTTVA"), + + m_decor_triggerEff("SetMe"), m_decor_triggerEff_loose("SetMe"), + m_decor_triggerSF("SetMe"), m_decor_triggerSF_loose("SetMe"), + m_decor_idSF("SetMe"), m_decor_idSF_loose("SetMe"), + m_decor_isoSF("SetMe"), m_decor_isoSF_loose("SetMe"), + m_decor_TTVA("MU_SF_TTVA"), + + m_do_muon_isolation_SFs(true), + m_do_muon_isolation_SFs_loose(true), + // The systematics are defined here... + m_trig_sf_stat_UP("MUON_EFF_TrigStatUncertainty__1up"), + m_trig_sf_stat_DOWN("MUON_EFF_TrigStatUncertainty__1down"), + m_trig_sf_syst_UP("MUON_EFF_TrigSystUncertainty__1up"), + m_trig_sf_syst_DOWN("MUON_EFF_TrigSystUncertainty__1down"), + + m_reco_stat_UP("MUON_EFF_STAT__1up"), + m_reco_stat_DOWN("MUON_EFF_STAT__1down"), + m_reco_syst_UP("MUON_EFF_SYS__1up"), + m_reco_syst_DOWN("MUON_EFF_SYS__1down"), + + m_reco_stat_lowpt_UP("MUON_EFF_STAT_LOWPT__1up"), + m_reco_stat_lowpt_DOWN("MUON_EFF_STAT_LOWPT__1down"), + m_reco_syst_lowpt_UP("MUON_EFF_SYS_LOWPT__1up"), + m_reco_syst_lowpt_DOWN("MUON_EFF_SYS_LOWPT__1down"), + + m_iso_stat_UP("MUON_ISO_STAT__1up"), + m_iso_stat_DOWN("MUON_ISO_STAT__1down"), + m_iso_syst_UP("MUON_ISO_SYS__1up"), + m_iso_syst_DOWN("MUON_ISO_SYS__1down"), + + m_TTVA_stat_UP("MUON_TTVA_STAT__1up"), + m_TTVA_stat_DOWN("MUON_TTVA_STAT__1down"), + m_TTVA_syst_UP("MUON_TTVA_SYS__1up"), + m_TTVA_syst_DOWN("MUON_TTVA_SYS__1down") { + declareProperty("config", m_config); + } + + StatusCode MuonScaleFactorCalculator::initialize() { + ATH_MSG_INFO(" top::MuonScaleFactorCalculator initialize"); + + std::set<std::string> implemented_systematics = + {"MUON_EFF_TrigStatUncertainty", + "MUON_EFF_TrigSystUncertainty", + "MUON_EFF_STAT", + "MUON_EFF_SYS", + "MUON_EFF_STAT_LOWPT", + "MUON_EFF_SYS_LOWPT", + "MUON_ISO_STAT", + "MUON_ISO_SYS", + "MUON_TTVA_STAT", + "MUON_TTVA_SYS"}; + + std::set<std::string> recommended_systematics; + this->retrieveSystematicTool(m_muonTriggerScaleFactors_2015, + recommended_systematics); + this->retrieveSystematicTool(m_muonTriggerScaleFactorsLoose_2015, + recommended_systematics); + this->retrieveSystematicTool(m_muonTriggerScaleFactors_2016, + recommended_systematics); + this->retrieveSystematicTool(m_muonTriggerScaleFactorsLoose_2016, + recommended_systematics); + this->retrieveSystematicTool(m_muonEfficiencyCorrectionsTool, + recommended_systematics); + this->retrieveSystematicTool(m_muonEfficiencyCorrectionsToolLoose, + recommended_systematics); + + if (asg::ToolStore::contains<CP::IMuonEfficiencyScaleFactors>("CP::MuonEfficiencyScaleFactorsToolIso")) { + this->retrieveSystematicTool(m_muonEfficiencyCorrectionsToolIso, + recommended_systematics); + } else { + m_do_muon_isolation_SFs = false; + } + if (asg::ToolStore::contains<CP::IMuonEfficiencyScaleFactors>("CP::MuonEfficiencyScaleFactorsToolLooseIso")) { + this->retrieveSystematicTool(m_muonEfficiencyCorrectionsToolLooseIso, + recommended_systematics); + } else { + m_do_muon_isolation_SFs_loose = false; + } + + ///-- Not a good reason for this happening at the moment --/// + if (m_config->muonIsolation() != "None" && !m_do_muon_isolation_SFs) { + ATH_MSG_WARNING("No muon isolation SFs available." + " You can run with MuonIsolation set to" + " None if you don't want isolation."); + return StatusCode::FAILURE; + } + ///-- Not a good reason for this happening at the moment --/// + if (m_config->muonIsolationLoose() != "None" && !m_do_muon_isolation_SFs_loose) { + ATH_MSG_WARNING("No loose muon isolation SFs available." + " You can run with MuonIsolationLoose set to" + " None if you don't want isolation."); + return StatusCode::FAILURE; + } + + this->retrieveSystematicTool(m_muonEfficiencyCorrectionsToolTTVA, + recommended_systematics); + + top::check(this->checkSystematicsImplemented(recommended_systematics, + implemented_systematics), + "There are differences between the recommended and implemented" + " muon SF systematic uncertainties"); + + + m_decor_triggerEff = "MU_EFF_Trigger_" + m_config->muonQuality(); + m_decor_triggerEff_loose = "MU_EFF_Trigger_" + m_config->muonQualityLoose(); + m_decor_triggerSF = "MU_SF_Trigger_" + m_config->muonQuality(); + m_decor_triggerSF_loose = "MU_SF_Trigger_" + m_config->muonQualityLoose(); + m_decor_idSF = "MU_SF_ID_" + m_config->muonQuality(); + m_decor_idSF_loose = "MU_SF_ID_" + m_config->muonQualityLoose(); + m_decor_isoSF = "MU_SF_Isol_" + m_config->muonIsolation(); + m_decor_isoSF_loose = "MU_SF_Isol_" + m_config->muonIsolationLoose(); + + return StatusCode::SUCCESS; + } + + + StatusCode MuonScaleFactorCalculator::execute() { + /************************************************************* + * + * The muon trigger SF tool wants a random run number, + * which we can get from the PRW tool. + * + *************************************************************/ + + if (m_config->doPileupReweighting()) { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + + // This is the default value in the MuonTriggerScaleFactors tool + unsigned int runNumber = 267639; + if (eventInfo->isAvailable<unsigned int>("RandomRunNumber")) + runNumber = eventInfo->auxdataConst<unsigned int>("RandomRunNumber"); + else + ATH_MSG_WARNING("Event has not been decorated with RandomRunNumber"); + + if (runNumber > 284484 || runNumber == 0) { + m_muonTriggerScaleFactors = m_muonTriggerScaleFactors_2016; + m_muonTriggerScaleFactorsLoose = m_muonTriggerScaleFactors_2016; + m_muon_trigger_sf_config = "HLT_mu26_ivarmedium_OR_HLT_mu50"; + } else { + m_muonTriggerScaleFactors = m_muonTriggerScaleFactors_2015; + m_muonTriggerScaleFactorsLoose = m_muonTriggerScaleFactors_2015; + m_muon_trigger_sf_config = "HLT_mu20_iloose_L1MU15_OR_HLT_mu50"; + } + + // The PRW tool can give run numbers of zero for unrepresented + // mu values. If we give the muon tool a run number of zero it + // complains with the message: + // "WARNING I am using run #0 but I cannot find corresponding run period. + // Now setting to use 2016 period B. + // This might give problems! Please check which year and mc you + // have set up". + // We do this by hand to avoid the messages. + if (runNumber == 0) runNumber = 300345; + + top::check(m_muonTriggerScaleFactors->setRunNumber(runNumber), + "Failed to set run number for muon trigger SFs"); + top::check(m_muonTriggerScaleFactorsLoose->setRunNumber(runNumber), + "Failed to set run number for (loose) muon trigger SFs"); + } + + ///-- Loop over all muon collections --/// + for (auto currentSystematic : *m_config->systSgKeyMapMuons()) { + const xAOD::MuonContainer* muons(nullptr); + top::check(evtStore()->retrieve(muons, currentSystematic.second), + "Failed to retrieve muons"); + + /// -- Loop over all muons in each collection --/// + for (auto muonPtr : *muons) { + /// -- Does the muon pass object selection? --/// + bool passSelection(false); + if (muonPtr->isAvailable<char>("passPreORSelection")) { + if (muonPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (muonPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (muonPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + if (!passSelection) continue; + + // Tell the SF tools to use the nominal systematic + // To be extra sure we do this when we try and get a SF too! + this->applySystematicVariation(m_muonTriggerScaleFactors, m_systNominal); + this->applySystematicVariation(m_muonTriggerScaleFactorsLoose, m_systNominal); + this->applySystematicVariation(m_muonEfficiencyCorrectionsTool, m_systNominal); + this->applySystematicVariation(m_muonEfficiencyCorrectionsToolLoose, m_systNominal); + this->applySystematicVariation(m_muonEfficiencyCorrectionsToolTTVA, m_systNominal); + + //-- Only do isolation if we actually get the tools --// + if (m_do_muon_isolation_SFs) + this->applySystematicVariation(m_muonEfficiencyCorrectionsToolIso, m_systNominal); + if (m_do_muon_isolation_SFs_loose) + this->applySystematicVariation(m_muonEfficiencyCorrectionsToolLooseIso, m_systNominal); + + // The nominal SFs/efficiencies. + // Include are:: + // 1. ID SF (no reco Eff since 2.4.22) + // 2. Isolation SF + // 3. TTVA SF + // 4. Trigger SF and efficiency + + // Reco efficiency and ID SF decorations + static SG::AuxElement::Decorator<float> id_sf_decor(m_decor_idSF); + static SG::AuxElement::Decorator<float> id_sf_loose_decor(m_decor_idSF_loose); + + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_systNominal, *muonPtr, + id_sf_decor); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_systNominal, *muonPtr, + id_sf_loose_decor); + + // Isolation SF decorations. If we aren't using isolation for + // either tight or loose muons then decorate anyway with 1.0. + static SG::AuxElement::Decorator<float> iso_sf_decor(m_decor_isoSF); + static SG::AuxElement::Decorator<float> iso_sf_loose_decor(m_decor_isoSF_loose); + + if (m_do_muon_isolation_SFs) { + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolIso, + m_systNominal, *muonPtr, + iso_sf_decor); + } else { + iso_sf_decor(*muonPtr) = 1.0; + } + if (m_do_muon_isolation_SFs_loose) { + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolLooseIso, + m_systNominal, *muonPtr, + iso_sf_loose_decor); + } else { + iso_sf_loose_decor(*muonPtr) = 1.0; + } + + // TTVA decoration + static SG::AuxElement::Decorator<float> TTVA_decor(m_decor_TTVA); + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolTTVA, + m_systNominal, *muonPtr, TTVA_decor); + + /********************************************************************** + * Muon Trigger Scale Factors + * TOM : The MCP tool takes a container of muons. The examples seem to + * suggest these should somehow be selected muons but it isn't clear + * to me what level of selection should be applied. + * + * *** To be followed up with MCP people by Jay *** + * + * TOM : We trick it by creating a view container + * with a single muon in. + * NOTE: This also happens later on for the systematics so if we ever + * get a nice function make sure we change it there too! + * + **********************************************************************/ + + ConstDataVector<xAOD::MuonContainer> trigger_SF_muon(SG::VIEW_ELEMENTS); + trigger_SF_muon.push_back(muonPtr); + + static SG::AuxElement::Decorator<float> trig_sf_decor(m_decor_triggerSF); + static SG::AuxElement::Decorator<float> trig_sf_loose_decor(m_decor_triggerSF_loose); + static SG::AuxElement::Decorator<float> trig_eff_decor(m_decor_triggerEff); + static SG::AuxElement::Decorator<float> trig_eff_loose_decor(m_decor_triggerEff_loose); + + this->decorateTrigSFandEff(m_muonTriggerScaleFactors, + m_systNominal, trigger_SF_muon, + trig_sf_decor, trig_eff_decor); + this->decorateTrigSFandEff(m_muonTriggerScaleFactorsLoose, + m_systNominal, trigger_SF_muon, + trig_sf_loose_decor, trig_eff_decor); + + // If we are running on the nominal tree, then do the + // SF systematic variations too. + // Otherwise just move onto the next muon... + if (currentSystematic.first != m_config->nominalHashValue()) continue; + + // Trigger systematics + this->decorateTriggerSystematics(trigger_SF_muon); + // ID systematics + this->decorateIDSFandRecoEffSystematics(*muonPtr); + // Isolation systematics + this->decorateIsolationSystematics(*muonPtr); + // TTVA muon SFs- track-to-vertex association + this->decorateTTVASystematics(*muonPtr); + } + } + return StatusCode::SUCCESS; + } + + // End of public functions + + template<typename T> + void MuonScaleFactorCalculator::retrieveSystematicTool(const ToolHandle<T>& tool, + std::set<std::string>& recommended_systematics) { + top::check(tool.retrieve(), "Failed to retrieve " + tool.name()); + // Add all recommended systematics to set + for (auto s : tool->recommendedSystematics().getBaseNames()) + recommended_systematics.insert(std::string(s)); + } + + + template<typename T> + void MuonScaleFactorCalculator::applySystematicVariation(ToolHandle<T>& tool, + const CP::SystematicSet& systematic) { + top::check(tool->applySystematicVariation(systematic), + "Failed to set " + tool.name() + + " to " + (systematic.empty() + ? "Nominal" : systematic.name())); + } + + StatusCode MuonScaleFactorCalculator::checkSystematicsImplemented(const std::set<std::string>& recommended, + const std::set<std::string>& implemented) { + std::vector<std::string> different_systematics = {}; + std::set_difference(recommended.begin(), + recommended.end(), + implemented.begin(), + implemented.end(), + std::back_inserter(different_systematics)); + if (different_systematics.size()) { + ATH_MSG_WARNING("WE ARE MISSING THE FOLLOWING SYSTEMATICS:"); + for (auto syst : different_systematics) + ATH_MSG_WARNING("\t" << syst); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; + } + + void MuonScaleFactorCalculator::decorateTriggerEfficiency(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& decor) { + double trigEff = 1.0; + top::check(tool->getTriggerEfficiency(muon, trigEff, + m_muon_trigger_sf_config, + !m_config->isMC()), + "Failed to get muon trigger efficiency"); + decor(muon) = trigEff; + } + + void MuonScaleFactorCalculator::decorateTriggerSF(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const ConstDataVector<xAOD::MuonContainer>& muon_cont, + const SG::AuxElement::Decorator<float>& decor) { + double trigSF = 1.0; + top::check(tool->getTriggerScaleFactor(*muon_cont.asDataVector(), trigSF, + m_muon_trigger_sf_config), + "Failed to get muon trigger scale factor"); + decor(*muon_cont[0]) = trigSF; + } + + void MuonScaleFactorCalculator::decorateTrigSFandEff(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const CP::SystematicSet& systematic, + const ConstDataVector<xAOD::MuonContainer>& muon_cont, + const SG::AuxElement::Decorator<float>& sf_decor, + const SG::AuxElement::Decorator<float>& eff_decor) { + // Set tool to systematic + this->applySystematicVariation(tool, systematic); + // Decorate with Trigger SF + this->decorateTriggerSF(tool, muon_cont, sf_decor); + // Decorate with Trigger Efficiency + this->decorateTriggerEfficiency(tool, *muon_cont[0], eff_decor); + } + + void MuonScaleFactorCalculator::decorateTriggerSystematics(const ConstDataVector<xAOD::MuonContainer>& trigger_SF_muon) { + // Perform all trigger systematic variations, for loose and tight, + // (stat/syst up/down) + static SG::AuxElement::Decorator<float> trig_eff_decor_stat_up(m_decor_triggerEff + "_STAT_UP"); + static SG::AuxElement::Decorator<float> trig_eff_loose_decor_stat_up(m_decor_triggerEff_loose + "_STAT_UP"); + static SG::AuxElement::Decorator<float> trig_sf_decor_stat_up(m_decor_triggerSF + "_STAT_UP"); + static SG::AuxElement::Decorator<float> trig_sf_loose_decor_stat_up(m_decor_triggerSF_loose + "_STAT_UP"); + + static SG::AuxElement::Decorator<float> trig_eff_decor_stat_down(m_decor_triggerEff + "_STAT_DOWN"); + static SG::AuxElement::Decorator<float> trig_eff_loose_decor_stat_down(m_decor_triggerEff_loose + "_STAT_DOWN"); + static SG::AuxElement::Decorator<float> trig_sf_decor_stat_down(m_decor_triggerSF + "_STAT_DOWN"); + static SG::AuxElement::Decorator<float> trig_sf_loose_decor_stat_down(m_decor_triggerSF_loose + "_STAT_DOWN"); + + static SG::AuxElement::Decorator<float> trig_eff_decor_syst_up(m_decor_triggerEff + "_SYST_UP"); + static SG::AuxElement::Decorator<float> trig_eff_loose_decor_syst_up(m_decor_triggerEff_loose + "_SYST_UP"); + static SG::AuxElement::Decorator<float> trig_sf_decor_syst_up(m_decor_triggerSF + "_SYST_UP"); + static SG::AuxElement::Decorator<float> trig_sf_loose_decor_syst_up(m_decor_triggerSF_loose + "_SYST_UP"); + + static SG::AuxElement::Decorator<float> trig_eff_decor_syst_down(m_decor_triggerEff + "_SYST_DOWN"); + static SG::AuxElement::Decorator<float> trig_eff_loose_decor_syst_down(m_decor_triggerEff_loose + "_SYST_DOWN"); + static SG::AuxElement::Decorator<float> trig_sf_decor_syst_down(m_decor_triggerSF + "_SYST_DOWN"); + static SG::AuxElement::Decorator<float> trig_sf_loose_decor_syst_down(m_decor_triggerSF_loose + "_SYST_DOWN"); + + // Trigger variations + // + // Stat UP + this->decorateTrigSFandEff(m_muonTriggerScaleFactors, + m_trig_sf_stat_UP, trigger_SF_muon, + trig_sf_decor_stat_up, + trig_eff_decor_stat_up); + + this->decorateTrigSFandEff(m_muonTriggerScaleFactorsLoose, + m_trig_sf_stat_UP, trigger_SF_muon, + trig_sf_loose_decor_stat_up, + trig_eff_loose_decor_stat_up); + + // Stat DOWN + this->decorateTrigSFandEff(m_muonTriggerScaleFactors, + m_trig_sf_stat_DOWN, trigger_SF_muon, + trig_sf_decor_stat_down, + trig_eff_decor_stat_down); + + this->decorateTrigSFandEff(m_muonTriggerScaleFactorsLoose, + m_trig_sf_stat_DOWN, trigger_SF_muon, + trig_sf_loose_decor_stat_down, + trig_eff_loose_decor_stat_down); + + // Syst UP + this->decorateTrigSFandEff(m_muonTriggerScaleFactors, + m_trig_sf_syst_UP, trigger_SF_muon, + trig_sf_decor_syst_up, + trig_eff_decor_syst_up); + + this->decorateTrigSFandEff(m_muonTriggerScaleFactorsLoose, + m_trig_sf_syst_UP, trigger_SF_muon, + trig_sf_loose_decor_syst_up, + trig_eff_loose_decor_syst_up); + + // Syst DOWN + this->decorateTrigSFandEff(m_muonTriggerScaleFactors, + m_trig_sf_syst_DOWN, trigger_SF_muon, + trig_sf_decor_syst_down, + trig_eff_decor_syst_down); + + this->decorateTrigSFandEff(m_muonTriggerScaleFactorsLoose, + m_trig_sf_syst_DOWN, trigger_SF_muon, + trig_sf_loose_decor_syst_down, + trig_eff_loose_decor_syst_down); + } + + void MuonScaleFactorCalculator::decorateEfficiencySF(ToolHandle<CP::IMuonEfficiencyScaleFactors>& tool, + const CP::SystematicSet& systematic, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& decor) { + // 1. Set tool to systematic + this->applySystematicVariation(tool, systematic); + + float efficiency_SF = 1.0; + // 2. Decorate muon with efficiency SF + top::check(tool->getEfficiencyScaleFactor(muon, efficiency_SF), + "Failed to get " + tool.name() + + " efficiency SF for " + (systematic.empty() + ? "Nominal" : systematic.name())); + decor(muon) = efficiency_SF; + } + + void MuonScaleFactorCalculator::decorateIsolationSystematics(const xAOD::Muon& muon) { + // Decorate 'tight' isolation SFs + static SG::AuxElement::Decorator<float> iso_sf_decor_stat_up(m_decor_isoSF+"_STAT_UP"); + static SG::AuxElement::Decorator<float> iso_sf_decor_stat_down(m_decor_isoSF+"_STAT_DOWN"); + static SG::AuxElement::Decorator<float> iso_sf_decor_syst_up(m_decor_isoSF+"_SYST_UP"); + static SG::AuxElement::Decorator<float> iso_sf_decor_syst_down(m_decor_isoSF+"_SYST_DOWN"); + + // Decorate 'loose' isolation SFs + static SG::AuxElement::Decorator<float> iso_sf_loose_decor_stat_up(m_decor_isoSF_loose+"_STAT_UP"); + static SG::AuxElement::Decorator<float> iso_sf_loose_decor_stat_down(m_decor_isoSF_loose+"_STAT_DOWN"); + static SG::AuxElement::Decorator<float> iso_sf_loose_decor_syst_up(m_decor_isoSF_loose+"_SYST_UP"); + static SG::AuxElement::Decorator<float> iso_sf_loose_decor_syst_down(m_decor_isoSF_loose+"_SYST_DOWN"); + + if (m_do_muon_isolation_SFs) { + ///-- Stat UP --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolIso, + m_iso_stat_UP, muon, + iso_sf_decor_stat_up); + ///-- Stat DOWN --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolIso, + m_iso_stat_DOWN, muon, + iso_sf_decor_stat_down); + ///-- Syst UP --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolIso, + m_iso_syst_UP, muon, + iso_sf_decor_syst_up); + ///-- Syst DOWN --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolIso, + m_iso_syst_DOWN, muon, + iso_sf_decor_syst_down); + } else { + // If we aren't using muon isolation then still + // decorate with isolation SFs of 1.0 + iso_sf_decor_stat_up(muon) = 1.0; + iso_sf_decor_stat_down(muon) = 1.0; + iso_sf_decor_syst_up(muon) = 1.0; + iso_sf_decor_syst_down(muon) = 1.0; + } + + if (m_do_muon_isolation_SFs_loose) { + ///-- Stat UP --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolLooseIso, + m_iso_stat_UP, muon, + iso_sf_loose_decor_stat_up); + ///-- Stat DOWN --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolLooseIso, + m_iso_stat_DOWN, muon, + iso_sf_loose_decor_stat_down); + ///-- Syst UP --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolLooseIso, + m_iso_syst_UP, muon, + iso_sf_loose_decor_syst_up); + ///-- Syst DOWN --/// + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolLooseIso, + m_iso_syst_DOWN, muon, + iso_sf_loose_decor_syst_down); + } else { + // If we aren't using muon isolation then still + // decorate with isolation SFs of 1.0 + iso_sf_loose_decor_stat_up(muon) = 1.0; + iso_sf_loose_decor_stat_down(muon) = 1.0; + iso_sf_loose_decor_syst_up(muon) = 1.0; + iso_sf_loose_decor_syst_down(muon) = 1.0; + } + } + + void MuonScaleFactorCalculator::decorateTTVASystematics(const xAOD::Muon& muon) { + static SG::AuxElement::Decorator<float> TTVA_decor_stat_up(m_decor_TTVA+"_STAT_UP"); + static SG::AuxElement::Decorator<float> TTVA_decor_stat_down(m_decor_TTVA+"_STAT_DOWN"); + static SG::AuxElement::Decorator<float> TTVA_decor_syst_up(m_decor_TTVA+"_SYST_UP"); + static SG::AuxElement::Decorator<float> TTVA_decor_syst_down(m_decor_TTVA+"_SYST_DOWN"); + + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolTTVA, + m_TTVA_stat_UP, muon, TTVA_decor_stat_up); + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolTTVA, + m_TTVA_stat_DOWN, muon, TTVA_decor_stat_down); + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolTTVA, + m_TTVA_syst_UP, muon, TTVA_decor_syst_up); + this->decorateEfficiencySF(m_muonEfficiencyCorrectionsToolTTVA, + m_TTVA_syst_DOWN, muon, TTVA_decor_syst_down); + } + + void MuonScaleFactorCalculator::decorateIDSFandRecoEff(ToolHandle<CP::IMuonEfficiencyScaleFactors>& tool, + const CP::SystematicSet& systematic, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& id_sf_decor) { + // 1. Set the tool to apply systematic and + // decorate the ID efficiency using decorateEfficiencySF() + this->decorateEfficiencySF(tool, systematic, muon, id_sf_decor); + // 2. No reco Eff since 2.4.22 + } + + void MuonScaleFactorCalculator::decorateIDSFandRecoEffSystematics(const xAOD::Muon& muon) { + static SG::AuxElement::Decorator<float> id_sf_decor_stat_up(m_decor_idSF + "_STAT_UP"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_stat_up(m_decor_idSF_loose + "_STAT_UP"); + + static SG::AuxElement::Decorator<float> id_sf_decor_stat_down(m_decor_idSF + "_STAT_DOWN"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_stat_down(m_decor_idSF_loose + "_STAT_DOWN"); + + static SG::AuxElement::Decorator<float> id_sf_decor_syst_up(m_decor_idSF + "_SYST_UP"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_syst_up(m_decor_idSF_loose + "_SYST_UP"); + + static SG::AuxElement::Decorator<float> id_sf_decor_syst_down(m_decor_idSF + "_SYST_DOWN"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_syst_down(m_decor_idSF_loose + "_SYST_DOWN"); + + + ///-- Stat UP --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_stat_UP, muon, + id_sf_decor_stat_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_stat_UP, muon, + id_sf_loose_decor_stat_up); + + ///-- Stat DOWN --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_stat_DOWN, muon, + id_sf_decor_stat_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_stat_DOWN, muon, + id_sf_loose_decor_stat_down); + ///-- Syst UP --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_syst_UP, muon, + id_sf_decor_syst_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_syst_UP, muon, + id_sf_loose_decor_syst_up); + + ///-- Syst DOWN --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_syst_DOWN, muon, + id_sf_decor_syst_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_syst_DOWN, muon, + id_sf_loose_decor_syst_down); + + static SG::AuxElement::Decorator<float> id_sf_decor_stat_lowpt_up(m_decor_idSF + "_STAT_LOWPT_UP"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_stat_lowpt_up(m_decor_idSF_loose + "_STAT_LOWPT_UP"); + + static SG::AuxElement::Decorator<float> id_sf_decor_stat_lowpt_down(m_decor_idSF + "_STAT_LOWPT_DOWN"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_stat_lowpt_down(m_decor_idSF_loose + "_STAT_LOWPT_DOWN"); + + static SG::AuxElement::Decorator<float> id_sf_decor_syst_lowpt_up(m_decor_idSF + "_SYST_LOWPT_UP"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_syst_lowpt_up(m_decor_idSF_loose + "_SYST_LOWPT_UP"); + + static SG::AuxElement::Decorator<float> id_sf_decor_syst_lowpt_down(m_decor_idSF + "_SYST_LOWPT_DOWN"); + static SG::AuxElement::Decorator<float> id_sf_loose_decor_syst_lowpt_down(m_decor_idSF_loose + "_SYST_LOWPT_DOWN"); + + ///-- Stat UP --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_stat_lowpt_UP, muon, + id_sf_decor_stat_lowpt_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_stat_lowpt_UP, muon, + id_sf_loose_decor_stat_lowpt_up); + + ///-- Stat DOWN --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_stat_lowpt_DOWN, muon, + id_sf_decor_stat_lowpt_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_stat_lowpt_DOWN, muon, + id_sf_loose_decor_stat_lowpt_down); + ///-- Syst UP --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_syst_lowpt_UP, muon, + id_sf_decor_syst_lowpt_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_syst_lowpt_UP, muon, + id_sf_loose_decor_syst_lowpt_up); + + ///-- Syst DOWN --/// + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_syst_lowpt_DOWN, muon, + id_sf_decor_syst_lowpt_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_syst_lowpt_DOWN, muon, + id_sf_loose_decor_syst_lowpt_down); + } +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PDFScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PDFScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1abf2f9743bf91e183f9d37e09dcc2b58b0b6cd7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PDFScaleFactorCalculator.cxx @@ -0,0 +1,134 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCorrections/PDFScaleFactorCalculator.h" + +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + + +#include "xAODTruth/TruthEventContainer.h" +#include "xAODEventInfo/EventInfo.h" + +namespace top { + + PDFScaleFactorCalculator::PDFScaleFactorCalculator( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr){ + + declareProperty( "config" , m_config ); + + } + + StatusCode PDFScaleFactorCalculator::initialize() + { + + ATH_MSG_INFO(" top::PDFScaleFactorCalculator initialize" ); + + // This prints all the available PDFsets we can use + //printAvailablePDFs(); + + for( const std::string& set_name : m_config->LHAPDFSets() ) { + m_pdf_sets[ set_name ] = PDFSet( set_name ); + } + + m_base_pdf_name = m_config->baseLHAPDF(); + if (!m_base_pdf_name.empty()) { + ATH_MSG_INFO("Enabling " << m_base_pdf_name << " to recompute PDF weights.\n Content of sumWeight and totalSumWeight trees might be inconsistent with this recalculation.\n Use only PDFSumWeight and for PDF uncertainty estimates.\n"); + m_basepdf = LHAPDF::mkPDF(m_base_pdf_name, 0); + } + + return StatusCode::SUCCESS; + + } + + StatusCode PDFScaleFactorCalculator::execute() + { + + // Get the event info for the MC weight + const xAOD::EventInfo* event_info(nullptr); + top::check(evtStore()->retrieve(event_info, m_config->sgKeyEventInfo()), "Failed to retrieve EventInfo"); + const xAOD::TruthEventContainer* truthEventContainer(nullptr); + top::check( evtStore()->retrieve(truthEventContainer, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth PDF info" ); + +// float mc_weight = event_info->mcEventWeight(); + float mc_weight = truthEventContainer->at(0)->weights()[0];// FIXME temporary bugfix + + // try this... + top::check( ( truthEventContainer->size() == 1 ), "More than one truth event, not sure how to cope with PDF info" ); + int PDFID1(0), PDFID2(0), PDGID1(0), PDGID2(0); + float X1(0), X2(0) ,Q(0), XF1(0), XF2(0); + + for (auto truthEvent : *truthEventContainer){ + + top::check( truthEvent->pdfInfoParameter( PDGID1, xAOD::TruthEvent::PdfParam::PDGID1 ), "Failed to get PDFInfo: PDGID1" ); + top::check( truthEvent->pdfInfoParameter( PDGID2, xAOD::TruthEvent::PdfParam::PDGID2 ), "Failed to get PDFInfo: PDGID2" ); + top::check( truthEvent->pdfInfoParameter( PDFID1, xAOD::TruthEvent::PdfParam::PDFID1 ), "Failed to get PDFInfo: PDFID1" ); + top::check( truthEvent->pdfInfoParameter( PDFID2, xAOD::TruthEvent::PdfParam::PDFID2 ), "Failed to get PDFInfo: PDFID2" ); + top::check( truthEvent->pdfInfoParameter( X1, xAOD::TruthEvent::PdfParam::X1 ), "Failed to get PDFInfo: X1" ); + top::check( truthEvent->pdfInfoParameter( X2, xAOD::TruthEvent::PdfParam::X2 ), "Failed to get PDFInfo: X2" ); + top::check( truthEvent->pdfInfoParameter( Q, xAOD::TruthEvent::PdfParam::Q ), "Failed to get PDFInfo: Q" ); + top::check( truthEvent->pdfInfoParameter( XF1, xAOD::TruthEvent::PdfParam::XF1 ), "Failed to get PDFInfo: XF1" ); + top::check( truthEvent->pdfInfoParameter( XF2, xAOD::TruthEvent::PdfParam::XF2 ), "Failed to get PDFInfo: XF2" ); + + // This isn't working ( nor the helper to get the PDF Info ) + //top::check( pdfInfo.valid(), "PDFInfo not valid" ); + + if( XF1*XF2==0 ) { + if( !m_base_pdf_name.empty()) { + XF1 = m_basepdf->xfxQ( PDGID1, X1, Q ); + XF2 = m_basepdf->xfxQ( PDGID2, X2, Q ); + } else { + ATH_MSG_FATAL("Not enough info to recompute PDF weights (empty XF1,XF2).\n Please try to set LHAPDFBaseSet to a valid PDF set.\n XF1=" << XF1 << " XF2=" << XF2 << " LHAPDFBaseSet=" << m_base_pdf_name); + return StatusCode::FAILURE; + } + } + + for( auto& pdf : m_pdf_sets ){ + + // Being cautious... + pdf.second.event_weights.clear(); + pdf.second.event_weights.resize(pdf.second.pdf_members.size()); + + int i = 0; + + for( const auto& pdf_member : pdf.second.pdf_members ){ + + float new_xf1 = pdf_member->xfxQ( PDGID1, X1, Q ); + float new_xf2 = pdf_member->xfxQ( PDGID2, X2, Q ); + + float weight = (new_xf1*new_xf2)/(XF1*XF2); + + // This is the reweighting each event + pdf.second.event_weights[i] = weight; + // This is the sum of all event weights for a final scaling + pdf.second.sum_of_event_weights[i] += (weight*mc_weight); + i++; + } + + // decorate each truth event with a vector of PDF weights + if( m_config->saveLHAPDFEvent() ) + truthEvent->auxdecor< std::vector< float > >( "AnalysisTop_"+pdf.first+"_Weights" ) = pdf.second.event_weights; + + } + + } + + return StatusCode::SUCCESS; + + } + + StatusCode PDFScaleFactorCalculator::finalize() + { + + for( auto& pdf : m_pdf_sets ) + m_config->addLHAPDFResult( pdf.first, pdf.second.sum_of_event_weights ); + + if (m_basepdf) delete m_basepdf; + + return StatusCode::SUCCESS; + + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PhotonScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PhotonScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..658c5ebfc1a23be3de9c0a363458e60ae5c1a323 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PhotonScaleFactorCalculator.cxx @@ -0,0 +1,238 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: PhotonScaleFactorCalculator.cxx 802226 2017-04-04 16:13:10Z grancagn $ +#include "TopCorrections/PhotonScaleFactorCalculator.h" + +#include <string> + +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEgamma/PhotonContainer.h" + +namespace top { +PhotonScaleFactorCalculator::PhotonScaleFactorCalculator(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + m_systNominal(CP::SystematicSet()), + m_systEffIDUp("PH_EFF_ID_Uncertainty__1up"), + m_systEffIDDown("PH_EFF_ID_Uncertainty__1down"), + m_systEffLowPtIsoUp("PH_EFF_LOWPTISO_Uncertainty__1up"), + m_systEffLowPtIsoDown("PH_EFF_LOWPTISO_Uncertainty__1down"), + m_systEffTrkIsoUp("PH_EFF_TRKISO_Uncertainty__1up"), + m_systEffTrkIsoDown("PH_EFF_TRKISO_Uncertainty__1down"), + m_photonEffSF("AsgPhotonEfficiencyCorrectionTool"), + m_photonIsoSF(), + m_photonLooseIsoSF(), + m_photonIsoSF_exists(false), + m_photonLooseIsoSF_exists(false), + m_decor_isoSF("SetMe"), + m_decor_isoSF_loose("SetMe") + { + declareProperty("config" , m_config); +} + + StatusCode PhotonScaleFactorCalculator::initialize() { + ATH_MSG_INFO(" top::PhotonScaleFactorCalculator initialize"); + top::check(m_photonEffSF.retrieve(), + "Failed to retrieve photon efficiency SF calculator"); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_photonEffSF->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + + // remove "FixedCut" if present + std::string s = "FixedCut"; + std::string isoName = m_config->photonIsolation(); + m_decor_isoSF = "PH_SF_Iso_" + isoName; + std::string::size_type i = isoName.find(s); + if (i != std::string::npos) + isoName.erase(i, s.length()); + std::string photonIsoSFName = "AsgPhotonEfficiencyCorrectionTool_IsoSF" + isoName; + m_photonIsoSF.setName(photonIsoSFName); + if (asg::ToolStore::contains<IAsgPhotonEfficiencyCorrectionTool>(photonIsoSFName)) { + m_photonIsoSF_exists = true; + top::check(m_photonIsoSF.retrieve(), + "Failed to retrieve photon isolation efficiency SF calculator"); + std::cout<<"------>Systematics:"<<std::endl; + for (auto sys:m_photonIsoSF->recommendedSystematics()) + std::cout<<"---> "<<sys<<std::endl; + } + + std::string isoNameLoose = m_config->photonIsolationLoose(); + m_decor_isoSF_loose = "PH_SF_Iso_" + isoNameLoose; + i = isoNameLoose.find(s); + if (i != std::string::npos) + isoNameLoose.erase(i, s.length()); + std::string photonLooseIsoSFName = "AsgPhotonEfficiencyCorrectionTool_IsoSF" + isoNameLoose; + m_photonLooseIsoSF.setName(photonLooseIsoSFName); + if (asg::ToolStore::contains<IAsgPhotonEfficiencyCorrectionTool>(photonLooseIsoSFName)) { + m_photonLooseIsoSF_exists = true; + top::check(m_photonLooseIsoSF.retrieve(), + "Failed to retrieve loose photon isolation efficiency SF calculator"); + //std::cout<<"------>Systematics:"<<std::endl; + //for (auto sys:m_photonIsoSF->recommendedSystematics()) + //std::cout<<"---> "<<sys<<std::endl; + } + return StatusCode::SUCCESS; + } + + +StatusCode PhotonScaleFactorCalculator::execute() { + // Loop over all photon collections + for (auto currentSystematic : *m_config->systSgKeyMapPhotons()) { + const xAOD::PhotonContainer* photons(nullptr); + top::check(evtStore()->retrieve(photons, currentSystematic.second), + "Failed to retrieve photons"); + + // Loop over all photons in each collection + for (auto photonPtr : *photons) { + // Does the photon pass object selection? + bool passSelection(false); + if (photonPtr->isAvailable<char>("passPreORSelection")) { + if (photonPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (photonPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (photonPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + if (!passSelection) continue; + + top::check(m_photonEffSF->applySystematicVariation(m_systNominal), + "Failed to set photon efficiency SF tool to nominal"); + + double effSF(1.); + top::check(m_photonEffSF->getEfficiencyScaleFactor(*photonPtr, effSF), + "Failed to get nominal photon SF"); + + static SG::AuxElement::Decorator<float> ph_effID_dec("EFF_ID_SF"); + ph_effID_dec(*photonPtr) = effSF; + + double isoSF(1.), isoLooseSF(1.); + if (m_photonIsoSF_exists) { + top::check(m_photonIsoSF->applySystematicVariation(m_systNominal), + "Failed to set photon efficiency SF tool to nominal"); + top::check(m_photonIsoSF->getEfficiencyScaleFactor(*photonPtr, isoSF), + "Failed to get nominal photon SF"); + static SG::AuxElement::Decorator<float> ph_isoID_dec(m_decor_isoSF); + ph_isoID_dec(*photonPtr) = isoSF; + } + if (m_photonLooseIsoSF_exists) { + top::check(m_photonLooseIsoSF->applySystematicVariation(m_systNominal), + "Failed to set photon efficiency SF tool to nominal"); + top::check(m_photonLooseIsoSF->getEfficiencyScaleFactor(*photonPtr, isoLooseSF), + "Failed to get nominal photon SF"); + static SG::AuxElement::Decorator<float> ph_isoID_dec(m_decor_isoSF_loose); + ph_isoID_dec(*photonPtr) = isoLooseSF; + } + + // For nominal calibration, vary the SF systematics + if (currentSystematic.first != m_config->nominalHashValue()) + continue; + + double effSF_up(1.), effSF_down(1.); + top::check(m_photonEffSF->applySystematicVariation(m_systEffIDUp), + "Failed to set photon efficiency SF tool to" + " ID up systematic"); + top::check(m_photonEffSF->getEfficiencyScaleFactor(*photonPtr, effSF_up), + "Failed to get photon efficiency SF:" + " systematic up ID SF"); + + top::check(m_photonEffSF->applySystematicVariation(m_systEffIDDown), + "Failed to set photon efficiency SF tool to" + " ID up systematic"); + top::check(m_photonEffSF->getEfficiencyScaleFactor(*photonPtr, effSF_down), + "Failed to get photon efficiency SF:" + " systematic down ID SF"); + + static SG::AuxElement::Decorator<float> ph_effIDUp_dec("EFF_ID_SF_UP"); + static SG::AuxElement::Decorator<float> ph_effIDDown_dec("EFF_ID_SF_DOWN"); + ph_effIDUp_dec(*photonPtr) = effSF_up; + ph_effIDDown_dec(*photonPtr) = effSF_down; + + // isolation systematic uncertainties + double effLowPtIsoSF_up(1.), effTrkIsoSF_up(1.); + double effLowPtIsoSF_down(1.), effTrkIsoSF_down(1.); + double effLowPtLooseIsoSF_up(1.), effTrkLooseIsoSF_up(1.); + double effLowPtLooseIsoSF_down(1.), effTrkLooseIsoSF_down(1.); + if (m_photonIsoSF_exists) { + top::check(m_photonIsoSF->applySystematicVariation(m_systEffLowPtIsoUp), + "Failed to set photon efficiency SF tool to" + " Radiative Z (low ET) up systematic "); + top::check(m_photonIsoSF->getEfficiencyScaleFactor(*photonPtr, effLowPtIsoSF_up), + "Failed to get photon efficiency SF:" + " up systematic Radiative Z (low ET)"); + top::check(m_photonIsoSF->applySystematicVariation(m_systEffLowPtIsoDown), + "Failed to set photon efficiency SF tool to" + " Radiative Z (low ET) down systematic"); + top::check(m_photonIsoSF->getEfficiencyScaleFactor(*photonPtr, effLowPtIsoSF_down), + "Failed to get photon efficiency SF:" + " down systematic Radiative Z (low ET)"); + + top::check(m_photonIsoSF->applySystematicVariation(m_systEffTrkIsoUp), + "Failed to set photon efficiency SF tool to" + " Track isolation (ptcone, intermediate and high ET) up systematic"); + top::check(m_photonIsoSF->getEfficiencyScaleFactor(*photonPtr, effTrkIsoSF_up), + "Failed to get photon efficiency SF:" + " up systematic Track isolation (ptcone, intermediate and high ET)"); + top::check(m_photonIsoSF->applySystematicVariation(m_systEffTrkIsoDown), + "Failed to set photon efficiency SF tool to" + " Track isolation (ptcone, intermediate and high ET) down systematic"); + top::check(m_photonIsoSF->getEfficiencyScaleFactor(*photonPtr, effTrkIsoSF_down), + "Failed to get photon efficiency SF:" + " down systematic Track isolation (ptcone, intermediate and high ET)"); + } + if (m_photonLooseIsoSF_exists) { + top::check(m_photonLooseIsoSF->applySystematicVariation(m_systEffLowPtIsoUp), + "Failed to set photon efficiency SF tool to" + " Radiative Z (low ET) up systematic "); + top::check(m_photonLooseIsoSF->getEfficiencyScaleFactor(*photonPtr, effLowPtLooseIsoSF_up), + "Failed to get photon efficiency SF:" + " up systematic Radiative Z (low ET)"); + top::check(m_photonLooseIsoSF->applySystematicVariation(m_systEffLowPtIsoDown), + "Failed to set photon efficiency SF tool to" + " Radiative Z (low ET) down systematic"); + top::check(m_photonLooseIsoSF->getEfficiencyScaleFactor(*photonPtr, effLowPtLooseIsoSF_down), + "Failed to get photon efficiency SF:" + " down systematic Radiative Z (low ET)"); + + top::check(m_photonLooseIsoSF->applySystematicVariation(m_systEffTrkIsoUp), + "Failed to set photon efficiency SF tool to" + " Track isolation (ptcone, intermediate and high ET) up systematic"); + top::check(m_photonLooseIsoSF->getEfficiencyScaleFactor(*photonPtr, effTrkLooseIsoSF_up), + "Failed to get photon efficiency SF:" + " up systematic Track isolation (ptcone, intermediate and high ET)"); + top::check(m_photonLooseIsoSF->applySystematicVariation(m_systEffTrkIsoDown), + "Failed to set photon efficiency SF tool to" + " Track isolation (ptcone, intermediate and high ET) down systematic"); + top::check(m_photonLooseIsoSF->getEfficiencyScaleFactor(*photonPtr, effTrkLooseIsoSF_down), + "Failed to get photon efficiency SF:" + " down systematic Track isolation (ptcone, intermediate and high ET)"); + } + + static SG::AuxElement::Decorator<float> ph_effLowPtIsoUp_dec(m_decor_isoSF+"_LOWPT_UP"); + static SG::AuxElement::Decorator<float> ph_effLowPtIsoDown_dec(m_decor_isoSF+"_LOWPT_DOWN"); + static SG::AuxElement::Decorator<float> ph_effTrkIsoUp_dec(m_decor_isoSF+"_TRK_UP"); + static SG::AuxElement::Decorator<float> ph_effTrkIsoDown_dec(m_decor_isoSF+"_TRK_DOWN"); + static SG::AuxElement::Decorator<float> ph_effLowPtLooseIsoUp_dec(m_decor_isoSF_loose+"_LOWPT_UP"); + static SG::AuxElement::Decorator<float> ph_effLowPtLooseIsoDown_dec(m_decor_isoSF_loose+"_LOWPT_DOWN"); + static SG::AuxElement::Decorator<float> ph_effTrkLooseIsoUp_dec(m_decor_isoSF_loose+"_TRK_UP"); + static SG::AuxElement::Decorator<float> ph_effTrkLooseIsoDown_dec(m_decor_isoSF_loose+"_TRK_DOWN"); + ph_effLowPtIsoUp_dec(*photonPtr) = effLowPtIsoSF_up; + ph_effLowPtIsoDown_dec(*photonPtr) = effLowPtIsoSF_down; + ph_effTrkIsoUp_dec(*photonPtr) = effTrkIsoSF_up; + ph_effTrkIsoDown_dec(*photonPtr) = effTrkIsoSF_down; + ph_effLowPtLooseIsoUp_dec(*photonPtr) = effLowPtLooseIsoSF_up; + ph_effLowPtLooseIsoDown_dec(*photonPtr) = effLowPtLooseIsoSF_down; + ph_effTrkLooseIsoUp_dec(*photonPtr) = effTrkLooseIsoSF_up; + ph_effTrkLooseIsoDown_dec(*photonPtr) = effTrkLooseIsoSF_down; + } + } + return StatusCode::SUCCESS; +} +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PileupScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PileupScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..918b6e72ce6cb3ea9900cb3c257eb50c94abd82c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/PileupScaleFactorCalculator.cxx @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCorrections/PileupScaleFactorCalculator.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" + +namespace top{ + + PileupScaleFactorCalculator::PileupScaleFactorCalculator( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + m_pileupReweightingTool("CP::PileupReweightingTool"), + m_systNominal( CP::SystematicSet() ), + m_systDataSFUp( CP::SystematicSet() ), + m_systDataSFDown( CP::SystematicSet() ) + { + declareProperty( "config" , m_config ); + } + + StatusCode PileupScaleFactorCalculator::initialize() + { + ATH_MSG_INFO(" top::PileupScaleFactorCalculator initialize" ); + + top::check( m_pileupReweightingTool.retrieve(), "Failed to retireve pileup reweighting tool" ); + + m_systDataSFUp.insert( CP::SystematicVariation("PRW_DATASF", 1) ); + m_systDataSFDown.insert( CP::SystematicVariation("PRW_DATASF", -1) ); + + m_mu_dependent_PRW = m_config->PileupMuDependent(); + + return StatusCode::SUCCESS; + } + + + StatusCode PileupScaleFactorCalculator::execute() + { + + // get the event info + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + + top::check( m_pileupReweightingTool->applySystematicVariation( m_systNominal ), + "Failed to set pileup reweighting to nominal value" ); + + top::check(m_pileupReweightingTool->apply(*eventInfo, m_mu_dependent_PRW), + "Failed to apply pileup weight"); + + // Get hash value which can be used later for reweighting + if (m_config->isMC()) { + unsigned long long prw_hash = m_pileupReweightingTool->getPRWHash(*eventInfo); + eventInfo->auxdecor<unsigned long long>("PileupWeight_Hash") = prw_hash; + } + + // Now get the up and down pileup variations + // We want the SF for MC and the mu value for data + + // Switch tool to DataSFUp + top::check( m_pileupReweightingTool->applySystematicVariation( m_systDataSFUp ), + "Failed to switch pileup reweighting tool to data SF up" ); + + if( m_config->isMC() ){ + // The apply method above has pileupWeight as + // a double (although the function returns a float) + // so here we do the same for consistency + float pileupWeight = m_pileupReweightingTool->getCombinedWeight( *eventInfo ); + eventInfo->auxdecor<float>("PileupWeight_UP") = pileupWeight; + } + else { + float lumiBlockMu = m_pileupReweightingTool->getCorrectedMu( *eventInfo ); + eventInfo->auxdecor<float>("corrected_averageInteractionsPerCrossing_UP") = lumiBlockMu; + } + + // Switch tool to DataSFDown + top::check( m_pileupReweightingTool->applySystematicVariation( m_systDataSFDown ), + "Failed to switch pileup reweighting tool to data SF down" ); + + if( m_config->isMC() ){ + float pileupWeight = m_pileupReweightingTool->getCombinedWeight( *eventInfo ); + eventInfo->auxdecor<float>("PileupWeight_DOWN") = pileupWeight; + } + else { + float lumiBlockMu = m_pileupReweightingTool->getCorrectedMu( *eventInfo ); + eventInfo->auxdecor<float>("corrected_averageInteractionsPerCrossing_DOWN") = lumiBlockMu; + } + + // Switch tool to back to nominal to be extra careful... + top::check( m_pileupReweightingTool->applySystematicVariation( m_systNominal ), + "Failed to switch pileup reweighting tool back to nominal" ); + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..733581f8f832616c1557ae1f6526fbd8a9a5e71e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorCalculator.cxx @@ -0,0 +1,155 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCorrections/ScaleFactorCalculator.h" + +#include <string> + +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODTruth/TruthEventContainer.h" + +namespace top { + +ScaleFactorCalculator::ScaleFactorCalculator(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + + m_photonSF(nullptr), + m_electronSF(nullptr), + m_muonSF(nullptr), + m_tauSF(nullptr), + m_jetSF(nullptr), + m_btagSF(nullptr), + m_pileupSF(nullptr), + m_sherpa_22_reweight_tool("PMGSherpa22VJetsWeightTool") { + declareProperty("config", m_config); +} + +StatusCode ScaleFactorCalculator::initialize() { + ATH_MSG_INFO(" top::ScaleFactorCalculator initialize"); + + m_photonSF = std::make_unique<top::PhotonScaleFactorCalculator>("top::PhotonScaleFactorCalculator"); + m_electronSF = std::make_unique<top::ElectronScaleFactorCalculator>("top::ElectronScaleFactorCalculator"); + m_muonSF = std::make_unique<top::MuonScaleFactorCalculator>("top::MuonScaleFactorCalculator"); + m_tauSF = std::make_unique<top::TauScaleFactorCalculator>("top::TauScaleFactorCalculator"); + m_jetSF = std::make_unique<top::JetScaleFactorCalculator>("top::JetScaleFactorCalculator"); + m_btagSF = std::make_unique<top::BTagScaleFactorCalculator>("top::BTagScaleFactorCalculator"); + m_pileupSF = std::make_unique<top::PileupScaleFactorCalculator>("top::PileupScaleFactorCalculator"); + + if (m_config->isMC()) { + if (m_config->usePhotons()) { + top::check(m_photonSF->setProperty("config", m_config), "Failed to setProperty"); + top::check(m_photonSF->initialize(), "Failed to initialize"); + } + + if (m_config->useElectrons()) { + top::check(m_electronSF->setProperty("config", m_config), "Failed to setProperty"); + // m_electronSF->msg().setLevel(MSG::DEBUG); + top::check(m_electronSF->initialize(), "Failed to initialize"); + } + + if (m_config->useMuons() && !m_config->isTruthDxAOD()) { + top::check(m_muonSF->setProperty("config", m_config), "Failed to setProperty"); + // m_muonSF->msg().setLevel(MSG::DEBUG); + top::check(m_muonSF->initialize(), "Failed to initialize"); + } + + if (m_config->useTaus()) { + top::check(m_tauSF->setProperty("config", m_config), "Failed to setProperty"); + top::check(m_tauSF->initialize(), "Failed to initialize"); + } + + if (m_config->useJets()) { + top::check(m_jetSF->setProperty("config", m_config), "Failed to setProperty"); + top::check(m_jetSF->initialize(), "Failed to initialize"); + + top::check(m_btagSF->setProperty("config", m_config), "Failed to setProperty"); + top::check(m_btagSF->initialize(), "Failed to initialize"); + } + + if (m_config->isSherpa22Vjets()) + top::check(m_sherpa_22_reweight_tool.retrieve(), + "Failed to retrieve PMGSherpa22VJetsWeightTool"); + } + + if (m_config->doPileupReweighting()) { + top::check(m_pileupSF->setProperty("config", m_config), "Failed to add config to pileup SF calculator"); + top::check(m_pileupSF->initialize(), "Failed to initialize pileup SF calculator"); + } + + return StatusCode::SUCCESS; +} + +StatusCode ScaleFactorCalculator::execute() { + if (m_config->isMC()) { + if (m_config->usePhotons()) + top::check(m_photonSF->execute(), "Failed to execute photon SF"); + if (m_config->useElectrons()) + top::check(m_electronSF->execute(), "Failed to execute electron SF"); + if (m_config->useMuons() && !m_config->isTruthDxAOD()) + top::check(m_muonSF->execute(), "Failed to execute muon SF"); + if (m_config->useTaus()) + top::check(m_tauSF->execute(), "Failed to execute tau SF"); + if (m_config->useJets()) + top::check(m_jetSF->execute(), "Failed to execute jet SF"); + if (m_config->useJets()) { + top::check(m_btagSF->execute(), "Failed to execute btag SF"); + } + // Add Sherpa 22 weights directly here, if we get more + // PMG tools for reweighting then we should consider making + // a m_PMG_SF class, as with other corrections + if (m_config->isSherpa22Vjets()) { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + double sherpa_weight = m_sherpa_22_reweight_tool->getWeight(); + eventInfo->auxdecor<double>("Sherpa22VJetsWeight") = sherpa_weight; + } + } + return StatusCode::SUCCESS; +} + +StatusCode ScaleFactorCalculator::executePileup() { + if (m_config->doPileupReweighting()) + top::check(m_pileupSF->execute(), "Failed to execute pileup SF"); + return StatusCode::SUCCESS; +} + +float ScaleFactorCalculator::pileupWeight() const { + float sf(1.); + if (!m_config->isMC()) { + return sf; + } + + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + + if (eventInfo->isAvailable<float>("PileupWeight")) + sf = eventInfo->auxdataConst<float>("PileupWeight"); + + return sf; +} + +float ScaleFactorCalculator::mcEventWeight() const { + float sf(1.); + if (!m_config->isMC()) { + return sf; + } + + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo, m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + const xAOD::TruthEventContainer* truthEventContainer(nullptr); + top::check( evtStore()->retrieve(truthEventContainer, m_config->sgKeyTruthEvent()) , "Failed to retrieve truth PDF info" ); + +// sf = eventInfo->mcEventWeight(); + sf = truthEventContainer->at(0)->weights()[0];// FIXME temporary bugfix + + return sf; +} +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aec8c45fbb39376b2ff2903204792e07d9e3e100 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx @@ -0,0 +1,967 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopCorrections/ScaleFactorRetriever.h" + +#include <vector> +#include <string> + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" +#include "AthContainers/AuxElement.h" + +namespace top { + + ScaleFactorRetriever::ScaleFactorRetriever(std::shared_ptr<top::TopConfig> config) : + m_config(config) { + std::shared_ptr<std::vector<std::string>> selectors = config -> allSelectionNames(); + + for (std::string selPtr : *selectors) { + std::vector<std::string> muonTrig = config -> muonTriggers(selPtr); + std::vector<std::string> electronTrig = config -> electronTriggers(selPtr); + + for (auto trig : muonTrig) + m_muonTriggers.push_back(trig); + + for (auto trig : electronTrig) + m_electronTriggers.push_back(trig); + } + } + + // Pile up SF + bool ScaleFactorRetriever::hasPileupSF(const top::Event& event) { + // Probably don't need this function... + return event.m_info->isAvailable<float>("PileupWeight"); + } + + float ScaleFactorRetriever::pileupSF(const top::Event& event, int var) { + float sf(1.); + + if (var == 0) { // nominal + if (event.m_info->isAvailable<float>("PileupWeight")) + sf = event.m_info->auxdataConst<float>("PileupWeight"); + } else if (var == 1) { // dataSF up + if (event.m_info->isAvailable<float>("PileupWeight_UP")) + sf = event.m_info->auxdataConst<float>("PileupWeight_UP"); + } else if (var == -1) { // dataSF down + if (event.m_info->isAvailable<float>("PileupWeight_DOWN")) + sf = event.m_info->auxdataConst<float>("PileupWeight_DOWN"); + } + + return sf; + } + + // Obtain the lepton SF + float ScaleFactorRetriever::leptonSF(const top::Event& event, const top::topSFSyst SFSyst) const { + return + electronSF(event, SFSyst, top::topSFComp::ALL) + * muonSF(event, SFSyst, top::topSFComp::ALL) + * triggerSF(event, SFSyst); + } + + float ScaleFactorRetriever::triggerSF(const top::Event& event, + const top::topSFSyst SFSyst) const { + std::string electronID = m_config->electronID(); + if (event.m_isLoose) { + electronID = m_config->electronIDLoose(); + } + + std::string muonID = m_config->muonQuality(); + if (event.m_isLoose) { + muonID = m_config->muonQualityLoose(); + } + + std::vector<float> triggerSFvec; + + // Loop over electrons + for (auto elPtr : event.m_electrons) { + bool trigMatch = false; + + for (const auto& trigger : m_electronTriggers) { + std::string trig = "TRIGMATCH_" + trigger; + if (elPtr->isAvailable<char>(trig)) { + if (elPtr->auxdataConst<char>(trig) == 1) + trigMatch = true; + } + } + + if (trigMatch) + triggerSFvec.push_back(electronSF_Trigger(*elPtr , electronID , SFSyst)); + } + + // Loop over muons + for (auto muPtr : event.m_muons) { + bool trigMatch = false; + + for (const auto& trigger : m_muonTriggers) { + std::string trig = "TRIGMATCH_" + trigger; + if (muPtr->isAvailable<char>(trig)) { + if (muPtr->auxdataConst<char>(trig) == 1) + trigMatch = true; + } + } + + if (trigMatch) + triggerSFvec.push_back(muonSF_Trigger(*muPtr , muonID , SFSyst)); + } + + // for the cutflow histograms, in case the lepton triggers have not been checked yet + if (triggerSFvec.empty()) + return 1.0; + + float trigSF = 1.0; + for (float SF : triggerSFvec) + trigSF *= (1.0 - SF); + + return 1.0-trigSF; + } + + // Obtain the electron SF + float ScaleFactorRetriever::electronSF(const top::Event& event, + const top::topSFSyst SFSyst, + const top::topSFComp SFComp) const { + float sf(1.); + + std::string electronID = m_config->electronID(); + if (event.m_isLoose && !m_config->applyTightSFsInLooseTree()) { + electronID = m_config->electronIDLoose(); + } + std::string electronIso = m_config->electronIsolation(); + if (event.m_isLoose && !m_config->applyTightSFsInLooseTree()) { + electronIso = m_config->electronIsolationLoose(); + } + + float trigger(1.); + float reco(1.); + float id(1.); + float isol(1.); + float chargeid(1.); + float chargemisid(1.); + + // Loop over electrons + for (auto elPtr : event.m_electrons) { + if (event.m_isLoose && m_config->applyTightSFsInLooseTree() && !elPtr->auxdataConst<char>("passPreORSelection")) + continue;// in case one want the tight SFs in the loose tree, need to only take the tight leptons + + // trigger *= electronSF_Trigger(*elPtr , electronID , SFSyst); + reco *= electronSF_Reco(*elPtr , SFSyst); + id *= electronSF_ID(*elPtr , electronID , SFSyst); + isol *= electronSF_Isol(*elPtr , electronIso , SFSyst); + chargeid *= electronSF_ChargeID(*elPtr, electronID , electronIso, SFSyst); + chargemisid *= electronSF_ChargeMisID(*elPtr, electronID , electronIso, SFSyst); + + } + + sf = trigger*reco*id*isol; // *chargeid*chargemisid; // let the charge id scale factors out until further tested by users + + // if (SFComp == top::topSFComp::TRIGGER) + // return trigger; + if (SFComp == top::topSFComp::RECO) + return reco; + else if (SFComp == top::topSFComp::ID) + return id; + else if (SFComp == top::topSFComp::ISOLATION) + return isol; + else if (SFComp == top::topSFComp::CHARGEID) + return chargeid; + else if (SFComp == top::topSFComp::CHARGEMISID) + return chargemisid; + else if (SFComp == top::topSFComp::ALL) + return sf; + + return sf; + } + + + + float ScaleFactorRetriever::electronSF_Trigger(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronSF_Trigger(x, (isLoose ? m_config->electronIDLoose() : m_config->electronID()), SFSyst); + + } + + float ScaleFactorRetriever::electronEff_Trigger(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronEff_Trigger(x, (isLoose ? m_config->electronIDLoose() : m_config->electronID()), SFSyst); + + } + + + float ScaleFactorRetriever::electronSF_Trigger(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_Trigger_"+id)) { + sf = x.auxdataConst<float>("EL_SF_Trigger_"+id); + } + + if (SFSyst == top::topSFSyst::EL_SF_Trigger_UP) { + if (x.isAvailable<float>("EL_SF_Trigger_"+id+"_UP")) { + sf = x.auxdataConst<float>("EL_SF_Trigger_"+id+"_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_Trigger_DOWN) { + if (x.isAvailable<float>("EL_SF_Trigger_"+id+"_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_Trigger_"+id+"_DOWN"); + } + } + + return sf; + } + + float ScaleFactorRetriever::electronEff_Trigger(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + float eff(1.); + if (x.isAvailable<float>("EL_EFF_Trigger_"+id)) { + eff = x.auxdataConst<float>("EL_EFF_Trigger_"+id); + } + + if (SFSyst == top::topSFSyst::EL_SF_Trigger_UP) { + if (x.isAvailable<float>("EL_EFF_Trigger_"+id+"_UP")) { + eff = x.auxdataConst<float>("EL_EFF_Trigger_"+id+"_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_Trigger_DOWN) { + if (x.isAvailable<float>("EL_EFF_Trigger_"+id+"_DOWN")) { + eff = x.auxdataConst<float>("EL_EFF_Trigger_"+id+"_DOWN"); + } + } + + return eff; + } + + + float ScaleFactorRetriever::electronSF_Reco(const xAOD::Electron& x, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_Reco")) { + sf = x.auxdataConst<float>("EL_SF_Reco"); + } + + if (SFSyst == top::topSFSyst::EL_SF_Reco_UP) { + if (x.isAvailable<float>("EL_SF_Reco_UP")) { + sf = x.auxdataConst<float>("EL_SF_Reco_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_Reco_DOWN) { + if (x.isAvailable<float>("EL_SF_Reco_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_Reco_DOWN"); + } + } + + return sf; + } + + + float ScaleFactorRetriever::electronSF_ID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronSF_ID(x, (isLoose ? m_config->electronIDLoose() : m_config->electronID()), SFSyst); + + } + + + float ScaleFactorRetriever::electronSF_ID(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_ID_"+id)) { + sf = x.auxdataConst<float>("EL_SF_ID_"+id); + } + + if (SFSyst == top::topSFSyst::EL_SF_ID_UP) { + if (x.isAvailable<float>("EL_SF_ID_"+id+"_UP")) { + sf = x.auxdataConst<float>("EL_SF_ID_"+id+"_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_ID_DOWN) { + if (x.isAvailable<float>("EL_SF_ID_"+id+"_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_ID_"+id+"_DOWN"); + } + } + + return sf; + } + + + float ScaleFactorRetriever::electronSF_Isol(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronSF_Isol(x, (isLoose ? m_config->electronIsolationLoose() : m_config->electronIsolation()), SFSyst); + + } + + float ScaleFactorRetriever::electronSF_Isol(const xAOD::Electron& x, + const std::string& iso, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_Iso_"+iso)) { + sf = x.auxdataConst<float>("EL_SF_Iso_"+iso); + } + + + if (SFSyst == top::topSFSyst::EL_SF_Isol_UP) { + + if (x.isAvailable<float>("EL_SF_Iso_"+iso+"_UP")) { + + sf = x.auxdataConst<float>("EL_SF_Iso_"+iso+"_UP"); + + } + } + + if (SFSyst == top::topSFSyst::EL_SF_Isol_DOWN) { + if (x.isAvailable<float>("EL_SF_Iso_"+iso+"_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_Iso_"+iso+"_DOWN"); + } + } + + return sf; + } + + float ScaleFactorRetriever::electronSF_ChargeID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronSF_ChargeID(x, (isLoose ? m_config->electronIDLoose() : m_config->electronID()), + (isLoose ? m_config->electronIsolationLoose() : m_config->electronIsolation()), SFSyst); + + } + + float ScaleFactorRetriever::electronSF_ChargeID(const xAOD::Electron& x, + const std::string& id, const std::string& iso, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_ChargeID_"+id+"_"+iso)) { + sf = x.auxdataConst<float>("EL_SF_ChargeID_"+id+"_"+iso); + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeID_UP) { + if (x.isAvailable<float>("EL_SF_ChargeID_"+id+"_"+iso+"_UP")) { + sf = x.auxdataConst<float>("EL_SF_ChargeID_"+id+"_"+iso+"_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeID_DOWN) { + if (x.isAvailable<float>("EL_SF_ChargeID_"+id+"_"+iso+"_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_ChargeID_"+id+"_"+iso+"_DOWN"); + } + } + return sf; + } + + float ScaleFactorRetriever::electronSF_ChargeMisID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return electronSF_ChargeMisID(x, (isLoose ? m_config->electronIDLoose() : m_config->electronID()), + (isLoose ? m_config->electronIsolationLoose() : m_config->electronIsolation()), SFSyst); + + } + + float ScaleFactorRetriever::electronSF_ChargeMisID(const xAOD::Electron& x, + const std::string& id, const std::string& iso, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("EL_SF_ChargeMisID_"+id+"_"+iso)) { + sf = x.auxdataConst<float>("EL_SF_ChargeMisID_"+id+"_"+iso); + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeMisID_STAT_UP) { + if (x.isAvailable<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_STAT_UP")) { + sf = x.auxdataConst<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_STAT_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeMisID_STAT_DOWN) { + if (x.isAvailable<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_STAT_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_STAT_DOWN"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeMisID_SYST_UP) { + if (x.isAvailable<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_SYST_UP")) { + sf = x.auxdataConst<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_SYST_UP"); + } + } + + if (SFSyst == top::topSFSyst::EL_SF_ChargeMisID_SYST_DOWN) { + if (x.isAvailable<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_SYST_DOWN")) { + sf = x.auxdataConst<float>("EL_SF_ChargeMisID_"+id+"_"+iso+"_SYST_DOWN"); + } + } + + return sf; + } + + // Obtain the muon SF + float ScaleFactorRetriever::muonSF(const top::Event& event, + const top::topSFSyst SFSyst, + const top::topSFComp SFComp) const { + float sf(1.); + + std::string muonID = m_config->muonQuality(); + std::string muonIso = m_config->muonIsolation(); + + if (event.m_isLoose && !m_config->applyTightSFsInLooseTree()) { + muonID = m_config->muonQualityLoose(); + muonIso = m_config->muonIsolationLoose(); + } + + float trigger(1.); + float reco(1.); + float id(1.); + float isol(1.); + float TTVA(1.); + + // Loop over muons + for (auto muPtr : event.m_muons) { + if (event.m_isLoose && m_config->applyTightSFsInLooseTree() && !muPtr->auxdataConst<char>("passPreORSelection")) + continue;// in case one want the tight SFs in the loose tree, need to only take the tight leptons + + id *= muonSF_ID(*muPtr , muonID , SFSyst); + isol *= muonSF_Isol(*muPtr , muonIso , SFSyst); + + if(m_config -> applyTTVACut()) // if not using TTVA cut, leave SF set to 1.0 + TTVA *= muonSF_TTVA(*muPtr , SFSyst); + + } + + sf = trigger * id * isol * TTVA; + + // if (SFComp == top::topSFComp::TRIGGER) + // return trigger; + if (SFComp == top::topSFComp::RECO) + return reco; + else if (SFComp == top::topSFComp::ID) + return id; + else if (SFComp == top::topSFComp::ISOLATION) + return isol; + else if (SFComp == top::topSFComp::TTVA) + return TTVA; + else if (SFComp == top::topSFComp::ALL) + return sf; + + return sf; + + } + + float ScaleFactorRetriever::muonSF_Trigger(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + return muonSF_Trigger(x, (isLoose ? m_config->muonQualityLoose() : m_config->muonQuality()), SFSyst); + } + + + float ScaleFactorRetriever::muonSF_Trigger(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + float sf(1.); + if (x.isAvailable<float>("MU_SF_Trigger_"+id)) { + sf = x.auxdataConst<float>("MU_SF_Trigger_"+id); + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_STAT_UP) { + if (x.isAvailable<float>("MU_SF_Trigger_"+id+"_STAT_UP")) { + sf = x.auxdataConst<float>("MU_SF_Trigger_"+id+"_STAT_UP"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_STAT_DOWN) { + if (x.isAvailable<float>("MU_SF_Trigger_"+id+"_STAT_DOWN")) { + sf = x.auxdataConst<float>("MU_SF_Trigger_"+id+"_STAT_DOWN"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_SYST_UP) { + if (x.isAvailable<float>("MU_SF_Trigger_"+id+"_SYST_UP")) { + sf = x.auxdataConst<float>("MU_SF_Trigger_"+id+"_SYST_UP"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_SYST_DOWN) { + if (x.isAvailable<float>("MU_SF_Trigger_"+id+"_SYST_DOWN")) { + sf = x.auxdataConst<float>("MU_SF_Trigger_"+id+"_SYST_DOWN"); + } + } + + + + return sf; + } + + + + float ScaleFactorRetriever::muonEff_Trigger(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + return muonEff_Trigger(x, (isLoose ? m_config->muonQualityLoose() : m_config->muonQuality()), SFSyst); + } + + + float ScaleFactorRetriever::muonEff_Trigger(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + float eff(1.); + if (x.isAvailable<float>("MU_EFF_Trigger_"+id)) { + eff = x.auxdataConst<float>("MU_EFF_Trigger_"+id); + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_STAT_UP) { + if (x.isAvailable<float>("MU_EFF_Trigger_"+id+"_STAT_UP")) { + eff = x.auxdataConst<float>("MU_EFF_Trigger_"+id+"_STAT_UP"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_STAT_DOWN) { + if (x.isAvailable<float>("MU_EFF_Trigger_"+id+"_STAT_DOWN")) { + eff = x.auxdataConst<float>("MU_EFF_Trigger_"+id+"_STAT_DOWN"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_SYST_UP) { + if (x.isAvailable<float>("MU_EFF_Trigger_"+id+"_SYST_UP")) { + eff = x.auxdataConst<float>("MU_EFF_Trigger_"+id+"_SYST_UP"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Trigger_SYST_DOWN) { + if (x.isAvailable<float>("MU_EFF_Trigger_"+id+"_SYST_DOWN")) { + eff = x.auxdataConst<float>("MU_EFF_Trigger_"+id+"_SYST_DOWN"); + } + } + + + + return eff; + } + + + float ScaleFactorRetriever::muonSF_ID(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + return muonSF_ID(x, (isLoose ? m_config->muonQualityLoose() : m_config->muonQuality()), SFSyst); + } + + float ScaleFactorRetriever::muonSF_ID(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const { + + std::string decoration = "MU_SF_ID_"+id; + switch (SFSyst) { + case top::topSFSyst::MU_SF_ID_STAT_UP: + decoration += "_STAT_UP"; + break; + case top::topSFSyst::MU_SF_ID_STAT_DOWN: + decoration += "_STAT_DOWN"; + break; + case top::topSFSyst::MU_SF_ID_SYST_UP: + decoration += "_SYST_UP"; + break; + case top::topSFSyst::MU_SF_ID_SYST_DOWN: + decoration += "_SYST_DOWN"; + break; + case top::topSFSyst::MU_SF_ID_STAT_LOWPT_UP: + decoration += "_STAT_LOWPT_UP"; + break; + case top::topSFSyst::MU_SF_ID_STAT_LOWPT_DOWN: + decoration += "_STAT_LOWPT_DOWN"; + break; + case top::topSFSyst::MU_SF_ID_SYST_LOWPT_UP: + decoration += "_SYST_LOWPT_UP"; + break; + case top::topSFSyst::MU_SF_ID_SYST_LOWPT_DOWN: + decoration += "_SYST_LOWPT_DOWN"; + break; + default: + // Do nothing, we have the decoration already + break; + } + + if (!x.isAvailable<float>(decoration)) { + return 1.0; + } else { + return x.auxdataConst<float>(decoration); + } + + // This should never happen + throw std::runtime_error("Something has gone wrong in mu ID SF retrieval"); + } + + float ScaleFactorRetriever::muonSF_Isol(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return muonSF_Isol(x, (isLoose ? m_config->muonIsolationLoose() : m_config->muonIsolation()), SFSyst); + } + + + float ScaleFactorRetriever::muonSF_Isol(const xAOD::Muon& x, + const std::string& iso, + const top::topSFSyst SFSyst) const { + + float sf(1.); + if (x.isAvailable<float>("MU_SF_Isol_"+iso)) { + sf = x.auxdataConst<float>("MU_SF_Isol_"+iso); + } + + if (SFSyst == top::topSFSyst::MU_SF_Isol_SYST_UP) { + + if (x.isAvailable<float>("MU_SF_Isol_"+iso+"_SYST_UP")) { + sf = x.auxdataConst<float>("MU_SF_Isol_"+iso+"_SYST_UP"); + } + + } + + if (SFSyst == top::topSFSyst::MU_SF_Isol_SYST_DOWN) { + if (x.isAvailable<float>("MU_SF_Isol_"+iso+"_SYST_DOWN")) { + sf = x.auxdataConst<float>("MU_SF_Isol_"+iso+"_SYST_DOWN"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Isol_STAT_UP) { + if (x.isAvailable<float>("MU_SF_Isol_"+iso+"_STAT_UP")) { + sf = x.auxdataConst<float>("MU_SF_Isol_"+iso+"_STAT_UP"); + } + } + + if (SFSyst == top::topSFSyst::MU_SF_Isol_STAT_DOWN) { + if (x.isAvailable<float>("MU_SF_Isol_"+iso+"_STAT_DOWN")) { + sf = x.auxdataConst<float>("MU_SF_Isol_"+iso+"_STAT_DOWN"); + } + } + + + return sf; + } + + /** + * @brief Get the muon track-to-vertex association SF + * + * @param x - muon to get SF for + * @param SFSyst - systematic variation required + * + * @return muon TTVA SF + **/ + float ScaleFactorRetriever::muonSF_TTVA(const xAOD::Muon& x, + const top::topSFSyst SFSyst) const { + + // Nominal decoration: if not a TTVA + // systematic then return the nominal + std::string decoration = "MU_SF_TTVA"; + switch (SFSyst) { + case top::topSFSyst::MU_SF_TTVA_STAT_UP: + decoration += "_STAT_UP"; + break; + case top::topSFSyst::MU_SF_TTVA_STAT_DOWN: + decoration += "_STAT_DOWN"; + break; + case top::topSFSyst::MU_SF_TTVA_SYST_UP: + decoration += "_SYST_UP"; + break; + case top::topSFSyst::MU_SF_TTVA_SYST_DOWN: + decoration += "_SYST_DOWN"; + break; + default: + // Do nothing, we have the decoration already + break; + } + + if (!(x.isAvailable<float>(decoration))) { + std::cout << "Muon is not decorated with requested " + << "TTVA SF. 1.0 will be returned." << std::endl; + return 1.0; + } + + return x.auxdataConst<float>(decoration);; + + } + + float ScaleFactorRetriever::tauSF(const top::Event& event, + const top::topSFSyst SFSyst) const { + float sf(1.0); + for (auto tau : event.m_tauJets) + sf *= tauSF(*tau, SFSyst, event.m_isLoose); + return sf; + } + + float ScaleFactorRetriever::tauSF(const xAOD::TauJet& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + // See TauScaleFactorCalculator.cxx for uncertainties + static SG::AuxElement::ConstAccessor<float> acc_tauSF("tauSF"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_eleolr_total_up("tauSF_eleolr_total_up"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_eleolr_total_down("tauSF_eleolr_total_down"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_jetid_total_up("tauSF_jetid_total_up"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_jetid_total_down("tauSF_jetid_total_down"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_reco_total_up("tauSF_reco_total_up"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_reco_total_down("tauSF_reco_total_down"); + + static SG::AuxElement::ConstAccessor<float> acc_tauSF_loose("tauSF_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_eleolr_total_up_loose("tauSF_eleolr_total_up_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_eleolr_total_down_loose("tauSF_eleolr_total_down_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_jetid_total_up_loose("tauSF_jetid_total_up_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_jetid_total_down_loose("tauSF_jetid_total_down_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_reco_total_up_loose("tauSF_reco_total_up_loose"); + static SG::AuxElement::ConstAccessor<float> acc_tauSF_reco_total_down_loose("tauSF_reco_total_down_loose"); + + if (!isLoose) { + switch (SFSyst) { + case top::topSFSyst::TAU_SF_ELEOLR_TOTAL_UP : + return acc_tauSF_eleolr_total_up(x); + case top::topSFSyst::TAU_SF_ELEOLR_TOTAL_DOWN : + return acc_tauSF_eleolr_total_down(x); + case top::topSFSyst::TAU_SF_JETID_TOTAL_UP : + return acc_tauSF_jetid_total_up(x); + case top::topSFSyst::TAU_SF_JETID_TOTAL_DOWN : + return acc_tauSF_jetid_total_down(x); + case top::topSFSyst::TAU_SF_RECO_TOTAL_UP : + return acc_tauSF_reco_total_up(x); + case top::topSFSyst::TAU_SF_RECO_TOTAL_DOWN : + return acc_tauSF_reco_total_down(x); + default : + // If not a tau systematic then return nominal SF + return acc_tauSF(x); + break; + } + } else { + switch (SFSyst) { + case top::topSFSyst::TAU_SF_ELEOLR_TOTAL_UP : + return acc_tauSF_eleolr_total_up_loose(x); + case top::topSFSyst::TAU_SF_ELEOLR_TOTAL_DOWN : + return acc_tauSF_eleolr_total_down_loose(x); + case top::topSFSyst::TAU_SF_JETID_TOTAL_UP : + return acc_tauSF_jetid_total_up_loose(x); + case top::topSFSyst::TAU_SF_JETID_TOTAL_DOWN : + return acc_tauSF_jetid_total_down_loose(x); + case top::topSFSyst::TAU_SF_RECO_TOTAL_UP : + return acc_tauSF_reco_total_up_loose(x); + case top::topSFSyst::TAU_SF_RECO_TOTAL_DOWN : + return acc_tauSF_reco_total_down_loose(x); + default : + // If not a tau systematic then return nominal SF + return acc_tauSF_loose(x); + break; + } + } + } + + float ScaleFactorRetriever::photonSF_Isol(const xAOD::Photon& x, + const top::topSFSyst SFSyst, + bool isLoose) const { + + return photonSF_Isol(x, (isLoose ? m_config->photonIsolationLoose() : m_config->photonIsolation()), SFSyst); + + } + + float ScaleFactorRetriever::photonSF_Isol(const xAOD::Photon& x, + const std::string& iso, + const top::topSFSyst SFSyst) const { + + float sf(1.); + if (x.isAvailable<float>("PH_SF_Iso_" + iso)) { + sf = x.auxdataConst<float>("PH_SF_Iso_"+iso); + } + if (SFSyst == top::topSFSyst::PHOTON_EFF_LOWPTISO_UP) { + if (x.isAvailable<float>("PH_SF_Iso_"+iso+"_LOWPT_UP")) { + sf = x.auxdataConst<float>("PH_SF_Iso_"+iso+"_LOWPT_UP"); + } + } + if (SFSyst == top::topSFSyst::PHOTON_EFF_LOWPTISO_DOWN) { + if (x.isAvailable<float>("PH_SF_Iso_"+iso+"_LOWPT_DOWN")) { + sf = x.auxdataConst<float>("PH_SF_Iso_"+iso+"_LOWPT_DOWN"); + } + } + if (SFSyst == top::topSFSyst::PHOTON_EFF_LOWPTISO_UP) { + if (x.isAvailable<float>("PH_SF_Iso_"+iso+"_TRK_UP")) { + sf = x.auxdataConst<float>("PH_SF_Iso_"+iso+"_TRK_UP"); + } + } + if (SFSyst == top::topSFSyst::PHOTON_EFF_LOWPTISO_DOWN) { + if (x.isAvailable<float>("PH_SF_Iso_"+iso+"_TRK_DOWN")) { + sf = x.auxdataConst<float>("PH_SF_Iso_"+iso+"_TRK_DOWN"); + } + } + return sf; + } + + float ScaleFactorRetriever::photonSF(const top::Event& event, + const top::topSFSyst SFSyst) const { + float sf(1.0); + for (auto photon : event.m_photons) + sf *= photonSF(*photon, SFSyst, event.m_isLoose); + return sf; + } + + float ScaleFactorRetriever::photonSF(const xAOD::Photon& photon, + const top::topSFSyst SFSyst, + bool isLoose) const { + + static SG::AuxElement::ConstAccessor<float> acc_ph_IDSF("EFF_ID_SF"); + static SG::AuxElement::ConstAccessor<float> acc_ph_IDSFUp("EFF_ID_SF_UP"); + static SG::AuxElement::ConstAccessor<float> acc_ph_IDSFDown("EFF_ID_SF_DOWN"); + + switch (SFSyst) { + case top::topSFSyst::nominal: + return acc_ph_IDSF(photon); + case top::topSFSyst::PHOTON_IDSF_UP: + return acc_ph_IDSFUp(photon); + case top::topSFSyst::PHOTON_IDSF_DOWN: + return acc_ph_IDSFDown(photon); + default: + return photonSF_Isol(photon, SFSyst, isLoose); + } + } + + /** + * @brief nominal SF or named systematics + */ + float ScaleFactorRetriever::btagSF(const top::Event& event, + const top::topSFSyst SFSyst, + std::string WP, bool do_trackjets, std::string uncert_name) const { + float sf(1.); + std::string decoration = "btag_SF_"+WP+"_nom"; + + switch (SFSyst) { + case top::topSFSyst::nominal : + break; // is btag_SF_nom by default + case top::topSFSyst::BTAG_SF_NAMED_UP : + if (uncert_name=="") { + std::cout << "Named b-tagging systematics should have a name. Please provide one." << std::endl; + return 0; + } + decoration = "btag_SF_"+WP+"_"+uncert_name+"__1up"; + break; + case top::topSFSyst::BTAG_SF_NAMED_DOWN : + if (uncert_name=="") { + std::cout << "Named b-tagging systematics should have a name. Please provide one." << std::endl; + return 0; + } + decoration = "btag_SF_"+WP+"_"+uncert_name+"__1down"; + break; + case top::topSFSyst::BTAG_SF_EIGEN_B : + case top::topSFSyst::BTAG_SF_EIGEN_C : + case top::topSFSyst::BTAG_SF_EIGEN_LIGHT : + std::cout << "For Eigenvectors please use ScaleFactorRetriever::btagSF_eigen_vars" << std::endl; + return 0; + break; + default : + std::cout << "Not the right function: " + << __PRETTY_FUNCTION__ << std::endl; + return 0; + break; + } + + // I'm testing! + xAOD::JetContainer jets = event.m_jets; + if (do_trackjets) jets = event.m_trackJets; + for (auto jetPtr : jets) { + + double weight = 1.0; + if (jetPtr -> isAvailable<float>(decoration)) + weight = jetPtr -> auxdataConst<float>(decoration); + + sf *= weight; + + } + + // for now + return sf; + } + + void ScaleFactorRetriever::btagSF_eigen_vars(const top::Event& event, + const top::topSFSyst SFSyst, + std::vector<float>& vec_btagSF_up, + std::vector<float>& vec_btagSF_down, + std::string WP, bool do_trackjets) const { + + // just in case + vec_btagSF_up.clear(); + vec_btagSF_down.clear(); + + unsigned int n_eigen = 0; + std::string prefix = "btag_SF_"+WP+"_FT_EFF_Eigen_"; + std::string flav = ""; + + switch (SFSyst) { + case top::topSFSyst::BTAG_SF_EIGEN_B : + n_eigen = do_trackjets ? m_config-> trkjet_btagging_num_B_eigenvars(WP) : m_config->btagging_num_B_eigenvars(WP); + flav = "B_"; + break; + case top::topSFSyst::BTAG_SF_EIGEN_C : + n_eigen = do_trackjets ? m_config-> trkjet_btagging_num_C_eigenvars(WP) : m_config->btagging_num_C_eigenvars(WP); + flav = "C_"; + break; + case top::topSFSyst::BTAG_SF_EIGEN_LIGHT : + n_eigen = do_trackjets ? m_config-> trkjet_btagging_num_Light_eigenvars(WP) : m_config->btagging_num_Light_eigenvars(WP); + flav = "Light_"; + break; + default : + std::cout << "Not the right function: " + << __PRETTY_FUNCTION__ << std::endl; + return; + } + vec_btagSF_up.resize(n_eigen); + vec_btagSF_down.resize(n_eigen); + + for (unsigned int i = 0; i < n_eigen; ++i) { + float SF_up(1.0), SF_down(1.0); + std::string num = std::to_string(i); + std::string SF_dec_up = prefix+flav+num+"__1up"; + std::string SF_dec_down = prefix+flav+num+"__1down"; + + xAOD::JetContainer jets = event.m_jets; + if (do_trackjets) jets = event.m_trackJets; + for (auto jetPtr : jets) { + if (jetPtr->isAvailable<float>(SF_dec_up)) + SF_up *= jetPtr->auxdataConst<float>(SF_dec_up); + if (jetPtr->isAvailable<float>(SF_dec_down)) + SF_down *= jetPtr->auxdataConst<float>(SF_dec_down); + } + vec_btagSF_up[i] = SF_up; + vec_btagSF_down[i] = SF_down; + + } + return; + } + + float ScaleFactorRetriever::jvtSF(const top::Event& event, + const top::topSFSyst SFSyst) const { + + xAOD::JetContainer jets = event.m_jets; + switch (SFSyst) { + case top::topSFSyst::JVT_UP: + return event.m_jvtSF_UP; + case top::topSFSyst::JVT_DOWN: + return event.m_jvtSF_DOWN; + default: + return event.m_jvtSF; + } + + } + + /** + * @brief Print all the SF values to cout + */ + void ScaleFactorRetriever::print(const top::Event& event) { + std::cout << "ScaleFactors" << "\n"; + std::cout << " MCEventWeight : " << event.m_info->mcEventWeight() << "\n"; + std::cout << " Pileup : " << pileupSF(event) << "\n"; + std::cout << " LeptonEventWeight : " << leptonSF(event, top::topSFSyst::nominal) << "\n"; + std::cout << " B-TagEventWeight : " << btagSF(event, top::topSFSyst::nominal) << "\n"; + } + + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/TauScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/TauScaleFactorCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..03ce54848f669dcf7f59748c45a7779b0897d37b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/TauScaleFactorCalculator.cxx @@ -0,0 +1,141 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TauScaleFactorCalculator.cxx 712396 2015-12-03 16:25:25Z tneep $ +#include <string> + +#include "TopCorrections/TauScaleFactorCalculator.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODTau/TauJetContainer.h" + +namespace top { + +TauScaleFactorCalculator::TauScaleFactorCalculator(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + m_tauEffCorrTool("TauAnalysisTools::TauEfficiencyCorrectionsTool"), + m_tauEffCorrToolLoose("TauAnalysisTools::TauEfficiencyCorrectionsToolLoose"), + + m_systNominal(CP::SystematicSet()) { + declareProperty("config" , m_config); +} + +StatusCode TauScaleFactorCalculator::initialize() { + ATH_MSG_INFO(" top::TauScaleFactorCalculator initialize"); + + top::check(m_tauEffCorrTool.retrieve(), + "Failed to retrieve tau efficiency corrections tool"); + + // How to get the recommended/affecting systematics... + // CP::SystematicSet m_syst_rec = m_tauEffCorrTool->recommendedSystematics(); + // CP::SystematicSet m_syst_aff = m_tauEffCorrTool->affectingSystematics(); + + const std::string tauSysPrefix = "TAUS_TRUEHADTAU_EFF_"; + // Should be empty- but lets be sure + m_syst_map.clear(); + // Add all recommended systematics to be clear + // Tau-electron overlap removal up/down + m_syst_map["tauSF_eleolr_total_down"] + = CP::SystematicSet(tauSysPrefix+"ELEOLR_TOTAL__1down"); + m_syst_map["tauSF_eleolr_total_up"] + = CP::SystematicSet(tauSysPrefix+"ELEOLR_TOTAL__1up"); + // Tau Jet ID WP up/down + m_syst_map["tauSF_jetid_total_down"] + = CP::SystematicSet(tauSysPrefix+"JETID_TOTAL__1down"); + m_syst_map["tauSF_jetid_total_up"] + = CP::SystematicSet(tauSysPrefix+"JETID_TOTAL__1up"); + // Tau reconstruction up/down + m_syst_map["tauSF_reco_total_down"] + = CP::SystematicSet(tauSysPrefix+"RECO_TOTAL__1down"); + m_syst_map["tauSF_reco_total_up"] + = CP::SystematicSet(tauSysPrefix+"RECO_TOTAL__1up"); + + return StatusCode::SUCCESS; +} + + +StatusCode TauScaleFactorCalculator::execute() { + ///-- Loop over all muon collections --/// + for (auto currentSystematic : *m_config->systSgKeyMapTaus()) { + const xAOD::TauJetContainer* taus(nullptr); + top::check(evtStore()->retrieve(taus, currentSystematic.second), + "failed to retrieve taus"); + + ///-- Tell the SF tools to use the nominal systematic --/// + + /// -- Loop over all taus in each collection --/// + for (auto tauPtr : *taus) { + /// -- Does the tau pass object selection? --/// + bool passSelection(false); + if (tauPtr->isAvailable<char>("passPreORSelection")) { + if (tauPtr->auxdataConst<char>("passPreORSelection") == 1) { + passSelection = true; + } + } + if (tauPtr->isAvailable<char>("passPreORSelectionLoose")) { + if (tauPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) { + passSelection = true; + } + } + + ///-- If we aren't selecting the tau, then don't bother --/// + if (!passSelection) continue; + + //============================================================ + // Find the nominal SF for the tight/loose tau IDs for every + // systematic uncertainty. + // + // Make sure we set both tools to nominal for each tau + //============================================================ + + top::check(m_tauEffCorrTool->applySystematicVariation(m_systNominal), + "Failed to set tau efficiency correction" + " tool to nominal value"); + top::check(m_tauEffCorrToolLoose->applySystematicVariation(m_systNominal), + "Failed to set (loose) tau efficiency correction" + " tool to nominal value"); + + double nominalSF(0.0), nominalSFLoose(0.0); + + top::check(m_tauEffCorrTool->getEfficiencyScaleFactor(*tauPtr, nominalSF), + "Failed to get nominal tau SF"); + top::check(m_tauEffCorrToolLoose->getEfficiencyScaleFactor(*tauPtr, + nominalSFLoose), + "Failed to get nominal (loose) tau SF"); + + ///-- Decorate the tau with the tight/loose SFs --/// + tauPtr->auxdecor<float>("tauSF") = nominalSF; + tauPtr->auxdecor<float>("tauSF_loose") = nominalSFLoose; + + ///-- For nominal calibration, vary the SF systematics --/// + if (currentSystematic.first == m_config->nominalHashValue()) { + for (const auto& i : m_syst_map) { + double SF(0.0), SF_loose(0.0); + const std::string decoration_name = i.first; + const std::string decoration_name_loose = i.first+"_loose"; + top::check(m_tauEffCorrTool->applySystematicVariation(i.second), + "Failed to set tau efficiency correction" + " tool to nominal value"); + top::check(m_tauEffCorrToolLoose->applySystematicVariation(i.second), + "Failed to set (loose) tau efficiency correction" + " tool to nominal value"); + top::check(m_tauEffCorrTool->getEfficiencyScaleFactor(*tauPtr, SF), + "Failed to get nominal tau SF"); + top::check(m_tauEffCorrToolLoose->getEfficiencyScaleFactor(*tauPtr, + SF_loose), + "Failed to get nominal (loose) tau SF"); + tauPtr->auxdecor<float>(decoration_name) = SF; + tauPtr->auxdecor<float>(decoration_name_loose) = SF_loose; + } + } // Calibration systematic is nominal, so calculate SF systematics + } + } + + + return StatusCode::SUCCESS; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/BTagScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/BTagScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..41fc0f4ae4c3a437217d1364e1fa904415c1ab7b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/BTagScaleFactorCalculator.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: BTagScaleFactorCalculator.h 754162 2016-06-10 15:01:10Z tpelzer $ +#ifndef ANALYSISTOP_TOPCORRECTIONS_BTAGSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_BTAGSCALEFACTORCALCULATOR_H + +/** + * @author Andrea Knue <aknue@cern.ch>, John Morris <john.morris@cern.ch> + * + * @brief BTagScaleFactorCalculator + * Calculate all jet scale factors and decorate + * + * $Revision: + * $Date: 2016-06-10 17:01:10 +0200 (Fri, 10 Jun 2016) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +#include "xAODBTaggingEfficiency/IBTaggingEfficiencyTool.h" +#include "xAODBTaggingEfficiency/IBTaggingSelectionTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class BTagScaleFactorCalculator final : public asg::AsgTool { + public: + explicit BTagScaleFactorCalculator( const std::string& name ); + virtual ~BTagScaleFactorCalculator(){} + + // Delete Standard constructors + BTagScaleFactorCalculator(const BTagScaleFactorCalculator& rhs) = delete; + BTagScaleFactorCalculator(BTagScaleFactorCalculator&& rhs) = delete; + BTagScaleFactorCalculator& operator=(const BTagScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + StatusCode apply( const std::shared_ptr<std::unordered_map<std::size_t,std::string>>& jet_syst_collections, + bool use_trackjets = false); + + private: + + std::shared_ptr<top::TopConfig> m_config; + + CP::SystematicSet m_nominal; + std::unordered_map<std::string, CP::SystematicSet> m_systs; + std::unordered_map<std::string, CP::SystematicSet> m_trkjet_systs; + + ///B-tagging efficiency tools + std::unordered_map<std::string, ToolHandle<IBTaggingEfficiencyTool>> m_btagEffTools; + std::unordered_map<std::string, ToolHandle<IBTaggingEfficiencyTool>> m_trkjet_btagEffTools; + ///B-tagging selection tools + std::unordered_map<std::string, ToolHandle<IBTaggingSelectionTool>> m_btagSelTools; + std::unordered_map<std::string, ToolHandle<IBTaggingSelectionTool>> m_trkjet_btagSelTools; + + int m_release_series = 24; // Default to 2.4 + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ElectronScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ElectronScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..79984a325cf3a7d9e67347cd6716db55179d02b7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ElectronScaleFactorCalculator.h @@ -0,0 +1,111 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronScaleFactorCalculator.h 799556 2017-03-05 19:46:03Z tpelzer $ +#ifndef ANALYSISTOP_TOPCORRECTIONS_ELECTRONSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_ELECTRONSCALEFACTORCALCULATOR_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief ElectronScaleFactorCalculator + * Calculate all electron scale factors and decorate + * + * $Revision: 799556 $ + * $Date: 2017-03-05 20:46:03 +0100 (Sun, 05 Mar 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h" +#include "ElectronEfficiencyCorrection/ElectronChargeEfficiencyCorrectionTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class ElectronScaleFactorCalculator final : public asg::AsgTool { + public: + explicit ElectronScaleFactorCalculator( const std::string& name ); + virtual ~ElectronScaleFactorCalculator(){} + + // Delete Standard constructors + ElectronScaleFactorCalculator(const ElectronScaleFactorCalculator& rhs) = delete; + ElectronScaleFactorCalculator(ElectronScaleFactorCalculator&& rhs) = delete; + ElectronScaleFactorCalculator& operator=(const ElectronScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + CP::SystematicSet m_systNominal; + CP::SystematicSet m_systTrigger_UP; + CP::SystematicSet m_systTrigger_DOWN; + CP::SystematicSet m_systReco_UP; + CP::SystematicSet m_systReco_DOWN; + CP::SystematicSet m_systID_UP; + CP::SystematicSet m_systID_DOWN; + CP::SystematicSet m_systIso_UP; + CP::SystematicSet m_systIso_DOWN; + CP::SystematicSet m_systChargeID_UP; + CP::SystematicSet m_systChargeID_DOWN; + CP::SystematicSet m_systChargeMisID_STAT_UP; + CP::SystematicSet m_systChargeMisID_STAT_DOWN; + CP::SystematicSet m_systChargeMisID_SYST_UP; + CP::SystematicSet m_systChargeMisID_SYST_DOWN; + + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFTrigger; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFTriggerLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffTrigger; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffTriggerLoose; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFReco; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFID; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIDLoose; + + bool m_electronEffIso_exists; + bool m_electronEffIsoLoose_exists; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIso; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFIsoLoose; + bool m_electronEffChargeID_exists; + bool m_electronEffChargeIDLoose_exists; + bool m_electronEffChargeMisID_exists; + bool m_electronEffChargeMisIDLoose_exists; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFChargeID; + ToolHandle<IAsgElectronEfficiencyCorrectionTool> m_electronEffSFChargeIDLoose; + ToolHandle<CP::ElectronChargeEfficiencyCorrectionTool> m_electronEffSFChargeMisID; + ToolHandle<CP::ElectronChargeEfficiencyCorrectionTool> m_electronEffSFChargeMisIDLoose; + + std::string m_decor_triggerEff; + std::string m_decor_triggerEff_loose; + std::string m_decor_triggerSF; + std::string m_decor_triggerSF_loose; + std::string m_decor_recoSF; + std::string m_decor_idSF; + std::string m_decor_idSF_loose; + std::string m_decor_isoSF; + std::string m_decor_isoSF_loose; + std::string m_decor_chargeidSF; + std::string m_decor_chargeidSF_loose; + std::string m_decor_chargemisidSF; + std::string m_decor_chargemisidSF_loose; + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/JetScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/JetScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..2382c616ba530425be77f9fd3d76412207cd253a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/JetScaleFactorCalculator.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: JetScaleFactorCalculator.h 724681 2016-02-17 18:20:27Z tneep $ +#ifndef ANALYSISTOP_TOPCORRECTIONS_JETSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_JETSCALEFACTORCALCULATOR_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief JetScaleFactorCalculator + * Calculate all jet scale factors and decorate + * + * $Revision: 724681 $ + * $Date: 2016-02-17 19:20:27 +0100 (Wed, 17 Feb 2016) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +#include "JetJvtEfficiency/IJetJvtEfficiency.h" + +// CP Tool include(s): +// #include "ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h" + +// Forward declaration(s): +namespace top { +class TopConfig; +} + +namespace top { + +class JetScaleFactorCalculator final : public asg::AsgTool { + public: + explicit JetScaleFactorCalculator(const std::string& name); + virtual ~JetScaleFactorCalculator() {} + + // Delete Standard constructors + JetScaleFactorCalculator(const JetScaleFactorCalculator& rhs) = delete; + JetScaleFactorCalculator(JetScaleFactorCalculator&& rhs) = delete; + JetScaleFactorCalculator& operator=(const JetScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + CP::SystematicSet m_systNominal; + CP::SystematicSet m_systUP; + CP::SystematicSet m_systDOWN; + + ToolHandle<CP::IJetJvtEfficiency> m_jvt_tool; +}; +} // namespace top +#endif // ANALYSISTOP_TOPCORRECTIONS_JETSCALEFACTORCALCULATOR_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..ace4a22c7283783bb83554e6b58b134782de1d0b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h @@ -0,0 +1,207 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MuonScaleFactorCalculator.h 786766 2016-11-28 03:21:13Z tpelzer $ +#ifndef ANALYSISTOP_TOPCORRECTIONS_MUONSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_MUONSCALEFACTORCALCULATOR_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief MuonScaleFactorCalculator + * Calculate all muon scale factors and decorate + * + * $Revision: 786766 $ + * $Date: 2016-11-28 04:21:13 +0100 (Mon, 28 Nov 2016) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "MuonEfficiencyCorrections/IMuonTriggerScaleFactors.h" +#include "MuonEfficiencyCorrections/IMuonEfficiencyScaleFactors.h" + +// Forward declaration(s): +namespace top { +class TopConfig; +} + +namespace top { + +class MuonScaleFactorCalculator final : public asg::AsgTool { + public: + explicit MuonScaleFactorCalculator(const std::string& name); + virtual ~MuonScaleFactorCalculator() {} + + // Delete Standard constructors + MuonScaleFactorCalculator(const MuonScaleFactorCalculator& rhs) = delete; + MuonScaleFactorCalculator(MuonScaleFactorCalculator&& rhs) = delete; + MuonScaleFactorCalculator& operator=(const MuonScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + // Helper function to retrieve a toolhandle and + // get the recommended systematics of that tool + // into a std::set + template<typename T> + void retrieveSystematicTool(const ToolHandle<T>& tool, + std::set<std::string>& recommended_systematics); + // We have (had) a lot of lines like :: + // top::check(tool->applySystematicVariation(...), + // "Failed to set systematic variation"); + // This function will essentially do that but try to give a more + // sensible and specific error message. + // If the SystematicSet is empty then it sets to the nominal, + // so edit error message accordingly. + // (This might be expensive). + // + // Since this is general, we should maybe move somewhere + // more common. + template<typename T> + void applySystematicVariation(ToolHandle<T>& tool, + const CP::SystematicSet& systematic); + + // Check that all recommended systematics are implemented + // The arguments are two c++ std::set, for recommended & implemented + // systematics. Recommended systematics can be automatically extracted + // from tools (see retrieveSystematicTool above) while the implemented + // systematics must be hard-coded by the maintainer of this class. + StatusCode checkSystematicsImplemented(const std::set<std::string>& recommended, + const std::set<std::string>& implemented); + + // Use this function to decorate the trigger efficiency + // onto the muon. Try not to use directly, instead use + // decorateTrigSFandEff(), see below. + void decorateTriggerEfficiency(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& decor); + + // Use this function to decorate the trigger SF + // onto the muon. Try not to use directly, instead use + // decorateTrigSFandEff(), see below. + void decorateTriggerSF(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const ConstDataVector<xAOD::MuonContainer>& muon_cont, + const SG::AuxElement::Decorator<float>& decor); + + // This function is a nice wrapper of:: + // applySystematicVariation(...); + // decorateTriggerEfficiency(...); + // and:: + // decorateTriggerSF(...); + // We have this code block ~10 times so this hopefully + // keeps it simple and ensures each block is the same. + void decorateTrigSFandEff(ToolHandle<CP::IMuonTriggerScaleFactors>& tool, + const CP::SystematicSet& systematic, + const ConstDataVector<xAOD::MuonContainer>& muon_cont, + const SG::AuxElement::Decorator<float>& sf_decor, + const SG::AuxElement::Decorator<float>& eff_decor); + + // To keep things as readable as possible this function + // decorates the muon with the loose and tight trigger SFs and effs + void decorateTriggerSystematics(const ConstDataVector<xAOD::MuonContainer>& trigger_SF_muon); + + // As with ``applySystematicVariation``, we have (had) a + // lot of lines:: + // top::check(tool->getEfficiencyScaleFactor(muon, syst), + // "Failed to get efficiency SF"); + // This helper function will replace that, as well as calling + // applySystematicVariation try and avoid errors + void decorateEfficiencySF(ToolHandle<CP::IMuonEfficiencyScaleFactors>& tool, + const CP::SystematicSet& systematic, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& decor); + + // Helper function to decorate isolation systematics + // if we have set isolation to None for either the + // tight or loose muon selections then this will still + // decorate the SFs all set to 1.0 + void decorateIsolationSystematics(const xAOD::Muon& muon); + + // Helper function to decorate all TTVA SF systematics onto muon + void decorateTTVASystematics(const xAOD::Muon& muon); + + // For a single systematic, decorate the ID SF onto muon + // no reco Eff since 2.4.22 + void decorateIDSFandRecoEff(ToolHandle<CP::IMuonEfficiencyScaleFactors>& tool, + const CP::SystematicSet& systematic, + const xAOD::Muon& muon, + const SG::AuxElement::Decorator<float>& id_sf_decor); + + // Helper funciton to do above for all systematics + void decorateIDSFandRecoEffSystematics(const xAOD::Muon& muon); + + std::shared_ptr<top::TopConfig> m_config; + + CP::SystematicSet m_systNominal; + + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactors; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactorsLoose; + + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactors_2015; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactorsLoose_2015; + + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactors_2016; + ToolHandle<CP::IMuonTriggerScaleFactors> m_muonTriggerScaleFactorsLoose_2016; + + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsTool; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolLoose; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolIso; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolLooseIso; + ToolHandle<CP::IMuonEfficiencyScaleFactors> m_muonEfficiencyCorrectionsToolTTVA; + + std::string m_decor_triggerEff; + std::string m_decor_triggerEff_loose; + std::string m_decor_triggerSF; + std::string m_decor_triggerSF_loose; + std::string m_decor_idSF; + std::string m_decor_idSF_loose; + std::string m_decor_isoSF; + std::string m_decor_isoSF_loose; + std::string m_decor_TTVA; + + bool m_do_muon_isolation_SFs; + bool m_do_muon_isolation_SFs_loose; + + CP::SystematicSet m_trig_sf_stat_UP; + CP::SystematicSet m_trig_sf_stat_DOWN; + CP::SystematicSet m_trig_sf_syst_UP; + CP::SystematicSet m_trig_sf_syst_DOWN; + + CP::SystematicSet m_reco_stat_UP; + CP::SystematicSet m_reco_stat_DOWN; + CP::SystematicSet m_reco_syst_UP; + CP::SystematicSet m_reco_syst_DOWN; + + CP::SystematicSet m_reco_stat_lowpt_UP; + CP::SystematicSet m_reco_stat_lowpt_DOWN; + CP::SystematicSet m_reco_syst_lowpt_UP; + CP::SystematicSet m_reco_syst_lowpt_DOWN; + + CP::SystematicSet m_iso_stat_UP; + CP::SystematicSet m_iso_stat_DOWN; + CP::SystematicSet m_iso_syst_UP; + CP::SystematicSet m_iso_syst_DOWN; + + CP::SystematicSet m_TTVA_stat_UP; + CP::SystematicSet m_TTVA_stat_DOWN; + CP::SystematicSet m_TTVA_syst_UP; + CP::SystematicSet m_TTVA_syst_DOWN; + + std::string m_muon_trigger_sf_config = ""; +}; +} // namespace top +#endif // ANALYSISTOP_TOPCORRECTIONS_MUONSCALEFACTORCALCULATOR_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PDFScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PDFScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..52a34504717b17af107a3bb1fd627b735aba355e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PDFScaleFactorCalculator.h @@ -0,0 +1,108 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PDFSCALEFACTORCALCULATOR +#define PDFSCALEFACTORCALCULATOR + +#include <memory> +#include <iostream> +#include <string> +#include <unordered_map> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// save diagnostic state +#pragma GCC diagnostic push +// turn off the sily warnings in Boost. +#pragma GCC diagnostic ignored "-Wunused-local-typedefs" +#include "LHAPDF/LHAPDF.h" +// turn back on the warnings +#pragma GCC diagnostic pop +#include "LHAPDF/PDFSet.h" + +#include "TopEvent/Event.h" + +namespace top { + + class TopConfig; + + /** + * @brief For testing PDF reweighting with LHAPDF6. Not serious, just a toy. + * + * Lots of stuff is available on cvmfs, set this: + * export LHAPDF_DATA_PATH=$ROOTCOREBIN/data/Asg_Lhapdf_LHAPDF:/cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current/:$LHAPDF_DATA_PATH + */ + class PDFScaleFactorCalculator final : public asg::AsgTool { + public: + explicit PDFScaleFactorCalculator( const std::string& name ); + + virtual ~PDFScaleFactorCalculator(){}; + + // Delete Standard constructors + PDFScaleFactorCalculator(const PDFScaleFactorCalculator& rhs) = delete; + PDFScaleFactorCalculator(PDFScaleFactorCalculator&& rhs) = delete; + PDFScaleFactorCalculator& operator=(const PDFScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + StatusCode finalize(); + + int numberInSet(const std::string& name) const { + const LHAPDF::PDFSet set(name); + return set.size(); + } + + /** + * @brief Print a list of the available PDFs to the screen. + * + * I think it looks in the directories in the LHAPDF_DATA_PATH environment + * variable. + */ + void printAvailablePDFs() const { + std::cout << "List of available PDFs:" << std::endl; + for (const std::string& pdfname : LHAPDF::availablePDFSets()) + std::cout << " " << pdfname << std::endl; + } + + + private: + + std::shared_ptr<top::TopConfig> m_config; + + std::vector< std::string > m_pdf_names; + std::string m_base_pdf_name; + LHAPDF::PDF* m_basepdf = 0; + + // Small helper class to hold the information we need + class PDFSet { + + public: + + PDFSet(){;}; + + explicit PDFSet( const std::string& name ){ + + LHAPDF::mkPDFs( name, pdf_members ); + unsigned int n_members = pdf_members.size(); + event_weights.resize( n_members ); + sum_of_event_weights.resize( n_members ); + + }; + + std::vector< std::unique_ptr<const LHAPDF::PDF> > pdf_members = {}; + + std::vector< float > event_weights = {}; + + std::vector< float > sum_of_event_weights = {}; + + }; + + std::unordered_map< std::string, PDFSet > m_pdf_sets; + + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PhotonScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PhotonScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..87ef808a016e9e6556dfbdc3bcb78e353b5cb34f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PhotonScaleFactorCalculator.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: PhotonScaleFactorCalculator.h 802226 2017-04-04 16:13:10Z grancagn $ +#ifndef TOPCORRECTIONS_PHOTONSCALEFACTORCALCULATOR_H_ +#define TOPCORRECTIONS_PHOTONSCALEFACTORCALCULATOR_H_ + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief PhotonScaleFactorCalculator + * Calculate all photon scale factors and decorate + * + * $Revision: 802226 $ + * $Date: 2017-04-04 18:13:10 +0200 (Tue, 04 Apr 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "PhotonEfficiencyCorrection/IAsgPhotonEfficiencyCorrectionTool.h" + +namespace top { +// Forward declaration(s): +class TopConfig; + +class PhotonScaleFactorCalculator final : public asg::AsgTool { + public: + explicit PhotonScaleFactorCalculator(const std::string& name); + virtual ~PhotonScaleFactorCalculator() {} + + // Delete Standard constructors + PhotonScaleFactorCalculator(const PhotonScaleFactorCalculator& rhs) = delete; + PhotonScaleFactorCalculator(PhotonScaleFactorCalculator&& rhs) = delete; + PhotonScaleFactorCalculator& operator=(const PhotonScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + CP::SystematicSet m_systNominal; + CP::SystematicSet m_systEffIDUp; + CP::SystematicSet m_systEffIDDown; + CP::SystematicSet m_systEffLowPtIsoUp; + CP::SystematicSet m_systEffLowPtIsoDown; + CP::SystematicSet m_systEffTrkIsoUp; + CP::SystematicSet m_systEffTrkIsoDown; + CP::SystematicSet m_systIsoDDonoffUp; + CP::SystematicSet m_systIsoDDonoffDown; + + ToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_photonEffSF; + ToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_photonIsoSF; + ToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_photonLooseIsoSF; + + bool m_photonIsoSF_exists; + bool m_photonLooseIsoSF_exists; + + std::string m_decor_isoSF; + std::string m_decor_isoSF_loose; + +}; +} // namespace top +#endif // TOPCORRECTIONS_PHOTONSCALEFACTORCALCULATOR_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PileupScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PileupScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..2c1c3bb255927653b5f42d81f9cc1472a99e7f99 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/PileupScaleFactorCalculator.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPCORRECTIONS_PILEUPSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_PILEUPSCALEFACTORCALCULATOR_H + + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +#include "AsgAnalysisInterfaces/IPileupReweightingTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class PileupScaleFactorCalculator final : public asg::AsgTool { + public: + explicit PileupScaleFactorCalculator( const std::string& name ); + virtual ~PileupScaleFactorCalculator(){} + + // Delete Standard constructors + PileupScaleFactorCalculator(const PileupScaleFactorCalculator& rhs) = delete; + PileupScaleFactorCalculator(PileupScaleFactorCalculator&& rhs) = delete; + PileupScaleFactorCalculator& operator=(const PileupScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + ///Pileup Reweighting Tool + ToolHandle<CP::IPileupReweightingTool> m_pileupReweightingTool; + + // systematics + CP::SystematicSet m_systNominal; + CP::SystematicSet m_systDataSFUp; + CP::SystematicSet m_systDataSFDown; + + bool m_mu_dependent_PRW = true; + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..61e388e10789de80476b3d984dc3e22f2828481a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorCalculator.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SCALEFACTORCALCULATOR_H_ +#define SCALEFACTORCALCULATOR_H_ + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief ScaleFactorCalculator + * Scale factors for all objects + * + * $Revision: 766520 $ + * $Date: 2016-08-04 18:39:21 +0200 (Thu, 04 Aug 2016) $ + * + **/ + +// system include(s): +#include <vector> +#include <memory> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// PMG Tools +#include "PMGTools/PMGSherpa22VJetsWeightTool.h" + +// Local include(s): +#include "TopCorrections/PhotonScaleFactorCalculator.h" +#include "TopCorrections/ElectronScaleFactorCalculator.h" +#include "TopCorrections/MuonScaleFactorCalculator.h" +#include "TopCorrections/TauScaleFactorCalculator.h" +#include "TopCorrections/JetScaleFactorCalculator.h" +#include "TopCorrections/BTagScaleFactorCalculator.h" +#include "TopCorrections/PileupScaleFactorCalculator.h" + +namespace top { + +class TopConfig; + +class ScaleFactorCalculator final : public asg::AsgTool{ + public: + explicit ScaleFactorCalculator( const std::string& name ); + virtual ~ScaleFactorCalculator() {} + + ScaleFactorCalculator(const ScaleFactorCalculator& rhs) = delete; + ScaleFactorCalculator(ScaleFactorCalculator&& rhs) = delete; + ScaleFactorCalculator& operator=(const ScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + StatusCode executePileup(); + float pileupWeight() const; + float mcEventWeight() const; + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::unique_ptr<top::PhotonScaleFactorCalculator> m_photonSF; + std::unique_ptr<top::ElectronScaleFactorCalculator> m_electronSF; + std::unique_ptr<top::MuonScaleFactorCalculator> m_muonSF; + std::unique_ptr<top::TauScaleFactorCalculator> m_tauSF; + std::unique_ptr<top::JetScaleFactorCalculator> m_jetSF; + std::unique_ptr<top::BTagScaleFactorCalculator> m_btagSF; + std::unique_ptr<top::PileupScaleFactorCalculator> m_pileupSF; + ToolHandle<PMGTools::PMGSherpa22VJetsWeightTool> m_sherpa_22_reweight_tool; + +}; +} // namespace top + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h new file mode 100644 index 0000000000000000000000000000000000000000..362fb0bbf276ee427f0dac42c83e5d46e57a478a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h @@ -0,0 +1,284 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SCALEFACTORRETRIEVER_H_ +#define SCALEFACTORRETRIEVER_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "AthContainers/AuxElement.h" + +// Forward declare: +namespace top { +class Event; +class TopConfig; +} + + +namespace top { + +///-- Top SF enmu, as CP::SystematicSet won't do the job --/// +enum topSFSyst{nominal = 0, + // Electron Trigger SFs + EL_SF_Trigger_UP, EL_SF_Trigger_DOWN, + // Electron reconstruction SFs + EL_SF_Reco_UP, EL_SF_Reco_DOWN, + // Electron ID SFs + EL_SF_ID_UP, EL_SF_ID_DOWN, + // Electron isolation SFs + EL_SF_Isol_UP, EL_SF_Isol_DOWN, + // Electron Charge flip SFs + EL_SF_ChargeID_UP, EL_SF_ChargeID_DOWN, + EL_SF_ChargeMisID_STAT_UP, EL_SF_ChargeMisID_STAT_DOWN, + EL_SF_ChargeMisID_SYST_UP, EL_SF_ChargeMisID_SYST_DOWN, + // Muon Trigger SFs + MU_SF_Trigger_UP, MU_SF_Trigger_DOWN, + MU_SF_Trigger_STAT_UP, MU_SF_Trigger_STAT_DOWN, + MU_SF_Trigger_SYST_UP, MU_SF_Trigger_SYST_DOWN, + // Muon ID SFs (regular) + MU_SF_ID_STAT_UP, MU_SF_ID_STAT_DOWN, + MU_SF_ID_SYST_UP, MU_SF_ID_SYST_DOWN, + // Muon ID SFs (low pT) + MU_SF_ID_STAT_LOWPT_UP, MU_SF_ID_STAT_LOWPT_DOWN, + MU_SF_ID_SYST_LOWPT_UP, MU_SF_ID_SYST_LOWPT_DOWN, + // Muon isolation SFs + MU_SF_Isol_STAT_UP, MU_SF_Isol_STAT_DOWN, + MU_SF_Isol_SYST_UP, MU_SF_Isol_SYST_DOWN, + // Muon TTVA SFs + MU_SF_TTVA_STAT_UP, MU_SF_TTVA_STAT_DOWN, + MU_SF_TTVA_SYST_UP, MU_SF_TTVA_SYST_DOWN, + // Tau SFs + TAU_SF_ELEOLR_TOTAL_UP, TAU_SF_ELEOLR_TOTAL_DOWN, + TAU_SF_JETID_TOTAL_UP, TAU_SF_JETID_TOTAL_DOWN, + TAU_SF_RECO_TOTAL_UP, TAU_SF_RECO_TOTAL_DOWN, + // Photon SFs + PHOTON_IDSF_UP, PHOTON_IDSF_DOWN, PHOTON_EFF_ISO, + PHOTON_EFF_LOWPTISO_UP, PHOTON_EFF_TRKISO_UP, + PHOTON_EFF_LOWPTISO_DOWN, PHOTON_EFF_TRKISO_DOWN, + // B-tagging SFs + BTAG_SF_EIGEN_B, BTAG_SF_EIGEN_C, + BTAG_SF_EIGEN_LIGHT, + BTAG_SF_NAMED_UP, BTAG_SF_NAMED_DOWN, + // JVT SFs + JVT_UP, JVT_DOWN, + + lastsys +}; + + +enum topSFComp{ALL = 0, TRIGGER, RECO, ID, ISOLATION, CHARGEID, CHARGEMISID, TTVA}; + + +class ScaleFactorRetriever final { + public: + explicit ScaleFactorRetriever(std::shared_ptr<top::TopConfig> config); + virtual ~ScaleFactorRetriever() {} + + // Delete Standard constructors + ScaleFactorRetriever(const ScaleFactorRetriever& rhs) = delete; + ScaleFactorRetriever(ScaleFactorRetriever&& rhs) = delete; + ScaleFactorRetriever& operator=(const ScaleFactorRetriever& rhs) = delete; + + // Pile up SF + static bool hasPileupSF(const top::Event& event); + static float pileupSF(const top::Event& event, int var = 0); + + // Obtain the lepton SF + float leptonSF(const top::Event& event, const top::topSFSyst SFSyst) const; + + // Obtain the trigger SF + float triggerSF(const top::Event& event, const top::topSFSyst SFSyst) const; + + // Obtain the electron SF + float electronSF(const top::Event& event, + const top::topSFSyst SFSyst, + const top::topSFComp SFComp) const; + + // Obtain the muon SF + float muonSF(const top::Event& event, + const top::topSFSyst SFSyst, + const top::topSFComp SFComp) const; + + /** + * @brief: get the tauSF for all taus in event + * @param: event, a top::Event object + * @param: SFSyst, systematic variation enum + */ + float tauSF(const top::Event& event, + const top::topSFSyst SFSyst) const; + + /** + * @brief: get the photonSF for all photons in event + * @param: event, a top::Event object + * @param: SFSyst, systematic variation enum + */ + float photonSF(const top::Event& event, + const top::topSFSyst SFSyst) const; + + /** + * @brief Missing important functionality, but testing... + */ + float btagSF(const top::Event& event, + const top::topSFSyst SFSyst = top::topSFSyst::nominal, + std::string WP = "FixedCutBEff_77", + bool do_trackjets = false, + std::string uncert_name = "") const; + + void btagSF_eigen_vars(const top::Event& event, + const top::topSFSyst SFSyst, + std::vector<float>& btagSF_up, + std::vector<float>& btagSF_down, + std::string WP = "FixedCutBEff_77", + bool do_trackjets = false) const; + + /** + * + * JVT Efficiency SFs + * @brief: Get the total JVT SF by taking the product of SFs for all jets + * + * @param: event, a top::Event object + * @param: SFSyst, systematic variation enum + * + * @return: prod_jvt, the product of the jvt SFs for selected jets + * + **/ + float jvtSF(const top::Event& event, + const top::topSFSyst SFsyst) const; + + + /** + * @brief Print all the SF values to cout + */ + void print(const top::Event& event); + + float electronSF_Reco(const xAOD::Electron& x, + const top::topSFSyst SFSyst) const; + + float electronSF_Trigger(const xAOD::Electron& x, const top::topSFSyst SFSyst, bool isLoose) const; + + float electronEff_Trigger(const xAOD::Electron& x, const top::topSFSyst SFSyst, bool isLoose) const ; + + float electronSF_ID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float electronSF_Isol(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float electronSF_ChargeID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float electronSF_ChargeMisID(const xAOD::Electron& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float muonSF_Trigger(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float muonEff_Trigger(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float muonSF_ID(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float muonSF_Isol(const xAOD::Muon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float muonSF_TTVA(const xAOD::Muon& x, + const top::topSFSyst SFSyst) const; + + /** + * @brief: get the tauSF for a single tau + * @param: x, an xAOD::TauJet object + * @param: SFSyst, systematic variation enum + * @param: whether you want the SF for loose event or not + */ + float tauSF(const xAOD::TauJet& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + /** + * @brief: get the photonSF for a single photon + * @param: x, an xAOD::Photon object + * @param: SFSyst, systematic variation enum + * @param: whether you want the SF for loose event or not + */ + float photonSF(const xAOD::Photon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + float photonSF_Isol(const xAOD::Photon& x, + const top::topSFSyst SFSyst, + bool isLoose) const; + + private: + float electronSF_Trigger(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float electronEff_Trigger(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float electronSF_ID(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float electronSF_Isol(const xAOD::Electron& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float electronSF_ChargeID(const xAOD::Electron& x, + const std::string& id, const std::string& iso, + const top::topSFSyst SFSyst) const; + + float electronSF_ChargeMisID(const xAOD::Electron& x, + const std::string& id, const std::string& iso, + const top::topSFSyst SFSyst) const; + + float photonSF_Isol(const xAOD::Photon& x, + const std::string& iso, + const top::topSFSyst SFSyst) const; + + float muonSF_Trigger(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + float muonEff_Trigger(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float muonSF_ID(const xAOD::Muon& x, + const std::string& id, + const top::topSFSyst SFSyst) const; + + float muonSF_Isol(const xAOD::Muon& x, + const std::string& iso, + const top::topSFSyst SFSyst) const; + + float m_event_el_trigger; + + // List of triggers to 'or' together for each event. + // If any one passes, the event passes + std::vector<std::string> m_electronTriggers; + std::vector<std::string> m_muonTriggers; + // Do we need to add tau triggers? + + // Configuration + std::shared_ptr<top::TopConfig> m_config; +}; +} // namespace top + +#endif // SCALEFACTORRETRIEVER_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/TauScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/TauScaleFactorCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..abaff879c46cb391119ec239ffdb2322d90d153c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/TauScaleFactorCalculator.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TauScaleFactorCalculator.h 718402 2016-01-19 11:58:25Z tneep $ +#ifndef ANALYSISTOP_TOPCORRECTIONS_TAUSCALEFACTORCALCULATOR_H +#define ANALYSISTOP_TOPCORRECTIONS_TAUSCALEFACTORCALCULATOR_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TauScaleFactorCalculator + * Calculate all tau scale factors and decorate + * + * $Revision: 718402 $ + * $Date: 2016-01-19 12:58:25 +0100 (Tue, 19 Jan 2016) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <map> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "TauAnalysisTools/ITauEfficiencyCorrectionsTool.h" + +// Forward declaration(s): +namespace top { +class TopConfig; +} + +namespace top { + +class TauScaleFactorCalculator final : public asg::AsgTool { + public: + explicit TauScaleFactorCalculator(const std::string& name); + virtual ~TauScaleFactorCalculator() {} + + // Delete Standard constructors + TauScaleFactorCalculator(const TauScaleFactorCalculator& rhs) = delete; + TauScaleFactorCalculator(TauScaleFactorCalculator&& rhs) = delete; + TauScaleFactorCalculator& operator=(const TauScaleFactorCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_tauEffCorrTool; + ToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_tauEffCorrToolLoose; + + CP::SystematicSet m_systNominal; + std::map< std::string, CP::SystematicSet > m_syst_map; +}; +} // namespace top +#endif // ANALYSISTOP_TOPCORRECTIONS_TAUSCALEFACTORCALCULATOR_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..449672666f26c213f5d5855d050c7b63d38f5fd5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopCorrections + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g -std=c++14 + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = Asg_Lhapdf xAODEgamma xAODMuon TopEvent PileupReweighting ElectronEfficiencyCorrection MuonEfficiencyCorrections xAODBTaggingEfficiency TauAnalysisTools JetJvtEfficiency PhotonEfficiencyCorrection PMGTools + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimisation (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..fb7c1f67ad9a48e90a4c3d57df4cb5478c723993 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/share/mainpage.h @@ -0,0 +1,7 @@ +/** + * @page tcpage TopCorrections + * + * For scale factors the current work in progress is: + * - top::ScaleFactorCalculator: For things that just change event weights. + * - top::ScaleFactorRetriever: To get a handle on the event weights. + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..867e742c8c54e5d74640ced11785ace31ce8419e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt @@ -0,0 +1,57 @@ +# Auto-generated on: 2017-03-08 14:47:36.020351 + +# Declare the name of this package: +atlas_subdir( TopEvent None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + CxxUtils + xAODCore + AthContainers + AthLinks + AsgTools + xAODEventInfo + xAODTruth + xAODEgamma + xAODMuon + xAODJet + xAODTau + xAODMissingET + xAODTracking + TopConfiguration + TopPartons ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopEvent _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopEvent Root/*.cxx Root/*.h Root/*.icc + TopEvent/*.h TopEvent/*.icc TopEvent/*/*.h + TopEvent/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopEvent + LINK_LIBRARIES CxxUtils + xAODCore + AthContainers + AthLinks + AsgTools + xAODEventInfo + xAODTruth + xAODEgamma + xAODMuon + xAODJet + xAODTau + xAODMissingET + xAODTracking + TopConfiguration + TopPartons + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/Event.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/Event.cxx new file mode 100644 index 0000000000000000000000000000000000000000..64ed39fdfb138bbd73fc7f508c6819265d938072 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/Event.cxx @@ -0,0 +1,145 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertex.h" +#include "xAODCore/ShallowCopy.h" + +#include <iomanip> + +std::ostream& operator<<(std::ostream& os, const TLorentzVector& v) { + os << "TLorentzVector" << + " pt=" << v.Pt() << + " eta " << v.Eta() << + " phi " << v.Phi() << + " m " << v.M(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const top::Event& event) { + +// os << *event.m_info << "\n"; + + os << "Electrons: " << event.m_electrons.size() << "\n"; + for (const auto* const elPtr : event.m_electrons) + os << " " << *elPtr << "\n"; + + os << "Muons: " << event.m_muons.size() << "\n"; + for (const auto* const muPtr : event.m_muons) + os << " " << *muPtr << "\n"; + + os << "Jets: " << event.m_jets.size() << "\n"; + for (const auto* const jetPtr : event.m_jets) + os << " " << *jetPtr << "\n"; + + os << "Large jets: " << event.m_largeJets.size() << "\n"; + for (const auto* const jetPtr : event.m_largeJets) + os << " " << *jetPtr << "\n"; + + os << "Track jets: " << event.m_trackJets.size() << "\n"; + for (const auto* const jetPtr : event.m_trackJets) + os << " " << *jetPtr << "\n"; + + os << "Taus: " << event.m_tauJets.size() << "\n"; + for (const auto* const tauPtr : event.m_tauJets) + os << " " << *tauPtr << "\n"; + + os << *event.m_met; + return os; +} + +/* +std::ostream& operator<<(std::ostream& os, const xAOD::EventInfo& ei) { + os << "EventInfo" << + " isSimulation " << std::boolalpha << ei.eventType(xAOD::EventInfo::IS_SIMULATION) << + " runNumber " << ei.runNumber() << + " eventNumber " << ei.eventNumber() << + " <mu> " << ei.averageInteractionsPerCrossing(); + + if (ei.eventType(xAOD::EventInfo::IS_SIMULATION)) { + os << " mcChannelNumber " << ei.mcChannelNumber() << + " mcEventWeight " << ei.mcEventWeight(); + } + + return os; +}*/ + +std::ostream& operator<<(std::ostream& os, const xAOD::Electron& el) { + os << "Electron" << + " author " << el.author() << + " pt " << el.pt() << + " eta " << el.eta() << + " phi " << el.phi() << + " m " << el.m() << + " charge " << el.charge(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const xAOD::Muon& mu) { + os << "Muon" << + " author " << mu.author() << + " pt " << mu.pt() << + " eta " << mu.eta() << + " phi " << mu.phi() << + " m " << mu.m() << + " charge " << mu.charge(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const xAOD::Jet& jet) { + os << "Jet" << + " pt " << jet.pt() << + " eta " << jet.eta() << + " phi " << jet.phi() << + " m " << jet.m(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const xAOD::TauJet& tau) { + os << "TauJet" << + " pt " << tau.pt() << + " eta " << tau.eta() << + " phi " << tau.phi() << + " m " << tau.m() << + " charge " << tau.charge(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const xAOD::TruthParticle& truth) { + const unsigned int w = 10; + os << "TruthParticle" << + " pdg " << std::setw(w) << truth.pdgId() << + " status " << std::setw(w) << truth.status() << + " pt " << std::setw(w) << truth.pt() << + " eta " << std::setw(w) << truth.eta() << + " phi " << std::setw(w) << truth.phi() << + " e " << std::setw(w) << truth.e() << + " m " << std::setw(w) << truth.p4().M(); + + return os; +} + +std::ostream& operator<<(std::ostream& os, const xAOD::MissingET& met) { + os << "MET" << + " et " << met.met() << + " phi " << met.phi() << "\n"; + + return os; +} + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/EventTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/EventTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..97443dcd43a966dcdf3853a7c4a0499b08ac7ac7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/EventTools.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEvent/EventTools.h" +#include "TopEvent/Event.h" + +#include "CxxUtils/fpcompare.h" + +#include "xAODBase/IParticle.h" + +namespace top { + +void check(bool thingToCheck, const std::string& usefulFailureMessage) { + if (!thingToCheck) { + std::cout << usefulFailureMessage << "\n"; + exit(1); + } +} + +double deltaR(const xAOD::IParticle& p1, const xAOD::IParticle& p2) { + return p1.p4().DeltaR(p2.p4()); +} + +double deltaPhi(const xAOD::IParticle& p1, const xAOD::IParticle& p2) { + return p1.p4().DeltaPhi(p2.p4()); +} + +double mwt(const xAOD::IParticle& lepton, const xAOD::MissingET& met) { + return sqrt(2. * lepton.pt() * met.met() * (1. - cos(lepton.phi() - met.phi()))); +} + +double ht(const top::Event& event) { + double sumHt = 0.; + for (const auto el : event.m_electrons) + sumHt += el->pt(); + + for (const auto mu : event.m_muons) + sumHt += mu->pt(); + + for (const auto jet : event.m_jets) + sumHt += jet->pt(); + + return sumHt; +} + +double invariantMass(const xAOD::IParticle& p1, const xAOD::IParticle& p2) { + return (p1.p4() + p2.p4()).M(); +} + +bool isSimulation(const top::Event& event) { + return event.m_info->eventType(xAOD::EventInfo::IS_SIMULATION); +} + +bool descendingPtSorter(const xAOD::IParticle* p1, const xAOD::IParticle* p2) { + return CxxUtils::fpcompare::greater(p1->pt(), p2->pt()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/KLFitterResult.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/KLFitterResult.cxx new file mode 100644 index 0000000000000000000000000000000000000000..24e16d26812f890e5b43310660a782ad873b2b3d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/KLFitterResult.cxx @@ -0,0 +1,143 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: SystematicEvent.cxx 661144 2015-04-17 09:09:07Z morrisj $ +#include "TopEvent/KLFitterResult.h" + +// EDM includes(s): +#include "xAODCore/AuxStoreAccessorMacros.h" +#include "xAODCore/AddDVProxy.h" + +namespace xAOD{ + // Aux Container + KLFitterResultAuxContainer::KLFitterResultAuxContainer() : + AuxContainerBase() + { + AUX_VARIABLE( minuitDidNotConverge ); + AUX_VARIABLE( fitAbortedDueToNaN ); + AUX_VARIABLE( atLeastOneFitParameterAtItsLimit ); + AUX_VARIABLE( invalidTransferFunctionAtConvergence ); + + AUX_VARIABLE( bestPermutation ); + AUX_VARIABLE( logLikelihood ); + AUX_VARIABLE( eventProbability ); + AUX_VARIABLE( parameters ); + AUX_VARIABLE( parameterErrors ); + + AUX_VARIABLE( model_bhad_pt ); + AUX_VARIABLE( model_bhad_eta ); + AUX_VARIABLE( model_bhad_phi ); + AUX_VARIABLE( model_bhad_E ); + AUX_VARIABLE( model_bhad_jetIndex ); + + AUX_VARIABLE( model_blep_pt ); + AUX_VARIABLE( model_blep_eta ); + AUX_VARIABLE( model_blep_phi ); + AUX_VARIABLE( model_blep_E ); + AUX_VARIABLE( model_blep_jetIndex ); + + AUX_VARIABLE( model_lq1_pt ); + AUX_VARIABLE( model_lq1_eta ); + AUX_VARIABLE( model_lq1_phi ); + AUX_VARIABLE( model_lq1_E ); + AUX_VARIABLE( model_lq1_jetIndex ); + + AUX_VARIABLE( model_lq2_pt ); + AUX_VARIABLE( model_lq2_eta ); + AUX_VARIABLE( model_lq2_phi ); + AUX_VARIABLE( model_lq2_E ); + AUX_VARIABLE( model_lq2_jetIndex ); + + AUX_VARIABLE( model_Higgs_b1_pt ); + AUX_VARIABLE( model_Higgs_b1_eta ); + AUX_VARIABLE( model_Higgs_b1_phi ); + AUX_VARIABLE( model_Higgs_b1_E ); + AUX_VARIABLE( model_Higgs_b1_jetIndex ); + + AUX_VARIABLE( model_Higgs_b2_pt ); + AUX_VARIABLE( model_Higgs_b2_eta ); + AUX_VARIABLE( model_Higgs_b2_phi ); + AUX_VARIABLE( model_Higgs_b2_E ); + AUX_VARIABLE( model_Higgs_b2_jetIndex ); + + AUX_VARIABLE( model_lep_pt ); + AUX_VARIABLE( model_lep_eta ); + AUX_VARIABLE( model_lep_phi ); + AUX_VARIABLE( model_lep_E ); + + AUX_VARIABLE( model_nu_pt ); + AUX_VARIABLE( model_nu_eta ); + AUX_VARIABLE( model_nu_phi ); + AUX_VARIABLE( model_nu_E ); + + + } + + /// Interface class + KLFitterResult::KLFitterResult() : + SG::AuxElement() + { + } + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , short , minuitDidNotConverge , setMinuitDidNotConverge ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , short , fitAbortedDueToNaN , setFitAbortedDueToNaN ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , short , atLeastOneFitParameterAtItsLimit , setAtLeastOneFitParameterAtItsLimit ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , short , invalidTransferFunctionAtConvergence , setInvalidTransferFunctionAtConvergence ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , bestPermutation , setBestPermutation ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , logLikelihood , setLogLikelihood ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , eventProbability , setEventProbability ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( KLFitterResult , std::vector<double> , parameters , setParameters ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( KLFitterResult , std::vector<double> , parameterErrors , setParameterErrors ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_bhad_pt , setModel_bhad_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_bhad_eta , setModel_bhad_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_bhad_phi , setModel_bhad_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_bhad_E , setModel_bhad_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_bhad_jetIndex , setModel_bhad_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_blep_pt , setModel_blep_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_blep_eta , setModel_blep_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_blep_phi , setModel_blep_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_blep_E , setModel_blep_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_blep_jetIndex , setModel_blep_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq1_pt , setModel_lq1_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq1_eta , setModel_lq1_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq1_phi , setModel_lq1_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq1_E , setModel_lq1_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_lq1_jetIndex , setModel_lq1_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq2_pt , setModel_lq2_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq2_eta , setModel_lq2_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq2_phi , setModel_lq2_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lq2_E , setModel_lq2_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_lq2_jetIndex , setModel_lq2_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b1_pt , setModel_Higgs_b1_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b1_eta , setModel_Higgs_b1_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b1_phi , setModel_Higgs_b1_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b1_E , setModel_Higgs_b1_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_Higgs_b1_jetIndex , setModel_Higgs_b1_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b2_pt , setModel_Higgs_b2_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b2_eta , setModel_Higgs_b2_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b2_phi , setModel_Higgs_b2_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_Higgs_b2_E , setModel_Higgs_b2_E ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , unsigned int , model_Higgs_b2_jetIndex , setModel_Higgs_b2_jetIndex ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lep_pt , setModel_lep_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lep_eta , setModel_lep_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lep_phi , setModel_lep_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_lep_E , setModel_lep_E ) + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_nu_pt , setModel_nu_pt ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_nu_eta , setModel_nu_eta ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_nu_phi , setModel_nu_phi ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( KLFitterResult , float , model_nu_E , setModel_nu_E ) + + +} +ADD_NS_DV_PROXY( xAOD , KLFitterResultContainer ); + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..16fcef788a76c06079e9683c56c236c07327e835 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/LinkDef.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEvent/SystematicEvent.h" +#include "TopEvent/KLFitterResult.h" +#include "TopEvent/PseudoTopResult.h" + +#ifdef __CINT__ +#pragma extra_include "TopEvent/SystematicEvent.h"; +#pragma extra_include "TopEvent/KLFitterResult.h"; +#pragma extra_include "TopEvent/PseudoTopResult.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class xAOD::SystematicEvent+; +#pragma link C++ class xAOD::SystematicEventContainer+; +#pragma link C++ class xAOD::SystematicEventAuxContainer+; + +#pragma link C++ class xAOD::KLFitterResult+; +#pragma link C++ class xAOD::KLFitterResultContainer+; +#pragma link C++ class xAOD::KLFitterResultAuxContainer+; + +#pragma link C++ class xAOD::PseudoTopResult+; +#pragma link C++ class xAOD::PseudoTopResultContainer+; +#pragma link C++ class xAOD::PseudoTopResultAuxContainer+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/PseudoTopResult.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/PseudoTopResult.cxx new file mode 100644 index 0000000000000000000000000000000000000000..92485f1dd7a6373d7e2334aa236bca0a8d9feacd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/PseudoTopResult.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEvent/PseudoTopResult.h" +#include "xAODCore/AddDVProxy.h" + +namespace xAOD{ + /// Aux Container + PseudoTopResultAuxContainer::PseudoTopResultAuxContainer() : + AuxContainerBase() + { + } + + /// Interface class + PseudoTopResult::PseudoTopResult() : + SG::AuxElement() + { + } + + //Initialize variables + void PseudoTopResult::IniVar(bool isReco){ + + if(isReco){ + + this->auxdecor< float >( "PseudoTop_Reco_ttbar_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_ttbar_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_ttbar_m" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_ttbar_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_had_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_had_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_had_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_had_m" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_lep_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_lep_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_lep_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Reco_top_lep_m" ) = -100.0; + + } + else{ + + this->auxdecor< float >( "PseudoTop_Particle_ttbar_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_ttbar_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_ttbar_m" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_ttbar_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_had_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_had_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_had_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_had_m" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_lep_pt" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_lep_eta" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_lep_phi" ) = -100.0; + this->auxdecor< float >( "PseudoTop_Particle_top_lep_m" ) = -100.0; + + } + + } + +} +ADD_NS_DV_PROXY( xAOD , PseudoTopResultContainer ); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/SystematicEvent.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/SystematicEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c4b17f54dc686849805418c3dbc4f2bf29dd7b6c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/SystematicEvent.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: SystematicEvent.cxx 692539 2015-09-02 00:20:52Z morrisj $ +#include "TopEvent/SystematicEvent.h" + +// EDM includes(s): +#include "xAODCore/AuxStoreAccessorMacros.h" +#include "xAODCore/AddDVProxy.h" + +namespace xAOD{ + // Aux Container + SystematicEventAuxContainer::SystematicEventAuxContainer() : + AuxContainerBase() + { + AUX_VARIABLE( hashValue ); + AUX_VARIABLE( ttreeIndex ); + AUX_VARIABLE( isLooseEvent ); + + AUX_VARIABLE( goodPhotons ); + AUX_VARIABLE( goodElectrons ); + AUX_VARIABLE( goodMuons ); + AUX_VARIABLE( goodTaus ); + AUX_VARIABLE( goodJets ); + AUX_VARIABLE( goodLargeRJets ); + AUX_VARIABLE( goodTrackJets ); + } + + /// Interface class + SystematicEvent::SystematicEvent() : + SG::AuxElement() + { + } + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( SystematicEvent , std::size_t , hashValue , setHashValue ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( SystematicEvent , unsigned int , ttreeIndex , setTtreeIndex ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( SystematicEvent , char , isLooseEvent , setIsLooseEvent ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodPhotons , setGoodPhotons ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodElectrons , setGoodElectrons ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodMuons , setGoodMuons ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodTaus , setGoodTaus ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodJets , setGoodJets ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodLargeRJets , setGoodLargeRJets ) + AUXSTORE_OBJECT_SETTER_AND_GETTER( SystematicEvent , std::vector<unsigned int> , goodTrackJets , setGoodTrackJets ) + +} +ADD_NS_DV_PROXY( xAOD , SystematicEventContainer ); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/TopEventMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/TopEventMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0438fabc7e1eb602baa7254e8b853c84bc56621b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/Root/TopEventMaker.cxx @@ -0,0 +1,356 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopEventMaker.cxx 795594 2017-02-04 22:12:45Z tpelzer $ +#include "TopEvent/TopEventMaker.h" +#include "TopEvent/EventTools.h" + +#include "TopConfiguration/TopConfig.h" + +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/ElectronAuxContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODMuon/MuonAuxContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODTau/TauJetAuxContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODCore/ShallowCopy.h" + +#include "TopPartons/PartonHistory.h" + +namespace top { + + TopEventMaker::TopEventMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr) + { + declareProperty( "config" , m_config ); + } + + /// As top-xaod isn't an asg::AsgTool, it doesn't have access to all the information + /// Very annoying, as it's actually quite simple + const xAOD::SystematicEventContainer* TopEventMaker::systematicEvents(const std::string& sgKey) const + { + const xAOD::SystematicEventContainer* systEvents(nullptr); + top::check( evtStore()->retrieve(systEvents,sgKey) , "Failed to get xAOD::SystematicEventContainer"); + return systEvents; + } + + top::Event TopEventMaker::makeTopEvent(const xAOD::SystematicEvent& currentSystematic) + { + //create a new event object + top::Event event; + + // Set systematic hash value + std::size_t hash = currentSystematic.hashValue(); + event.m_hashValue = hash; + + // TTree index + event.m_ttreeIndex = currentSystematic.ttreeIndex(); + + // Is Loose event? + event.m_isLoose = currentSystematic.isLooseEvent(); + + //event info + top::check(evtStore()->retrieve(event.m_info, m_config->sgKeyEventInfo()), "Failed to retrieve EventInfo"); + + //Primary Vertices + if (evtStore()->contains<xAOD::VertexContainer>(m_config->sgKeyPrimaryVertices())) { + top::check(evtStore()->retrieve(event.m_primaryVertices, m_config->sgKeyPrimaryVertices()), "Failed to retrieve Primary Vertices"); + } + + //electrons + if (m_config->useElectrons()) { + ///-- Need to read const collections for mini-xaod read back --/// + + const xAOD::ElectronContainer* calibratedElectrons(nullptr); + top::check(evtStore()->retrieve(calibratedElectrons, m_config->sgKeyElectrons(hash) ), "Failed to retrieve electrons"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::ElectronContainer>(m_config->sgKeyElectronsTDS(hash))) { + std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > shallow_electrons = xAOD::shallowCopyContainer( *calibratedElectrons ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_electrons.first , m_config->sgKeyElectronsTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_electrons.second , m_config->sgKeyElectronsTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::ElectronContainer* calibratedElectronsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedElectronsTDS, m_config->sgKeyElectronsTDS(hash) ), "Failed to retrieve electrons"); + + + // re-write overlap information if it is decorated onto currentSystematic + if (currentSystematic.isAvailable< std::vector<unsigned int> >("overlapsEl")) { + std::vector<unsigned int> overlapsEl = currentSystematic.auxdataConst< std::vector<unsigned int> >("overlapsEl"); + if (overlapsEl.size() == calibratedElectronsTDS->size()) { + unsigned int counter(0); + for (auto x : *calibratedElectronsTDS) { + x->auxdecor<char>("overlaps") = overlapsEl.at(counter); + ++counter; + } + } + } + + for (auto index : currentSystematic.goodElectrons()) { + event.m_electrons.push_back(calibratedElectronsTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected muons (faster) + event.m_electrons.sort(top::descendingPtSorter); + } + + //photons + if (m_config->usePhotons()) { + ///-- Need to read const collections for mini-xaod read back --/// + + const xAOD::PhotonContainer* calibratedPhotons(nullptr); + top::check(evtStore()->retrieve(calibratedPhotons, m_config->sgKeyPhotons(hash) ), "Failed to retrieve photons"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::PhotonContainer>(m_config->sgKeyPhotonsTDS(hash))) { + std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > shallow_photons = xAOD::shallowCopyContainer( *calibratedPhotons ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_photons.first , m_config->sgKeyPhotonsTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_photons.second , m_config->sgKeyPhotonsTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::PhotonContainer* calibratedPhotonsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedPhotonsTDS, m_config->sgKeyPhotonsTDS(hash) ), "Failed to retrieve photons"); + + for (auto index : currentSystematic.goodPhotons()) { + event.m_photons.push_back(calibratedPhotonsTDS->at(index)); + } + //shallow copies aren't sorted! + //sort only the selected photons (faster) + event.m_photons.sort(top::descendingPtSorter); + } + + //muons + if (m_config->useMuons()) { + ///-- Need to read const collections for mini-xaod read back --/// + const xAOD::MuonContainer* calibratedMuons(nullptr); + top::check(evtStore()->retrieve(calibratedMuons, m_config->sgKeyMuons(hash) ), "Failed to retrieve muons"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::MuonContainer>(m_config->sgKeyMuonsTDS(hash))) { + std::pair< xAOD::MuonContainer*, xAOD::ShallowAuxContainer* > shallow_muons = xAOD::shallowCopyContainer( *calibratedMuons ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_muons.first , m_config->sgKeyMuonsTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_muons.second , m_config->sgKeyMuonsTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::MuonContainer* calibratedMuonsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedMuonsTDS, m_config->sgKeyMuonsTDS(hash) ), "Failed to retrieve muons"); + + // re-write overlap information if it is decorated onto currentSystematic + if (currentSystematic.isAvailable< std::vector<unsigned int> >("overlapsMu")) { + std::vector<unsigned int> overlapsMu = currentSystematic.auxdataConst< std::vector<unsigned int> >("overlapsMu"); + if (overlapsMu.size() == calibratedMuonsTDS->size()) { + unsigned int counter(0); + for (auto x : *calibratedMuons) { + x->auxdecor<char>("overlaps") = overlapsMu.at(counter); + ++counter; + } + } + } + + for (auto index : currentSystematic.goodMuons()) { + event.m_muons.push_back(calibratedMuonsTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected muons (faster) + event.m_muons.sort(top::descendingPtSorter); + } + + //taus + if (m_config->useTaus()) { + ///-- Need to read const collections for mini-xaod read back --/// + const xAOD::TauJetContainer* calibratedTaus(nullptr); + top::check(evtStore()->retrieve(calibratedTaus,m_config->sgKeyTaus(hash) ), "Failed to retrieve taus"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::TauJetContainer>(m_config->sgKeyTausTDS(hash))) { + std::pair< xAOD::TauJetContainer*, xAOD::ShallowAuxContainer* > shallow_taus = xAOD::shallowCopyContainer( *calibratedTaus ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_taus.first , m_config->sgKeyTausTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_taus.second , m_config->sgKeyTausTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::TauJetContainer* calibratedTausTDS(nullptr); + top::check(evtStore()->retrieve(calibratedTausTDS, m_config->sgKeyTausTDS(hash) ), "Failed to retrieve taus"); + + for (auto index : currentSystematic.goodTaus()) { + event.m_tauJets.push_back(calibratedTausTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected taus (faster) + event.m_tauJets.sort(top::descendingPtSorter); + } + + //jets + // We need to be careful with the boosted analysis, + // Do we take the jets collection that has loose or tight leptons subtracted? + bool looseJets(false); + if (m_config->applyElectronInJetSubtraction()) { + if (m_config->doOverlapRemovalOnLooseLeptonDef() || currentSystematic.isLooseEvent()) { + looseJets = true; + } + } + + if (m_config->useJets()) { + ///-- Need to read const collections for mini-xaod read back --/// + std::string sgKeyCalibrated( m_config->sgKeyJets(hash,looseJets) ); + std::string sgKeyTmp = "tmp_"+sgKeyCalibrated; + std::string sgKeyTmpAux = sgKeyTmp+"Aux."; + + const xAOD::JetContainer* calibratedJets(nullptr); + top::check(evtStore()->retrieve(calibratedJets, m_config->sgKeyJets(hash,looseJets)), "Failed to retrieve jets"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyJetsTDS(hash,looseJets))) { + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer( *calibratedJets ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_jets.first , m_config->sgKeyJetsTDS(hash,looseJets) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_jets.second , m_config->sgKeyJetsTDSAux(hash,looseJets) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::JetContainer* calibratedJetsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyJetsTDS(hash,looseJets) ), "Failed to retrieve taus"); + + for (auto index : currentSystematic.goodJets()) { + auto jet = calibratedJetsTDS->at(index); + + if (m_config->isMC()) { + // make product of SF (initialised to 1 in the header) + top::check( jet->isAvailable<float>("JET_SF_jvt") , " Can't find jet decoration \"JET_SF_jvt\" - we need it to calculate the jet scale-factors!"); + event.m_jvtSF *= jet->auxdataConst<float>("JET_SF_jvt"); + if (currentSystematic.hashValue() == m_config->nominalHashValue()) {// we only need the up/down JVT SF systs for nominal + top::check( jet->isAvailable<float>("JET_SF_jvt_UP") , " Can't find jet decoration \"JET_SF_jvt_UP\" - we need it to calculate the jet scale-factors!"); + event.m_jvtSF_UP *= jet->auxdataConst<float>("JET_SF_jvt_UP"); + top::check( jet->isAvailable<float>("JET_SF_jvt_DOWN") , " Can't find jet decoration \"JET_SF_jvt_DOWN\" - we need it to calculate the jet scale-factors!"); + event.m_jvtSF_DOWN *= jet->auxdataConst<float>("JET_SF_jvt_DOWN"); + } + } + + top::check( jet->isAvailable<char>("passJVT") , " Can't find jet decoration \"passJVT\" - we need it to decide if we should keep the jet in the top::Event instance or not!"); + if (jet->auxdataConst<char>( "passJVT" )) + event.m_jets.push_back(calibratedJetsTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected taus (faster) + event.m_jets.sort(top::descendingPtSorter); + } + + //large-R jets + if (m_config->useLargeRJets()) { + ///-- Need to read const collections for mini-xaod read back --/// + const xAOD::JetContainer* calibratedJets(nullptr); + top::check(evtStore()->retrieve(calibratedJets,m_config->sgKeyLargeRJets(hash) ), "Failed to retrieve largeR jets"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyLargeRJetsTDS(hash))) { + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer( *calibratedJets ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_jets.first , m_config->sgKeyLargeRJetsTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_jets.second , m_config->sgKeyLargeRJetsTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::JetContainer* calibratedJetsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyLargeRJetsTDS(hash) ), "Failed to retrieve largeR jets"); + + for (auto index : currentSystematic.goodLargeRJets()) { + event.m_largeJets.push_back(calibratedJetsTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected jets (faster) + event.m_largeJets.sort(top::descendingPtSorter); + } + + //track jets + if (m_config->useTrackJets()) { + ///-- Need to read const collections for mini-xaod read back --/// + const xAOD::JetContainer* calibratedJets(nullptr); + top::check(evtStore()->retrieve(calibratedJets,m_config->sgKeyTrackJets(hash) ), "Failed to retrieve track jets"); + + ///-- Shallow copy and save to TStore --/// + if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyTrackJetsTDS(hash))) { + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer( *calibratedJets ); + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_jets.first , m_config->sgKeyTrackJetsTDS(hash) ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_jets.second , m_config->sgKeyTrackJetsTDSAux(hash) ); + top::check( (save && saveAux) , "Failed to store object in TStore"); + } + + ///-- Pull shallow copy back out of TStore in non-const way --/// + xAOD::JetContainer* calibratedJetsTDS(nullptr); + top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyTrackJetsTDS(hash) ), "Failed to retrieve track jets"); + + for (auto index : currentSystematic.goodTrackJets()) { + event.m_trackJets.push_back(calibratedJetsTDS->at(index)); + } + + //shallow copies aren't sorted! + //sort only the selected jets (faster) + event.m_trackJets.sort(top::descendingPtSorter); + } + + //met + const xAOD::MissingETContainer* mets(nullptr); + if (!currentSystematic.isLooseEvent()) { + top::check(evtStore()->retrieve(mets, m_config->sgKeyMissingEt(hash)), "Failed to retrieve MET"); + } + if (currentSystematic.isLooseEvent()) { + top::check(evtStore()->retrieve(mets, m_config->sgKeyMissingEtLoose(hash)), "Failed to retrieve MET"); + } + event.m_met = (*mets)["FinalTrk"]; // MissingETBase::Source::total()]; + + //MC + if (m_config->isMC()) { + + // Truth particles (these are BIG) + if (m_config->useTruthParticles()) { + top::check(evtStore()->retrieve(event.m_truth, m_config->sgKeyMCParticle()), "Failed to retrieve truth particles"); + } + + // Truth Event + top::check(evtStore()->retrieve(event.m_truthEvent,m_config->sgKeyTruthEvent()),"Failed to retrieve truth Event"); + + // Parton History + if (m_config->doTopPartonHistory()) { + if (evtStore()->contains<xAOD::PartonHistoryContainer>(m_config->sgKeyTopPartonHistory())) { + const xAOD::PartonHistoryContainer* partonHistory(nullptr); + top::check(evtStore()->retrieve(partonHistory, m_config->sgKeyTopPartonHistory()),"Failed to retrieve Top Parton History"); + if (partonHistory->size() == 1) { + event.m_partonHistory = partonHistory->at(0); + } + } + } // end doTopPartonHistory + + } // end isMC + + + + return event; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/Event.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/Event.h new file mode 100644 index 0000000000000000000000000000000000000000..6216e0afec9220123e6cfef6b5cdcf7eca21b981 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/Event.h @@ -0,0 +1,144 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPEVENT_H_ +#define TOPEVENT_H_ + +#include "xAODEventInfo/EventInfo.h" +#include "xAODTracking/VertexContainer.h" + +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODMissingET/MissingET.h" + +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthParticleContainer.h" + +#include "TopPartons/PartonHistory.h" +#include "TopEvent/KLFitterResult.h" +#include "TopEvent/PseudoTopResult.h" + +#include <ostream> +#include <iostream> +/** + * @brief A namespace for the top group, to avoid using the same name as + * somewhere else in the code. + */ +namespace top { + +/** + * @brief Very simple class to hold event data after reading from a file. + * + * The idea of this is that we read from the xAOD and provide links here to all + * of the information the user might need. The code can add / remove objects + * and plot things from this. + * + * The best way to ensure this is reset every event is probably to make a new + * one every event, that way it'll tidy-up after itself. + */ +class Event { +public: + Event() : + m_hashValue(0), // this will be set properly by TopEventMaker + m_ttreeIndex(99999), // this will be set properly by TopEventMaker + m_isLoose(false), // this will be set properly by TopEventMaker + m_saveEvent(false), + m_info(nullptr), + m_primaryVertices(nullptr), + m_electrons(SG::VIEW_ELEMENTS), + m_muons(SG::VIEW_ELEMENTS), + m_jets(SG::VIEW_ELEMENTS), + m_photons(SG::VIEW_ELEMENTS), + m_largeJets(SG::VIEW_ELEMENTS), + m_trackJets(SG::VIEW_ELEMENTS), + m_tauJets(SG::VIEW_ELEMENTS), + m_met(nullptr), + + m_truthEvent(nullptr), + m_truth(nullptr), + m_partonHistory(nullptr), + m_KLFitterResults(nullptr), + m_PseudoTopResult(nullptr) + { + } + + ///systematic has value + std::size_t m_hashValue; + ///TTree index + unsigned int m_ttreeIndex; + ///is Loose Event? + bool m_isLoose; + ///save the event? + bool m_saveEvent; + + ///Pointer to the event info - nullptr if not loaded, but that's probably a bad idea + const xAOD::EventInfo* m_info; + + ///Primary Vertices + const xAOD::VertexContainer* m_primaryVertices; + + ///Container of electrons (can be sorted) + xAOD::ElectronContainer m_electrons; + + ///Container of muons (can be sorted) + xAOD::MuonContainer m_muons; + + ///Container of jets (can be sorted) + xAOD::JetContainer m_jets; + + ///Container of photons (can be sorted) + xAOD::PhotonContainer m_photons; + + ///Container of large jets (can be sorted) + xAOD::JetContainer m_largeJets; + + ///Container of track jets (can be sorted) + xAOD::JetContainer m_trackJets; + + ///Container of taujets (can be sorted) + xAOD::TauJetContainer m_tauJets; + + ///Pointer to MET if it is loaded + const xAOD::MissingET* m_met; + + ///Truth event + const xAOD::TruthEventContainer* m_truthEvent; + + ///Container of truth particles + const xAOD::TruthParticleContainer *m_truth; + + ///Top Parton TopPartonHistory + const xAOD::PartonHistory* m_partonHistory; + + ///KLFitter Results + mutable const xAOD::KLFitterResultContainer* m_KLFitterResults; + + ///Pseudo Top Results + mutable const xAOD::PseudoTopResultContainer* m_PseudoTopResult; + + ///JVT SFs - now needed here because it includes jets that are good jets, + ///but which are not in the top::Event::m_jets container + float m_jvtSF = 1.; + float m_jvtSF_UP = 1.; + float m_jvtSF_DOWN = 1.; + +}; + +} + +std::ostream& operator<<(std::ostream& os, const TLorentzVector& v); +std::ostream& operator<<(std::ostream& os, const top::Event& event); +std::ostream& operator<<(std::ostream& os, const xAOD::EventInfo& ei); +std::ostream& operator<<(std::ostream& os, const xAOD::Electron& el); +std::ostream& operator<<(std::ostream& os, const xAOD::Muon& mu); +std::ostream& operator<<(std::ostream& os, const xAOD::Photon& ph); +std::ostream& operator<<(std::ostream& os, const xAOD::Jet& jet); +std::ostream& operator<<(std::ostream& os, const xAOD::TauJet& tau); +std::ostream& operator<<(std::ostream& os, const xAOD::TruthParticle& truth); +std::ostream& operator<<(std::ostream& os, const xAOD::MissingET& met); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/EventTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/EventTools.h new file mode 100644 index 0000000000000000000000000000000000000000..b11b64ca534eac12ff1ae7552a79bc5ef55228d7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/EventTools.h @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTTOOLS_H_ +#define EVENTTOOLS_H_ + +#include <string> + +#include "xAODMissingET/MissingET.h" + +/** + * @file EventTools.h + * + * @brief A few functions for doing operations on particles / events. Currently + * holds code for dR, dPhi, MWT, HT, invariantMass, isSimulation and sorting + * containers in descending pT order. Note that the xAOD currently doesn't know + * if it's fast sim or full sim. + */ + +namespace xAOD { +class IParticle; +} + +namespace top { +class Event; + +/** + * @brief Print an error message and terminate if thingToCheck is false. + * + * Lots of the xAOD functions need checking to see if they work or not. I guess + * we take the approach that if it didn't work, we should not really try to + * recover but just print a message and quit as soon as we can. So, this will + * either return nothing or quit your program. + * + * @param thingToCheck The thing to check. If it's false then print the error + * message and quit. + */ +void check(bool thingToCheck, const std::string& usefulFailureMessage); + +/** + * @brief Calculate the delta-r distance between two particles (e.g. an Electron + * and a Muon). + * + * You could do this directly with the xAOD interface, but like invariant mass, + * I think it's nicer like this. + * + * @param p1 The first particle of the two. + * @param p2 The second particle of the two. + * @return delta-R metric. + */ +double deltaR(const xAOD::IParticle& p1, const xAOD::IParticle& p2); + +/** + * @brief Calculate delta-phi between two particles (e.g. an Electron and a + * Muon) + * + * @param p1 The first particle of the two. + * @param p2 The second particle of the two. + * @return Signed delta-phi in radians. + */ +double deltaPhi(const xAOD::IParticle& p1, const xAOD::IParticle& p2); + +/** + * @brief Calculate the transverse mass of the W from the charged lepton and + * the missing ET. The maths looks something a bit like this: + * + * sqrt(2. * lepton.pt() * met.met() * (1. - cos(lepton.phi() - met.phi()))) + * + * @return The calculated value, obviously. + */ +double mwt(const xAOD::IParticle& lepton, const xAOD::MissingET& met); + +/** + * @brief HT calculation. + * + * Uses the pT of the electrons, muons and jets. If they are present. It loops + * through those three containers and adds up the pT. + * + * @return The HT value. + */ +double ht(const top::Event& event); + +/** + * @brief Calculate the invariant mass of two particles. + * + * This can be done using the xAOD objects directly, but I think this type + * of interface is prettier. + * + * @param p1 The first particle of the two. + * @param p2 The second particle of the two. + * + * @return The invariant mass of the pair. + */ +double invariantMass(const xAOD::IParticle& p1, const xAOD::IParticle& p2); + +/** + * @brief Is this event MC simulation (True) or data (False)? + * + * @return True if the event is MC simulation. + */ +bool isSimulation(const top::Event& event); + +/** + * @brief Used when sorting the e, mu, jet, tau containers after CP corrections. + * + * In case they have changed order. Containers have pointers in, so this should + * take pointers as arguments. + * + * @param p1 The first particle of the two. + * @param p2 The second particle of the two. + * + */ +bool descendingPtSorter(const xAOD::IParticle* p0, const xAOD::IParticle* p1); + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/KLFitterResult.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/KLFitterResult.h new file mode 100644 index 0000000000000000000000000000000000000000..d19b2bdbca6ded8f12ef1185d445f1aab67156e7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/KLFitterResult.h @@ -0,0 +1,366 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: SystematicEvent.h 661144 2015-04-17 09:09:07Z morrisj $ +#ifndef ANALYSISTOP_TOPEVENT_KLFITTERRESULT_H +#define ANALYSISTOP_TOPEVENT_KLFITTERRESULT_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief KLFitterResult + * A simple xAOD class which we can persist into a mini-xAOD + * The xAOD EDM is way too complex, so let's simplify it + * It's not like ROOT can do schema evolution...... + * + * This class contains the result of the KLFitter algorithm + * + * $Revision: 661144 $ + * $Date: 2015-04-17 10:09:07 +0100 (Fri, 17 Apr 2015) $ + * + **/ + +// EDM include(s): +#include "AthContainers/DataVector.h" +#include "AthContainers/AuxElement.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/CLASS_DEF.h" +#include <vector> +#include <stdint.h> + +namespace xAOD{ + + /// Aux Container + class KLFitterResultAuxContainer : public AuxContainerBase { + public: + KLFitterResultAuxContainer(); + private: + + /// Error flags + std::vector<short> minuitDidNotConverge; + std::vector<short> fitAbortedDueToNaN; + std::vector<short> atLeastOneFitParameterAtItsLimit; + std::vector<short> invalidTransferFunctionAtConvergence; + + /// Global result + std::vector<unsigned int> bestPermutation; + std::vector<float> logLikelihood; + std::vector<float> eventProbability; + std::vector<std::vector<double>> parameters; + std::vector<std::vector<double>> parameterErrors; + + /// Model + std::vector<float> model_bhad_pt; + std::vector<float> model_bhad_eta; + std::vector<float> model_bhad_phi; + std::vector<float> model_bhad_E; + std::vector<unsigned int> model_bhad_jetIndex; + + std::vector<float> model_blep_pt; + std::vector<float> model_blep_eta; + std::vector<float> model_blep_phi; + std::vector<float> model_blep_E; + std::vector<unsigned int> model_blep_jetIndex; + + std::vector<float> model_lq1_pt; + std::vector<float> model_lq1_eta; + std::vector<float> model_lq1_phi; + std::vector<float> model_lq1_E; + std::vector<unsigned int> model_lq1_jetIndex; + + std::vector<float> model_lq2_pt; + std::vector<float> model_lq2_eta; + std::vector<float> model_lq2_phi; + std::vector<float> model_lq2_E; + std::vector<unsigned int> model_lq2_jetIndex; + + + // model particles in case of TTH topology + std::vector<float> model_Higgs_b1_pt; + std::vector<float> model_Higgs_b1_eta; + std::vector<float> model_Higgs_b1_phi; + std::vector<float> model_Higgs_b1_E; + std::vector<unsigned int> model_Higgs_b1_jetIndex; + + std::vector<float> model_Higgs_b2_pt; + std::vector<float> model_Higgs_b2_eta; + std::vector<float> model_Higgs_b2_phi; + std::vector<float> model_Higgs_b2_E; + std::vector<unsigned int> model_Higgs_b2_jetIndex; + + + std::vector<float> model_lep_pt; + std::vector<float> model_lep_eta; + std::vector<float> model_lep_phi; + std::vector<float> model_lep_E; + + std::vector<float> model_nu_pt; + std::vector<float> model_nu_eta; + std::vector<float> model_nu_phi; + std::vector<float> model_nu_E; + + + + }; + + /// Interface class + class KLFitterResult : public SG::AuxElement { + public: + /// Default constructor + KLFitterResult(); + /// Default destructor + virtual ~KLFitterResult(){} + + /// get minuitDidNotConverge + short minuitDidNotConverge() const; + /// set minuitDidNotConverge + void setMinuitDidNotConverge(short); + + /// get fitAbortedDueToNaN + short fitAbortedDueToNaN() const; + /// set fitAbortedDueToNaN + void setFitAbortedDueToNaN(short); + + /// get atLeastOneFitParameterAtItsLimit + short atLeastOneFitParameterAtItsLimit() const; + /// set atLeastOneFitParameterAtItsLimit + void setAtLeastOneFitParameterAtItsLimit(short); + + /// get invalidTransferFunctionAtConvergence + short invalidTransferFunctionAtConvergence() const; + /// set invalidTransferFunctionAtConvergence + void setInvalidTransferFunctionAtConvergence(short); + + /// get bestPermutation + unsigned int bestPermutation() const; + /// set bestPermutation + void setBestPermutation(unsigned int); + + /// get logLikelihood + float logLikelihood() const; + /// set logLikelihood + void setLogLikelihood(float); + + /// get eventProbability + float eventProbability() const; + /// set eventProbability + void setEventProbability(float); + + /// get parameters + const std::vector<double>& parameters() const; + /// set parameters + void setParameters(const std::vector<double>&); + + /// get parameterErrors + const std::vector<double>& parameterErrors() const; + /// set parameterErrors + void setParameterErrors(const std::vector<double>&); + + + /// get model_bhad_pt + float model_bhad_pt() const; + /// set model_bhad_pt + void setModel_bhad_pt(float); + + /// get model_bhad_eta + float model_bhad_eta() const; + /// set model_bhad_eta + void setModel_bhad_eta(float); + + /// get model_bhad_phi + float model_bhad_phi() const; + /// set model_bhad_phi + void setModel_bhad_phi(float); + + /// get model_bhad_E + float model_bhad_E() const; + /// set model_bhad_E + void setModel_bhad_E(float); + + /// get model_bhad_jetIndex + unsigned int model_bhad_jetIndex() const; + /// set model_bhad_jetIndex + void setModel_bhad_jetIndex(unsigned int); + + + /// get model_blep_pt + float model_blep_pt() const; + /// set model_blep_pt + void setModel_blep_pt(float); + + /// get model_blep_eta + float model_blep_eta() const; + /// set model_blep_eta + void setModel_blep_eta(float); + + /// get model_blep_phi + float model_blep_phi() const; + /// set model_blep_phi + void setModel_blep_phi(float); + + /// get model_blep_E + float model_blep_E() const; + /// set model_blep_E + void setModel_blep_E(float); + + /// get model_blep_jetIndex + unsigned int model_blep_jetIndex() const; + /// set model_blep_jetIndex + void setModel_blep_jetIndex(unsigned int); + + + /// get model_lq1_pt + float model_lq1_pt() const; + /// set model_lq1_pt + void setModel_lq1_pt(float); + + /// get model_lq1_eta + float model_lq1_eta() const; + /// set model_lq1_eta + void setModel_lq1_eta(float); + + /// get model_lq1_phi + float model_lq1_phi() const; + /// set model_lq1_phi + void setModel_lq1_phi(float); + + /// get model_lq1_E + float model_lq1_E() const; + /// set model_lq1_E + void setModel_lq1_E(float); + + /// get model_lq1_jetIndex + unsigned int model_lq1_jetIndex() const; + /// set model_lq1_jetIndex + void setModel_lq1_jetIndex(unsigned int); + + + /// get model_lq2_pt + float model_lq2_pt() const; + /// set model_lq2_pt + void setModel_lq2_pt(float); + + /// get model_lq2_eta + float model_lq2_eta() const; + /// set model_lq2_eta + void setModel_lq2_eta(float); + + /// get model_lq2_phi + float model_lq2_phi() const; + /// set model_lq2_phi + void setModel_lq2_phi(float); + + /// get model_lq2_E + float model_lq2_E() const; + /// set model_lq2_E + void setModel_lq2_E(float); + + /// get model_lq2_jetIndex + unsigned int model_lq2_jetIndex() const; + /// set model_lq2_jetIndex + void setModel_lq2_jetIndex(unsigned int); + + /// get model_Higgs_b1_pt + float model_Higgs_b1_pt() const; + /// set model_Higgs_b1_pt + void setModel_Higgs_b1_pt(float); + + /// get model_Higgs_b1_eta + float model_Higgs_b1_eta() const; + /// set model_Higgs_b1_eta + void setModel_Higgs_b1_eta(float); + + /// get model_Higgs_b1_phi + float model_Higgs_b1_phi() const; + /// set model_Higgs_b1_phi + void setModel_Higgs_b1_phi(float); + + /// get model_Higgs_b1_E + float model_Higgs_b1_E() const; + /// set model_Higgs_b1_E + void setModel_Higgs_b1_E(float); + + /// get model_Higgs_b1_jetIndex + unsigned int model_Higgs_b1_jetIndex() const; + /// set model_Higgs_b1_jetIndex + void setModel_Higgs_b1_jetIndex(unsigned int); + + + /// get model_Higgs_b2_pt + float model_Higgs_b2_pt() const; + /// set model_Higgs_b2_pt + void setModel_Higgs_b2_pt(float); + + /// get model_Higgs_b2_eta + float model_Higgs_b2_eta() const; + /// set model_Higgs_b2_eta + void setModel_Higgs_b2_eta(float); + + /// get model_Higgs_b2_phi + float model_Higgs_b2_phi() const; + /// set model_Higgs_b2_phi + void setModel_Higgs_b2_phi(float); + + /// get model_Higgs_b2_E + float model_Higgs_b2_E() const; + /// set model_Higgs_b2_E + void setModel_Higgs_b2_E(float); + + /// get model_Higgs_b2_jetIndex + unsigned int model_Higgs_b2_jetIndex() const; + /// set model_Higgs_b2_jetIndex + void setModel_Higgs_b2_jetIndex(unsigned int); + + /// get model_lep_pt + float model_lep_pt() const; + /// set model_lep_pt + void setModel_lep_pt(float); + + /// get model_lep_eta + float model_lep_eta() const; + /// set model_lep_eta + void setModel_lep_eta(float); + + /// get model_lep_phi + float model_lep_phi() const; + /// set model_lep_phi + void setModel_lep_phi(float); + + /// get model_lep_E + float model_lep_E() const; + /// set model_lep_E + void setModel_lep_E(float); + + + /// get model_nu_pt + float model_nu_pt() const; + /// set model_nu_pt + void setModel_nu_pt(float); + + /// get model_nu_eta + float model_nu_eta() const; + /// set model_nu_eta + void setModel_nu_eta(float); + + /// get model_nu_phi + float model_nu_phi() const; + /// set model_nu_phi + void setModel_nu_phi(float); + + /// get model_nu_E + float model_nu_E() const; + /// set model_nu_E + void setModel_nu_E(float); + + + }; + + typedef DataVector< xAOD::KLFitterResult > KLFitterResultContainer; +} + +// Dictonaries +CLASS_DEF( xAOD::KLFitterResult , 103465656 , 1 ) +CLASS_DEF( xAOD::KLFitterResultContainer , 1116647492 , 1 ) +CLASS_DEF( xAOD::KLFitterResultAuxContainer , 1292529835 , 1 ) +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/PseudoTopResult.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/PseudoTopResult.h new file mode 100644 index 0000000000000000000000000000000000000000..a30b730c83b0e38607510d9a780b8fdf690cb3c0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/PseudoTopResult.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPEVENT_PSEUDOTOPRESULT_H +#define ANALYSISTOP_TOPEVENT_PSEUDOTOPRESULT_H + +/** + * @author Andrea Knue <aknue@cern.ch> + **/ + +// EDM include(s): +#include "AthContainers/DataVector.h" +#include "AthContainers/AuxElement.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/CLASS_DEF.h" +#include <vector> + +namespace xAOD{ + + /// Aux Container + class PseudoTopResultAuxContainer : public AuxContainerBase { + public: + /// Default constructor + PseudoTopResultAuxContainer(); + }; // end Aux container + + /// Interface class + class PseudoTopResult : public SG::AuxElement { + public: + /// Default constructor + PseudoTopResult(); + /// Default desturctor + virtual ~PseudoTopResult(){} + + void IniVar(bool); + + }; + typedef DataVector < xAOD::PseudoTopResult > PseudoTopResultContainer; +} + +// Dictonaries +CLASS_DEF( xAOD::PseudoTopResult , 135846343 , 1 ) +CLASS_DEF( xAOD::PseudoTopResultContainer , 1219079565 , 1 ) +CLASS_DEF( xAOD::PseudoTopResultAuxContainer , 1244378748 , 1 ) + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/SystematicEvent.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/SystematicEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..63e466eb1191d5d6ad7db752884e8fa0a9e9d541 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/SystematicEvent.h @@ -0,0 +1,121 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: SystematicEvent.h 692539 2015-09-02 00:20:52Z morrisj $ +#ifndef ANALYSISTOP_TOPEVENT_SYSTEMATICEVENT_H +#define ANALYSISTOP_TOPEVENT_SYSTEMATICEVENT_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief SystematicEvent + * A simple xAOD class which we can persist into a mini-xAOD + * The xAOD EDM is way too complex, so let's simplify it + * It's not like ROOT can do schema evolution...... + * + * This class contains only vectors of unsigned int's + * It is very light weight and is used to make top::Event objects + * + * $Revision: 692539 $ + * $Date: 2015-09-02 02:20:52 +0200 (Wed, 02 Sep 2015) $ + * + **/ + +// EDM include(s): +#include "AthContainers/DataVector.h" +#include "AthContainers/AuxElement.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/CLASS_DEF.h" +#include <vector> +#include <stdint.h> + +namespace xAOD{ + + /// Aux Container + class SystematicEventAuxContainer : public AuxContainerBase { + public: + /// Default constructor + SystematicEventAuxContainer(); + private: + + std::vector<std::size_t> hashValue; + std::vector<unsigned int> ttreeIndex; + std::vector<char> isLooseEvent; + + std::vector<std::vector<unsigned int>> goodPhotons; + std::vector<std::vector<unsigned int>> goodElectrons; + std::vector<std::vector<unsigned int>> goodMuons; + std::vector<std::vector<unsigned int>> goodTaus; + std::vector<std::vector<unsigned int>> goodJets; + std::vector<std::vector<unsigned int>> goodLargeRJets; + std::vector<std::vector<unsigned int>> goodTrackJets; + }; + + /// Interface class + class SystematicEvent : public SG::AuxElement { + public: + /// Default constructor + SystematicEvent(); + /// Default destructor + virtual ~SystematicEvent(){} + + /// get hash value + std::size_t hashValue() const; + /// set hash value + void setHashValue(std::size_t); + + /// get ttreeIndex + unsigned int ttreeIndex() const; + /// set ttreeIndex + void setTtreeIndex(unsigned int); + + /// get isLooseEvent + char isLooseEvent() const; + /// set isLooseEvent + void setIsLooseEvent(char); + + /// get Photons + const std::vector<unsigned int>& goodPhotons() const; + /// set Photons + void setGoodPhotons(const std::vector<unsigned int>&); + + /// get Electrons + const std::vector<unsigned int>& goodElectrons() const; + /// set Electrons + void setGoodElectrons(const std::vector<unsigned int>&); + + /// get Muons + const std::vector<unsigned int>& goodMuons() const; + /// set Muons + void setGoodMuons(const std::vector<unsigned int>&); + + /// get Taus + const std::vector<unsigned int>& goodTaus() const; + /// set Taus + void setGoodTaus(const std::vector<unsigned int>&); + + /// get Jets + const std::vector<unsigned int>& goodJets() const; + /// set Jets + void setGoodJets(const std::vector<unsigned int>&); + + /// get LargeRJets + const std::vector<unsigned int>& goodLargeRJets() const; + /// set LargeRJets + void setGoodLargeRJets(const std::vector<unsigned int>&); + + /// get TrackJets + const std::vector<unsigned int>& goodTrackJets() const; + /// set TrackJets + void setGoodTrackJets(const std::vector<unsigned int>&); + }; + + typedef DataVector< xAOD::SystematicEvent > SystematicEventContainer; +} + +// Dictonaries +CLASS_DEF( xAOD::SystematicEvent , 173054021 , 1 ) +CLASS_DEF( xAOD::SystematicEventContainer , 1133646307 , 1 ) +CLASS_DEF( xAOD::SystematicEventAuxContainer , 1283481454 , 1 ) +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/TopEventMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/TopEventMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..1f56a1dc51d1ec8aed6c4c443a5ec60023932d63 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/TopEvent/TopEventMaker.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopEventMaker.h 661108 2015-04-17 00:01:16Z morrisj $ +#ifndef ANALYSISTOP_TOPEVENT_TOPEVENTMAKER_H +#define ANALYSISTOP_TOPEVENT_TOPEVENTMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TopEventMaker + * produce top::Event objects from xAOD::SystematicEvent objects + * + * + * $Revision: 661108 $ + * $Date: 2015-04-17 02:01:16 +0200 (Fri, 17 Apr 2015) $ + * + **/ + +// system include(s): +#include <memory> +#include <vector> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +#include "TopEvent/Event.h" +#include "TopEvent/SystematicEvent.h" + +namespace top { + + class TopConfig; + + class TopEventMaker final : public asg::AsgTool { + public: + explicit TopEventMaker( const std::string& name ); + virtual ~TopEventMaker(){} + + // Delete Standard constructors + TopEventMaker(const TopEventMaker& rhs) = delete; + TopEventMaker(TopEventMaker&& rhs) = delete; + TopEventMaker& operator=(const TopEventMaker& rhs) = delete; + + /** + * @brief Make a top::Event from a xAOD::SystematicEvent + * + * A SingleSystEvent contains only access to calibrated/systematic + * StoreGate keys and vectors telling it which objects in a collection + * are good + * + * You want to do physics on a top::Event + * + * @param systEvent Essentially this make an analysis friendly version of + * the information in systEvent + * + * @return A top::Event that you can do analysis on containing the good + * objects, which you can then perform selection based on event-level info + * with. Such as object multiplicity. Fun times are ahead. + */ + top::Event makeTopEvent(const xAOD::SystematicEvent& currentSystematic); + + /// As top-xaod isn't an asg::AsgTool, it doesn't have access to all the information + /// Very annoying + const xAOD::SystematicEventContainer* systematicEvents(const std::string& sgKey) const; + + private: + std::shared_ptr<top::TopConfig> m_config; + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..85a53859199a0cd15e08f5b357d72ba55b3e66f1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopEvent + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = CxxUtils xAODCore AthContainers AthLinks AsgTools xAODEventInfo xAODTruth xAODEgamma xAODMuon xAODJet xAODTau xAODMissingET xAODTracking TopConfiguration TopPartons + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..de103d356b6234273d77eca2f5e40b67bb2b69f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/share/mainpage.h @@ -0,0 +1,17 @@ +/** + * @page tevpage TopEvent + * + * @section ev Event + * + * This contains a top::Event object which stores our electrons, muons, jets, + * large-R jets, MET, truth etc. It also contains a file which has a few tools + * in for doing top::deltaR, top::deltaPhi, top::mwt, top::ht, + * top::invariantMass, top::descendingPtSorter, top::isSimulation etc. + + * - top::Event: An event object used by all the packages. + * - top::TopEventMaker: Converts the systematics collections into objects that can be used in the analysis + * - EventTools.h: Some tools for doing simple calculations and / or checks. + * + * - xAOD::SystematicEvent, xAOD::SystematicEventAux + * - xAOD::KLFitterResult, xAOD::KLFitterResultAux + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..2130f62ec744737780c720339df45a85adc8db5a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt @@ -0,0 +1,57 @@ +# Auto-generated on: 2017-03-08 14:47:36.489231 + +# Declare the name of this package: +atlas_subdir( TopEventReconstructionTools None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODCore + AthContainers + AsgTools + TopEvent + TopEventSelectionTools + TopAnalysis + KLFitter ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathMore MathCore Graf Minuit Minuit2 ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopEventReconstructionTools _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopEventReconstructionTools Root/*.cxx Root/*.h Root/*.icc + TopEventReconstructionTools/*.h TopEventReconstructionTools/*.icc TopEventReconstructionTools/*/*.h + TopEventReconstructionTools/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopEventReconstructionTools + LINK_LIBRARIES xAODCore + AthContainers + AsgTools + TopEvent + TopEventSelectionTools + TopAnalysis + KLFitter + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Build the executables of the package: +atlas_add_executable( topreco_test_mt2 + util/topreco_test_mt2.cxx + LINK_LIBRARIES xAODCore + AthContainers + AsgTools + TopEvent + TopEventSelectionTools + TopAnalysis + KLFitter + ${ROOT_LIBRARIES} + TopEventReconstructionTools ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Chi2LJets.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Chi2LJets.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c19f4c80636a683ad329f6725d23c3c62c887495 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Chi2LJets.cxx @@ -0,0 +1,208 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/Chi2LJets.h" + +#include "TMinuit.h" + +namespace top { + +const double Chi2LJets::input_topmass = 172500; +const double Chi2LJets::input_wmass = 80300; + +const double Chi2LJets::input_topsigma = 13000; +const double Chi2LJets::input_wsigma = 7000; + +Chi2LJets::Chi2LJets() { + min = new TMinuit(2); + min->SetPrintLevel(-1); + min->SetObjectFit(¶ms); + min->SetFCN(fcn); +} + +Chi2LJets::~Chi2LJets() { + delete min; +} + +bool Chi2LJets::apply(const top::Event& event) const { + //set lepton + if (event.m_electrons.size() == 1) + params.lepton = event.m_electrons.at(0)->p4(); + + if (event.m_muons.size() == 1) + params.lepton = event.m_muons.at(0)->p4(); + + //and met + params.neutrino_px = event.m_met->mpx(); + params.neutrino_py = event.m_met->mpy(); + + //Output + double chi2min = 1e200; + double topmass = 0.; + //double wmass = 0.; + + //First loop is for the leptonic b quark + for (xAOD::JetContainer::const_iterator j1 = event.m_jets.begin(); j1 != event.m_jets.end(); ++j1) { + params.leptonic_b = (*j1)->p4(); + + //Second loop is for one of the jets that makes a W + for (xAOD::JetContainer::const_iterator j2 = event.m_jets.begin(); j2 != event.m_jets.end(); ++j2) { + if (j1 == j2) + continue; + + ///The other jet in the W + for (xAOD::JetContainer::const_iterator j3 = event.m_jets.begin(); j3 != event.m_jets.end(); ++j3) { + if (j1 == j3 || j2 == j3) + continue; + + params.hadronic_w_mass = ((*j2)->p4() + (*j3)->p4()).M(); + + ///The hadronic b quark + for (xAOD::JetContainer::const_iterator j4 = event.m_jets.begin(); j4 != event.m_jets.end(); ++j4) { + if (j1 == j4 || j2 == j4 || j3 == j4) + continue; + + params.hadronic_t_mass = ((*j1)->p4() + (*j2)->p4() + (*j3)->p4()).M(); + + //Set input parameters to something reasonable (a guess) + min->DefineParameter(0, "top_mass", 172500., 10000., 0, 500000); //starting guess, step, min, max + min->DefineParameter(1, "neutrino_pz", 10000, 10000, -1000000, 1000000); + + //Perform the minimisation + int status = min->Migrad(); + + double chi2 = 0; + double edm = 0; + double errdef = 0; + int nvpar = 0; + int nparx = 0; + int icstat = 0; + + min->mnstat(chi2, edm, errdef, nvpar, nparx, icstat); + + if (status == 0 && chi2 < chi2min) { + double error = 0; + chi2min = chi2; + min->GetParameter(0, topmass, error); + //wmass = params.hadronic_w_mass; + } //min chi2 + } //j4 = hadronic b + } //j3 = j3 + j2 = hadronic W + } //j2 + } //j1 = leptonic b + + + + + // + // 577 MiniElectronContainer electrons = event.electrons(); + // 578 if (electrons.size() == 1) + // 579 params.lepton.SetPtEtaPhiE(electrons[0]->pt(), electrons[0]->eta(), electrons[0]->phi(), electrons[0]->E()); + // 580 + // 581 MiniMuonContainer muons = event.muons(); + // 582 if (muons.size() == 1) + // 583 params.lepton.SetPtEtaPhiE(muons[0]->pt(), muons[0]->eta(), muons[0]->phi(), muons[0]->E()); + // 584 + // 585 //set met + // 586 const MiniMET* met = event.MET(); + // 587 params.neutrino_px = met->et()*cos(met->phi()); + // 588 params.neutrino_py = met->et()*sin(met->phi()); + // 589 + // 590 //Out + // 591 double chi2, edm, errdef; + // 592 int nvpar, nparx, icstat; + // 593 + // 594 double chi2min = 1e200; + // 595 double topmass = 0.; + // 596 double wmass = 0.; + // 597 + // 598 //TObjects have a significant creation overhead so move them out of the loop + // 599 TLorentzVector a; + // 600 TLorentzVector b; + // 601 TLorentzVector c; + // 602 + // 603 const MiniJetContainer jets = event.jets(); + // 604 + // 605 //checks + // 606 assert((electrons.size() == 1 && muons.empty()) || (muons.size() == 1 && electrons.empty())); + // 607 assert(jets.size() >= 4); + // 608 + // 609 //First loop is for the leptonic b quark + // 610 for (MiniJetContainer::const_iterator j1 = jets.begin(); j1 !=jets.end(); ++j1) { + // 611 + // 612 params.leptonic_b.SetPtEtaPhiE((*j1)->pt(), (*j1)->eta(), (*j1)->phi(), (*j1)->E()); + // 613 + // 614 //Second loop is for one of the jets that makes a W + // 615 for (MiniJetContainer::const_iterator j2 = jets.begin(); j2 != jets.end(); ++j2) { + // 616 if (j1 == j2) + // 617 continue; + // 618 + // 619 a.SetPtEtaPhiE((*j2)->pt(), (*j2)->eta(), (*j2)->phi(), (*j2)->E()); + // 620 + // 621 ///The other jet in the W + // 622 for (MiniJetContainer::const_iterator j3 = jets.begin(); j3 != jets.end(); ++j3) { + // 623 if (j1 == j3 || j2 == j3) + // 624 continue; + // 625 + // 626 b.SetPtEtaPhiE((*j3)->pt(), (*j3)->eta(), (*j3)->phi(), (*j3)->E()); + // 627 params.hadronic_w_mass = (a + b).M(); + // 628 + // 629 ///The hadronic b quark + // 630 for (MiniJetContainer::const_iterator j4 = jets.begin(); j4 != jets.end(); ++j4) { + // 631 if (j1 == j4 || j2 == j4 || j3 == j4) + // 632 continue; + // 633 + // 634 c.SetPtEtaPhiE((*j4)->pt(), (*j4)->eta(), (*j4)->phi(), (*j4)->E()); + // 635 params.hadronic_t_mass = (a + b + c).M(); + // 636 + // 637 //Set input parameters to something reasonable (a guess) + // 638 min->DefineParameter(0, "top_mass", 172500., 10000., 0, 500000); //starting guess, step, min, max + // 639 min->DefineParameter(1, "neutrino_pz", 10000, 10000, -1000000, 1000000); + // 640 + // 641 //Perform the minimisation + // 642 int status = min->Migrad(); + // 643 min->mnstat(chi2, edm, errdef, nvpar, nparx, icstat); + // 644 + // 645 if (status == 0 && chi2 < chi2min) { + // 646 double error; + // 647 chi2min = chi2; + // 648 min->GetParameter(0, topmass, error); + // 649 wmass = params.hadronic_w_mass; + // 650 } //min chi2 + // 651 + // 652 } //j4 = hadronic b + // 653 } //j3 = j3 + j2 = hadronic W + // 654 } //j2 + // 655 } //j1 = leptonic b + + return true; +} + +} + + + /** + * @brief this is where we write out chi2 + */ +void fcn(int& /*npar*/, double* /*deriv*/, double& result, double par[], int /*flag*/) { + const top::FitInfo* params = (top::FitInfo*) gMinuit->GetObjectFit(); + + double mytopmass = par[0]; + double pz = par[1]; + + TLorentzVector neutrino(params->neutrino_px, params->neutrino_py, pz, sqrt(params->neutrino_px * params->neutrino_px + params->neutrino_py * params->neutrino_py + pz * pz)); + double w_lep_term = ((params->lepton + neutrino).M() - top::Chi2LJets::input_wmass) / top::Chi2LJets::input_wsigma; + double t_lep_term = ((params->lepton + neutrino + params->leptonic_b).M() - mytopmass) / top::Chi2LJets::input_topsigma; + + double w_term = (params->hadronic_w_mass - top::Chi2LJets::input_wmass) / top::Chi2LJets::input_wsigma; + double t_term = (params->hadronic_t_mass - mytopmass) / top::Chi2LJets::input_topsigma; + + result = w_lep_term * w_lep_term + + t_lep_term * t_lep_term + + w_term * w_term + + t_term * t_term; + + // cout << "SJH fcn hadw " << fit->hadronicW << " " << TopWidth::input_wmass << " " << TopWidth::input_wsigma << endl; + // cout << "SJH fcn hadt " << fit->hadronicTop << " " << mytopmass << " " << TopWidth::input_topsigma << endl; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterRun.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterRun.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f93519feacd822f04497dff6ede31e556cfb0b89 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterRun.cxx @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/KLFitterRun.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include <iostream> +#include <vector> +#include <cmath> +#include <fstream> + +namespace top{ + + KLFitterRun::KLFitterRun(const std::string& kLeptonType,std::shared_ptr<top::TopConfig> config) : + m_name("RECO::KLFitterRun_" + kLeptonType), + m_myFitter(nullptr) + { + + m_myFitter = std::unique_ptr<top::KLFitterTool> ( new top::KLFitterTool( m_name ) ); + top::check( m_myFitter->setProperty("config", config ), "Failed to setProperty of KLFitterTool" ); + top::check( m_myFitter->setProperty("LeptonType",kLeptonType), "Failed to setProperty of KLFitterTool" ); + top::check( m_myFitter->initialize() , "Failed to initialize KLFitterTool" ); + } + + bool KLFitterRun::apply(const top::Event& event) const + { + top::check( m_myFitter->execute(event) , "Failed to run KLFitterTool" ); + return true; + } + + std::string KLFitterRun::name() const { + return m_name; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterTool.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..13a95e55634d1bd2d60c3d7e3200f69870b1836a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/KLFitterTool.cxx @@ -0,0 +1,630 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: KLFitterTool.cxx 790035 2016-12-15 19:47:38Z aknue $ + +// Local include(s): +#include "TopEventReconstructionTools/KLFitterTool.h" +#include "TopEvent/KLFitterResult.h" +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" +#include "PathResolver/PathResolver.h" + +#include <algorithm> + +namespace top{ + + KLFitterTool::KLFitterTool( const std::string& name) : + asg::AsgTool( name ), + m_config(nullptr), + m_massTop(172.5), // This is the MC top mass in GeV - only change if you change the MC mass + m_bTagCutValue(9999.9), + m_transferFunctionsPathPrefix("SetMe"), + m_transferFunctionsPath("SetMe"), + m_leptonType("SetMe"), + m_LHType("SetMe"), + m_myFitter(nullptr) + { + declareProperty( "config" , m_config , "Set the configuration" ); + declareProperty( "LeptonType", m_leptonType = "kUndefined" , "Define the lepton type" ); + declareProperty( "LHType", m_LHType = "kUndefined" , "Define the Likelihood type" ); + } + + /// Function initialising the tool + StatusCode KLFitterTool::initialize() + { + // Have you set the config?? + if (m_config == nullptr) { + ATH_MSG_ERROR("Please set the top::TopConfig"); + return StatusCode::FAILURE; + } + m_config->setKLFitter(); + m_LHType = m_config -> KLFitterLH(); + m_transferFunctionsPathPrefix = PathResolverFindCalibDirectory( "KLFitter/transferfunctions/" ); + m_transferFunctionsPath = m_config->KLFitterTransferFunctionsPath(); + + std::string transferFunctionAbsPath = m_transferFunctionsPathPrefix + m_transferFunctionsPath + "/"; + + // 1) create an instance of the fitter + m_myFitter = std::unique_ptr<KLFitter::Fitter>( new KLFitter::Fitter{} ); + + // 2) create an instance of the detector, which holds the information on the resolutions (transfer functions); + // it takes as an argument the folder which contains the parameter files for the transfer functions + KLFitter::DetectorBase * myDetector = new KLFitter::DetectorAtlas_8TeV( transferFunctionAbsPath ); + + // 3) tell the fitter which detector to use + if (!m_myFitter->SetDetector(myDetector)) { + ATH_MSG_ERROR( "ERROR setting detector to fitter" ); + return StatusCode::FAILURE; + } + + // 4) create an instance of the likelihood for ttbar->l+jets channel and customize it according to your needs + KLFitter::LikelihoodTopLeptonJets * myLikelihood = new KLFitter::LikelihoodTopLeptonJets{}; + + // 4) create an instance of the likelihood for ttH -> l+jets channel and customize it according to your needs + KLFitter::LikelihoodTTHLeptonJets * myLikelihood_TTH = new KLFitter::LikelihoodTTHLeptonJets{}; + + // 4.a) SetleptonType + if (m_leptonType == "kElectron") { + m_leptonTypeKLFitterEnum = KLFitter::LikelihoodTopLeptonJets::LeptonType::kElectron; + m_leptonTypeKLFitterEnum_TTH = KLFitter::LikelihoodTTHLeptonJets::LeptonType::kElectron; + } + else if (m_leptonType == "kMuon") { + m_leptonTypeKLFitterEnum = KLFitter::LikelihoodTopLeptonJets::LeptonType::kMuon; + m_leptonTypeKLFitterEnum_TTH = KLFitter::LikelihoodTTHLeptonJets::LeptonType::kMuon; + } + else { + ATH_MSG_ERROR(" Please supply a valid LeptonType : kElectron or kMuon"); + return StatusCode::FAILURE; + } + + myLikelihood -> SetLeptonType( m_leptonTypeKLFitterEnum ); + myLikelihood_TTH -> SetLeptonType( m_leptonTypeKLFitterEnum_TTH ); + + // 4.b) Jet Selection Mode + if (m_config->KLFitterJetSelectionMode() == "kLeadingFour" ){ + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kLeadingFour; + } + else if (m_config->KLFitterJetSelectionMode() == "kLeadingFive") { + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kLeadingFive; + } + else if (m_config->KLFitterJetSelectionMode() == "kLeadingSix") { + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kLeadingSix; + } + else if (m_config->KLFitterJetSelectionMode() == "kBtagPriorityFourJets") { + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kBtagPriorityFourJets; + } + else if (m_config->KLFitterJetSelectionMode() == "kBtagPriorityFiveJets") { + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kBtagPriorityFiveJets; + } + else if (m_config->KLFitterJetSelectionMode() == "kBtagPrioritySixJets") { + m_jetSelectionModeKLFitterEnum = top::KLFitterJetSelection::kBtagPrioritySixJets; + } + else { + ATH_MSG_ERROR("Please supply a valid JetSelectionMode : kLeadingFour , kLeadingFive , kLeadingSix, kBtagPriorityFourJets , kBtagPriorityFiveJets kBtagPrioritySixJets" ); + return StatusCode::FAILURE; + } + + if(m_jetSelectionModeKLFitterEnum != top::KLFitterJetSelection::kLeadingSix && m_jetSelectionModeKLFitterEnum != top::KLFitterJetSelection::kBtagPrioritySixJets){ + if(m_LHType == "ttH"){ + + ATH_MSG_ERROR("You want to run the ttH Likelihood, you need to use either : kLeadingSix or kBtagPrioritySixJets" ); + return StatusCode::FAILURE; + + } + } + + // 4.c) SetBTagging method + if (m_config->KLFitterBTaggingMethod() == "kNotag") { + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kNotag; + } + else if (m_config->KLFitterBTaggingMethod() == "kVetoNoFit" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVetoNoFit; + } + else if (m_config->KLFitterBTaggingMethod() == "kVetoNoFitLight" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVetoNoFitLight; + } + else if (m_config->KLFitterBTaggingMethod() == "kVetoNoFitBoth" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVetoNoFitBoth; + } + else if (m_config->KLFitterBTaggingMethod() == "kWorkingPoint" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kWorkingPoint; + } + else if (m_config->KLFitterBTaggingMethod() == "kVeto" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVeto; + } + else if (m_config->KLFitterBTaggingMethod() == "kVetoLight" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVetoLight; + } + else if (m_config->KLFitterBTaggingMethod() == "kVetoBoth" ){ + m_bTaggingMethodKLFitterEnum = KLFitter::LikelihoodBase::BtaggingMethod::kVetoBoth; + } + else { + ATH_MSG_ERROR("Please supply a valid BTaggingMethod : kNotag,kVetoNoFit,kVetoNoFitLight,kVetoNoFitBoth,kWorkingPoint,kVeto,kVetoLight or kVetoBoth" ); + return StatusCode::FAILURE; + } + myLikelihood -> SetBTagging( m_bTaggingMethodKLFitterEnum ); + myLikelihood_TTH -> SetBTagging( m_bTaggingMethodKLFitterEnum ); + // 4.d) SetTopMass + myLikelihood -> PhysicsConstants()->SetMassTop( m_massTop ); + myLikelihood_TTH -> PhysicsConstants()->SetMassTop( m_massTop ); + // 4.e) TopMassFixed + myLikelihood -> SetFlagTopMassFixed( m_config->KLFitterTopMassFixed() ); + myLikelihood_TTH -> SetFlagTopMassFixed( m_config->KLFitterTopMassFixed() ); + + // 5) tell the fitter which likelihood to use + if(m_LHType == "ttbar") + m_myFitter->SetLikelihood(myLikelihood); + else if (m_LHType == "ttH") + m_myFitter->SetLikelihood(myLikelihood_TTH); + else{ + + ATH_MSG_ERROR( "KLFitter: This likelihood is not defined..." ); + return StatusCode::FAILURE; + + } + + // 6) Figure out the b tagging working point + // All the blame for this horrible code rests with the b-tagging people + if (m_config->bTagWP_available().size() != 1) { + ATH_MSG_INFO(m_config->bTagWP_available().size()<<" b-tagging WP - cannot pick b-jets. Please select only 1 WP if you are using KLFitter"); + } + + const auto btagWP = m_config->bTagWP_available()[0]; + m_btagging_eff_tool = "BTaggingEfficiencyTool_"+btagWP+"_"+m_config->sgKeyJets(); + top::check( m_btagging_eff_tool.retrieve(), "Failed to retrieve b-tagging Efficiency tool" ); + + ATH_MSG_INFO("++++++++++++++++++++++++++++++"); + ATH_MSG_INFO("Configured KLFitter with name "<<name()); + ATH_MSG_INFO(" Using " << "BTaggingEfficiencyTool_"+btagWP+"_"+m_config->sgKeyJets()); + ATH_MSG_INFO(" Using transfer functions with full path " << transferFunctionAbsPath); + ATH_MSG_INFO(" Using Lepton \t\t" << m_leptonType); + ATH_MSG_INFO(" Using JetSelectionMode \t" << m_config->KLFitterJetSelectionMode()); + ATH_MSG_INFO(" Using BTaggingMethod \t" << m_config->KLFitterBTaggingMethod()); + ATH_MSG_INFO(" Using TopMassFixed \t" << m_config->KLFitterTopMassFixed()); + + if (m_config->KLFitterSaveAllPermutations()) + ATH_MSG_INFO(" Saving All permutations"); + if (!m_config->KLFitterSaveAllPermutations()) + ATH_MSG_INFO(" Saving only the permutation with the highest event probability"); + ATH_MSG_INFO("++++++++++++++++++++++++++++++"); + + /// Return gracefully: + return StatusCode::SUCCESS; + } + + /// Function executing the tool + StatusCode KLFitterTool::execute(const top::Event& event) + { + + // run KLFitter + // create an instance of the particles class filled with the particles to be fitted; + // here, you need to make sure that + // - the particles are in the range allowed by the transfer functions (eta and pt) + // - the energies and momenta are in GeV + // - be aware that *all* particles you're adding are considered in the fit + // (many particles lead to many permutations to be considered and hence a long + // running time and not necessarily good fitting results due to the many available + // permutations) + // the arguments taken py AddParticle() are + // - TLorentzVector of the physics 4-momentum + // - detector eta for the evaluation of the transfer functions (for muons: just use the physics eta) + // - type of particle + // - an optional name of the particle (pass empty string in case you don't want to give your particle a name) + // - index of the particle in your original collection (for convenience) + // - for jets: + // * bool isBtagged : mandatory only if you want to use b-tagging in the fit + + KLFitter::Particles * myParticles = new KLFitter::Particles{}; + + if(m_LHType == "ttbar"){ + + if (m_leptonTypeKLFitterEnum == KLFitter::LikelihoodTopLeptonJets::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 == KLFitter::LikelihoodTopLeptonJets::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 == "ttH"){ + + if (m_leptonTypeKLFitterEnum_TTH == KLFitter::LikelihoodTTHLeptonJets::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_TTH == KLFitter::LikelihoodTTHLeptonJets::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); + } + } + + // set the jets, depending on the Jet Selection Mode + setJets(event, myParticles); + + // add the particles to the fitter + if (!m_myFitter->SetParticles(myParticles)) { + ATH_MSG_ERROR( "KLFitter: Error adding particles to fitter..." ); + return StatusCode::FAILURE; + } + + // add the MET x and y components as well as the SumET to the fitter + const double met_ex = event.m_met->mpx() / 1.e3; + const double met_ey = event.m_met->mpy() / 1.e3; + const double met_sumet = event.m_met->sumet() / 1.e3; + + if (!m_myFitter->SetET_miss_XY_SumET(met_ex, met_ey, met_sumet)) { + ATH_MSG_ERROR( "KLFitter: Error adding MET to fitter..." ); + return StatusCode::FAILURE; + } + + // create the xAOD::KLFitterResultContainer + xAOD::KLFitterResultAuxContainer* resultAuxContainer = new xAOD::KLFitterResultAuxContainer{}; + xAOD::KLFitterResultContainer* resultContainer = new xAOD::KLFitterResultContainer{}; + resultContainer->setStore( resultAuxContainer ); + + + // loop over all permutations + const int nperm = m_myFitter->Permutations()->NPermutations(); + for (int iperm = 0; iperm < nperm; ++iperm) { + // Perform the fit + m_myFitter->Fit(iperm); + + // create a result + xAOD::KLFitterResult* result = new xAOD::KLFitterResult{}; + resultContainer->push_back( result ); + + unsigned int ConvergenceStatusBitWord = m_myFitter->ConvergenceStatus(); + bool MinuitDidNotConverge = (ConvergenceStatusBitWord & m_myFitter->MinuitDidNotConvergeMask) != 0; + bool FitAbortedDueToNaN = (ConvergenceStatusBitWord & m_myFitter->FitAbortedDueToNaNMask) != 0; + bool AtLeastOneFitParameterAtItsLimit = (ConvergenceStatusBitWord & m_myFitter->AtLeastOneFitParameterAtItsLimitMask) != 0; + bool InvalidTransferFunctionAtConvergence = (ConvergenceStatusBitWord & m_myFitter->InvalidTransferFunctionAtConvergenceMask) != 0; + + result->setMinuitDidNotConverge( ((MinuitDidNotConverge) ? 1 : 0) ); + result->setFitAbortedDueToNaN( ((FitAbortedDueToNaN) ? 1 : 0) ); + result->setAtLeastOneFitParameterAtItsLimit( ((AtLeastOneFitParameterAtItsLimit) ? 1 : 0 ) ); + result->setInvalidTransferFunctionAtConvergence( ((InvalidTransferFunctionAtConvergence) ? 1 : 0) ); + + result->setLogLikelihood( m_myFitter->Likelihood()->LogLikelihood(m_myFitter->Likelihood()->GetBestFitParameters()) ); + result->setEventProbability( std::exp(m_myFitter->Likelihood()->LogEventProbability()) ); + result->setParameters( m_myFitter->Likelihood()->GetBestFitParameters() ); + result->setParameterErrors( m_myFitter->Likelihood()->GetBestFitParameterErrors() ); + + KLFitter::Particles * myModelParticles = m_myFitter->Likelihood()->ParticlesModel(); + KLFitter::Particles ** myPermutedParticles = m_myFitter->Likelihood()->PParticlesPermuted(); + + result->setModel_bhad_pt( myModelParticles->Parton(0)->Pt() ); + result->setModel_bhad_eta( myModelParticles->Parton(0)->Eta() ); + result->setModel_bhad_phi( myModelParticles->Parton(0)->Phi() ); + result->setModel_bhad_E( myModelParticles->Parton(0)->E() ); + result->setModel_bhad_jetIndex( (*myPermutedParticles)->JetIndex(0) ); + + result->setModel_blep_pt( myModelParticles->Parton(1)->Pt() ); + result->setModel_blep_eta( myModelParticles->Parton(1)->Eta() ); + result->setModel_blep_phi( myModelParticles->Parton(1)->Phi() ); + result->setModel_blep_E( myModelParticles->Parton(1)->E() ); + result->setModel_blep_jetIndex( (*myPermutedParticles)->JetIndex(1) ); + + result->setModel_lq1_pt( myModelParticles->Parton(2)->Pt() ); + result->setModel_lq1_eta( myModelParticles->Parton(2)->Eta() ); + result->setModel_lq1_phi( myModelParticles->Parton(2)->Phi() ); + result->setModel_lq1_E( myModelParticles->Parton(2)->E() ); + result->setModel_lq1_jetIndex( (*myPermutedParticles)->JetIndex(2) ); + + result->setModel_lq2_pt( myModelParticles->Parton(3)->Pt() ); + result->setModel_lq2_eta( myModelParticles->Parton(3)->Eta() ); + result->setModel_lq2_phi( myModelParticles->Parton(3)->Phi() ); + result->setModel_lq2_E( myModelParticles->Parton(3)->E() ); + result->setModel_lq2_jetIndex( (*myPermutedParticles)->JetIndex(3) ); + + if(m_LHType == "ttH"){ + + result->setModel_Higgs_b1_pt( myModelParticles->Parton(4)->Pt() ); + result->setModel_Higgs_b1_eta( myModelParticles->Parton(4)->Eta() ); + result->setModel_Higgs_b1_phi( myModelParticles->Parton(4)->Phi() ); + result->setModel_Higgs_b1_E( myModelParticles->Parton(4)->E() ); + result->setModel_Higgs_b1_jetIndex( (*myPermutedParticles)->JetIndex(4) ); + + result->setModel_Higgs_b2_pt( myModelParticles->Parton(5)->Pt() ); + result->setModel_Higgs_b2_eta( myModelParticles->Parton(5)->Eta() ); + result->setModel_Higgs_b2_phi( myModelParticles->Parton(5)->Phi() ); + result->setModel_Higgs_b2_E( myModelParticles->Parton(5)->E() ); + result->setModel_Higgs_b2_jetIndex( (*myPermutedParticles)->JetIndex(5) ); + + } + + if (m_leptonTypeKLFitterEnum == KLFitter::LikelihoodTopLeptonJets::LeptonType::kElectron || m_leptonTypeKLFitterEnum_TTH == KLFitter::LikelihoodTTHLeptonJets::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() ); + result->setModel_lep_E( myModelParticles->Electron(0)->E() ); + } + + if (m_leptonTypeKLFitterEnum == KLFitter::LikelihoodTopLeptonJets::LeptonType::kMuon || m_leptonTypeKLFitterEnum_TTH == KLFitter::LikelihoodTTHLeptonJets::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() ); + result->setModel_lep_E( myModelParticles->Muon(0)->E() ); + } + + result->setModel_nu_pt( myModelParticles->Neutrino(0)->Pt() ); + result->setModel_nu_eta( myModelParticles->Neutrino(0)->Eta() ); + result->setModel_nu_phi( myModelParticles->Neutrino(0)->Phi() ); + result->setModel_nu_E( myModelParticles->Neutrino(0)->E() ); + + + } // Loop over permutations + + // Normalize event probability to unity + // work out best permutation + float sumEventProbability(0.),bestEventProbability(0.); + unsigned int bestPermutation(999),iPerm(0); + + // First loop + for (auto x : *resultContainer) { + float prob = x->eventProbability(); + sumEventProbability += prob; + + if (prob > bestEventProbability) { + bestEventProbability = prob; + bestPermutation = iPerm; + } + ++iPerm; + } + + // Second loop + iPerm = 0; + for (auto x : *resultContainer) { + x->setEventProbability( x->eventProbability() / sumEventProbability ); + if (iPerm == bestPermutation) { + x->setBestPermutation(1); + } + else{ + x->setBestPermutation(0); + } + ++iPerm; + } + + + + // Save to StoreGate / TStore + std::string outputSGKey("SetMe"); + if (!event.m_isLoose) { + outputSGKey = m_config->sgKeyKLFitter( event.m_hashValue ); + } + if (event.m_isLoose) { + outputSGKey = m_config->sgKeyKLFitterLoose( event.m_hashValue ); + } + + std::string outputSGKeyAux = outputSGKey + "Aux."; + + // Save all permutations or only the highest event probability? + + // Save all + if (m_config->KLFitterSaveAllPermutations()) { + xAOD::TReturnCode save = evtStore()->tds()->record( resultContainer ,outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( resultAuxContainer , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } + + // Save only the best + if (!m_config->KLFitterSaveAllPermutations()) { + // create the xAOD::KLFitterResultContainer + xAOD::KLFitterResultAuxContainer* bestAuxContainer = new xAOD::KLFitterResultAuxContainer{}; + xAOD::KLFitterResultContainer* bestContainer = new xAOD::KLFitterResultContainer{}; + bestContainer->setStore( bestAuxContainer ); + + for (auto x : *resultContainer) { + if (x->bestPermutation() == 1) { + xAOD::KLFitterResult* result = new xAOD::KLFitterResult{}; + result->makePrivateStore( *x ); + bestContainer->push_back( result ); + } + } + + xAOD::TReturnCode save = evtStore()->tds()->record( bestContainer ,outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( bestAuxContainer , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + // watch out for memory leaks! + // raw pointers have not been put into a DataVector + // we still actually own them + // AnalysisTop will actually do some memory management (which is very wierd and we don't like it) + delete resultContainer; + delete resultAuxContainer; + } + + // Pull the const result back out of StoreGate and attach to top::Event + top::check(evtStore()->retrieve(event.m_KLFitterResults,outputSGKey),"Failed to add KLFitterResults to top::Event"); + + delete myParticles; + + /// Return gracefully: + return StatusCode::SUCCESS; + } + + bool KLFitterTool::HasTag(const xAOD::Jet& jet, double& weight) const { + weight = -99.; + const auto& btag_object = jet.btagging(); + const auto& tagger_name = m_btagging_eff_tool->getTaggerName(); + if (!btag_object || !btag_object->MVx_discriminant(tagger_name, weight)) { + ATH_MSG_ERROR("Failed to retrieve "+tagger_name+" weight!"); + } + + for(const auto& tagWP : m_config->bTagWP_available()){ + if(!jet.isAvailable<char>("isbtagged_"+tagWP)) { + ATH_MSG_ERROR("Failed to retrieve jet decoration isbtagged_"+tagWP); + break; + } + return jet.auxdataConst<char>("isbtagged_"+tagWP); + } + return false; + } + + + void KLFitterTool::retrieveEfficiencies(const xAOD::Jet& jet, float* efficiency, float* inefficiency) { + *efficiency = .7725; // dummy values + *inefficiency = 1./125.93; // dummy values + + auto pretend_to_be_b = new xAOD::Jet(jet); + auto pretend_to_be_light = new xAOD::Jet(jet); + + pretend_to_be_b->setAttribute("HadronConeExclTruthLabelID", 5); + pretend_to_be_light->setAttribute("HadronConeExclTruthLabelID", 0); + + top::check(m_btagging_eff_tool->getMCEfficiency(*pretend_to_be_b, *efficiency), + "Could not retrieve tagging efficiency for b-jet"); + top::check(m_btagging_eff_tool->getMCEfficiency(*pretend_to_be_light, *inefficiency), + "Could not retrieve tagging efficiency for light jet"); + + delete pretend_to_be_b; + delete pretend_to_be_light; + + } + + + + void KLFitterTool::setJets(const top::Event& event,KLFitter::Particles* inputParticles) + { + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kLeadingFour) { + setJetskLeadingFour( event , inputParticles ); + } + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kLeadingFive) { + setJetskLeadingFive( event , inputParticles ); + } + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kLeadingSix) { + setJetskLeadingSix( event , inputParticles ); + } + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kBtagPriorityFourJets) { + setJetskBtagPriorityFourJets( event , inputParticles ); + } + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kBtagPriorityFiveJets) { + setJetskBtagPriorityFiveJets( event , inputParticles ); + } + if (m_jetSelectionModeKLFitterEnum == top::KLFitterJetSelection::kBtagPrioritySixJets) { + setJetskBtagPrioritySixJets( event , inputParticles ); + } + + + } + + void KLFitterTool::setJetskLeadingFour(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskLeadingX(event, inputParticles, 4); + } + + void KLFitterTool::setJetskLeadingFive(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskLeadingX(event, inputParticles, 5); + } + + void KLFitterTool::setJetskLeadingSix(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskLeadingX(event, inputParticles, 6); + } + + void KLFitterTool::setJetskLeadingX(const top::Event& event,KLFitter::Particles* inputParticles, int njets) + { + int index(0); + for (const auto& jet : event.m_jets) { + if (index > njets-1) break; + + TLorentzVector jet_p4; + jet_p4.SetPtEtaPhiE(jet->pt() / 1.e3, jet->eta(), jet->phi(), jet->e() / 1.e3); + + double weight(-99.); + const bool isTagged = HasTag(*jet, weight); + + float eff(0), ineff(0); + retrieveEfficiencies(*jet, &eff, &ineff); + + inputParticles->AddParticle(&jet_p4, jet_p4.Eta(), KLFitter::Particles::kParton, "", index, + isTagged, eff, 1./ineff, KLFitter::Particles::kNone, weight); + ++index; + } + } + + + void KLFitterTool::setJetskBtagPriorityFourJets(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskBtagPriority( event , inputParticles , 4 ); + } + + void KLFitterTool::setJetskBtagPriorityFiveJets(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskBtagPriority( event , inputParticles , 5 ); + } + + void KLFitterTool::setJetskBtagPrioritySixJets(const top::Event& event,KLFitter::Particles* inputParticles) + { + setJetskBtagPriority( event , inputParticles , 6 ); + } + + void KLFitterTool::setJetskBtagPriority(const top::Event& event,KLFitter::Particles* inputParticles,const unsigned int maxJets) + { + // kBtagPriority mode first adds the b jets, then the light jets + // If your 6th or 7th jet is a b jet, then you probably want this option + + unsigned int totalJets(0); + + // First find the b-jets + unsigned int index(0); + double weight(0); + for (const auto& jet : event.m_jets) { + if (totalJets >= maxJets) break; + if (HasTag(*jet, weight)) { + TLorentzVector jet_p4; + jet_p4.SetPtEtaPhiE(jet->pt() / 1.e3, jet->eta(), jet->phi(), jet->e() / 1.e3); + + float eff(0), ineff(0); + retrieveEfficiencies(*jet, &eff, &ineff); + + inputParticles->AddParticle(&jet_p4, jet_p4.Eta(), KLFitter::Particles::kParton, "", index, + true, eff, 1./ineff, KLFitter::Particles::kNone, weight); + ++totalJets; + } // HasTag + + ++index; + } // for (jet) + + + // Second, find the light jets + index = 0; + for (const auto& jet : event.m_jets) { + if (totalJets >= maxJets) break; + if (!HasTag(*jet, weight)) { + TLorentzVector jet_p4; + jet_p4.SetPtEtaPhiE(jet->pt() / 1.e3, jet->eta(), jet->phi(), jet->e() / 1.e3); + + float eff(0), ineff(0); + retrieveEfficiencies(*jet, &eff, &ineff); + + inputParticles->AddParticle(&jet_p4, jet_p4.Eta(), KLFitter::Particles::kParton, "", index, + false, eff, 1./ineff, KLFitter::Particles::kNone, weight); + ++totalJets; + } // !HasTag + + ++index; + } // for (jet) + + } + + + /// Function finalizing the tool + StatusCode KLFitterTool::finalize() + { + /// Return gracefully: + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..dbc94fd06e17016ff0ab7bea737a0911ede05941 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/LinkDef.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/TopEventReconstructionToolsLoader.h" + +#ifdef __CINT__ + +#pragma extra_include "TopEventReconstructionTools/TopEventReconstructionToolsLoader.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class top::TopEventReconstructionToolsLoader+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/MT2Reco.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/MT2Reco.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dcbe8c0e0001fff90af4d23323f04f08271043a0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/MT2Reco.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/MT2Reco.h" + +#include "TopEvent/Event.h" + +#ifdef ROOTCORE_PACKAGE_Oxbridgekinetics + +namespace top { + +MT2Reco::MT2Reco() { +} + +MT2Reco::~MT2Reco() { +} + +bool MT2Reco::apply(const top::Event& /*event*/) const { + return true; +} + +} + +#endif //ROOTCORE_PACKAGE_Oxbridgekinetics diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/NeutrinoWeighting.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/NeutrinoWeighting.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f0807169e4d99aa4c2bf69be48712fabf58e457d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/NeutrinoWeighting.cxx @@ -0,0 +1,126 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/NeutrinoWeighting.h" + +#include "TopEvent/Event.h" + +namespace top { + +NeutrinoWeighting::NeutrinoWeighting() : sigmax(10), sigmay(10) { + double etaStep = 0.2; + + //construct the array of eta values to use (cosh and sinh them) + int index = 0; + for (double eta = -5.0; eta < 5.0001; eta += etaStep) { + neutrinos[index][0] = eta; + neutrinos[index][1] = sinh(eta); + neutrinos[index][2] = cosh(eta); + ++index; + } + + etaSize = index; + + if (etaSize > 2000) { + std::cout << "ERROR TOO MANY SAMPLING POINT FOR neutrinos ARRAY" << std::endl; + exit(1); + } +} + +NeutrinoWeighting::~NeutrinoWeighting() { +} + +bool NeutrinoWeighting::apply(const top::Event& event) const { + TLorentzVector l1; + TLorentzVector l2; + TLorentzVector b1; + TLorentzVector b2; + double topMass = 172500.; + + const double met_ex = event.m_met->mpx(); + const double met_ey = event.m_met->mpy(); + + for (int i = 0; i < etaSize; ++i) { + for (int j = 0; j < etaSize; ++j) { + NWSolution ans1 = solveForNeutrinoEta(l1, b1, topMass, i); + NWSolution ans2 = solveForNeutrinoEta(l2, b2, topMass, j); + + if (ans1.getNumSolutions() > 0 && ans2.getNumSolutions() > 0) { + const double sol1 = neutrino_weight(ans1.getv1(), ans2.getv1(), met_ex, met_ey); + const double sol2 = neutrino_weight(ans1.getv1(), ans2.getv2(), met_ex, met_ey); + const double sol3 = neutrino_weight(ans1.getv2(), ans2.getv1(), met_ex, met_ey); + const double sol4 = neutrino_weight(ans1.getv2(), ans2.getv2(), met_ex, met_ey); + + if (isnan(sol1) || isnan(sol2) || isnan(sol3) || isnan(sol4)) + std::cout << "One of the quadratic ans is NaN!" << std::endl; + } + + ans1 = solveForNeutrinoEta(l1, b2, topMass, i); + ans2 = solveForNeutrinoEta(l2, b1, topMass, j); + + if (ans1.getNumSolutions() > 0 && ans2.getNumSolutions() > 0) { + const double sol1 = neutrino_weight(ans1.getv1(), ans2.getv1(), met_ex, met_ey); + const double sol2 = neutrino_weight(ans1.getv1(), ans2.getv2(), met_ex, met_ey); + const double sol3 = neutrino_weight(ans1.getv2(), ans2.getv1(), met_ex, met_ey); + const double sol4 = neutrino_weight(ans1.getv2(), ans2.getv2(), met_ex, met_ey); + + if (isnan(sol1) || isnan(sol2) || isnan(sol3) || isnan(sol4)) + std::cout << "One of the quadratic ans is NaN!" << std::endl; + } + } + } + + //normalise? + + return true; +} + +NWSolution NeutrinoWeighting::solveForNeutrinoEta(const TLorentzVector& lepton, const TLorentzVector& bJet, double topMass, int index) const { + double Wmass2 = m_wmass * m_wmass; + double bmass = m_bmass; + + double Elprime = lepton.E() * neutrinos[index][2] - lepton.Pz() * neutrinos[index][1]; + double Ebprime = bJet.E() * neutrinos[index][2] - bJet.Pz() * neutrinos[index][1]; + + double A = (lepton.Py() * Ebprime - bJet.Py() * Elprime) / (bJet.Px() * Elprime - lepton.Px() * Ebprime); + double B = (Elprime * (topMass * topMass - Wmass2 - bmass * bmass - 2. * lepton * bJet) - Ebprime * Wmass2) / (2. * (lepton.Px() * Ebprime - bJet.Px() * Elprime)); + + double par1 = (lepton.Px() * A + lepton.Py()) / Elprime; + double C = A * A + 1. - par1 * par1; + double par2 = (Wmass2 / 2. + lepton.Px() * B) / Elprime; + double D = 2. * (A * B - par2 * par1); + double F = B * B - par2 * par2; + double det = D * D - 4. * C * F; + + NWSolution sol; + sol.setSolutions(0); + + if (det > 0.) { + double tmp = sqrt(det) / (2. * C); + double py1 = -D / (2. * C) + tmp; + double py2 = -D / (2. * C) - tmp; + double px1 = A * py1 + B; + double px2 = A * py2 + B; + double pT2_1 = px1 * px1 + py1 * py1; + double pT2_2 = px2 * px2 + py2 * py2; + double pz1 = sqrt(pT2_1) * neutrinos[index][1]; + double pz2 = sqrt(pT2_2) * neutrinos[index][1]; + + TLorentzVector a1(px1, py1, pz1, sqrt(pT2_1 + pz1 * pz1)); + TLorentzVector a2(px2, py2, pz2, sqrt(pT2_2 + pz2 * pz2)); + + sol.setSolutions(2, a1, a2); + } + + return sol; +} + +double NeutrinoWeighting::neutrino_weight(const TLorentzVector& neutrino1, const TLorentzVector& neutrino2, double met_ex, double met_ey) const { + const double dx = met_ex - neutrino1.Px() - neutrino2.Px(); + const double dy = met_ey - neutrino1.Py() - neutrino2.Py(); + + return exp(- dx * dx / (2. * sigmax * sigmax) - dy * dy / (2. * sigmay * sigmay)); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PTMaxReco.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PTMaxReco.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9fc9fd90a0168e621bbdc586a71c4072d6045b3f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PTMaxReco.cxx @@ -0,0 +1,115 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/PTMaxReco.h" + +#include "TopEvent/Event.h" + +namespace top { + +PTMaxReco::PTMaxReco() : m_wmass(80400.), m_topmass(172500.) { +} + +PTMaxReco::~PTMaxReco() { +} + +bool PTMaxReco::apply(const top::Event& event) const { + //get the hadronic top + + //jets that make-up the hadronic top quark + const xAOD::Jet* jet1 = nullptr; + const xAOD::Jet* jet2 = nullptr; + const xAOD::Jet* jet3 = nullptr; + + double maxptsq = 0.; + for (xAOD::JetContainer::const_iterator j1 = event.m_jets.begin(); j1 != event.m_jets.end(); ++j1) { + for (xAOD::JetContainer::const_iterator j2 = j1 + 1; j2 != event.m_jets.end(); ++j2) { + for (xAOD::JetContainer::const_iterator j3 = j2 + 1; j3 != event.m_jets.end(); ++j3) { + const double px = (*j1)->px() + (*j2)->px() + (*j3)->px(); + const double py = (*j1)->py() + (*j2)->py() + (*j3)->py(); + + //pt2 to avoid the slow sqrt + const double ptsq = px * px + py * py; + + if (ptsq > maxptsq) { + jet1 = (*j1); + jet2 = (*j2); + jet3 = (*j3); + } + } + } + } + + //get the leptonic top + + //e+jets + TLorentzVector lepton; + if (event.m_electrons.size() == 1) + lepton = event.m_electrons.at(0)->p4(); + + //mu+jets + if (event.m_muons.size() == 1) + lepton = event.m_muons.at(0)->p4(); + + TLorentzVector nu = neutrinoCandidate(lepton, *event.m_met, true); + + const xAOD::Jet* lepb = nullptr; + double topdiff = 1000000.; + for (xAOD::JetContainer::const_iterator j1 = event.m_jets.begin(); j1 != event.m_jets.end(); ++j1) { + //ignore the three jets that make-up the hadronic top quark + if (*j1 == jet1 || *j1 == jet2 || *j1 == jet3) + continue; + + //pick the jet which makes a leptonic top closest to the true top mass + const double tempdiff = fabs((lepton + nu + (*j1)->p4()).M()); + + if ((tempdiff - m_topmass) < topdiff) { + lepb = *j1; + topdiff = tempdiff; + } + } + + std::cout << lepb->pt() << std::endl; + + return true; +} + +TLorentzVector PTMaxReco::neutrinoCandidate(const TLorentzVector& lep, const xAOD::MissingET& met, bool dealWithNegative_nu) const { + const double px = met.mpx(); + const double py = met.mpy(); + + // solve quadratic to find neutrino four vector + double alpha = pow(m_wmass,2) + pow((px+lep.Px()),2)+pow((py+lep.Py()),2) -pow(lep.E(),2); + double beta = 0.5 * ( alpha-pow(met.met(),2) + pow(lep.Pz(), 2) ); + double gamma = -( beta*beta - ( pow(lep.E(),2)*pow(met.met(), 2) ) ) / ( pow(lep.E(),2)-pow(lep.Pz(), 2) ); + double lambda = 2. * beta * lep.Pz() / (pow(lep.E(), 2)-pow(lep.Pz(), 2)); + double delta = pow(lambda,2) - 4 * gamma; + + if (delta < 0) { // ignore non real solutions + if (dealWithNegative_nu) + delta = 0; + else + return TLorentzVector(); + } + + delta = sqrt(delta); + + double pz_pos = (lambda+delta) / 2.; + double pz_neg = (lambda-delta) / 2.; + + double pz = 0.0; + + if (fabs(pz_pos) > fabs(pz_neg)) + pz = pz_neg; + else + pz = pz_pos; + + double e = sqrt(px*px + py*py + pz*pz); + + TLorentzVector neutrino; + neutrino.SetPxPyPzE(px, py, pz, e); + return neutrino; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopReco.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopReco.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3895c0fd436e0e656ae23c789aaa2ad9ba30aeb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopReco.cxx @@ -0,0 +1,388 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// definitions taken from the MAMbo code here: https://twiki.cern.ch/twiki/bin/view/Main/MAMbo + +// Local include(s): +#include "TopEventReconstructionTools/PseudoTopReco.h" +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" +#include "PathResolver/PathResolver.h" + +#include <algorithm> + +namespace top{ + + PseudoTopReco::PseudoTopReco( const std::string& name) : + asg::AsgTool( name ), + m_config(nullptr), + m_bTagCutValue(9999.9), + m_leptonType("SetMe") + { + declareProperty( "config" , m_config , "Set the configuration" ); + declareProperty( "LeptonType", m_leptonType = "kUndefined" , "Define the lepton type" ); + } + + /// Function initialising the tool + StatusCode PseudoTopReco::initialize() + { + // Have you set the config?? + if (m_config == nullptr) { + ATH_MSG_ERROR("Please set the top::TopConfig"); + return StatusCode::FAILURE; + } + + m_config->setPseudoTop(); + + // Figure out the b tagging working point + if (m_config->bTagWP_available().size() != 1) { + ATH_MSG_INFO(m_config->bTagWP_available().size()<<" b-tagging WP - cannot pick b-jets. Please select only 1 WP if you want to use the PseudoTop reconstruction"); + } + + + ATH_MSG_INFO("++++++++++++++++++++++++++++++"); + ATH_MSG_INFO(" Using Lepton \t" << m_leptonType); + ATH_MSG_INFO("++++++++++++++++++++++++++++++"); + + /// Return gracefully: + return StatusCode::SUCCESS; + } + + /// Function executing the tool + StatusCode PseudoTopReco::execute(const top::Event& event) + { + + // Create the partonHistory xAOD object + xAOD::PseudoTopResultAuxContainer* pseudoTopAuxCont = new xAOD::PseudoTopResultAuxContainer{}; + xAOD::PseudoTopResultContainer* pseudoTop = new xAOD::PseudoTopResultContainer{}; + pseudoTop->setStore( pseudoTopAuxCont ); + + xAOD::PseudoTopResult* PseudoTopResult = new xAOD::PseudoTopResult{}; + pseudoTop -> push_back( PseudoTopResult ); + + PseudoTopResult -> IniVar(true); + + // fill either reco particles or truth particles into four vectors + // store them in GeV + // check if particle/jet is b-tagged + // check if electron or muon channel + // store output so that it can be written later to the event saver + + m_bJets.clear(); + m_lightJets.clear(); + + // get the MET x and y components for the reconstruction + m_nu_px = event.m_met->mpx() / 1.e3; + m_nu_py = event.m_met->mpy() / 1.e3; + m_met_et = sqrt(m_nu_px*m_nu_px + m_nu_py*m_nu_py); + + SetJetInfo(event); + SetChargedLeptonInfo(event); + + if(m_bJets.size() == 2 && m_lightJets.size() >= 2){ + + ReconstructLeptonicW(); + RunReconstruction(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_lep_pt" ) = m_top_lep.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_lep_eta" ) = m_top_lep.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_lep_phi" ) = m_top_lep.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_lep_m" ) = m_top_lep.M(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_had_pt" ) = m_top_had.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_had_eta" ) = m_top_had.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_had_phi" ) = m_top_had.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_top_had_m" ) = m_top_had.M(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_ttbar_pt" ) = m_ttbar.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_ttbar_eta" ) = m_ttbar.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_ttbar_phi" ) = m_ttbar.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Reco_ttbar_m" ) = m_ttbar.M(); + + } + else{ + + // std::cout<< "NOT ENOUGH BJETS!!!" << std::endl; + + } + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyPseudoTop(event.m_hashValue); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( pseudoTop , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( pseudoTopAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + /// Return gracefully: + return StatusCode::SUCCESS; + } + + StatusCode PseudoTopReco::execute(const top::ParticleLevelEvent& plEvent) + { + + // Create the pseudoTopHistory xAOD object + xAOD::PseudoTopResultAuxContainer* pseudoTopAuxCont = new xAOD::PseudoTopResultAuxContainer{}; + xAOD::PseudoTopResultContainer* pseudoTop = new xAOD::PseudoTopResultContainer{}; + pseudoTop->setStore( pseudoTopAuxCont ); + + xAOD::PseudoTopResult* PseudoTopResult = new xAOD::PseudoTopResult{}; + pseudoTop->push_back( PseudoTopResult ); + + PseudoTopResult -> IniVar(false); + + + m_bJets.clear(); + m_lightJets.clear(); + + // get the MET x and y components for the reconstruction + m_nu_px = plEvent.m_met->mpx() / 1.e3; + m_nu_py = plEvent.m_met->mpy() / 1.e3; + m_met_et = sqrt(m_nu_px*m_nu_px + m_nu_py*m_nu_py); + + SetJetInfo(plEvent); + SetChargedLeptonInfo(plEvent); + + if(m_bJets.size() == 2 && m_lightJets.size() >= 2){ + + ReconstructLeptonicW(); + RunReconstruction(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_lep_pt" ) = m_top_lep.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_lep_eta" ) = m_top_lep.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_lep_phi" ) = m_top_lep.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_lep_m" ) = m_top_lep.M(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_had_pt" ) = m_top_had.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_had_eta" ) = m_top_had.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_had_phi" ) = m_top_had.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_top_had_m" ) = m_top_had.M(); + + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_ttbar_pt" ) = m_ttbar.Pt(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_ttbar_eta" ) = m_ttbar.Eta(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_ttbar_phi" ) = m_ttbar.Phi(); + PseudoTopResult->auxdecor< float >( "PseudoTop_Particle_ttbar_m" ) = m_ttbar.M(); + + + + } + else{ + + // std::cout << "NOT ENOUGH BJETS!!!" << std::endl; + + } + + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyPseudoTop(0); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( pseudoTop , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( pseudoTopAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + /// Return gracefully: + return StatusCode::SUCCESS; + } + + + bool PseudoTopReco::SetChargedLeptonInfo(const top::Event& event){ + + if (m_leptonType == "kElectron") { + m_lepton.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 ); + } + else if (m_leptonType == "kMuon") { + m_lepton.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); + } + else { + ATH_MSG_ERROR(" Please supply a valid LeptonType : kElectron or kMuon"); + return false; + } + + return true; + + } + + bool PseudoTopReco::SetChargedLeptonInfo(const top::ParticleLevelEvent& plEvent){ + + if (m_leptonType == "kElectron") { + m_lepton.SetPtEtaPhiE( plEvent.m_electrons->at(0)->pt()/1.e3 , plEvent.m_electrons->at(0)->eta(), plEvent.m_electrons->at(0)->phi(), plEvent.m_electrons->at(0)->e() / 1.e3 ); + } + else if (m_leptonType == "kMuon") { + m_lepton.SetPtEtaPhiE( plEvent.m_muons->at(0)->pt()/1.e3 , plEvent.m_muons->at(0)->eta(), plEvent.m_muons->at(0)->phi(), plEvent.m_muons->at(0)->e() / 1.e3 ); + } + else { + ATH_MSG_ERROR(" Please supply a valid LeptonType : kElectron or kMuon"); + return false; + } + + return true; + + } + + + bool PseudoTopReco::SetJetInfo(const top::Event& event){ + + int bCounter = 0; + + for (const auto* const jetPtr : event.m_jets) { + + TLorentzVector helpVec(0, 0, 0, 0); + helpVec.SetPtEtaPhiE( jetPtr->pt() / 1.e3 , jetPtr->eta() , jetPtr->phi() , jetPtr->e() / 1.e3); + + // if more than two b-jets are available, consider third leading b-tagged jet as light jet! + std::string out = m_config->bTagWP_available()[0]; + + const bool hasbTagFlag = jetPtr->isAvailable<char>("isbtagged_"+out); + + if (hasbTagFlag) { + if (jetPtr->auxdataConst<char>("isbtagged_"+out) && bCounter < 2) { + m_bJets.push_back(helpVec); + + bCounter++; + } + else{ + m_lightJets.push_back(helpVec); + } + } + } // end loop over jets + + + return true; + + } + + + bool PseudoTopReco::SetJetInfo(const top::ParticleLevelEvent& plEvent){ + + // if more than two b-jets are available, consider third leading b-tagged jet as light jet! + + int bCounter = 0; + + for (const auto & jetPtr : * plEvent.m_jets) { + + TLorentzVector helpVec(0, 0, 0, 0); + helpVec.SetPtEtaPhiE( jetPtr->pt() / 1.e3 , jetPtr->eta() , jetPtr->phi() , jetPtr->e() / 1.e3); + + int nGhosts = jetPtr->auxdata<int>( "GhostBHadronsFinalCount" ); + + if(nGhosts >= 1 && bCounter < 2){ + m_bJets.push_back(helpVec); + bCounter++; + } + else + m_lightJets.push_back(helpVec); + } + + return true; + + } + + + bool PseudoTopReco::RunReconstruction(){ + + double bestwmass = 999.e9; + TLorentzVector Whelp(0, 0, 0, 0); + + // get first the b-jet closest to the lepton in dR + // define this as TLorentzVector m_b_lep; + // take now remaining b-jet as m_b_had + double dRb1 = m_bJets[0].DeltaR(m_lepton); + double dRb2 = m_bJets[1].DeltaR(m_lepton); + + if(dRb1 < dRb2){ + m_b_lep = m_bJets[0]; + m_b_had = m_bJets[1]; + } + else{ + m_b_lep = m_bJets[1]; + m_b_had = m_bJets[0]; + } + + // then loop over all light jets + // take combination which is closest to mW (PDG) + for(unsigned int iJet = 0; iJet < m_lightJets.size(); ++iJet){ + for(unsigned int kJet = 0; kJet < m_lightJets.size(); ++kJet){ + + if(iJet == kJet) + continue; + + Whelp = m_lightJets[iJet] + m_lightJets[kJet]; + + if(fabs(mWPDG - Whelp.M()) < fabs(mWPDG - bestwmass)){ + + m_W_had = Whelp; + bestwmass = Whelp.M(); + + } + + } + } + + // define now the top and ttbar four-vectors + m_top_lep = m_W_lep + m_b_lep; + m_top_had = m_W_had + m_b_had; + m_ttbar = m_top_lep + m_top_had; + + return true; + + } + + bool PseudoTopReco::ReconstructLeptonicW() + { + + double v_pz = -KinemEdge; + double delta = -KinemEdge; + + // lepton already made by reco or particle levels: + double l_px = m_lepton.Px(); double l_py = m_lepton.Py(); double l_pz = m_lepton.Pz(); + double l_m = m_lepton.M(); double l_E = m_lepton.E(); + + double mdiff = 0.5 * ( mWPDG*mWPDG - l_m*l_m ); + double pT_vl = m_nu_px*l_px + m_nu_py*l_py; + + double a = l_E*l_E - l_pz*l_pz; + double b = -2. * l_pz * ( mdiff + pT_vl ); + double c = m_met_et*m_met_et*l_E*l_E - mdiff*mdiff - pT_vl*pT_vl - 2.*mdiff*pT_vl; + + delta = b*b - 4.*a*c; + + if( delta <= 0. ) { + // take only the real part + v_pz = -0.5*b/a; + } else { + double v_pz_1 = 0.5 * ( -b - sqrt(delta) ) / a; + double v_pz_2 = 0.5 * ( -b + sqrt(delta) ) / a; + + v_pz = ( fabs(v_pz_1) > fabs(v_pz_2) ) ? v_pz_2 : v_pz_1; + + } + + double v_E = sqrt( m_met_et*m_met_et + v_pz*v_pz ); + + m_neutrino.SetPxPyPzE( m_nu_px, m_nu_py, v_pz, v_E ); + + m_W_lep = m_neutrino + m_lepton; + + return true; + + } + + + /// Function finalizing the tool + StatusCode PseudoTopReco::finalize() + { + /// Return gracefully: + return StatusCode::SUCCESS; + } + + + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopRecoRun.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopRecoRun.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f12493ee40f03363026cca298b860d54ec7941a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/PseudoTopRecoRun.cxx @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/PseudoTopRecoRun.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include <iostream> +#include <vector> +#include <cmath> +#include <fstream> + +namespace top{ + + PseudoTopRecoRun::PseudoTopRecoRun(const std::string& kLeptonType, std::shared_ptr<top::TopConfig> config) : + m_name("RECO::PseudoTopRecoRun_" + kLeptonType), + m_PseudoTopReco(nullptr) + { + + m_PseudoTopReco = std::unique_ptr<top::PseudoTopReco> ( new top::PseudoTopReco( m_name ) ); + top::check( m_PseudoTopReco->setProperty("config", config ), "Failed to setProperty of PseudoTopReco" ); + top::check( m_PseudoTopReco->setProperty("LeptonType", kLeptonType), "Failed to setProperty of PseudoTopReco" ); + //top::check( m_PseudoTopReco->setProperty("RecoType", kRecoType), "Failed to setProperty of PseudoTopReco" ); + top::check( m_PseudoTopReco->initialize() , "Failed to initialize PseudoTopRecoTool" ); + + } + + bool PseudoTopRecoRun::apply(const top::Event& event) const + { + top::check( m_PseudoTopReco->execute(event) , "Failed to run PseudoTopReco" ); + return true; + } + + bool PseudoTopRecoRun::applyParticleLevel(const top::ParticleLevelEvent& plEvent) const + { + top::check( m_PseudoTopReco->execute(plEvent) , "Failed to run PseudoTopReco" ); + return true; + } + + std::string PseudoTopRecoRun::name() const { + return m_name; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Sonnenschein.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Sonnenschein.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2c774ba9c53c18d69d69c1680860b3f48b562cd2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/Sonnenschein.cxx @@ -0,0 +1,107 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/Sonnenschein.h" +#include "TopEvent/Event.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertex.h" + +#include <iostream> + +namespace top { + +Sonnenschein::Sonnenschein() { +} + +Sonnenschein::~Sonnenschein() { +} + +bool Sonnenschein::tWb(const top::Event& event, int start, TLorentzVector& t, TLorentzVector& W, TLorentzVector& b, TLorentzVector& l, TLorentzVector& nu) const { + bool hasT = false; + bool hasB = false; + bool hasL = false; + bool hasNu = false; + + for (const xAOD::TruthParticle* particle : *event.m_truth) { + if (particle->pdgId() == start) { + //std::cout << *particle << std::endl; + t = particle->p4(); + hasT = true; + + if (particle->hasDecayVtx()) { + const xAOD::TruthVertex* vtx = particle->decayVtx(); + for (size_t i = 0; i < vtx->nOutgoingParticles(); ++i) { + const xAOD::TruthParticle* tDecayProduct = vtx->outgoingParticle(i); + //std::cout << " " << *tDecayProduct << std::endl; + + if (abs(tDecayProduct->pdgId()) == 24 && tDecayProduct->hasDecayVtx()) { + W = tDecayProduct->p4(); + + const xAOD::TruthVertex* wDecayVtx = tDecayProduct->decayVtx(); + for (size_t j = 0; j < wDecayVtx->nOutgoingParticles(); ++j) { + const xAOD::TruthParticle* wDecayProduct = wDecayVtx->outgoingParticle(j); + //std::cout << " " << *wDecayProduct << std::endl; + + if (abs(wDecayProduct->pdgId()) == 11 || abs(wDecayProduct->pdgId()) == 13 || abs(wDecayProduct->pdgId()) == 15) { + l = wDecayProduct->p4(); + hasL = true; + } + + if (abs(wDecayProduct->pdgId()) == 12 || abs(wDecayProduct->pdgId()) == 14 || abs(wDecayProduct->pdgId()) == 16) { + nu = wDecayProduct->p4(); + hasNu = true; + } + + } + } else if (abs(tDecayProduct->pdgId()) == 5) { + b = tDecayProduct->p4(); + hasB = true; + } + } + } + } + } + + return hasT && hasB && hasL && hasNu; +} + +bool Sonnenschein::apply(const top::Event& event) const { + TLorentzVector t; + TLorentzVector Wp; + TLorentzVector b; + TLorentzVector lp; + TLorentzVector nu; + bool cando1 = tWb(event, 6, t, Wp, b, lp, nu); + + TLorentzVector tbar; + TLorentzVector Wm; + TLorentzVector bbar; + TLorentzVector lm; + TLorentzVector nubar; + bool cando2 = tWb(event, -6, tbar, Wm, bbar, lm, nubar); + + //isn't dilepton at truth level, so return + if (!cando1 || !cando2) + return true; + + const double met_ex = nu.Px() + nubar.Px(); + const double met_ey = nu.Py() + nubar.Py(); + + //solve + std::vector<std::pair<TLorentzVector, TLorentzVector>> allSolutions = m_sonn.solve(lp, b, t.M(), Wp.M(), lm, bbar, tbar.M(), Wm.M(), met_ex, met_ey); + + std::cout << "EVENT" << std::endl; + unsigned int counter = 0; + for (const auto& possible : allSolutions) { + std::cout << "Possible solution number " << counter << "\n"; + std::cout << " first neutrino : " << possible.first << "\n"; + std::cout << " second neutrino: " << possible.second << "\n"; + ++counter; + } + + return true; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/SonnenscheinEngine.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/SonnenscheinEngine.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aaa2683543a2c5d3b4ecc9e90c7440171e5fcc29 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/SonnenscheinEngine.cxx @@ -0,0 +1,536 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/SonnenscheinEngine.h" + +#include "TopEvent/Event.h" //for TLorentzVector << + +#include <iostream> +#include <iomanip> +#include <cmath> + +namespace top { + +SonnenscheinEngine::SonnenscheinEngine() : m_debug(false) { +} + +SonnenscheinEngine::~SonnenscheinEngine() { +} + +std::vector<std::pair<TLorentzVector, TLorentzVector> > SonnenscheinEngine::solve(const TLorentzVector& me_t_lp, const TLorentzVector& me_t_b, double mass_t, double mass_wp, const TLorentzVector& me_tbar_lm, const TLorentzVector& me_tbar_bbar, double mass_tbar, double mass_wm, double me_mex, double me_mey) const { + std::vector<std::pair<TLorentzVector, TLorentzVector> > lvs; + + if (m_debug) { + std::cout << "Starting SOLVE\n"; + std::cout << "lp " << me_t_lp << "\n"; + std::cout << "lm " << me_tbar_lm << "\n"; + std::cout << "b " << me_t_b << "\n"; + std::cout << "bbar " << me_tbar_bbar << "\n"; + std::cout << "met_ex " << me_mex << "\n"; + std::cout << "met_ey " << me_mey << "\n"; + std::cout << "mt " << mass_t << "\n"; + std::cout << "mtbar " << mass_tbar << "\n"; + std::cout << "mWp " << mass_wp << "\n"; + std::cout << "mWm " << mass_wm << "\n"; + } + + const double Elp = me_t_lp.E(); + const double mlp = me_t_lp.M(); + const double plpx = me_t_lp.Px(); + const double plpy = me_t_lp.Py(); + const double plpz = me_t_lp.Pz(); + const TVector3 plp = 1. * me_t_lp.Vect(); + + const double Eb = me_t_b.E(); + const double pbx = me_t_b.Px(); + const double pby = me_t_b.Py(); + const double pbz = me_t_b.Pz(); + const double mb = me_t_b.M(); + const TVector3 pb = 1. * me_t_b.Vect(); + + + const double Elm = me_tbar_lm.E(); + const double mlm = me_tbar_lm.M(); + const double plmx = me_tbar_lm.Px(); + const double plmy = me_tbar_lm.Py(); + const double plmz = me_tbar_lm.Pz(); + const TVector3 plm = me_tbar_lm.Vect(); + + const double Ebbar = me_tbar_bbar.E(); + const double pbbarx = me_tbar_bbar.Px(); + const double pbbary = me_tbar_bbar.Py(); + const double pbbarz = me_tbar_bbar.Pz(); + const double mbbar = me_tbar_bbar.M(); + const TVector3 pbbar = me_tbar_bbar.Vect(); + + if (m_debug) { + std::cout << "mex and mey " << me_mex << " " << me_mey << "\n"; + std::cout << "Starting Calculation\n"; + std::cout << "Calculating a\n"; + } + + double a1 = (Eb + Elp)*(mass_wp * mass_wp - mlp * mlp) + - Elp * (mass_t * mass_t - mb * mb - mlp * mlp) + + 2 * Eb * Elp * Elp - 2 * Elp * pb * plp; + + double a2 = 2 * (Eb * plpx - Elp * pbx); + double a3 = 2 * (Eb * plpy - Elp * pby); + double a4 = 2 * (Eb * plpz - Elp * pbz); + + if (m_debug) { + std::cout << "a1 : " << a1 << "\n"; + std::cout << "a2 : " << a2 << "\n"; + std::cout << "a3 : " << a3 << "\n"; + std::cout << "a4 : " << a4 << "\n"; + + //double pvx = nu->Px() ; + //double pvy = nu->Py() ; + //double pvz = nu->Pz() ; + //std::cout << a1 + a2 * pvx + a3 * pvy + a4 * pvz << "\n"; + } + + double b1 = (Ebbar + Elm)*(mass_wm * mass_wm - mlm * mlm) + - Elm * (mass_tbar * mass_tbar - mbbar * mbbar - mlm * mlm) + + 2 * Ebbar * Elm * Elm - 2 * Elm * pbbar * plm; + + double b2 = 2 * (Ebbar * plmx - Elm * pbbarx); + double b3 = 2 * (Ebbar * plmy - Elm * pbbary); + double b4 = 2 * (Ebbar * plmz - Elm * pbbarz); + + if (m_debug) { + std::cout << "Calculating b\n"; + std::cout << "b1 : " << b1 << "\n"; + std::cout << "b2 : " << b2 << "\n"; + std::cout << "b3 : " << b3 << "\n"; + std::cout << "b4 : " << b4 << "\n"; + + //std::cout << "Checking b" << "\n"; + + //double pvbarx = nu2->Px() ; + //double pvbary = nu2->Py() ; + //double pvbarz = nu2->Pz() ; + + //std::cout << b1 + b2 * pvbarx + b3 * pvbary + b4 * pvbarz << "\n"; + + std::cout << "Calculating c\n"; + } + + double c22 = (mass_wp * mass_wp - mlp * mlp) * (mass_wp * mass_wp - mlp * mlp) + -4 * (Elp * Elp - plpz * plpz) * (a1 / a4) * (a1 / a4) + -4 * (mass_wp * mass_wp - mlp * mlp) * plpz * a1 / a4; + + double c21 = 4 * (mass_wp * mass_wp - mlp * mlp) * (plpx - plpz * a2 / a4) //? + -8 * (Elp * Elp - plpz * plpz) * a1 * a2 / (a4 * a4) + -8 * plpx * plpz * a1 / a4; + + double c20 = -4 * (Elp * Elp - plpx * plpx) + -4 * (Elp * Elp - plpz * plpz)*(a2 / a4)*(a2 / a4) + -8 * plpx * plpz * a2 / a4; + + double c11 = 4 * (mass_wp * mass_wp - mlp * mlp) * (plpy - plpz * a3 / a4) + -8 * (Elp * Elp - plpz * plpz) * a1 * a3 / (a4 * a4) + -8 * plpy * plpz * a1 / a4; + + double c10 = -8 * (Elp * Elp - plpz * plpz) * a2 * a3 / (a4 * a4) + +8 * plpx * plpy + -8 * plpx * plpz * a3 / a4 + -8 * plpy * plpz * a2 / a4; + + double c00 = -4 * (Elp * Elp - plpy * plpy) + -4 * (Elp * Elp - plpz * plpz) * (a3 / a4) * (a3 / a4) + -8 * plpy * plpz * a3 / a4; + + /* + for cross check - the original paper used these definitions. + similar for dp. + */ + c22 = a4 * a4 * c22; + c21 = a4 * a4 * c21; + c20 = a4 * a4 * c20; + c11 = a4 * a4 * c11; + c10 = a4 * a4 * c10; + c00 = a4 * a4 * c00; + + if (m_debug) { + std::cout << "c22 : " << c22 << "\n"; + std::cout << "c21 : " << c21 << "\n"; + std::cout << "c20 : " << c20 << "\n"; + std::cout << "c11 : " << c11 << "\n"; + std::cout << "c10 : " << c10 << "\n"; + std::cout << "c00 : " << c00 << "\n"; + + //std::cout "c=0? " << + //c22 + //+ c21 * pvx + //+ c11 * pvy + //+ c20 * pvx * pvx + //+ c10 * pvx * pvy + //+ c00 * pvy * pvy + //<<"\n"; + + std::cout << "Calculating d'\n"; + } + + double dp22 = pow( mass_wm * mass_wm - mlm * mlm, 2) + -4 * (Elm * Elm - plmz * plmz) * (b1 / b4) * (b1 / b4) + -4 * (mass_wm * mass_wm - mlm * mlm) * plmz * b1 / b4; + + double dp21 = 4 * (mass_wm * mass_wm - mlm * mlm) * (plmx - plmz * b2 / b4) + -8 * (Elm * Elm - plmz * plmz) * b1 * b2 / (b4 * b4) + -8 * plmx * plmz * b1 / b4; + + double dp20 = -4 * (Elm * Elm - plmx * plmx) + -4 * (Elm * Elm - plmz * plmz)*(b2 / b4)*(b2 / b4) + -8 * plmx * plmz * b2 / b4; + + double dp11 = 4 * (mass_wm * mass_wm - mlm * mlm) * (plmy - plmz * b3 / b4) + -8 * (Elm * Elm - plmz * plmz) * b1 * b3 / (b4 * b4) + -8 * plmy * plmz * b1 / b4; + + double dp10 = -8 * (Elm * Elm - plmz * plmz) * b2 * b3 / (b4 * b4) + +8 * plmx * plmy + -8 * plmx * plmz * b3 / b4 + -8 * plmy * plmz * b2 / b4; + + double dp00 = -4 * (Elm * Elm - plmy * plmy) + -4 * (Elm * Elm - plmz * plmz) * (b3 / b4) * (b3 / b4) + -8 * plmy * plmz * b3 / b4; + + dp22 = b4 * b4 * dp22; + dp21 = b4 * b4 * dp21; + dp20 = b4 * b4 * dp20; + dp11 = b4 * b4 * dp11; + dp10 = b4 * b4 * dp10; + dp00 = b4 * b4 * dp00; + + if (m_debug) { + std::cout << "dp22 : " << dp22 << "\n"; + std::cout << "dp21 : " << dp21 << "\n"; + std::cout << "dp20 : " << dp20 << "\n"; + std::cout << "dp11 : " << dp11 << "\n"; + std::cout << "dp10 : " << dp10 << "\n"; + std::cout << "dp00 : " << dp00 << "\n"; + + //in the paper for c and dp c21 appears twice. is this right? + //std::cout << "dp=0? " << + //dp22 + //+ dp21 * pvbarx + //+ dp11 * pvbary + //+ dp20 * pvbarx * pvbarx + //+ dp10 * pvbarx * pvbary + //+ dp00 * pvbary * pvbary + //<<"\n"; + + std::cout << "Calculating d\n"; + } + + const double d22 = dp22 + + me_mex * me_mex * dp20 + + me_mey * me_mey * dp00 + + me_mex * me_mey * dp10 + + me_mex * dp21 + + me_mey * dp11; + + const double d21 = -1 * dp21 + -2 * me_mex * dp20 + - me_mey * dp10; + + const double d20 = dp20; + const double d11 = -1 * dp11 + - 2 * me_mey * dp00 + - me_mex * dp10; + + const double d10 = dp10; + const double d00 = dp00; + + if (m_debug) { + std::cout << "d22 : " << d22 << "\n"; + std::cout << "d21 : " << d21 << "\n"; + std::cout << "d20 : " << d20 << "\n"; + std::cout << "d11 : " << d11 << "\n"; + std::cout << "d10 : " << d10 << "\n"; + std::cout << "d00 : " << d00 << "\n"; + + //std::cout << "d " << + //d22 + //+d21 * pvx + //+d11 * pvy + //+d20 * pvx * pvx + //+d10 * pvx * pvy + //+d00 * pvy * pvy + //<< "\n"; + + std::cout << "Calculating h\n"; + } + + const double h4 = c00 * c00 * d22 * d22 + + c11 * d22 * (c11 * d00 - c00 * d11) + + c00 * c22 * (d11 * d11 - 2 * d00 * d22) + + c22 * d00 * (c22 * d00 - c11 * d11); + + const double h3 = c00 * d21 * (2 * c00 * d22 - c11 * d11) + + c00 * d11 * (2 * c22 * d10 + c21 * d11) + + c22 * d00 * (2 * c21 * d00 - c11 * d10) + - c00 * d22 * (c11 * d10 + c10 * d11) + -2 * c00 * d00 *(c22 * d21 + c21 * d22) + - d00 * d11 * (c11 * c21 + c10 * c22) + + c11 * d00 * (c11 * d21 + 2 * c10 * d22); + + const double h2 = c00 * c00 * (2 * d22 * d20 + d21 * d21) + - c00 * d21 * (c11 * d10 + c10 * d11) + + c11 * d20 * (c11 * d00 - c00 * d11) + + c00 * d10 * (c22 * d10 - c10 * d22) + + c00 * d11 * (2 * c21 * d10 + c20 * d11) + + (2 * c22 * c20 + c21 * c21) * d00 * d00 + - 2 * c00 * d00 * (c22 * d20 + c21 * d21 + c20 * d22) + + c10 * d00 * (2 * c11 * d21 + c10 * d22) + - d00 * d10 * (c11 * c21 + c10 * c22) + - d00 * d11 * (c11 * c20 + c10 * c21); + + /* + * leave! + */ + /* + double h1 = c00 * d21 * (2 * c00 * d20 - c10 * d10) + - c00 * d20 * (c11 * d10 + c10 * d11) + + c00 * d10 * (c21 * d10 + 2 * c20 * d11) + -2 * c00 * d00 * (c21 * d20 + c20 * d21) + + c10 * d00 * (2 * c11 * d20 + c10 * d21) + - c20 * d00 * (2 * c21 * d00 - c10 * d11) + - d00 * d10 * (c11 * c20 + c10 * c21); + */ + + const double h1 = c00 * d21 * (2 * c00 * d20 - c10 * d10) + - c00 * d20 * (c11 * d10 + c10 * d11) + + c00 * d10 * (c21 * d10 + 2 * c20 * d11) + -2 * c00 * d00 * (c21 * d20 + c20 * d21) + + c10 * d00 * (2 * c11 * d20 + c10 * d21) + + c20 * d00 * (2 * c21 * d00 - c10 * d11) + - d00 * d10 * (c11 * c20 + c10 * c21); + + const double h0 = c00 * c00 * d20 * d20 + + c10 * d20 * (c10 * d00 - c00 * d10) + + c20 * d10 * (c00 * d10 - c10 * d00) + + c20 * d00 * (c20 * d00 - 2 * c00 * d20); + + if (m_debug) { + std::cout << "h4 : " << h4 << "\n"; + std::cout << "h3 : " << h3 << "\n"; + std::cout << "h2 : " << h2 << "\n"; + std::cout << "h1 : " << h1 << "\n"; + std::cout << "h0 : " << h0 << "\n"; + + std::cout << "Messy Calculate Over\n"; + + //function is h0 pvx ^4 + h1 pvx ^3 + h2 pvx ^2 + h3 pvx + h4 + + std::cout << "gnuplot command\n"; + + std::stringstream s; + s << h0/h0 << "*x*x*x*x + " << + h1/h0 << "*x*x*x + " << + h2/h0<< "*x*x + " << + h3/h0 << "*x + " << h4/h0; + + std::string fn = s.str(); + + std::cout << "plot " << fn << "\n"; + } + + std::vector<double> pvxs = solveQuartic(h0, h1, h2, h3, h4); + + if (m_debug) { + std::cout << "--------------------------\n"; + std::cout << "Kinematic Solutions\n"; + } + + int num = 0; + + for (std::vector<double>::const_iterator it = pvxs.begin(); it != pvxs.end(); ++it, ++num) { + double pvx = *it; + + double pvbarx = me_mex - *it; + + double c0 = c00; + double d0 = d00; + + double c1 = c10 * pvx + c11; + double c2 = c20 * pvx * pvx + c21 * pvx + c22; + + double d1 = d10 * pvx + d11; + double d2 = d20 * pvx * pvx + d21 * pvx + d22; + + double pvy = (c0 * d2 - c2 * d0) / (c1 * d0 - c0 * d1); + double pvbary = me_mey - pvy; + + double pvz = (a1 + a2 * pvx + a3 * pvy) / (-a4); + double pvbarz = (b1 + b2 * pvbarx + b3 * pvbary) / (-b4); + + double pvE = sqrt(pvx*pvx + pvy*pvy + pvz*pvz); + double pvbarE = sqrt(pvbarx*pvbarx + pvbary*pvbary + pvbarz*pvbarz); + + TLorentzVector tlv1(pvx,pvy,pvz,pvE); + TLorentzVector tlv2(pvbarx,pvbary,pvbarz,pvbarE); + + if (m_debug) { + std::cout << "Solution " << num << "\n"; + std::cout << tlv1 << std::endl; + std::cout << tlv2 << std::endl; + std::cout << "----------" << "\n"; + } + + std::pair<TLorentzVector, TLorentzVector> p(tlv1,tlv2); + + lvs.push_back(p); + } + + if (m_debug) + std::cout << "Finished Kinematic Solution" << "\n"; + + return lvs; +} + +std::vector<double> SonnenscheinEngine::solveQuartic(double h0, double h1, double h2, double h3, double h4) const { + if (m_debug) + std::cout << "Solve Quartic\n"; + + //normalise to coefficient of highest order. + const double nh1 = h1 / h0; + const double nh2 = h2 / h0; + const double nh3 = h3 / h0; + const double nh4 = h4 / h0; + + //calculate variables + const double k1 = nh2 - 3 * nh1 * nh1 / 8.; + const double k2 = nh3 + nh1 * nh1 * nh1 / 8. - nh1 * nh2 / 2.; + const double k3 = nh4 - 3 * pow(nh1, 4) / 256. + nh1 * nh1 * nh2 / 16. - nh1 * nh3 / 4.; + + if (m_debug) { + std::cout << "e " << k1 << "\n"; + std::cout << "f " << k2 << "\n"; + std::cout << "g " << k3 << "\n"; + } + + std::vector<double> sols = solveCubic(2. * k1, k1 * k1 -4. * k3, -k2 * k2); + + //using the solutions from above... + double t1 = -1.; + + for (std::vector<double>::const_iterator it = sols.begin(); it != sols.end(); ++it) { + if (*it > 0.) + t1 = sqrt(*it); + } + + //we just need one positive root to get the other roots... + + double t2 = (k1 + t1 * t1 - k2 / t1) / 2.; + + if (m_debug) + std::cout << "first quadratic\n"; + + std::vector<double> s1 = solveQuadratic(1., t1, t2); + + std::vector<double> pvxs; + + for (std::vector<double>::const_iterator it = s1.begin(); it != s1.end(); ++it) { + + if (m_debug) + std::cout << "pvx " << *it - nh1 / 4. << "\n"; + + pvxs.push_back(*it - nh1 / 4.); + } + + //now use the other quadratic + if (m_debug) + std::cout << "second quadratic\n"; + + std::vector<double> s2 = solveQuadratic(1., -t1, k3 / t2); + + for (std::vector<double>::const_iterator it = s2.begin(); it != s2.end(); ++it) { + if (m_debug) + std::cout << "pvx " << *it - nh1 / 4. << "\n"; + + pvxs.push_back(*it - nh1 / 4.); + } + + return pvxs; +} + +std::vector<double> SonnenscheinEngine::solveCubic(double s1, double s2, double s3) const { + std::vector<double> sols; + + const double q = (s1 * s1 - 3 * s2) / 9.; + const double r = (2 * s1 * s1 * s1 - 9 * s1 * s2 + 27 * s3) / 54.; + + if (m_debug) { + std::cout << "Solve Cubic\n"; + std::cout << "q " << q << "\n"; + std::cout << "r " << r << "\n"; + } + + if (r*r < q*q*q) { + const double theta = acos(r / sqrt(q*q*q) ); + const double z1_1 = -2 * sqrt(q) * cos(theta / 3.) - s1 / 3.; + const double z1_2 = -2 * sqrt(q) * cos((theta + 2 * M_PI) / 3.) - s1 / 3.; + const double z1_3 = -2 * sqrt(q) * cos((theta - 2 * M_PI) / 3.) - s1 / 3.; + + if (m_debug) { + std::cout << "r^2 < q^3 -> 3 solutions\n"; + std::cout << "z1_1 " << z1_1 << "\n"; + std::cout << "z1_2 " << z1_2 << "\n"; + std::cout << "z1_3 " << z1_3 << "\n"; + } + + sols.push_back(z1_1); + sols.push_back(z1_2); + sols.push_back(z1_3); + } else { + if (m_debug) + std::cout << "r^2 >= q^3 -> 1 solution" << "\n"; + + const double radicant = -r + sqrt( r * r - q * q * q); + const double powthrd = pow( fabs(radicant), 1./3.); + const double a = sign(radicant) * powthrd; //sign?? + //double b = (a!=0.) ? q/a : 0.; + const double b = q / a; + + const double z1_1 = a + b - s1 /3.; + //std::cout << "z1_1 " << z1_1 << "\n"; + + sols.push_back(z1_1); + } + + return sols; +} + +std::vector<double> SonnenscheinEngine::solveQuadratic(double a, double b, double c) const { + std::vector<double> sols; + + if (m_debug) + std::cout << "Solve Quadratic\n"; + + const double b2m4ac = b * b - 4. * a * c; + + if (b2m4ac > 0.) { + const double sol1 = (-b + sqrt(b2m4ac)) / 2. * a; + const double sol2 = (-b - sqrt(b2m4ac)) / 2. * a; + + if (m_debug) { + std::cout << "Quadratic sol1 : " << sol1 << "\n"; + std::cout << "Quadratic sol2 : " << sol2 << "\n"; + } + + sols.push_back(sol1); + sols.push_back(sol2); + } else if (m_debug) + std::cout << "Quadratic has no solutions\n"; + + return sols; +} + +double SonnenscheinEngine::sign(double a) const { + return (a < 0) ? -1 : (a > 0) ? 1 : 0; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TopEventReconstructionToolsLoader.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TopEventReconstructionToolsLoader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..62a25e3470fff31cebf598b018a4627e05542df4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TopEventReconstructionToolsLoader.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventReconstructionTools/TopEventReconstructionToolsLoader.h" +#include "TopEventReconstructionTools/Sonnenschein.h" +#include "TopEventReconstructionTools/KLFitterRun.h" +#include "TopEventReconstructionTools/PseudoTopRecoRun.h" +#include "TopConfiguration/TopConfig.h" + +#include "TopAnalysis/Tools.h" //for the loadLibraries function + +namespace top { + +top::EventSelectorBase* TopEventReconstructionToolsLoader::initTool(const std::string& /*name*/, const std::string& line, TFile* /*outputFile*/,std::shared_ptr<top::TopConfig> config, EL::Worker* /*wk*/) { + //get the first bit of the string and store it in toolname + std::istringstream iss(line); + std::string toolname; + getline(iss, toolname, ' '); + + //any parameters? + std::string param; + if (line.size() > toolname.size()) + param = line.substr(toolname.size() + 1); + + if (toolname == "RECO::SONNENSCHEIN") + return new top::Sonnenschein(); + + else if (toolname == "RECO::KLFITTERRUN") { + loadLibraries("libKLFitter"); + return new top::KLFitterRun(param,config); + } + + else if (toolname == "RECO::PSEUDOTOP"){ + return new top::PseudoTopRecoRun(param, config); + } + + + return nullptr; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresChi2.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresChi2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e991d93320abb44c07a62e3bcc03b99d4627cf91 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresChi2.cxx @@ -0,0 +1,731 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* ********************************************************************** + * Class : TTBarLeptonJetsBuilder_chi2 + * Author : LPC-ClermontFerrand team + ************************************************************************/ + +#include "TopEventReconstructionTools/TtresChi2.h" +#include "TopEventReconstructionTools/TtresNeutrinoBuilder.h" + +//_________________________________________________________________________________________________ +TtresChi2::TtresChi2(std::string units){ + m_debug = 0; + m_WReco = ROTATION; + if (units=="MeV")m_Units = 1000.; + else if(units=="GeV")m_Units = 1.; + else std::cerr << "WARNING in TtresChi2: units different from GeV or MeV" << std::endl; + m_UsePtDiff = PTDIFF; + m_Btag = AFFECTBTAG; + m_RunMode = RUNDEFAULT; + m_NeutrinoBuilder = new TtresNeutrinoBuilder(units); + Init(DATA2012SUMMER2013PT100); + res_chi2All = -1.; + res_chi2WH = -1.; + res_chi2TopH = -1.; + res_chi2TopL = -1.; + res_Mtl = -1.; + res_Mwh = -1.; + res_Mth = -1.; + res_Mtt = -1.; + m_WhChi2Value = -1; + m_ThWhChi2Value = -1; + m_TlChi2Value = -1; + m_PtDiffChi2Value = -1; + m_category = -1; +} + +//_________________________________________________________________________________________________ +TtresChi2::~TtresChi2(){ + if(m_debug>0) std::cout << "in destructor " << std::endl; + if (m_NeutrinoBuilder) delete m_NeutrinoBuilder; +} + +//_________________________________________________________________________________________________ +void TtresChi2::Init(Chi2Version version, double highJetMass) { + + m_highJetMass = highJetMass; + + switch (version){ + + case DATA2012SUMMER2013PT100: + //Rel17.2: values obtained for Z' 0.5TeV-2 TeV including njets>=5 events + // LC jets + Jet Area correction + // Applying a cut at 100 GeV on the pT of the leading jet + MjjP=82.74*m_Units; + SMjjP=9.524*m_Units; + + m_TopMinusW_had_mean=89.99*m_Units; + m_TopMinusW_had_sigma=13.91*m_Units; + + m_Top_lep_mean=166.6*m_Units; + m_Top_lep_sigma=17.34*m_Units; + + m_PtDiff_mean=-1.903*m_Units; + m_PtDiff_sigma=47.24*m_Units; + + m_PtDiffRel_mean=0.002678; + m_PtDiffRel_sigma=0.07662; + + m_PtDiffRelMass_mean=0.001315; + m_PtDiffRelMass_sigma=0.05092; + + MTHJJ=171.8*m_Units; + STHJJ=16.04*m_Units; + break; + + case DATA2012SUMMER2013: + //Rel17.2: values obtained for Z' 0.5TeV-2 TeV including njets>=5 events + // LC jets + Jet Area correction + MjjP=82.41*m_Units; + SMjjP=9.553*m_Units; + + m_TopMinusW_had_mean=89.01*m_Units; + m_TopMinusW_had_sigma=15.67*m_Units; + + m_Top_lep_mean=166*m_Units; + m_Top_lep_sigma=17.48*m_Units; + + m_PtDiff_mean=0.4305*m_Units; + m_PtDiff_sigma=46.07*m_Units; + + m_PtDiffRel_mean=0.00144; + m_PtDiffRel_sigma=0.07837; + + m_PtDiffRelMass_mean=0.0004532; + m_PtDiffRelMass_sigma=0.05112; + + MTHJJ=171.8*m_Units; + STHJJ=16.04*m_Units; + break; + case DATA2012AUTOMN2012: + //Rel17.2: values obtained for Z' 0.5TeV-2 TeV including njets>=5 events + // LC jets + MjjP=83.93*m_Units; + SMjjP=10.76*m_Units; + + m_TopMinusW_had_mean=91.05*m_Units; + m_TopMinusW_had_sigma=14.23*m_Units; + + m_Top_lep_mean=168.2*m_Units; + m_Top_lep_sigma=20.57*m_Units; + + m_PtDiff_mean=-8.709*m_Units; + m_PtDiff_sigma=55.*m_Units; + + MTHJJ=173.5*m_Units; + STHJJ=16.25*m_Units; + break; + + case DATA2011SUMMER2012: + //Rel17.0: values obtained for Z' 1TeV-2 TeV including njets>=5 events + // EM+JES jets + MjjP=83.18*m_Units; + SMjjP=10.67*m_Units; + + m_TopMinusW_had_mean=90.87*m_Units; + m_TopMinusW_had_sigma=12.78*m_Units; + + m_Top_lep_mean=167.6*m_Units; + m_Top_lep_sigma=20.53*m_Units; + + m_PtDiff_mean=-7.381*m_Units; + m_PtDiff_sigma=63.96*m_Units; + + MTHJJ=172.2*m_Units; + STHJJ=16.8*m_Units; + break; + default: + std::cerr << "TtresChi2::Init chi2 is not defined!!" << std::endl; + break; + } + return; +} + +//_________________________________________________________________________________________________ +void TtresChi2::Reset(){ + res_chi2All = -1.; + res_chi2WH = -1.; + res_chi2TopH = -1.; + res_chi2TopL = -1.; + res_Mwh = -1.; + res_Mth = -1.; + res_Mtl = -1.; + res_Mtt = -1.; + m_WhChi2Value = -1; + m_ThWhChi2Value = -1; + m_TlChi2Value = -1; + m_PtDiffChi2Value = -1; + m_category = -1; + m_nChi2Values = 0; + m_chi2Values.clear(); + m_chi2Wh_Values.clear(); + m_chi2Th_Values.clear(); + m_chi2ThWh_Values.clear(); + m_chi2Tl_Values.clear(); + m_i_Wq1.clear(); + m_i_Wq2.clear(); + m_i_Thb.clear(); + m_i_Tlb.clear(); + m_i_n.clear(); + m_chi2PtDiff_Values.clear(); + m_PtDiff_Values.clear(); + m_Wh_Values.clear(); + m_ThWh_Values.clear(); + m_Th_Values.clear(); + m_Tl_Values.clear(); + m_chi2Values.reserve(10000); + m_chi2Wh_Values.reserve(10000); + m_chi2Th_Values.reserve(10000); + m_chi2ThWh_Values.reserve(10000); + m_chi2Tl_Values.reserve(10000); + m_chi2PtDiff_Values.reserve(10000); + m_i_Wq1.reserve(10000); + m_i_Wq2.reserve(10000); + m_i_Thb.reserve(10000); + m_i_Tlb.reserve(10000); + m_i_n.reserve(10000); + m_PtDiff_Values.reserve(10000); + m_Wh_Values.reserve(10000); + m_ThWh_Values.reserve(10000); + m_Th_Values.reserve(10000); + m_Tl_Values.reserve(10000); + return; +} + +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresChi2::GetNeutrinos(TLorentzVector* L, TLorentzVector*MET){ + std::vector<TLorentzVector*> neutrinoVector; + if (m_WReco==ROTATION) neutrinoVector = m_NeutrinoBuilder->candidatesFromWMass_Rotation(L, MET, false /*m_useSmallestPz*/); + else if (m_WReco==REALPART)neutrinoVector = m_NeutrinoBuilder->candidatesFromWMass_RealPart(L, MET, false /*m_useSmallestPz*/); + else if (m_WReco==DECREASING) neutrinoVector = m_NeutrinoBuilder->candidatesFromWMass_Scaling(L, MET); + return neutrinoVector; +} + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare_HMelseLM(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q1_W, int& i_q2_W, int& i_b_had, int& i_b_lep, int& ign1, double& chi2ming1, double& chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare_HMelseLM()" << std::endl; + bool status = false; + + status = this->findMinChiSquare_HighMass(L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + + if (status && TMath::Log10(chi2ming1)<0.9) return status; // have found a good combination for HM + + // Otherwise try the LM chi2 + status = this->findMinChiSquare (L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_had, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + + return status; +} + + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare_LMelseHM(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q1_W, int& i_q2_W, int& i_b_had, int& i_b_lep, int& ign1, double& chi2ming1, double& chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare_LMelseHM()" << std::endl; + bool status = false; + + status = this->findMinChiSquare (L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_had, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + + if (status && TMath::Log10(chi2ming1)<0.9) return status; // have found a good combination for LM + + // Otherwise try the HM chi2 + status = this->findMinChiSquare_HighMass(L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + + return status; +} + + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare_AllRanges(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q1_W, int& i_q2_W, int& i_b_had, int& i_b_lep, int& ign1, double& chi2ming1, double& chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare_AllRanges()" << std::endl; + bool status = false; + float massMax = 0.; + + for (unsigned int i=0; i<jetVector->size(); ++i) if(jetVector->at(i)->M()>massMax)massMax= jetVector->at(i)->M(); + + if(massMax>=m_highJetMass*m_Units)status = this->findMinChiSquare_HighMass(L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + else status = this->findMinChiSquare (L, jetVector, isJetBtagged, MET, i_q1_W, i_q2_W, i_b_had, i_b_lep, ign1, chi2ming1, chi2ming1H, chi2ming1L); + + return status; +} + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q1_W, int& i_q2_W, int& i_b_had, int& i_b_lep, int& ign1, double& chi2ming1, double& chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare()" << std::endl; + //_________________________________________________________________________________________________ + i_q1_W=-1; + i_q2_W=-1; + i_b_had=-1; + i_b_lep=-1; + ign1=-1; + chi2ming1 =1e7; + chi2ming1H=1e7; + chi2ming1L=1e7; + double chi2ming1WH=1e7; + int n_jets = jetVector->size(); + int n_bjets = 0; + + this->Reset(); + + if (L == NULL) { + std::cerr << "ERROR : TtresChi2::findMinChiSquare: Lepton is NULL" << std::endl; + return false; + } + + if(m_Btag==AFFECTBTAG){ + for(unsigned int ib = 0; ib<(unsigned int)isJetBtagged->size(); ++ib){ + if(isJetBtagged->at(ib)) n_bjets++; + } + } + + //_________________________________________________________________________________________________ + std::vector<TLorentzVector*> neutrinoVector = GetNeutrinos(L, MET); + + //_________________________________________________________________________________________________ + for (unsigned int i=0; i<(unsigned int)n_jets; i++){ + const TLorentzVector* I = jetVector->at(i); + for (unsigned int j=i+1; j<(unsigned int)n_jets; j++){ + const TLorentzVector* J = jetVector->at(j); + for (unsigned int k=0; k< (unsigned int)n_jets; k++){ + if ( k!=i && k!=j) { + const TLorentzVector* K = jetVector->at(k); + TLorentzVector TopH = (*I) + (*J) + (*K); + TLorentzVector Whad = (*I) + (*J); + for (unsigned int n=0; n< neutrinoVector.size(); n++){ + + TLorentzVector* N = neutrinoVector[n]; + + TLorentzVector Wlv = (*N) + (*L); + for (unsigned int m=0; m< (unsigned int)n_jets; m++){ + if (m!=i && m!=j && m!=k) { + const TLorentzVector* M = jetVector->at(m); + TLorentzVector Tlv = Wlv + (*M); + TLorentzVector Tt = Tlv + TopH; + double chi2WH = pow((Whad.M()-MjjP)/SMjjP,2); + double chi2H = chi2WH + pow((TopH.M()-Whad.M()-m_TopMinusW_had_mean)/m_TopMinusW_had_sigma,2); + double chi2L = pow((Tlv.M()-m_Top_lep_mean)/m_Top_lep_sigma,2); + + double chi2tempg1 = chi2H+chi2L; + if (m_UsePtDiff==PTDIFF){ + double chi2Diff = pow((TopH.Pt()-Tlv.Pt()-m_PtDiff_mean)/m_PtDiff_sigma,2); + chi2tempg1+=chi2Diff; + }else if (m_UsePtDiff==PTDIFFREL){ + double chi2DiffRel = pow(((TopH.Pt()-Tlv.Pt())/(TopH.Pt()+Tlv.Pt())-m_PtDiffRel_mean)/m_PtDiffRel_sigma,2); + chi2tempg1+=chi2DiffRel; + }else if (m_UsePtDiff==PTDIFFMASS){ + double chi2DiffRelMass = pow(((TopH.Pt()-Tlv.Pt())/(Tt.M())-m_PtDiffRelMass_mean)/m_PtDiffRelMass_sigma,2); + chi2tempg1+=chi2DiffRelMass; + } + + // does this combination contain a b + // k -> hadronic b + // m -> leptonic b + int n_bJetsComb = 0; + if (isJetBtagged->at(k)){ + n_bJetsComb++; + } + // second b + if (isJetBtagged->at(m)){ + n_bJetsComb++; + } + + bool passBtag = false; + if(m_Btag==STDBTAG || m_Btag==NO_BTAGHM){ + if(n_bJetsComb>0){ + passBtag = true; + } + }else if(m_Btag==AFFECTBTAG){ + if(n_bjets==0){ + passBtag = true; + }else if(n_bjets==1){ + if(n_bJetsComb==1){ passBtag = true; } + }else if(n_bjets>=2){ + if(n_bJetsComb==2){ passBtag = true; } + } + }else if(m_Btag==NO_BTAG){ + passBtag = true; + } + + if(passBtag && m_RunMode==RUNSTUDY){ + m_chi2Values.push_back(chi2tempg1); + m_chi2Wh_Values.push_back(chi2WH); + m_chi2ThWh_Values.push_back(chi2H - chi2WH); + m_chi2Tl_Values.push_back(chi2L); + m_chi2PtDiff_Values.push_back(chi2tempg1 - chi2H - chi2L); + m_i_Wq1.push_back(i); + m_i_Wq2.push_back(j); + m_i_Thb.push_back(k); + m_i_Tlb.push_back(m); + m_i_n.push_back(n); + if(m_UsePtDiff==PTDIFF) m_PtDiff_Values.push_back((TopH.Pt()-Tlv.Pt())/m_Units); + else if(m_UsePtDiff==PTDIFFMASS) m_PtDiff_Values.push_back((TopH.Pt()-Tlv.Pt())/(Tt.M())); + m_Wh_Values.push_back(Whad.M()/m_Units); + m_ThWh_Values.push_back((TopH.M()-Whad.M())/m_Units); + m_Tl_Values.push_back((Tlv.M())/m_Units); + m_nChi2Values++; + } + + //################# + //Original chi2 method + //################# + if (chi2tempg1<chi2ming1){ + + if(passBtag){ + chi2ming1 = chi2tempg1; + chi2ming1H = chi2H; + chi2ming1L = chi2L; + m_WhChi2Value = chi2WH; + m_ThWhChi2Value = chi2H - chi2WH; + m_TlChi2Value = chi2L; + m_PtDiffChi2Value = chi2tempg1 - chi2H - chi2L; + + i_q1_W=i; + i_q2_W=j; + i_b_had=k; + i_b_lep=m; + ign1=n; + res_Mtl=Tlv.M(); + res_Mwh=Whad.M(); + res_Mth=TopH.M(); + res_Mtt=Tt.M(); + res_Tt = Tt; + + //============================ + // bjet category splitting + //============================ + if(n_bjets==0){ + m_category = 0; + }else if(n_bjets==1){ + if(isJetBtagged->at(k)){//b-jet on the hadronic side + m_category = 2; + }else if(isJetBtagged->at(m)){//b-jet on the leptonic side + m_category = 3; + }else{ + std::cerr << "<!> In TtresChi2::findMinChiSquare : cannot find the corresponding category." << std::endl; + } + }else if(n_bjets>=2){ + if(isJetBtagged->at(k)){//b-jet on the hadronic side + if(isJetBtagged->at(m)){//b-jet on the leptonic side too + m_category = 1; + }else{//b-jet only on the hadronic side + m_category = 2; + } + }else if(isJetBtagged->at(m)){ + m_category = 3; + }else{ + std::cerr << "<!> In TtresChi2::findMinChiSquare : cannot find the corresponding category." << std::endl; + } + } + } + } // end of case a minimal chisquare was found + } // end of case unique combination + } //end of loop over jets + } // end of loop over all neutrino solutions + } // end of case this is the electron channel + } // end of loop over jets k + } // end of loop over jets + } // end of loop over jets + + bool status=false; + if ( i_q1_W != -1 && i_q2_W != -1 && i_b_had != -1 && i_b_lep != -1 && ign1 != -1){ + status = true; + } + + res_chi2All = chi2ming1; + res_chi2WH = chi2ming1WH; + res_chi2TopH = chi2ming1H; + res_chi2TopL = chi2ming1L; + + for (unsigned int i =0; i< neutrinoVector.size(); i++)delete neutrinoVector[i]; neutrinoVector.clear(); + return status; +} + + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare_HighMass(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q1_W, int& i_q2_W, int& i_b_lep, int& ign1, double& chi2ming1, double& +chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare_HighMass()" << std::endl; + //_________________________________________________________________________________________________ + i_q1_W=-1; + i_q2_W=-1; + i_b_lep=-1; + ign1=-1; + chi2ming1 =1e7; + chi2ming1H=1e7; + chi2ming1L=1e7; + double HMtop = -1e6; + int n_jets = jetVector->size(); + int n_bjets = 0; + + this->Reset(); + + if (L == NULL) { + std::cerr << "ERROR : TtresChi2::findMinChiSquare: Lepton is NULL" << std::endl; + return false; + } + + if(m_Btag==AFFECTBTAG){ + for(unsigned int ib = 0; ib<(unsigned int)isJetBtagged->size(); ++ib){ + if(isJetBtagged->at(ib)) n_bjets++; + } + } + + //_________________________________________________________________________________________________ + std::vector<TLorentzVector*> neutrinoVector= GetNeutrinos(L, MET); + + //_________________________________________________________________________________________________ + for (unsigned int i=0; i<(unsigned int)n_jets; i++){ + const TLorentzVector* I = jetVector->at(i); + for (unsigned int j=i+1; j<(unsigned int)n_jets; j++){ + const TLorentzVector* J = jetVector->at(j); + if ( I->M()>m_highJetMass*m_Units || J->M()>m_highJetMass*m_Units ) { + TLorentzVector TopH = (*I) + (*J); + + for (unsigned int n=0; n< neutrinoVector.size(); n++){ + + TLorentzVector* N = neutrinoVector[n]; + + TLorentzVector Wlv = (*N) + (*L); + for (unsigned int m=0; m<(unsigned int) n_jets; m++){ + if (m!=i && m!=j) { + const TLorentzVector* M = jetVector->at(m); + TLorentzVector Tlv = Wlv + (*M); + TLorentzVector Tt = Tlv + TopH; + + double HMtoptemp = I->M(); + double chi2H = pow((TopH.M()-MTHJJ)/STHJJ,2); + double chi2L = pow((Tlv.M()-m_Top_lep_mean)/m_Top_lep_sigma,2); + + double chi2tempg1 = chi2H+chi2L; + if (m_UsePtDiff==PTDIFF){ + double chi2Diff = pow((TopH.Pt()-Tlv.Pt()-m_PtDiff_mean)/m_PtDiff_sigma,2); + chi2tempg1+=chi2Diff; + }else if (m_UsePtDiff==PTDIFFREL){ + double chi2DiffRel = pow(((TopH.Pt()-Tlv.Pt())/(TopH.Pt()+Tlv.Pt())-m_PtDiffRel_mean)/m_PtDiffRel_sigma,2); + chi2tempg1+=chi2DiffRel; + }else if (m_UsePtDiff==PTDIFFMASS){ + double chi2DiffRelMass = pow(((TopH.Pt()-Tlv.Pt())/(Tt.M())-m_PtDiffRelMass_mean)/m_PtDiffRelMass_sigma,2); + chi2tempg1+=chi2DiffRelMass; + } + + // does this combination contain a b + // k -> hadronic b + // m -> leptonic b + int n_bJetsComb = 0; + // check whether one of the taggers is passed + // first b + if (isJetBtagged->at(i) || isJetBtagged->at(j)){ + n_bJetsComb++; + } + // second b + if (isJetBtagged->at(m)){ + n_bJetsComb++; + } + + bool passBtag = false; + if(m_Btag==STDBTAG){ + if(n_bJetsComb>0){ + passBtag = true; + } + }else if(m_Btag==AFFECTBTAG){ + if(n_bjets==0){ + passBtag = true; + }else if(n_bjets==1){ + if(n_bJetsComb==1){ passBtag = true; } + }else if(n_bjets>=2){ + if(n_bJetsComb==2){ passBtag = true; } + } + }else if(m_Btag==NO_BTAGHM || m_Btag==NO_BTAG){ + passBtag = true; + } + + if(passBtag && m_RunMode==RUNSTUDY){ + m_chi2Values.push_back(chi2tempg1); + m_chi2Th_Values.push_back(chi2H); + m_chi2Tl_Values.push_back(chi2L); + m_chi2PtDiff_Values.push_back(chi2tempg1 - chi2H - chi2L); + m_i_Wq1.push_back(i); + m_i_Wq2.push_back(j); + m_i_Tlb.push_back(m); + m_i_n.push_back(n); + if(m_UsePtDiff==PTDIFF) m_PtDiff_Values.push_back((TopH.Pt()-Tlv.Pt())/m_Units); + else if(m_UsePtDiff==PTDIFFMASS) m_PtDiff_Values.push_back((TopH.Pt()-Tlv.Pt())/(Tt.M())); + m_Th_Values.push_back((TopH.M())/m_Units); + m_Tl_Values.push_back((Tlv.M())/m_Units); + m_nChi2Values++; + } + + //################# + //Original chi2 method + //################# + if (chi2tempg1<chi2ming1 && HMtoptemp>=HMtop){ + if(passBtag){ + HMtop=HMtoptemp; + chi2ming1=chi2tempg1; + chi2ming1H=chi2H; + chi2ming1L=chi2L; + m_ThWhChi2Value = chi2H; + m_TlChi2Value = chi2L; + m_PtDiffChi2Value = chi2tempg1 - chi2H - chi2L; + + i_q1_W=i; + i_q2_W=j; + i_b_lep=m; + ign1=n; + res_Mtl=Tlv.M(); + //res_Mwh is not defined here + res_Mth=TopH.M(); + res_Mtt=Tt.M(); + res_Tt = Tt; + + //============================ + // bjet category splitting + //============================ + if(n_bjets==0){ + m_category = 0; + }else if(n_bjets==1){ + if(isJetBtagged->at(i) || isJetBtagged->at(j)){//b-jet on the hadronic side + m_category = 2; + }else if(isJetBtagged->at(m)){//b-jet on the leptonic side + m_category = 3; + }else{ + std::cerr << "<!> In TtresChi2::findMinChiSquare : cannot find the corresponding category." << std::endl; + } + }else if(n_bjets>=2){ + if(isJetBtagged->at(i) || isJetBtagged->at(m)){//b-jet on the hadronic side + if(isJetBtagged->at(m)){//b-jet on the leptonic side too + m_category = 1; + }else{//b-jet only on the hadronic side + m_category = 2; + } + }else if(isJetBtagged->at(m)){ + m_category = 3; + }else{ + std::cerr << "<!> In TtresChi2::findMinChiSquare : cannot find the corresponding category." << std::endl; + } + } + + } //end of btag requirement + } // end of case a minimal chisquare was found + } // end of case unique combination + } //end of loop over jets + } // end of loop over all neutrino solutions + } // end of case this is the electron channel + } // end of loop over jets + } // end of loop over jets + + bool status=false; + if ( i_q1_W != -1 && i_q2_W != -1 && i_b_lep != -1 && ign1 != -1){ + status = true; + } + + res_chi2All = chi2ming1; + res_chi2TopH = chi2ming1H; + res_chi2TopL = chi2ming1L; + + + for (unsigned int i =0; i< neutrinoVector.size(); i++)delete neutrinoVector[i]; neutrinoVector.clear(); + return status; +} + +//_________________________________________________________________________________________________ +bool TtresChi2::findMinChiSquare_VeryHighMass(TLorentzVector* L, const std::vector<TLorentzVector*>* jetVector, const std::vector<bool>* isJetBtagged, TLorentzVector* MET, int& i_q2_W, int& i_b_lep, int& ign1, double& chi2ming1, double& chi2ming1H, double& chi2ming1L){ + if(m_debug>0) std::cout << "entering TtresChi2::findMinChiSquare_VeryHighMass() " << std::endl; + //_________________________________________________________________________________________________ + i_q2_W=-1; + i_b_lep=-1; + ign1=-1; + chi2ming1 =1e7; + chi2ming1H=1e7; + chi2ming1L=1e7; + double HMtop = -1e6; + int n_jets = jetVector->size(); + this->Reset(); + + if (L == NULL) { + std::cerr << "ERROR : TtresChi2::findMinChiSquare: Lepton is NULL" << std::endl; + return false; + } + + std::vector<TLorentzVector*> neutrinoVector= GetNeutrinos(L, MET); + + //_________________________________________________________________________________________________ + for (unsigned int i=0; i<(unsigned int)n_jets; i++){ + const TLorentzVector* I = jetVector->at(i); + TLorentzVector TopH = (*I); + + if (I->M()>150.*m_Units){ + for (unsigned int n=0; n< neutrinoVector.size(); n++){ + + TLorentzVector* N = neutrinoVector[n]; + + TLorentzVector Wlv = (*N) + (*L); + for (unsigned int m=0; m< (unsigned int)n_jets; m++){ + if (m!=i) { + const TLorentzVector* M = jetVector->at(m); + TLorentzVector Tlv = Wlv + (*M); + TLorentzVector Tt = Tlv + TopH; + + double HMtoptemp = I->M(); + double chi2H = 1.; + double chi2L = pow((Tlv.M()-m_Top_lep_mean)/m_Top_lep_sigma,2); + double chi2Diff = pow((TopH.Pt()-Tlv.Pt()-m_PtDiff_mean)/m_PtDiff_sigma,2); + double chi2tempg1 = chi2L; + + if (m_UsePtDiff) chi2tempg1+=chi2Diff; + + //################# + //Original chi2 method + //################# + if (chi2tempg1<chi2ming1 && HMtoptemp>=HMtop){ + + // does this combination contain a b + // k -> hadronic b + // m -> leptonic b + int n_bJets = 0; + // check whether one of the taggers is passed + // first b + if (isJetBtagged->at(i)){ + n_bJets++; + } + // second b + if (isJetBtagged->at(m)){ + n_bJets++; + } + + if (n_bJets >= 1){ + HMtop=HMtoptemp; + chi2ming1=chi2tempg1; + chi2ming1H=chi2H; + chi2ming1L=chi2L; + i_q2_W=i; + i_b_lep=m; + ign1=n; + res_Mtl=Tlv.M(); + //res_Mwh is not defined here + res_Mth=TopH.M(); + res_Mtt=Tt.M(); + res_Tt = Tt; + } + } // end of case a minimal chisquare was found + } // end of case unique combination + } //end of loop over jets + } // end of loop over all neutrino solutions + } // end of high mass + } // end of loop over jets + + bool status = false; + if ( i_q2_W != -1 && i_b_lep != -1 && ign1 != -1){ + status = true; + } + + res_chi2All = chi2ming1; + res_chi2TopH = chi2ming1H; + res_chi2TopL = chi2ming1L; + + for (unsigned int i =0; i< neutrinoVector.size(); i++)delete neutrinoVector[i]; neutrinoVector.clear(); + return status; +} + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresNeutrinoBuilder.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresNeutrinoBuilder.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f177f65c3f0dfb3f071dc9cafe8c55408c40eaf3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresNeutrinoBuilder.cxx @@ -0,0 +1,349 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <TMinuit.h> +#include "TopEventReconstructionTools/TtresNeutrinoBuilder.h" + +//_________________________________________________________________________________________________ +void delta2_fcn(Int_t&, Double_t*, Double_t&, Double_t*, Int_t); + +//_________________________________________________________________________________________________ +TtresNeutrinoBuilder::TtresNeutrinoBuilder(std::string units){ + m_debug = 0; + if (units=="MeV")m_Units = 1000.; + else if(units=="GeV")m_Units = 1.; + else std::cerr << "WARNING in NeutrinoBuilder: units different from GeV or MeV" << std::endl; +} + +//_________________________________________________________________________________________________ +TtresNeutrinoBuilder::~TtresNeutrinoBuilder(){ + if(m_debug>0) std::cout << "in destructor " << std::endl; +} + +//_________________________________________________________________________________________________ +TtresNeutrinoBuilder::TtresNeutrinoBuilder(const TtresNeutrinoBuilder& other) { + m_debug = other.m_debug; +} + +//_________________________________________________________________________________________________ +TtresNeutrinoBuilder& TtresNeutrinoBuilder::operator=(const TtresNeutrinoBuilder& other) { + if(this != &other) { + m_debug = other.m_debug; + } + return *this; +} + +//_________________________________________________________________________________________________ +// JDM - fix compiler warnings +void delta2_fcn(Int_t& /*npar*/, Double_t* /*grad*/, Double_t& f, Double_t* par, Int_t /*iflag*/){ + + Double_t delta2 = 0; + Double_t alpha = par[0]; + Double_t r = par[1]; + Double_t dphi = par[2]; + Double_t l_pt = par[3]; + Double_t l_m = par[4]; + Double_t n_px = par[5]; + Double_t n_py = par[6]; + r /= sqrt(l_pt * l_pt + l_m * l_m) - l_pt * cos(dphi + alpha); + TLorentzVector *neut = new TLorentzVector(n_px, n_py, 0., 0.); + neut->SetE(neut->P()); + + TLorentzVector *neut_new = new TLorentzVector(r * neut->P() * cos(neut->Phi() + alpha), r * neut->P() * sin(neut->Phi() + alpha), 0., 0.); + neut_new->SetE(neut_new->P()); + + delta2 = pow((neut_new->Px() - neut->Px()), 2) + pow((neut_new->Py() - neut->Py()), 2); + r *= sqrt(l_pt * l_pt + l_m * l_m) - l_pt * cos(dphi + alpha); + delete neut; + delete neut_new; + f = delta2; +} + +//_________________________________________________________________________________________________ +double TtresNeutrinoBuilder::fitAlpha(const TLorentzVector* L, const Double_t met, const Double_t metphi){ + + // initialize + double m_mWpdg = 80.4 * m_Units; + Double_t pxNu = met * cos(metphi); + Double_t pyNu = met * sin(metphi); + Double_t ptNu = met; + + TMinuit *fit = new TMinuit(7); + fit->SetFCN(delta2_fcn); + int ierr = 0; + double arglist[1] = {-1}; + fit->mnexcm("SET PRIN",arglist,1,ierr); + + // Initialise the parameters + std::string par_name[7] = {"alpha", "r", "dphi", "l_pt", "l_m", "n_px", "n_py"}; + Double_t par_ival[7] = {0., (m_mWpdg * m_mWpdg - L->M() * L->M()) / (2 * ptNu), metphi - L->Phi(), L->Pt(), L->M(), pxNu, pyNu}; + Double_t par_step[7] = {0.1, 0., 0., 0., 0., 0., 0.}; + Double_t par_min[7] = {-3.15, 0., -3.15, 0., 0., -10000., -10000.}; + Double_t par_max[7] = {3.15, 1., 3.15, 10000., 80., 10000., 10000.}; + for (Int_t i = 0; i < 7; i++){ + fit->DefineParameter(i,par_name[i].c_str(),par_ival[i],par_step[i],par_min[i],par_max[i]); + if (i != 0){ + fit->FixParameter(i); + } + } + fit->SetPrintLevel(-1); + fit->Migrad(); + Double_t a, e_a; + Int_t ret = fit->GetParameter(0, a, e_a); + delete fit; + if (ret > 0){ + return a; + } + else { + std::cout << "Error in fit of alpha for met correction" << std::endl; + return 0.; + } + +} + + +// In case of negative discriminant, decrease the MET +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_Scaling(const TLorentzVector* L, const TLorentzVector* MET){ +return this->candidatesFromWMass_Scaling(L, MET->Px(), MET->Py()); +} + +// In case of negative discriminant, decrease the MET +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_Scaling(const TLorentzVector* L, const double met_etx, const double met_ety){ + if(m_debug>0) std::cout << "entering NeutrinoBuilder::candidatesFromWMass_Scaling()" << std::endl; + std::vector<TLorentzVector*> NC; + this->candidatesFromWMass_Scaling(L, met_etx, met_ety, NC); + return NC; +} + +// In case of negative discriminant, decrease the MET +//_________________________________________________________________________________________________ +bool TtresNeutrinoBuilder::candidatesFromWMass_Scaling(const TLorentzVector* L, const double met_etx, const double met_ety, std::vector<TLorentzVector*>& NC){ + + if(m_debug>0) std::cout << "entering NeutrinoBuilder::candidatesFromWMass_Scaling()" << std::endl; + // initialize + double delta; + double lambda; + double pxNu; + double pyNu; + double ptNu = 21; + double alpha; + double beta; + double gamma; + double m_mWpdg=80.4 * m_Units; + int count = 0; + + pxNu = met_etx; + pyNu = met_ety; + do { + // solve the quadratic equation + ++count; + ptNu = sqrt (pxNu*pxNu + pyNu*pyNu); + alpha = pow(m_mWpdg,2)+pow((pxNu+L->Px()),2)+pow((pyNu+L->Py()),2)-pow(L->E(),2); + + beta = 0.5 * ( alpha-pow(ptNu,2)+pow(L->Pz(),2) ); + gamma = -( beta*beta - ( pow(L->E(),2)*pow(ptNu,2) ) ) / ( pow(L->E(),2)-pow(L->Pz(),2) ); + lambda = 2*beta*L->Pz() / (pow(L->E(),2)-pow(L->Pz(),2)); + delta = pow(lambda,2)-4*gamma; + if(m_debug>1) std::cout << "count = " << count << "\tptNu = " << ptNu << "\tdelta = " << delta << "\tm_mWpdg = " << m_mWpdg << std::endl; + // if no real solution, reduce Pt by 0.1 GeV and recompute pxNu & pyNu + // in consequence + if (delta < 0){ + if(ptNu > 100. ){ + double Ptmiss = ptNu; + ptNu -= 100. ; + pxNu *= ptNu/Ptmiss; + pyNu *= ptNu/Ptmiss; + } + } // end of case delta is negatively defined + + } while( (delta < 0) && (count < 10000) && ( ptNu > 20 *1000)); + if (delta < 0){ + if(m_debug>0) std::cout << "no solution delta still<0" << std::endl; return false; + } + delta = sqrt(delta); + // instantiate Neutrino + double pz = (lambda-delta)/2.0; + double e = sqrt(pxNu*pxNu+pyNu*pyNu+pz*pz); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pz,e); + pz = (lambda+delta)/2.0; + e = sqrt(pxNu*pxNu+pyNu*pyNu+pz*pz); + TLorentzVector *nu2 = new TLorentzVector(pxNu,pyNu,pz,e); + NC.push_back(nu1); + NC.push_back(nu2); + if(m_debug>0) std::cout << "quitting NeutrinoBuilder::candidatesFromWMass_Scaling()" << std::endl; + return true; +} + + + + + +// In case of negative discriminant, decrese the MET +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_Rotation(const TLorentzVector* L, const TLorentzVector* MET, const bool useSmallestPz){ + return this->candidatesFromWMass_Rotation(L, MET->Pt(), MET->Phi(), useSmallestPz); +} + +// In case of negative discriminant, decrese the MET +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_Rotation(const TLorentzVector* L, const Double_t met, const Double_t metphi, const bool useSmallestPz){ + if(m_debug>0) std::cout << "entering candidatesFromWMassRotation()" << std::endl; + + // initialize + Double_t m_mWpdg = 80.4 * m_Units; + Double_t pxNu = met * cos(metphi); + Double_t pyNu = met * sin(metphi); + Double_t pzNu = -1000000; + Double_t ptNu = met; + Double_t eNu; + + std::vector<TLorentzVector*> NC; + + Double_t c1 = m_mWpdg * m_mWpdg - L->M() * L->M() + 2 * (L->Px() * pxNu + L->Py() * pyNu); + Double_t b1 = 2 * L->Pz(); + + Double_t A = 4 * pow(L->E(), 2) - b1 * b1; + Double_t B = -2 * c1 * b1; + Double_t C = 4 * pow(L->E(), 2) * ptNu * ptNu - c1 * c1; + Double_t discr = B*B - 4*A*C; + Double_t r = 1; + + Double_t sol1, sol2; + if (discr > 0){ + sol1 = (-B + sqrt(discr)) / (2*A); + sol2 = (-B - sqrt(discr)) / (2*A); + } + else { + Double_t alpha = fitAlpha(L, met, metphi); + Double_t dphi = metphi - L->Phi(); + r = ( pow(m_mWpdg,2) - pow(L->M(),2) ) / (2 * ptNu * (sqrt(pow(L->Pt(),2) + pow(L->M(),2)) - L->Pt() * cos(dphi + alpha))); + + Double_t old_p = ptNu; + Double_t old_phi = metphi; + pxNu = r * old_p * cos(old_phi + alpha); + pyNu = r * old_p * sin(old_phi + alpha); + ptNu = sqrt (pxNu*pxNu + pyNu*pyNu); + + c1 = m_mWpdg * m_mWpdg - pow(L->M(),2) + 2 * (L->Px() * pxNu + L->Py() * pyNu); + B = -2 * c1 * b1; + C = 4 * pow(L->E(),2) * ptNu * ptNu - c1 * c1; + discr = B*B - 4*A*C; + + sol1 = -B / (2*A); + sol2 = -B / (2*A); + } + + if (useSmallestPz){ + + pzNu = (fabs(sol1) > fabs(sol2)) ? sol2 : sol1; + + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + NC.push_back(nu1); + + }else{ + + pzNu = sol1; + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + pzNu = sol2; + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu2 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + NC.push_back(nu1); + NC.push_back(nu2); + + } + + if(m_debug>0) std::cout << "quitting NeutrinoBuilder::candidatesFromWMassRotation() : " << NC.size() << std::endl; + return NC; +} + +// In case of negative discriminant, use the real part +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_RealPart(const TLorentzVector* L, const TLorentzVector* MET, const bool useSmallestPz){ + return this->candidatesFromWMass_RealPart(L, MET->Pt(), MET->Phi(), useSmallestPz); +} +// In case of negative discriminant, use the real part +//_________________________________________________________________________________________________ +std::vector<TLorentzVector*> TtresNeutrinoBuilder::candidatesFromWMass_RealPart(const TLorentzVector* L, Double_t met, Double_t metphi, const bool useSmallestPz){ + if(m_debug>0) std::cout << "entering candidatesFromWMass_RealPart()" << std::endl; + + // initialize + Double_t m_mWpdg = 80.4 * m_Units; + Double_t pxNu = met * cos(metphi); + Double_t pyNu = met * sin(metphi); + Double_t pzNu = -1000000; + Double_t ptNu = met; + Double_t eNu; + + std::vector<TLorentzVector*> NC; + + Double_t c1 = m_mWpdg * m_mWpdg - L->M() * L->M() + 2 * (L->Px() * pxNu + L->Py() * pyNu); + Double_t b1 = 2 * L->Pz(); + + Double_t A = 4 * pow(L->E(), 2) - b1 * b1; + Double_t B = -2 * c1 * b1; + Double_t C = 4 * pow(L->E(), 2) * ptNu * ptNu - c1 * c1; + Double_t discr = B*B - 4*A*C; + + Double_t sol1, sol2; + if (discr > 0){ + sol1 = (-B + sqrt(discr)) / (2*A); + sol2 = (-B - sqrt(discr)) / (2*A); + } + //if discr<0 + else { + pzNu = -B / (2*A); + + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + NC.push_back(nu1); + return NC; + } + + if (useSmallestPz){ + + pzNu = (fabs(sol1) > fabs(sol2)) ? sol2 : sol1; + + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + NC.push_back(nu1); + + }else{ + + pzNu = sol1; + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu1 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + pzNu = sol2; + eNu = sqrt(pxNu*pxNu + pyNu*pyNu + pzNu*pzNu); + TLorentzVector *nu2 = new TLorentzVector(pxNu,pyNu,pzNu,eNu); + NC.push_back(nu1); + NC.push_back(nu2); + + } + + if(m_debug>0) std::cout << "quitting NeutrinoBuilder::candidatesFromWMass_RealPart() : " << NC.size() << std::endl; + return NC; +} + +Double_t TtresNeutrinoBuilder::getDiscriminant(const TLorentzVector* L, Double_t met, Double_t metphi){ + + // initialize + Double_t m_mWpdg = 80.4 * m_Units; + Double_t pxNu = met * cos(metphi); + Double_t pyNu = met * sin(metphi); + Double_t ptNu = met; + + Double_t c1 = m_mWpdg * m_mWpdg - L->M() * L->M() + 2 * (L->Px() * pxNu + L->Py() * pyNu); + Double_t b1 = 2 * L->Pz(); + + Double_t A = 4 * pow(L->E(), 2) - b1 * b1; + Double_t B = -2 * c1 * b1; + Double_t C = 4 * pow(L->E(), 2) * ptNu * ptNu - c1 * c1; + Double_t discr = B*B - 4*A*C; + return discr; +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresdRmin.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresdRmin.cxx new file mode 100644 index 0000000000000000000000000000000000000000..551fa4518b1375a1138db4c4dbc6b0b246d113a8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/Root/TtresdRmin.cxx @@ -0,0 +1,298 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////////////////////// +// // +// TTBarLeptonJetsBuilder_dRmin tool // +// // +// This tool provides functionality to calculated the ttbar mass using the // +// dRmin method // +// // +// (1) If the event contains a high mass jet above a given threshold, the // +// mass is calculated using the high mass jet, the closest jet to this // +// one, and the jet closest to the leptonic W-boson // +// // +// (2) If the event does not contain a high mass jet and at least four jets, // +// the dRmin method removes jets passing a specific cut requirement // +// correlated to its mass. This procedure is repeated as long as there // +// are at least 4 jets available. // +// // +// Note: This procedure also calculates the mass for cases with only 2 jets. // +// These events have to be filtered in the cutflow! // +// // +// Contact: lmasetti@cern.ch // +// theck@cern.ch // +// // +/////////////////////////////////////////////////////////////////////////////////// + + +#include "TopEventReconstructionTools/TtresdRmin.h" + +//========================================================================================================== +// Class constructor +// +TtresdRmin::TtresdRmin(TString units, bool verbose) { + + m_init = false; + m_verbose = verbose; + + if(units == "MeV") { + m_Units = 1000.0; + } else if(units == "GeV") { + m_Units = 1.0; + } else { + cout << " ERROR in in TtresdRmin :: Unit setting '" << units << "' doest not match pattern of GeV or MeV" << endl; + } +} + + +//========================================================================================================== +// Initialize parameters for tool +// +void TtresdRmin::Init(double highJetMass, double minJetPt, double dRCutOffset, double dRCutMassFactor) { + //Set parameters + m_highM = highJetMass; + m_minJetPt = minJetPt; + m_dRCutOffset = dRCutOffset; + m_dRCutMassFactor = dRCutMassFactor; + + //Reset + m_jet_indices.clear(); + m_highMassJetIndex = -1; + m_highestJetMass = 0.0; + + //Initialization status + m_init = true; +} + + +//========================================================================================================== +// Setup event with kinematic objects +// +bool TtresdRmin::SetupEvent(vector<TLorentzVector*> &jets, TLorentzVector &lepton, TLorentzVector &neutrino) { + + if(!m_init) { + cout << " ERROR in TtresdRmin :: Tool not initialized! Initialize tool before usage!!!" << endl; + return false; + } + + //Set objects + m_jets = jets; + m_lepton = lepton; + m_neutrino = neutrino; + m_Wleptonic = lepton + neutrino; + + //Reset + m_jet_indices.clear(); + m_highMassJetIndex = -1; + m_highestJetMass = 0.0; + + + //===== Search for high mass jet ===== + int highMJetIdx = -1; //Index of jet with highest mass above threshold + double highM = m_highM*m_Units; //Threshold for high mass jet + double minJetPt = m_minJetPt*m_Units; //Threshold for jet pT + + //Loop jets + for(int ijet = 0; ijet < (int)jets.size(); ijet++) { + + //pT requirmenet + if(jets.at(ijet)->Pt() <= minJetPt) continue; //next jet + + //high mass requirement + if(jets.at(ijet)->M() <= highM) continue; //next jet + + highMJetIdx = ijet; + highM = jets.at(ijet)->M(); + }//end of jet loop + + if(highMJetIdx >= 0) { + m_highMassJetIndex = highMJetIdx; + m_highestJetMass = highM; + FindJetIndices_HM(); + } else { + FindJetIndices_LM(); + } + + return true; +} + + +//========================================================================================================== +// Get invariant ttbar mass +// +double TtresdRmin::GetMttdRmin() { + + double mtt_dRmin = 0.0; + + if(m_jet_indices.size() > 0) { + TLorentzVector dRsumJet(0,0,0,0); + for(unsigned int ijet = 0; ijet < m_jet_indices.size(); ijet++) { + dRsumJet += *(m_jets.at(m_jet_indices.at(ijet))); + } + mtt_dRmin = (dRsumJet + m_Wleptonic).M(); + } + + return mtt_dRmin; +} + +//========================================================================================================== +// Get ttbar system TLorentzVector +// +TLorentzVector TtresdRmin::GetTlvdRmin() { + + TLorentzVector tt_dRmin(0,0,0,0); + + if(m_jet_indices.size() > 0) { + TLorentzVector dRsumJet(0,0,0,0); + for(unsigned int ijet = 0; ijet < (unsigned int)m_jet_indices.size(); ijet++) { + dRsumJet += *(m_jets.at(m_jet_indices.at(ijet))); + } + tt_dRmin = dRsumJet + m_Wleptonic; + } + + return tt_dRmin; +} + + +//========================================================================================================== +// Find jet indices for reconstruction for events with a high mass jet +// +bool TtresdRmin::FindJetIndices_HM() { + + //===== Find closest jet to high mass jet ===== + double dR_had = 999.9; + int closest_jetIdx_had = -1; + + //Loop m_jets + for(int ijet = 0; ijet < (int)m_jets.size(); ijet++) { + if(ijet == m_highMassJetIndex) continue; //next jet + double dR = m_jets.at(m_highMassJetIndex)->DeltaR(*(m_jets.at(ijet))); + if(dR < dR_had) { + closest_jetIdx_had = ijet; + dR_had = dR; + } + }//end of jet loop + + + //===== Find closest jet to leptonic W-boson ===== + double dR_lep = 999.9; + int closest_jetIdx_lep = -1; + + //Loop jets + for(int ijet = 0; ijet < (int)m_jets.size(); ijet++) { + if(ijet == m_highMassJetIndex) continue; //next jet + if(ijet == closest_jetIdx_had) continue; //next jet + double dR = m_Wleptonic.DeltaR(*(m_jets.at(ijet))); + if(dR < dR_lep) { + closest_jetIdx_lep = ijet; + dR_lep = dR; + } + }//end of jet loop + + //===== Save jet indices used for reconstruction ===== + m_jet_indices.push_back(m_highMassJetIndex); + + if(closest_jetIdx_had >= 0){ + m_jet_indices.push_back(closest_jetIdx_had); + } else { + if(m_verbose) cout << " WARNING in TtresdRmin :: Can not find jet close to high mass jet" << endl; + } + + if(closest_jetIdx_lep >= 0) { + m_jet_indices.push_back(closest_jetIdx_lep); + } else { + if(m_verbose) cout << " WARNING in TtresdRmin :: Can not find jet close to leptonic W-boson" << endl; + } + + return true; +} + + +//========================================================================================================== +// Find jet indices for reconstruction for events without a high mass jet +// +bool TtresdRmin::FindJetIndices_LM() { + + //jetflag vector to flag jets rejected by dRmin method + vector<bool> jetflags(m_jets.size(), true); + + //do dRmin procedure if at least 4 jets are available + bool repeat_dRmin = ((int)m_jets.size() > 3); + + //Loop dRmin method + while(repeat_dRmin) { + repeat_dRmin = false; + + double dR_max = 0.0; //Maximum dR passing dRmin cut requirement + int index_max = -1; //Index of jet with dR_max + + //Number of goodflagged processed jets (outer loop) + int nijet = 0; + + //Outer jet loop + for(int ijet = 0; ijet < (int)m_jets.size(); ijet++) { + + if(!jetflags.at(ijet)) continue; //next outer jet + + //Use maximum of 4 goodflagged jets + if(nijet > 3) break; + nijet++; + + double dR_min = 999.9; + + double dR_lep = m_jets.at(ijet)->DeltaR(m_lepton); + dR_min = dR_lep; + + //Number of goodflagged processed jets (inner loop) + int njjet = 0; + + //Inner jet loop + for(int jjet = 0; jjet < (int)m_jets.size(); jjet++) { + + if(!jetflags.at(jjet)) continue; //next inner jet + + //Use maximum of 4 goodflagged jets + if(njjet > 3) break; + njjet++; + + if(jjet == ijet) continue; //next inner jet + + double dR_jet = m_jets.at(ijet)->DeltaR(*(m_jets.at(jjet))); + if(dR_jet < dR_min){ + dR_min = dR_jet; + } + } //end of inner jet loop + + if(dR_min > dR_max) { + //dRmin specific cut (defined for GeV, needs m_Units correction on mass) + double dR_cut = m_dRCutOffset - m_dRCutMassFactor * m_jets.at(ijet)->M()/m_Units; + if(dR_min > dR_cut) { + dR_max = dR_min; + index_max = ijet; + } + } + }//end of outer jet loop + + if(index_max >= 0) { + jetflags.at(index_max) = false; + if(count(jetflags.begin(), jetflags.end(), true) > 3) repeat_dRmin = true; + } + }//end of while(repeat) + + int nijet = 0; + //Save selected jet indices + for(int ijet = 0; ijet < (int)m_jets.size(); ijet++) { + if(!jetflags.at(ijet)) continue; //next jet + + //Use maximum of 4 goodflagged jets + if(nijet > 3) break; + nijet++; + + m_jet_indices.push_back(ijet); + } + + return true; +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Chi2LJets.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Chi2LJets.h new file mode 100644 index 0000000000000000000000000000000000000000..def6b3cce0d9b3d175e8827ced03dc2ea6a2b21d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Chi2LJets.h @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CHI2LJETS_H_ +#define CHI2LJETS_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +#include "TLorentzVector.h" + +class TMinuit; + +namespace top { +class Event; + +/** + * @brief Hold the information that is required for the chi^2 minimisation + */ +class FitInfo : public TObject { +public: + ///Mass of the hadronic W (j+j) + double hadronic_w_mass; + + ///Mass of the hadronic top quark (j+j+j) + double hadronic_t_mass; + + ///Missing ET - px + double neutrino_px; + + ///Missing ET - py + double neutrino_py; + + ///Four-vector of the lepton (electron or muon) + TLorentzVector lepton; + + ///Four vector of the jet that we think is the leptonic b quark + TLorentzVector leptonic_b; +}; + +/** + * @brief Not complete. Work in progress + */ +class Chi2LJets : public EventSelectorBase { +public: + Chi2LJets(); + virtual ~Chi2LJets(); + + virtual bool apply(const top::Event&) const override; + + std::string name() const { return "RECO:CHI2LJETS"; } + +private: + ///So we can do a minimisation + TMinuit* min; + + mutable FitInfo params; + +//so the fcn function can see them +public: + ///The top mass that we're using as the baseline - used in chi2 function. + static const double input_topmass; + + ///The W mass that we're using as the baseline - used in chi2 function. + static const double input_wmass; + + ///The top resolution that we're using as the baseline - used in chi2 function. + static const double input_topsigma; + + ///The W resolution that we're using as the baseline - used in chi2 function. + static const double input_wsigma; +}; + +} + +void fcn(int& npar, double* deriv, double& result, double par[], int flag); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterRun.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterRun.h new file mode 100644 index 0000000000000000000000000000000000000000..f11c5c2821944b898e713fb82186ec5818c88092 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterRun.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: KLFitterRun.h 688037 2015-08-07 01:24:06Z morrisj $ +#ifndef ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_KLFITTERRUN_H +#define ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_KLFITTERRUN_H + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventReconstructionTools/KLFitterTool.h" + +namespace top{ + class Event; + class TopConfig; + + class KLFitterRun : public EventSelectorBase { + public: + KLFitterRun(const std::string& kLeptonType,std::shared_ptr<top::TopConfig> config); + virtual ~KLFitterRun(){} + + virtual bool apply(const top::Event&) const override; + std::string name() const; + + private: + std::string m_name; + + std::unique_ptr<top::KLFitterTool> m_myFitter; + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterTool.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..8d28f4c22a68f7a826e89e56aff3eb70e0e0537f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/KLFitterTool.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: KLFitterTool.h 788027 2016-12-04 18:30:45Z aknue $ +#ifndef ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_KLFITTERTOOL_H +#define ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_KLFITTERTOOL_H + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "xAODBTaggingEfficiency/IBTaggingEfficiencyTool.h" + + +// KLFitter include(s): +#include "KLFitter/Fitter.h" +#include "KLFitter/LikelihoodTopLeptonJets.h" +#include "KLFitter/LikelihoodTTHLeptonJets.h" +#include "KLFitter/PhysicsConstants.h" +#include "KLFitter/LikelihoodBase.h" +#include "KLFitter/DetectorAtlas_8TeV.h" +#include "KLFitter/Permutations.h" + +// system include(s): +#include <iostream> +#include <sstream> +#include <vector> +#include <cmath> +#include <memory> + + + /// + /// @author John Morris <john.morris@cern.ch> + /// + /// $Revision: 788027 $ + /// $Date: 2016-12-04 19:30:45 +0100 (Sun, 04 Dec 2016) $ + /// + /// @brief Interface to KLFitter + /// + +// Forware declare +namespace KLFitter{ + class Particles; +} + +namespace top{ + class Event; + class TopConfig; + + /// Some additional enums + namespace KLFitterJetSelection{ + enum JetSelectionMode{ kLeadingFour , kLeadingFive , kLeadingSix, kBtagPriorityFourJets , kBtagPriorityFiveJets , kBtagPrioritySixJets}; + } + + + class KLFitterTool final : public asg::AsgTool { + + public: + /// Constructor + explicit KLFitterTool( const std::string& name ); + /// Destructor + virtual ~KLFitterTool(){} + + /// Function initialising the tool + virtual StatusCode initialize(); + /// Function executing the tool + virtual StatusCode execute(const top::Event&); + /// Function finalizing the tool + virtual StatusCode finalize(); + + private: + + // set jets depending on selection mode + void setJets(const top::Event&,KLFitter::Particles* inputParticles); + void setJetskLeadingFour(const top::Event&,KLFitter::Particles* inputParticles); + void setJetskLeadingFive(const top::Event&,KLFitter::Particles* inputParticles); + void setJetskLeadingSix(const top::Event&,KLFitter::Particles* inputParticles); + + void setJetskLeadingX(const top::Event& event,KLFitter::Particles* inputParticles, int); + + + void setJetskBtagPriorityFourJets(const top::Event&,KLFitter::Particles* inputParticles); + void setJetskBtagPriorityFiveJets(const top::Event&,KLFitter::Particles* inputParticles); + void setJetskBtagPrioritySixJets(const top::Event&,KLFitter::Particles* inputParticles); + + void setJetskBtagPriority(const top::Event&,KLFitter::Particles* inputParticles,const unsigned int maxJets); + + // configuration + std::shared_ptr<top::TopConfig> m_config; + float m_massTop; + float m_bTagCutValue; + + // Tools and functions for btagging + ToolHandle<IBTaggingEfficiencyTool> m_btagging_eff_tool; + bool HasTag(const xAOD::Jet& jet, double& weight) const; + void retrieveEfficiencies(const xAOD::Jet& jet, float* efficiency, float* inefficiency); + + /// KLFitter parameters, to be set by input file + std::string m_transferFunctionsPathPrefix; + std::string m_transferFunctionsPath; + + std::string m_leptonType; + std::string m_LHType; + KLFitter::LikelihoodTopLeptonJets::LeptonType m_leptonTypeKLFitterEnum; + KLFitter::LikelihoodTTHLeptonJets::LeptonType m_leptonTypeKLFitterEnum_TTH; + top::KLFitterJetSelection::JetSelectionMode m_jetSelectionModeKLFitterEnum; + KLFitter::LikelihoodBase::BtaggingMethod m_bTaggingMethodKLFitterEnum; + + /// The KLFitter + std::unique_ptr<KLFitter::Fitter> m_myFitter; + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/MT2Reco.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/MT2Reco.h new file mode 100644 index 0000000000000000000000000000000000000000..21730795c365110ec26673a6b3201e386bee33b5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/MT2Reco.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MT2RECO_H_ +#define MT2RECO_H_ + +#ifdef ROOTCORE_PACKAGE_Oxbridgekinetics + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { +class Event; + +/** + * @brief Not complete. Work in progress + */ +class MT2Reco : public EventSelectorBase { +public: + MT2Reco(); + virtual ~MT2Reco(); + + virtual bool apply(const top::Event&) const override; + + std::string name() const { return "RECO:MT2"; } +}; + +} + +#endif //ROOTCORE_PACKAGE_Oxbridgekinetics + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/NeutrinoWeighting.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/NeutrinoWeighting.h new file mode 100644 index 0000000000000000000000000000000000000000..1a4a6ea63d93ce64f040f681f8cfbfb06e805c8a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/NeutrinoWeighting.h @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NEUTRINOWEIGHTING_H_ +#define NEUTRINOWEIGHTING_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { +class Event; + +/** + * @brief Holds the two solutions from the quadratic equation as TLorentVectors. + * + * Filled when solving the quadratic equation to calculate the 4 Vectors for + * the two neutrinos in the event. + */ +class NWSolution { +public: + void setSolutions(int num, const TLorentzVector& a, const TLorentzVector& b) { + m_v1 = a; + m_v2 = b; + m_solutions = num; + } + + void setSolutions(int num) { + m_solutions = num; + } + + int getNumSolutions() const { + return m_solutions; + } + + TLorentzVector getv1() const { + return m_v1; + } + + TLorentzVector getv2() const { + return m_v2; + } + +private: + ///Number of solutions. 0 or 2, one solution isn't possible due to the use of floats. + int m_solutions; + + ///First solution from the quadratic, check m_solutions is 2 first. + TLorentzVector m_v1; + + ///Second solution from the quadratic, check m_solutions is 2 first. + TLorentzVector m_v2; +}; + +/** + * @brief Not complete. Work in progress + */ +class NeutrinoWeighting : public EventSelectorBase { +public: + NeutrinoWeighting(); + virtual ~NeutrinoWeighting(); + + bool apply(const top::Event&) const override; + + std::string name() const { return "RECO:NEUTRINOWEIGHTING"; } + +private: + /** + * @param lepton The lepton 4 vector. + * @param bJet The b jet 4 vector. + * @param topMass The top mass is a constraint in the spin correlation calculation. + * @param index Gives the position in the neutrino eta array of this neutrino. + */ + NWSolution solveForNeutrinoEta(const TLorentzVector& lepton, const TLorentzVector& bJet, double topMass, int index) const; + + /** + * @brief Calculate the weight for this combination of particles by comparing with Met. + * + * Weight a solution based on the agreement with missing Et. + * + * @param neutrino1 The first neutrino (actually the order doesn't matter). + * @param neutrino2 The second neutrino. + * @param met_ex The x component of missing Et. + * @param met_ey The y component of missing Et. + * + * @return The weight of this solution based on the input neutrinos. + */ + double neutrino_weight(const TLorentzVector&, const TLorentzVector&, double, double) const; + + ///Sampling points + double neutrinos[2000][3]; + + ///Delta eta sampling size. For the mass we don't need to sample so many points. + int etaSize; + + ///Top Quark Mass constraint. + double topMass; + + ///B jet mass constraint. + double m_bmass; + + ///W jet mass constraint. + double m_wmass; + + //For weighter. + double sigmax; + + //For weighter. + double sigmay; + +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PTMaxReco.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PTMaxReco.h new file mode 100644 index 0000000000000000000000000000000000000000..7d701f9871b914afa5ef595750ca54740e96bf5a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PTMaxReco.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PTMAXRECO_H_ +#define PTMAXRECO_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +#include "TLorentzVector.h" + +namespace top { +class Event; + +/** + * @brief Not complete. Work in progress + */ +class PTMaxReco : public EventSelectorBase { +public: + PTMaxReco(); + virtual ~PTMaxReco(); + + bool apply(const top::Event&) const override; + + std::string name() const { return "RECO:PTMAX"; } + +private: + TLorentzVector neutrinoCandidate(const TLorentzVector& lep, const xAOD::MissingET& met, bool dealWithNegative_nu) const; + + double m_wmass; + double m_topmass; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopReco.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopReco.h new file mode 100644 index 0000000000000000000000000000000000000000..0b5ea4b5a0bb3b2ca1ae25d89c23eecb499f9429 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopReco.h @@ -0,0 +1,95 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_PSEUDOTOPRECO_H + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "TopParticleLevel/ParticleLevelEvent.h" + +// ROOT include(s): +#include "TLorentzVector.h" + +// system include(s): +#include <iostream> +#include <sstream> +#include <vector> +#include <cmath> +#include <memory> + + + /// + /// @translated by A.Knue from MAMbo tool, Link: https://twiki.cern.ch/twiki/bin/view/Main/MAMbo + /// + /// @brief use PseudoTop definitions to reconstruct tttbar event + /// + +namespace PseudoTopReco{ + class Particles; +} + +namespace top{ + class Event; + class TopConfig; + + enum LeptonType{kElectron, kMuon}; + + class PseudoTopReco final : public asg::AsgTool { + + public: + /// Constructor + explicit PseudoTopReco( const std::string& name ); + /// Destructor + virtual ~PseudoTopReco(){} + + /// Function initialising the tool + virtual StatusCode initialize(); + /// Function executing the tool + virtual StatusCode execute(const top::Event&); + + virtual StatusCode execute(const top::ParticleLevelEvent& plEvent); + + /// Function finalizing the tool + virtual StatusCode finalize(); + + // fill first all four vectors to use for the reconstruction + bool SetChargedLeptonInfo(const top::Event& event); + bool SetJetInfo(const top::Event& event); + + bool SetChargedLeptonInfo(const top::ParticleLevelEvent& plEvent); + bool SetJetInfo(const top::ParticleLevelEvent& plEvent); + + bool RunReconstruction(); + + bool ReconstructLeptonicW(); + + private: + + // config file + std::shared_ptr<top::TopConfig> m_config; + float m_bTagCutValue; + + std::string m_leptonType; + + std::vector<TLorentzVector> m_bJets; + std::vector<TLorentzVector> m_lightJets; + TLorentzVector m_lepton; + TLorentzVector m_neutrino; + TLorentzVector m_W_lep; + TLorentzVector m_W_had; + TLorentzVector m_b_lep; + TLorentzVector m_b_had; + TLorentzVector m_top_lep; + TLorentzVector m_top_had; + TLorentzVector m_ttbar; + double m_nu_px, m_nu_py, m_nu_pz, m_met_et; + double m_ht,m_R_lb,m_R_Wb_had,m_R_Wb_lep; + + const double KinemEdge = 13.9e6; + const double mWPDG = 80.399; + + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopRecoRun.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopRecoRun.h new file mode 100644 index 0000000000000000000000000000000000000000..b5c11a73f0b3f3d9f7836e87db47c61d870f967c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/PseudoTopRecoRun.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_PSEUDOTOPRECORUN_H +#define ANALYSISTOP_TOPEVENTRECONSTRCUTIONTOOLS_PSEUDOTOPRECORUN_H + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventReconstructionTools/PseudoTopReco.h" + +namespace top{ + class Event; + class TopConfig; + + class PseudoTopRecoRun : public EventSelectorBase { + public: + PseudoTopRecoRun(const std::string& kLeptonType, std::shared_ptr<top::TopConfig> config); + virtual ~PseudoTopRecoRun(){} + + virtual bool apply(const top::Event&) const override; + + virtual bool applyParticleLevel(const top::ParticleLevelEvent& plEvent) const override; + + std::string name() const; + + private: + std::string m_name; + + std::unique_ptr<top::PseudoTopReco> m_PseudoTopReco; + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Sonnenschein.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Sonnenschein.h new file mode 100644 index 0000000000000000000000000000000000000000..d9882e2d94b0259a6941e2270a222ab43672749a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/Sonnenschein.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SONNENSCHEIN_H_ +#define SONNENSCHEIN_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventReconstructionTools/SonnenscheinEngine.h" + +#include "TLorentzVector.h" + +namespace top { +class Event; + +/** + * @brief An AnalysisTop friendly wrapper for the Sonnenschein reconstruction + * that is implemented in SonnenscheinEngine. + */ +class Sonnenschein : public EventSelectorBase { +public: + Sonnenschein(); + virtual ~Sonnenschein(); + + virtual bool apply(const top::Event&) const override; + + std::string name() const { return "RECO:SONNENSCHEIN"; } + +private: + bool tWb(const top::Event& event, int start, TLorentzVector& t, TLorentzVector& W, TLorentzVector& b, TLorentzVector& l, TLorentzVector& nu) const; + + top::SonnenscheinEngine m_sonn; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/SonnenscheinEngine.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/SonnenscheinEngine.h new file mode 100644 index 0000000000000000000000000000000000000000..564bc251970186df96ff14649d9f34dc612405c5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/SonnenscheinEngine.h @@ -0,0 +1,97 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SONNENSCEINENGINE_H_ +#define SONNENSCEINENGINE_H_ + +#include <vector> +#include <string> +#include <utility> + +#include "TLorentzVector.h" + +namespace top { + +/** + * @brief Rewrite the top and anti-top decays as a quartic polynomial using top + * and W mass constraints. And solve. + * + * Implements http://arxiv.org/abs/hep-ph/0510100 and + * http://arxiv.org/abs/hep-ph/0603011. Solves exactly the 4-th order polynomial + * and returns the neutrino Lorentz vectors for both neutrinos in the event. + * + */ +class SonnenscheinEngine { +public: + /** + * @brief Does nothing except sets the default flag to false. + */ + SonnenscheinEngine(); + + /** + * @brief Does nothing. + */ + ~SonnenscheinEngine(); + + /** + * @brief Does the real work. + * + * Supply it with the Lorentz vectors of the (lepton, b and a top and W mass) + * * 2 and the MET ex and ey components. Note that if you give it 'truth' + * particles and the truth W and t masses then it should reproduce the neutrinos + * exactly in one of the solutions. + * + * @return A vector of up-to 4 solutions. Note that when you called this + * function you assumed a lepton-b pairing, so if you want to try the other + * one you'll have to call it again with the b and bbar swapped or something. + */ + std::vector<std::pair<TLorentzVector, TLorentzVector> > solve(const TLorentzVector& me_t_lp, const TLorentzVector& me_t_b, double mass_t, double mass_wp, const TLorentzVector& me_tbar_lm, const TLorentzVector& me_tbar_bbar, double mass_tbar, double mass_wm, double me_mex, double me_mey) const; + +private: + /** + * @brief Solve a quartic. + * + * You're probably confused. It says quartic, but takes five parameters as + * input. First it divides everything by h0 - so that gives four parameters. + * + * In the original code they have lots of cases to test when something == 0. + * Not sure this would ever run - so I deleted it :). + */ + std::vector<double> solveQuartic(double h0, double h1, double h2, double h3, double h4) const; + + /** + * @brief Solves a cubic. No, really! + * + * Similar cases to check something == 0 left out. + * z^3 + s1z^2 + s2z + s3 + * + * @return Either 3 solutions, or a single one. + */ + std::vector<double> solveCubic(double s1, double s2, double s3) const; + + /** + * @brief Another Ronseal (google it) of a function. + * + * @param a Coefficient of x^2 + * @param b Coefficient of x^1 + * @param c Coefficient of x^0 + * @return A vector of (up-to) two solutions. + */ + std::vector<double> solveQuadratic(double a, double b, double c) const; + + /** + * @brief Is a number positive or negative. This little gem will let you know. + * + * @param a The number in question. + * @return Plus or minus one. + */ + double sign(double a) const; + + ///Print a load of debug information (probably not by default, right)? + bool m_debug; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TopEventReconstructionToolsLoader.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TopEventReconstructionToolsLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..5f2dd1b0d6dd9bbc9db9fc6e35924472fd8695df --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TopEventReconstructionToolsLoader.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RECONSTRUCTIONTOOLLOADER_H_ +#define RECONSTRUCTIONTOOLLOADER_H_ + +#include "TopEventSelectionTools/ToolLoaderBase.h" + +namespace top { + +/** + * @brief Load a ttbar event reconstruction code based on the same. + * + * Names for reconstruction (rather than selection) should start with "RECO:" + * so that we can tell them apart. + * + * Why is this a class? So that ROOT can load it at run-time! The only + * important function is the initTool one, after that has been called then this + * class can be safely disposed of. + * + * Note that the name of this tool is the name of the package with the word + * Loader after it. That's important so the main code can find the tools that + * this package provides! For the same reason it inherits from + * top::ToolLoaderBase. + * + */ +class TopEventReconstructionToolsLoader : public ToolLoaderBase { +public: + /** + * @brief Some sort of factory that can create the tool you need given a + * string. + * + * @param name The name of the tool to load, e.g. RECO:KLFITTERLJETS. + * @param line Not used here yet, but could be used to send configuration options to the tool. + * @param config The TopConfig object, which is needed by the KLFitterTool + * @param outputFile Not used here, but could be used so the tool has direct access to the output file. + * @param wk Not used, but needed by EventLoop for some of the selection tools. + * @return A pointer to a fully initialised and ready to use tool. + */ + top::EventSelectorBase* initTool(const std::string& name, const std::string& line, TFile* outputFile, std::shared_ptr<top::TopConfig> config,EL::Worker* wk = nullptr); + + ClassDef(top::TopEventReconstructionToolsLoader, 0) +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresChi2.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresChi2.h new file mode 100644 index 0000000000000000000000000000000000000000..1aee478fb6e3e776a36c15f6e0a64fc473970d0f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresChi2.h @@ -0,0 +1,126 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TtresChi2_H +#define TtresChi2_H + +#include<iostream> +#include <string> +#include <vector> +#include "TLorentzVector.h" +#include "TopEventReconstructionTools/TtresNeutrinoBuilder.h" + + +class TtresChi2{ + public: + TtresChi2(std::string units="GeV"); + virtual ~TtresChi2(); + + enum WReco {ROTATION, REALPART, DECREASING}; + enum Chi2Version {DATA2011SUMMER2012, DATA2012AUTOMN2012, DATA2012SUMMER2013, DATA2012SUMMER2013PT100}; + enum PtDiff {NOPTDIFF, PTDIFF, PTDIFFREL, PTDIFFMASS}; + enum Btag {STDBTAG, AFFECTBTAG, NO_BTAGHM, NO_BTAG}; + enum RunMode {RUNDEFAULT, RUNSTUDY}; + + private: + TtresChi2(const TtresChi2&); + TtresChi2& operator=(const TtresChi2&); + std::vector<TLorentzVector*> GetNeutrinos(TLorentzVector*, TLorentzVector*); + + double MjjP, SMjjP, m_TopMinusW_had_mean, m_TopMinusW_had_sigma, m_Top_lep_mean, m_Top_lep_sigma, m_PtDiff_mean, m_PtDiff_sigma, m_PtDiffRel_mean, m_PtDiffRel_sigma, m_PtDiffRelMass_mean, m_PtDiffRelMass_sigma, MTHJJ, STHJJ; + double m_WhChi2Value,m_ThWhChi2Value,m_TlChi2Value,m_PtDiffChi2Value; + int m_debug; + PtDiff m_UsePtDiff; + Btag m_Btag; + WReco m_WReco; + RunMode m_RunMode; + double m_Units; + TtresNeutrinoBuilder* m_NeutrinoBuilder; + double m_highJetMass; + int m_category; + + double res_chi2All, res_chi2WH, res_chi2TopH, res_chi2TopL, res_Mtl, res_Mwh, res_Mth, res_Mtt; + TLorentzVector res_Tt; + + std::vector < double > m_chi2Values; + std::vector < double > m_chi2Wh_Values; + std::vector < double > m_chi2Th_Values; + std::vector < double > m_chi2ThWh_Values; + std::vector < double > m_chi2Tl_Values; + std::vector < double > m_chi2PtDiff_Values; + + std::vector < double > m_PtDiff_Values; + std::vector < double > m_Wh_Values; + std::vector < double > m_ThWh_Values; + std::vector < double > m_Th_Values; + std::vector < double > m_Tl_Values; + + std::vector < int > m_i_Wq1; + std::vector < int > m_i_Wq2; + std::vector < int > m_i_Thb; + std::vector < int > m_i_Tlb; + std::vector < int > m_i_n; + + int m_nChi2Values; + + public: + void Init(Chi2Version version = DATA2012SUMMER2013, double highJetMass = 60.0); + void Reset(); + bool findMinChiSquare_HMelseLM(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, int&, int&, double&, double&, double&); + bool findMinChiSquare_LMelseHM(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, int&, int&, double&, double&, double&); + + bool findMinChiSquare_AllRanges(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, int&, int&, double&, double&, double&); + + bool findMinChiSquare(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, int&, int&, double&, double&, double&); + + bool findMinChiSquare_HighMass(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, int&, double&, double&, double&); + + bool findMinChiSquare_VeryHighMass(TLorentzVector*, const std::vector<TLorentzVector*>*, const std::vector<bool>*, TLorentzVector*, int&, int&, int&, double&, double&, double&); + + inline void SetDebugMode(bool X){m_debug=X;if(m_debug>2)m_NeutrinoBuilder->setdebuglevel(m_debug);} + inline void SetWReconstruction(WReco X){m_WReco=X;} + inline void SetBtagHandeling(Btag X){m_Btag=X;} + inline void SetHighMThreshold(double highJetMass) {m_highJetMass = highJetMass;} + inline void UsePtDiff(PtDiff X){m_UsePtDiff=X;} + inline void SetRunMode(RunMode X){m_RunMode=X;} + + inline double getResult_Chi2All() {return res_chi2All;} + inline double getResult_Chi2WH() {return res_chi2WH;} + inline double getResult_Chi2TopH() {return res_chi2TopH;} + inline double getResult_Chi2TopL() {return res_chi2TopL;} + inline double getResult_Mtl() {return res_Mtl;} + inline double getResult_Mwh() {return res_Mwh;} + inline double getResult_Mth() {return res_Mth;} + inline double getResult_Mtt() {return res_Mtt;} + + inline std::vector < double > getAllChi2Values() {return m_chi2Values; } + inline std::vector < double > getAllWh_Chi2Values() {return m_chi2Wh_Values; } + inline std::vector < double > getAllTh_Chi2Values() {return m_chi2Th_Values; } + inline std::vector < double > getAllThWh_Chi2Values() {return m_chi2ThWh_Values; } + inline std::vector < double > getAllTl_Chi2Values() {return m_chi2Tl_Values; } + inline std::vector < double > getAllPtDiff_Chi2Values() {return m_chi2PtDiff_Values;} + inline std::vector < int > getAllIndicesWq1() {return m_i_Wq1; } + inline std::vector < int > getAllIndicesWq2() {return m_i_Wq2; } + inline std::vector < int > getAllIndicesThb() {return m_i_Thb; } + inline std::vector < int > getAllIndicesTlb() {return m_i_Tlb; } + inline std::vector < int > getAllIndicesN() {return m_i_n; } + + inline std::vector < double > getAllPtDiff_Values() {return m_PtDiff_Values; } + inline std::vector < double > getAllWh_Values() {return m_Wh_Values; } + inline std::vector < double > getAllThWh_Values() {return m_ThWh_Values; } + inline std::vector < double > getAllTh_Values() {return m_Th_Values; } + inline std::vector < double > getAllTl_Values() {return m_Tl_Values; } + + inline double getWhChi2Value() {return m_WhChi2Value; } + inline double getThWhChi2Value() {return m_ThWhChi2Value;} + inline double getTlChi2Value() {return m_TlChi2Value; } + inline double getPtDiffChi2Value() {return m_PtDiffChi2Value;} + inline int getNChi2Values() {return m_nChi2Values; } + inline int getCategory() {return m_category; } + inline TLorentzVector getResult_Tlv() {return res_Tt; } + +}; + + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresNeutrinoBuilder.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresNeutrinoBuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..bc6ddbec57b7aab422b4349a291a461a24d63793 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresNeutrinoBuilder.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TtresNeutrinoBuilder_H +#define TtresNeutrinoBuilder_H 1 + +#include <iostream> +#include <string> + +// ROOT classes +#include "TLorentzVector.h" +#include <TMinuit.h> +#include <TUUID.h> + +class TtresNeutrinoBuilder { + + public: + TtresNeutrinoBuilder(std::string units); + virtual ~TtresNeutrinoBuilder(); + TtresNeutrinoBuilder(const TtresNeutrinoBuilder&); + TtresNeutrinoBuilder& operator=(const TtresNeutrinoBuilder&); + + inline void setdebuglevel(int level){m_debug = level;}; + + Double_t getDiscriminant(const TLorentzVector*, const Double_t, const Double_t); + // In case of negative discriminant, decrease the MET + bool candidatesFromWMass_Scaling(const TLorentzVector*, double, Double_t, std::vector<TLorentzVector*>&); + std::vector<TLorentzVector*> candidatesFromWMass_Scaling(const TLorentzVector*, const Double_t, const Double_t); + std::vector<TLorentzVector*> candidatesFromWMass_Scaling(const TLorentzVector*, const TLorentzVector*); + // In case of negative discriminant, rotate the MET + std::vector<TLorentzVector*> candidatesFromWMass_Rotation(const TLorentzVector*, const Double_t, const Double_t, const bool); + std::vector<TLorentzVector*> candidatesFromWMass_Rotation(const TLorentzVector*, const TLorentzVector*, const bool); + // In case of negative discriminant, use the real part + std::vector<TLorentzVector*> candidatesFromWMass_RealPart(const TLorentzVector*, const Double_t, const Double_t, const bool); + std::vector<TLorentzVector*> candidatesFromWMass_RealPart(const TLorentzVector*, const TLorentzVector*, const bool); + + protected: + double fitAlpha(const TLorentzVector*, const Double_t, const Double_t); + int m_debug; + double m_Units; + +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresdRmin.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresdRmin.h new file mode 100644 index 0000000000000000000000000000000000000000..06bd7b2506ae6d4f5bbed953e977fa15dc6359d7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/TopEventReconstructionTools/TtresdRmin.h @@ -0,0 +1,139 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TtresdRmin_H +#define TtresdRmin_H + +#include <iostream> +#include <vector> + +#include "TLorentzVector.h" + +using namespace std; + +class TtresdRmin { + + +///////////////////////////////////////////////////////////////////////////////////////////// +// public +///////////////////////////////////////////////////////////////////////////////////////////// + + public: + + /** + * Class constructor. Set unit used in four momentum vector calculations + * @param units : Unit used for reconstruction, MeV or GeV + */ + TtresdRmin(TString units = "GeV", bool verbose = false); + + + /** + * Class destructor + */ + virtual ~TtresdRmin() {}; + + + /** + * Initialize the tool, giving specific parameters needed for dRmin cut + * Paramters are given in GeV scale, will be scaled internally to MeV if set. + * + * @param highJetMass : jet mass for highMass jet criteria + * @param minJetPt : minimum pT of jets used for dRmin method + * @param dRCutOffset : Offset for dRmin specific cut + * @param dRCutMassFactor : Factor applied to jet mass in dRmin specific cut + * @return void + */ + void Init(double highJetMass = 60.0, double minJetPt = 25.0, double dRCutOffset = 2.5, double dRCutMassFactor = 0.015); + + + /** + * Set the objects needed to calculate the invariant ttbar mass + * + * @param jets : Jet container + * @param lepton : Selected lepton + * @param neutrino : Reconstructed neutrino + * @return bool : Success of setup + */ + bool SetupEvent(vector<TLorentzVector*> &jets, TLorentzVector &lepton, TLorentzVector &neutrino); + + + /** + * Get jet indicices identified by dRmin method, used for mtt reconstruction + * @return vector<int> : Indices of identified jets in passed jet vector + */ + inline vector<int> GetJetIndices() { return m_jet_indices; }; + + + /** + * Get index of jet with highest mass + * @return int : jet index + */ + inline int GetHighMassJetIndex() { return m_highMassJetIndex; }; + + + /** + * Get highest jet mass found in jet vector + * @return double : jet mass + */ + inline double GetHighestJetMass() { return m_highestJetMass; }; + + + /** + * Set threshold for highMass case + * @param highJetMass threshold for the high jet mass case + */ + inline void SetHighMThreshold(double highJetMass) { m_highM = highJetMass; }; + + + /** + * Get calculated invariant ttbar mass for dRmin method + * @return double : invariant ttbar mass + */ + double GetMttdRmin(); + + /** + * Get the TLorentzVector for the ttbar system + */ + TLorentzVector GetTlvdRmin(); + + +///////////////////////////////////////////////////////////////////////////////////////////// +// private +///////////////////////////////////////////////////////////////////////////////////////////// + + private: + /** + * Find the jet indices used for mtt reconstruction for events containing a high mass jet + * @return bool : success of function + */ + bool FindJetIndices_HM(); + + + /** + * Find the jet indices used for mtt reconstruction for events NOT containing a high mass jet + * @return bool : success of function + */ + bool FindJetIndices_LM(); + + bool m_init; ///< Flag of initialization status of tool + bool m_verbose; ///< Flag for verbosity level + double m_highM; ///< Jet mass threshold to identify it as a "high mass jet" + double m_Units; ///< Unit factor used, GeV = 1, MeV = 1000 + double m_minJetPt; ///< Minimum jet pT used for highM jet search + double m_dRCutOffset; ///< Offset of dRmin specific cut on jet_dR + double m_dRCutMassFactor; ///< Jet mass factor of dRmin specific cut on jet_dR + + int m_highMassJetIndex; ///< Index of highest mass jet for current event + double m_highestJetMass; ///< Highest jet mass found for current event + + vector<TLorentzVector*> m_jets; ///< Input vector of jet objects + TLorentzVector m_lepton; ///< Input lepton object + TLorentzVector m_neutrino; ///< Input neutrino object + TLorentzVector m_Wleptonic; ///< leptonic W object reconstructed from lepton and neutrino + + vector<int> m_jet_indices; ///< Indices of jets used for reconstruction of invariant ttbar mass + +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..5913d21068d8a6aa974f8430a5ac3ec5ef0d1193 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopEventReconstructionTools + +# the libraries to link with this one: +PACKAGE_PRELOAD = Minuit + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = xAODCore AthContainers AsgTools TopEvent TopEventSelectionTools TopAnalysis + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = KLFitter Asg_Oxbridgekinetics + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..0427963fd7c956482695af0eb6c93c55954cb083 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/share/mainpage.h @@ -0,0 +1,18 @@ +/** + * @page tertpage TopEventReconstructionTools + * + * @section er Event Reconstruction Tools + * + * - top::TopEventReconstructionToolsLoader: Code that loads a tool from the name. + * + * @section ljets l+jets Event Reconstruction + * - top::PTMaxReco: Take the 3-jet combination with highest pT as hadronic top + * - top::Chi2LJets: Do some chi2 fit to hadronic + leptonic part + * - top::KLFitterLJets: KLFitter + * + * @section dil Dilepton Event Reconstruction + * - top::NeutrinoWeighting + * - top::Sonnenschein and top::SonnenscheinEngine: Rewrite as a quartic polynomial, and solve exactly. + * - top::KLFitterDil: Dilepton KLFitter + * - top::MT2Reco + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/util/topreco_test_mt2.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/util/topreco_test_mt2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..55e00f281b2f84acb7f139c79402c327b14400ce --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/util/topreco_test_mt2.cxx @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> + +#include "RootCore/Packages.h" + +#ifdef ROOTCORE_PACKAGE_Oxbridgekinetics +#include "Mt2/Basic_Mt2_332_Calculator.h" +#include "Mt2/Mt2TwoVector.h" +#include "Mt2/Mt2LorentzVector.h" +#include "Mt2/Mt2LorentzTransverseVector.h" +#endif + +int main() { + +#ifndef ROOTCORE_PACKAGE_Oxbridgekinetics + std::cout << "Oxbridgekinetics library not found when compiling" << std::endl; +#else + std::cout << "Starting top mt2 test\n"; + Mt2::LorentzTransverseVector a; + Mt2::LorentzTransverseVector b; + Mt2::TwoVector c; + double d = 0.; + + Mt2::Basic_Mt2_332_Calculator mt2Calculator; + const double mt2 = mt2Calculator.mt2_332( a, b, c, d); + + std::cout << "mt2 " << mt2 << std::endl; + std::cout << "Ending\n"; +#endif + + return 0; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fb43493d7fba746a1ea1761ab31ee16a7e21fe7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt @@ -0,0 +1,44 @@ +# Auto-generated on: 2017-03-08 14:47:36.708684 + +# Declare the name of this package: +atlas_subdir( TopEventSelectionTools None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + EventLoop + AsgTools + JetInterface + TopEvent + TopCorrections + TopParticleLevel + MuonSelectorTools ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopEventSelectionTools _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopEventSelectionTools Root/*.cxx Root/*.h Root/*.icc + TopEventSelectionTools/*.h TopEventSelectionTools/*.icc TopEventSelectionTools/*/*.h + TopEventSelectionTools/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopEventSelectionTools + LINK_LIBRARIES EventLoop + AsgTools + JetInterface + TopEvent + TopCorrections + TopParticleLevel + MuonSelectorToolsLib + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ExamplePlots.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ExamplePlots.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6cabee37f80f876d3ef34c8d4dc861d4224d4dd1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ExamplePlots.cxx @@ -0,0 +1,395 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/ExamplePlots.h" + +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include "TopCorrections/ScaleFactorRetriever.h" + +#include <cmath> +#include <array> + +#include "TH1.h" +#include "TFile.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +namespace top { + +const double ExamplePlots::toGeV = 0.001; + + ExamplePlots::ExamplePlots(const std::string& name, TFile* outputFile, EL::Worker* wk, std::shared_ptr<top::TopConfig> config) : + m_hists(name, outputFile, wk), m_nominalHashValue(0) { + + m_config = config; + CP::SystematicSet nominal; + m_nominalHashValue = nominal.hash(); + + m_hists.addHist("event_mu", ";<#mu>;Events", 25, 0., 50.); + if (m_config->isMC()) { + m_hists.addHist("mc_weight", ";MC Event Weight", 30, -1, 2); + m_hists.addHist("jvt_SF", ";JVT SF", 120, -0.5, 2.5); + } + + m_hists.addHist("pileup_weight", ";Pileup Weight", 20, -1, 5); + + m_hists.addHist("el_n", ";Electron multiplicity;Events", 10, -0.5, 9.5); + m_hists.addHist("el_pt", ";Electron p_{T} / GeV;Electrons", 20, 0., 250.); + m_hists.addHist("el_eta", ";Electron #eta;Electrons", 20, -2.5, 2.5); + m_hists.addHist("el_phi", ";Electron #phi;Electrons", 20, -M_PI, M_PI); + m_hists.addHist("el_charge", ";Electron charge;Electrons", 3, -1.5, 1.5); + m_hists.addHist("el_trkpart_charge", ";Electron TrackParticle charge;Electrons", 3, -1.5, 1.5); + if (m_config->isMC()) m_hists.addHist("el_true_type", ";Electron true type;Electrons", 20, 0., 20.); + m_hists.addHist("el_topoetcone20", ";Electron topoetcone20 / GeV;Electrons", 20, 0., 20.); + m_hists.addHist("el_topoetcone30", ";Electron topoetcone30 / GeV;Electrons", 20, 0., 20.); + m_hists.addHist("el_topoetcone40", ";Electron topoetcone40 / GeV;Electrons", 20, 0., 20.); + m_hists.addHist("el_ptcone20", ";Electron ptcone20 / GeV;Electrons", 20, 0., 10.); + m_hists.addHist("el_ptcone30", ";Electron ptcone30 / GeV;Electrons", 20, 0., 10.); + m_hists.addHist("el_ptcone40", ";Electron ptcone40 / GeV;Electrons", 20, 0., 10.); + m_hists.addHist("el_ptvarcone20", ";Electron ptvarcone20 / GeV;Electrons", 20, 0., 10.); + m_hists.addHist("el_ptvarcone30", ";Electron ptvarcone30 / GeV;Electrons", 20, 0., 10.); + m_hists.addHist("el_ptvarcone40", ";Electron ptvarcone40 / GeV;Electrons", 20, 0., 10.); + + m_hists.addHist("mu_n", ";Muon multiplicity;Events", 10, -0.5, 9.5); + m_hists.addHist("mu_pt", ";Muon p_{T} / GeV;Muons", 20, 0., 250.); + m_hists.addHist("mu_eta", ";Muon #eta;Muons", 20, -2.5, 2.5); + m_hists.addHist("mu_phi", ";Muon #phi;Muons", 20, -M_PI, M_PI); + m_hists.addHist("mu_charge", ";Muon charge;Muons", 3, -1.5, 1.5); + if (m_config->isMC()) m_hists.addHist("mu_true_type", ";Muon true type;Muons", 20, 0., 20.); + m_hists.addHist("mu_topoetcone20", ";Muon topoetcone20 / GeV;Muons", 20, 0., 20.); + m_hists.addHist("mu_topoetcone30", ";Muon topoetcone30 / GeV;Muons", 20, 0., 20.); + m_hists.addHist("mu_topoetcone40", ";Muon topoetcone40 / GeV;Muons", 20, 0., 20.); + m_hists.addHist("mu_ptcone20", ";Muon ptcone20 / GeV;Muons", 20, 0., 10.); + m_hists.addHist("mu_ptcone30", ";Muon ptcone30 / GeV;Muons", 20, 0., 10.); + m_hists.addHist("mu_ptcone40", ";Muon ptcone40 / GeV;Muons", 20, 0., 10.); + m_hists.addHist("mu_ptvarcone20", ";Muon ptvarcone20 / GeV;Muons", 20, 0., 10.); + m_hists.addHist("mu_ptvarcone30", ";Muon ptvarcone30 / GeV;Muons", 20, 0., 10.); + m_hists.addHist("mu_ptvarcone40", ";Muon ptvarcone40 / GeV;Muons", 20, 0., 10.); + + m_hists.addHist("ph_n", ";Photon multiplicity;Events", 10, -0.5, 9.5); + m_hists.addHist("ph_pt", ";Photon p_{T} / GeV;Photons", 20, 0., 250.); + m_hists.addHist("ph_eta", ";Photon #eta;Photons", 20, -2.5, 2.5); + m_hists.addHist("ph_phi", ";Photon #phi;Photons", 20, -M_PI, M_PI); + m_hists.addHist("ph_e", ";Photon e / GeV;Photons", 3, -1.5, 1.5); + m_hists.addHist("ph_ptvarcone20", ";Photon ptvarcone20 / GeV;Photons", 20, 0., 10.); + + m_hists.addHist("jet_n", ";Jet multiplicity;Events", 10, -0.5, 9.5); + m_hists.addHist("jet_pt", ";Jet p_{T} / GeV;Jets", 40, 0., 500.); + m_hists.addHist("jet_e", ";Jet e / GeV;Jets", 40, 0., 1000.); + m_hists.addHist("jet_eta", ";Jet #eta;Jets", 20, -2.5, 2.5); + m_hists.addHist("jet_phi", ";Jet #phi;Jets", 20, -M_PI, M_PI); + m_hists.addHist("jet_mv2c10", ";Jet mv2c10;Jets", 20, -1., 1.); + if (m_config->isMC()) { + m_hists.addHist("jet_truthflav", ";Jet truth flavor;Jets", 20, 0., 20.); + m_hists.addHist("jet_btagSF_77", ";Jet btag SF;Jets", 100, 0.5, 1.5); + } + m_hists.addHist("jet_isbtagged_77", ";Jet is b-tagged;Jets", 2, 0., 2.); + + m_hists.addHist("jet0_pt", ";Jet0 p_{T} / GeV; Events / 10 GeV", 25, 5, 505); + m_hists.addHist("jet0_eta", ";Jet0 #eta; Jets", 25, -2.5, 2.5); + m_hists.addHist("jet0_phi", ";Jet0 #phi; Jets", 25, -M_PI, M_PI); + m_hists.addHist("jet0_e", ";Jet0 E / GeV; Jets", 100, 0, 1000); + m_hists.addHist("jet0_mv2c10", ";Jet0 mv2c10; Jets", 50, 0, 1); + if (m_config->isMC()) { + m_hists.addHist("jet0_truthflav", ";Jet0 truth flavor;Jets", 20, 0., 20.); + m_hists.addHist("jet0_btagSF_77", ";Jet0 btag SF;Jets", 100, 0.5, 1.5); + } + m_hists.addHist("jet0_isbtagged_77", ";Jet is b-tagged;Jets", 2, 0., 2.); + + m_hists.addHist("jet1_pt", ";Jet1 p_{T} / GeV; Events / 10 GeV", 25, 5, 505); + m_hists.addHist("jet1_eta", ";Jet1 #eta; Jets", 25, -2.5, 2.5); + m_hists.addHist("jet1_phi", ";Jet1 #phi; Jets", 25, -M_PI, M_PI); + m_hists.addHist("jet1_e", ";Jet1 E / GeV; Jets", 100, 0, 1000); + m_hists.addHist("jet1_mv2c10", ";Jet1 mv2c10; Jets", 50, 0, 1); + if (m_config->isMC()) { + m_hists.addHist("jet1_truthflav", ";Jet1 truth flavor;Jets", 20, 0., 20.); + m_hists.addHist("jet1_btagSF_77", ";Jet1 btag SF;Jets", 100, 0.5, 1.5); + } + m_hists.addHist("jet1_isbtagged_77", ";Jet is b-tagged;Jets", 2, 0., 2.); + + m_hists.addHist("jet2_pt", ";Jet2 p_{T} / GeV; Events / 10 GeV", 25, 5, 505); + m_hists.addHist("jet2_eta", ";Jet2 #eta; Jets", 25, -2.5, 2.5); + m_hists.addHist("jet2_phi", ";Jet2 #phi; Jets", 25, -M_PI, M_PI); + m_hists.addHist("jet2_e", ";Jet2 E / GeV; Jets", 100, 0, 1000); + m_hists.addHist("jet2_mv2c10", ";Jet2 mv2c10; Jets", 50, 0, 1); + if (m_config->isMC()) { + m_hists.addHist("jet2_truthflav", ";Jet2 truth flavor;Jets", 20, 0., 20.); + m_hists.addHist("jet2_btagSF_77", ";Jet2 btag SF;Jets", 100, 0.5, 1.5); + } + m_hists.addHist("jet2_isbtagged_77", ";Jet is b-tagged;Jets", 2, 0., 2.); + + m_hists.addHist("jet3_pt", ";Jet3 p_{T} / GeV; Events / 10 GeV", 25, 5, 505); + m_hists.addHist("jet3_eta", ";Jet3 #eta; Jets", 25, -2.5, 2.5); + m_hists.addHist("jet3_phi", ";Jet3 #phi; Jets", 25, -M_PI, M_PI); + m_hists.addHist("jet3_e", ";Jet3 E / GeV; Jets", 100, 0, 1000); + m_hists.addHist("jet3_mv2c10", ";Jet3 mv2c10; Jets", 50, 0, 1); + if (m_config->isMC()) { + m_hists.addHist("jet3_truthflav", ";Jet3 truth flavor;Jets", 20, 0., 20.); + m_hists.addHist("jet3_btagSF_77", ";Jet3 btag SF;Jets", 100, 0.5, 1.5); + } + m_hists.addHist("jet3_isbtagged_77", ";Jet is b-tagged;Jets", 2, 0., 2.); + + //Large-R jet + m_hists.addHist("ljet_n", ";Large-R Jet multiplicity; Jets ", 5, 0, 5); + m_hists.addHist("ljet_pt", ";Large-R Jet p_{T} / GeV; Jets / 26 GeV", 50, 200, 1500); + m_hists.addHist("ljet_eta", ";Large-R Jet #eta; Jets", 15, -2., 2.); + m_hists.addHist("ljet_phi", ";Large-R Jet #phi; Jets", 25, -M_PI, M_PI); + m_hists.addHist("ljet_m", ";Large-R mass / GeV; Jets/ 10 GeV", 35, 50, 400); + m_hists.addHist("ljet_sd12", "Large-R #sqrt{d_{12}} / GeV; Jets / 10 GeV", 20, 0, 200); + + m_hists.addHist("taujet_n", ";TauJet multiplicity;Events", 20, -0.5, 19.5); + m_hists.addHist("taujet_pt", ";TauJet p_{T} / GeV;TauJet", 20, 0., 200.); + m_hists.addHist("taujet_eta", ";TauJet #eta;TauJet", 20, -2.5, 2.5); + m_hists.addHist("taujet_phi", ";TauJet #phi;TauJet", 20, -M_PI, M_PI); + m_hists.addHist("taujet_charge", ";TauJet charge;TauJet", 3, -1.5, 1.5); + + m_hists.addHist("event_met_et", ";MET / GeV;Events", 50, 0., 400.); + m_hists.addHist("event_met_phi", ";MET #phi;Events", 20, -M_PI, M_PI); +} + +bool ExamplePlots::apply(const top::Event& event) const { + //only nominal + + if (event.m_hashValue != m_nominalHashValue) + return true; + + //only plot tight selection + //before, we were plotting tight and loose together + if (event.m_isLoose) + return true; + + //std::cout << event << std::endl; + + double eventWeight = 1.; + if (top::isSimulation(event)) +// eventWeight = event.m_info->mcEventWeight(); + eventWeight = event.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + if (m_config->isMC()) { + m_hists.hist("mc_weight")->Fill(eventWeight, eventWeight); + m_hists.hist("jvt_SF")->Fill(event.m_jvtSF, eventWeight); + + //pileup weight needs pileup reweighting tool to have run + if (top::ScaleFactorRetriever::hasPileupSF(event)) + m_hists.hist("pileup_weight")->Fill(top::ScaleFactorRetriever::pileupSF(event), eventWeight); + } + + m_hists.hist("event_mu")->Fill(event.m_info->averageInteractionsPerCrossing(), eventWeight); + + m_hists.hist("el_n")->Fill(event.m_electrons.size(), eventWeight); + for (const auto* const elPtr : event.m_electrons) { + m_hists.hist("el_pt") -> Fill(elPtr->pt() * toGeV, eventWeight); + m_hists.hist("el_eta") -> Fill(elPtr->eta(), eventWeight); + m_hists.hist("el_phi") -> Fill(elPtr->phi(), eventWeight); + m_hists.hist("el_charge") -> Fill(elPtr->charge(), eventWeight); + + //protection from the derivation framework - + //So far we keep tracks associated with "good" electrons. + //It could be you have a super-loose selection here (just for testing) + //so we need to check if the electron has a track associated with it + if (elPtr->trackParticle()) + m_hists.hist("el_trkpart_charge")->Fill(elPtr->trackParticle()->charge(), eventWeight); + + //retrieve the truth-matching variables from MCTruthClassifier + if (m_config->isMC()) { + static SG::AuxElement::Accessor<int> typeel("truthType"); + if (typeel.isAvailable(*elPtr)) m_hists.hist("el_true_type")->Fill(typeel(*elPtr), eventWeight); + } + + //testing isolation in the derivation framework + float iso = 0; + + if (elPtr->isolationValue(iso, xAOD::Iso::topoetcone20)) + m_hists.hist("el_topoetcone20")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isolationValue(iso, xAOD::Iso::topoetcone30)) + m_hists.hist("el_topoetcone30")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isolationValue(iso, xAOD::Iso::topoetcone40)) + m_hists.hist("el_topoetcone40")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isolationValue(iso, xAOD::Iso::ptcone20)) + m_hists.hist("el_ptcone20")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isolationValue(iso, xAOD::Iso::ptcone30)) + m_hists.hist("el_ptcone30")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isolationValue(iso, xAOD::Iso::ptcone40)) + m_hists.hist("el_ptcone40")->Fill(iso * toGeV, eventWeight); + + if (elPtr->isAvailable<float>("ptvarcone20")) { + float ptvarcone20 = elPtr->auxdataConst<float>("ptvarcone20"); + m_hists.hist("el_ptvarcone20")->Fill(ptvarcone20 * toGeV, eventWeight); + } + + if (elPtr->isAvailable<float>("ptvarcone30")) { + float ptvarcone30 = elPtr->auxdataConst<float>("ptvarcone30"); + m_hists.hist("el_ptvarcone30")->Fill(ptvarcone30 * toGeV, eventWeight); + } + + if (elPtr->isAvailable<float>("ptvarcone40")) { + float ptvarcone40 = elPtr->auxdataConst<float>("ptvarcone40"); + m_hists.hist("el_ptvarcone40")->Fill(ptvarcone40 * toGeV, eventWeight); + } + } + + m_hists.hist("mu_n")->Fill(event.m_muons.size(), eventWeight); + for (const auto* const muPtr : event.m_muons) { + m_hists.hist("mu_pt")->Fill(muPtr->pt() * toGeV, eventWeight); + m_hists.hist("mu_eta")->Fill(muPtr->eta(), eventWeight); + m_hists.hist("mu_phi")->Fill(muPtr->phi(), eventWeight); + + //protection from derivation framework removing tracks + const xAOD::TrackParticle* mutrack = muPtr->primaryTrackParticle(); + if (mutrack!=nullptr) { + m_hists.hist("mu_charge")->Fill(mutrack->charge(), eventWeight); + if (m_config->isMC()) { + static SG::AuxElement::Accessor<int> acc_mctt("truthType"); + if (acc_mctt.isAvailable(*mutrack)) m_hists.hist("mu_true_type")->Fill(acc_mctt(*mutrack), eventWeight); + } + } + + //testing isolation in the derivation framework + float iso = 0; + + if (muPtr->isAvailable<float>("topoetcone20") && muPtr->isolation(iso, xAOD::Iso::topoetcone20)) + m_hists.hist("mu_topoetcone20")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isAvailable<float>("topoetcone30") && muPtr->isolation(iso, xAOD::Iso::topoetcone30)) + m_hists.hist("mu_topoetcone30")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isAvailable<float>("topoetcone40") && muPtr->isolation(iso, xAOD::Iso::topoetcone40)) + m_hists.hist("mu_topoetcone40")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isolation(iso, xAOD::Iso::ptcone20)) + m_hists.hist("mu_ptcone20")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isolation(iso, xAOD::Iso::ptcone30)) + m_hists.hist("mu_ptcone30")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isolation(iso, xAOD::Iso::ptcone40)) + m_hists.hist("mu_ptcone40")->Fill(iso * toGeV, eventWeight); + + if (muPtr->isAvailable<float>("ptvarcone20")) { + float ptvarcone20 = muPtr->auxdataConst<float>("ptvarcone20"); + m_hists.hist("mu_ptvarcone20")->Fill(ptvarcone20 * toGeV, eventWeight); + } + + if (muPtr->isAvailable<float>("ptvarcone30")) { + float ptvarcone30 = muPtr->auxdataConst<float>("ptvarcone30"); + m_hists.hist("mu_ptvarcone30")->Fill(ptvarcone30 * toGeV, eventWeight); + } + + if (muPtr->isAvailable<float>("ptvarcone40")) { + float ptvarcone40 = muPtr->auxdataConst<float>("ptvarcone40"); + m_hists.hist("mu_ptvarcone40")->Fill(ptvarcone40 * toGeV, eventWeight); + } + } + + m_hists.hist("ph_n")->Fill(event.m_photons.size(), eventWeight); + for (const auto* const phPtr : event.m_photons) { + m_hists.hist("ph_pt") -> Fill(phPtr->pt() * toGeV, eventWeight); + m_hists.hist("ph_eta") -> Fill(phPtr->eta(), eventWeight); + m_hists.hist("ph_phi") -> Fill(phPtr->phi(), eventWeight); + m_hists.hist("ph_e") -> Fill(phPtr->e() * toGeV, eventWeight); + if (phPtr->isAvailable<float>("ptvarcone20")) { + float ptvarcone20 = phPtr->auxdataConst<float>("ptvarcone20"); + m_hists.hist("ph_ptvarcone20")->Fill(ptvarcone20 * toGeV, eventWeight); + } + } + + m_hists.hist("jet_n")->Fill(event.m_jets.size(), eventWeight); + unsigned int i = 0; + std::array<std::string, 4> numbers{ {"jet0", "jet1", "jet2", "jet3"} }; + for (const auto* const jetPtr : event.m_jets) { + m_hists.hist("jet_pt") -> Fill(jetPtr->pt() * toGeV, eventWeight); + m_hists.hist("jet_eta") -> Fill(jetPtr->eta(), eventWeight); + m_hists.hist("jet_phi") -> Fill(jetPtr->phi(), eventWeight); + m_hists.hist("jet_e") -> Fill(jetPtr->e() * toGeV, eventWeight); + + double mv2c10_discriminant = 0.; + const bool hasmv2c10 = jetPtr->btagging()->MVx_discriminant("MV2c10", mv2c10_discriminant); + if (hasmv2c10){ + m_hists.hist("jet_mv2c10")->Fill(mv2c10_discriminant, eventWeight); + + } + + int jet_truthflav = -1; + if (m_config->isMC()) { + if(jetPtr->isAvailable<int>("HadronConeExclTruthLabelID")){ + jetPtr->getAttribute("HadronConeExclTruthLabelID", jet_truthflav); + m_hists.hist("jet_truthflav")->Fill(jet_truthflav, eventWeight); + } + } + + int isbtagged = 0; + bool hasBtag = false; + float btagSF = 1.; + bool hasBtagSF = false; + hasBtag = jetPtr->isAvailable<char>("isbtagged_FixedCutBEff_77"); + if(hasBtag) { + isbtagged = jetPtr->auxdataConst<char>("isbtagged_FixedCutBEff_77"); + m_hists.hist("jet_isbtagged_77")->Fill(isbtagged, eventWeight); + if (m_config->isMC()) { + if (jetPtr -> isAvailable<float>("btag_SF_FixedCutBEff_77_nom")) { + btagSF = jetPtr -> auxdataConst<float>("btag_SF_FixedCutBEff_77_nom"); + m_hists.hist("jet_btagSF_77")->Fill(btagSF, eventWeight); + hasBtagSF = true; + } + } + } + + if (i < numbers.size()) { + m_hists.hist(numbers[i] + "_pt") -> Fill(jetPtr->pt() * toGeV, eventWeight); + m_hists.hist(numbers[i] + "_eta") -> Fill(jetPtr->eta(), eventWeight); + m_hists.hist(numbers[i] + "_phi") -> Fill(jetPtr->phi(), eventWeight); + m_hists.hist(numbers[i] + "_e") -> Fill(jetPtr->e() * toGeV, eventWeight); + m_hists.hist(numbers[i] + "_mv2c10") -> Fill(mv2c10_discriminant, eventWeight); + if(hasBtag) m_hists.hist(numbers[i] + "_isbtagged_77")->Fill(isbtagged, eventWeight); + if (m_config->isMC()) { + if (hasBtagSF) m_hists.hist(numbers[i] + "_btagSF_77")->Fill(btagSF, eventWeight); + m_hists.hist(numbers[i] + "_truthflav")->Fill(jet_truthflav, eventWeight); + } + } + + ++i; + } + + m_hists.hist("ljet_n") -> Fill(event.m_largeJets.size(), eventWeight); + for (const auto* const jetPtr : event.m_largeJets) { + m_hists.hist("ljet_pt") -> Fill(jetPtr->pt() * toGeV, eventWeight); + m_hists.hist("ljet_eta") -> Fill(jetPtr->eta(), eventWeight); + m_hists.hist("ljet_phi") -> Fill(jetPtr->phi(), eventWeight); + m_hists.hist("ljet_m") -> Fill(jetPtr->m() * toGeV, eventWeight); + + float Split12 = 0; + jetPtr->getAttribute("Split12", Split12); + m_hists.hist("ljet_sd12") -> Fill(Split12 * toGeV, eventWeight); + + } + + m_hists.hist("taujet_n")->Fill(event.m_tauJets.size(), eventWeight); + for (const auto* const tauPtr : event.m_tauJets) { + m_hists.hist("taujet_pt") -> Fill(tauPtr->pt() * toGeV, eventWeight); + m_hists.hist("taujet_eta") -> Fill(tauPtr->eta(), eventWeight); + m_hists.hist("taujet_phi") -> Fill(tauPtr->phi(), eventWeight); + m_hists.hist("taujet_charge") -> Fill(tauPtr->charge(), eventWeight); + } + + if (event.m_met != nullptr) { + m_hists.hist("event_met_et") -> Fill(event.m_met->met() * toGeV, eventWeight); + m_hists.hist("event_met_phi") -> Fill(event.m_met->phi(), eventWeight); + } + + return true; +} + +std::string ExamplePlots::name() const { + return "EXAMPLEPLOTS"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/FakesMMConfigs.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/FakesMMConfigs.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d133f58b075114ec17c23ae1a46b249bbde3b48e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/FakesMMConfigs.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/FakesMMConfigs.h" + +namespace top { + + FakesMMConfigs::FakesMMConfigs(const std::string& configs) { + std::istringstream iss(configs); + std::string config; + while (iss>>config) { + m_configurations.push_back(config); + } + } + + bool FakesMMConfigs::apply(const top::Event&) const { + return true; + } + + std::string FakesMMConfigs::name() const { + return "FAKESMMCONFIGS"; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GRLSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GRLSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..91a261bed8ea8f1f69faaaf2458428823c835329 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GRLSelector.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/GRLSelector.h" + +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" + +namespace top { + + GRLSelector::GRLSelector() + { + } + + bool GRLSelector::apply(const top::Event& event) const + { + if (event.m_info->isAvailable<char>("AnalysisTop_GRL")) { + if (event.m_info->auxdataConst<char>("AnalysisTop_GRL") == 1) { + return true; + } + } + return false; + } + + std::string GRLSelector::name() const + { + return "GRL"; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GoodCaloSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GoodCaloSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..43056052026318aa06e9d2a0bd4d37fc0572fcf2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/GoodCaloSelector.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/GoodCaloSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + + GoodCaloSelector::GoodCaloSelector() + { + } + + bool GoodCaloSelector::apply(const top::Event& event) const + { + if (event.m_info->isAvailable<char>("AnalysisTop_GOODCALO")) { + if (event.m_info->auxdataConst<char>("AnalysisTop_GOODCALO") == 1) { + return true; + } + } + return false; + } + + std::string GoodCaloSelector::name() const + { + return "GOODCALO"; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/HTSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/HTSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4627ce137a86d2da85c6f3ef2a53d3beed1b64cf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/HTSelector.cxx @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/HTSelector.h" + +#include "TopEvent/EventTools.h" + +namespace top { + +HTSelector::HTSelector(const std::string& params) : + SignValueSelector("HT", params) { +} + +bool HTSelector::apply(const top::Event& event) const { + const double ht = top::ht(event); + return checkFloat(ht, value()); +} + +bool HTSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons + or not event.m_jets ){ + return false; + } + + double sumHt = 0.0; + + for (const auto el : * event.m_electrons) + sumHt += el->pt(); + + for (const auto mu : * event.m_muons) + sumHt += mu->pt(); + + for (const auto jet : * event.m_jets) + sumHt += jet->pt(); + + return checkFloat(sumHt, value()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/IP3DSV1Selector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/IP3DSV1Selector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..997a6f6a719765f5df24f4c9c73738e5cc071cf8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/IP3DSV1Selector.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/IP3DSV1Selector.h" + +#include <algorithm> + +namespace top { + +IP3DSV1Selector::IP3DSV1Selector(const std::string& params) : + SignValueSelector("IP3DSV1_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool IP3DSV1Selector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* const jetPtr) { return jetPtr->btagging()->SV1plusIP3D_discriminant() > value(); }; + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/InitialSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/InitialSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..06599f35b9d7321002dcfbebb9b1d04752f1029f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/InitialSelector.cxx @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/InitialSelector.h" + +namespace top { + +bool InitialSelector::apply(const top::Event&) const { + return true; +} + +std::string InitialSelector::name() const { + return "INITIAL"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetCleaningSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetCleaningSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8e2a2f9cc03a4ff786e4c3173f8c7966eb16b6a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetCleaningSelector.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/JetCleaningSelector.h" +#include "TopEvent/EventTools.h" +#include "xAODJet/JetContainer.h" +#include "TopConfiguration/TopConfig.h" + +namespace top { + + JetCleaningSelector::JetCleaningSelector(const std::string& level, std::shared_ptr<top::TopConfig> config) : + m_jetCleaningToolLooseBad("JetCleaningToolLooseBad"), + m_jetCleaningToolTightBad("JetCleaningToolTightBad"), + m_level(level), + m_useLooseBad(true), + m_config(config) + { + + if (m_level != "LooseBad" && m_level != "TightBad") { + std::cout << "JetCleaningSelector level not recognised - " << m_level << "\n"; + std::cout << "Should be LooseBad or TightBad\n"; + exit(1); + } + + if (m_level == "LooseBad") m_useLooseBad = true; + if (m_level == "TightBad") m_useLooseBad = false; + + // we can't yet use jet cleaning for particle-flow jets + if (!m_config->useParticleFlowJets()) { + if (m_useLooseBad) + top::check( m_jetCleaningToolLooseBad.retrieve() , "Failed to retrieve JetCleaningToolLooseBad" ); + if (!m_useLooseBad) + top::check( m_jetCleaningToolTightBad.retrieve() , "Failed to retrieve JetCleaningToolTightBad" ); + } + } + + bool JetCleaningSelector::apply(const top::Event& event) const { + for (const auto* const jetPtr : event.m_jets){ + // we can't yet use jet cleaning for particle-flow jets, so do nothing in this case + if (m_config->useParticleFlowJets()) return true; + + if (m_useLooseBad) { + if (m_jetCleaningToolLooseBad->keep(*jetPtr) == 0) { + return false; + } + } + + if (!m_useLooseBad) { + if (m_jetCleaningToolTightBad->keep(*jetPtr) == 0) { + return false; + } + } + + } + + return true; + } + + std::string JetCleaningSelector::name() const + { + return "JETCLEAN " + m_level; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetFlavorPlots.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetFlavorPlots.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e7545d70af9b1df6a263747410467915dd4c7500 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetFlavorPlots.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/JetFlavorPlots.h" + +#include <cmath> +#include <array> +#include <string> + +#include "TopEvent/EventTools.h" +#include "TopCorrections/ScaleFactorRetriever.h" + +#include "TH1.h" +#include "TH2D.h" +#include "TFile.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +namespace top { + +const double JetFlavorPlots::toGeV = 0.001; + +JetFlavorPlots::JetFlavorPlots(const std::string& name, + TFile* outputFile, EL::Worker* wk) : + m_hists(name, outputFile, wk), m_nominalHashValue(0) { + CP::SystematicSet nominal; + m_nominalHashValue = nominal.hash(); + + m_hists.addHist("gluon_jets", ";pT [GeV];Eta;Events", + 50, 0., 500., 10, 0, 5); + m_hists.addHist("quark_jets", ";pT [GeV];Eta;Events", + 50, 0., 500., 10, 0, 5); +} + +bool JetFlavorPlots::apply(const top::Event& event) const { + // only nominal + if (event.m_hashValue != m_nominalHashValue) + return true; + + // only plot tight selection + // before, we were plotting tight and loose together + if (event.m_isLoose) + return true; + + double eventWeight = 1.; + if (top::isSimulation(event)) +// eventWeight = event.m_info->mcEventWeight(); + eventWeight = event.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + else // Only do this for MC + return true; + + for (const auto* const jetPtr : event.m_jets) { + int jet_flavor = -99; + bool status = jetPtr->getAttribute<int>("PartonTruthLabelID", jet_flavor); + if (!status) continue; + if (jet_flavor == 21) { // PDG ID for gluon is 21 + static_cast<TH2D*>(m_hists.hist("gluon_jets"))->Fill(jetPtr->pt()*toGeV, + jetPtr->eta(), + eventWeight); + } else { + static_cast<TH2D*>(m_hists.hist("quark_jets"))->Fill(jetPtr->pt()*toGeV, + jetPtr->eta(), + eventWeight); + } + } + + return true; +} + +std::string JetFlavorPlots::name() const { + return "JETFLAVORPLOTS"; +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetNGhostSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetNGhostSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..85124b4b7b93dfa8a8062965d3fb638a8dea3fc8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/JetNGhostSelector.cxx @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: JetNGhostSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Fri May 8 15:39:38 2015 + +#include "TopEventSelectionTools/JetNGhostSelector.h" + +namespace top { + + JetNGhostSelector::JetNGhostSelector(const std::string& params) + : SignValueSelector( "", parseType( params ) ){ + switch ( m_type ){ + case c: m_name = "JET_N_GHOST c" + SignValueSelector::name(); break; + case C: m_name = "JET_N_GHOST C" + SignValueSelector::name(); break; + case b: m_name = "JET_N_GHOST b" + SignValueSelector::name(); break; + case B: m_name = "JET_N_GHOST B" + SignValueSelector::name(); break; + case t: m_name = "JET_N_GHOST t" + SignValueSelector::name(); break; + case W: m_name = "JET_N_GHOST W" + SignValueSelector::name(); break; + case Z: m_name = "JET_N_GHOST Z" + SignValueSelector::name(); break; + case H: m_name = "JET_N_GHOST H" + SignValueSelector::name(); break; + case tau: m_name = "JET_N_GHOST tau" + SignValueSelector::name(); break; + case Invalid: m_name = "JET_N_GHOST !!! INVALID !!"; break; + } + checkMultiplicityIsInteger(); + } + + std::string JetNGhostSelector::parseType( const std::string & params ){ + // Initialise the type variable + m_type = Invalid; + // Skip leading whitespace + std::size_t pos{ 0 }; + while ( pos < params.length() - 1 && std::isspace( params[pos] ) ) { ++pos; } + + // Check, Use a switch statement hoping that the compiler may use this + // as a hint to optimise this bit using a jump table. + switch ( params[pos] ){ + // The easy cases + case 'c': case 'C': case 'b': case 'B': case 't': case 'W': case 'Z': case 'H': { + if ( pos + 1 < params.length() && std::isspace( params[ pos + 1 ] ) ){ + m_type = static_cast<Type>( params[ pos ] ); + return params.substr( pos + 2 ); + } else if ( params.compare( pos, 4, "tau " ) == 0 ){ + m_type = tau; + return params.substr( pos + 4 ); + } + } + default: { + std::cout << "Could not parse the type from the parameter string\n"; + std::cout << " '" << params << "'\n"; + std::exit(1); + } + } + } + + bool JetNGhostSelector::applyParticleLevel(const top::ParticleLevelEvent& plEvent) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not plEvent.m_jets ){ + return false; + } + + auto func = [&](const xAOD::Jet* truJetPtr) -> bool { + switch ( m_type ){ + case c: { return truJetPtr->auxdata<int>( "GhostCQuarksFinalCount" ); } + case C: { return truJetPtr->auxdata<int>( "GhostCHadronsFinalCount" ); } + case b: { return truJetPtr->auxdata<int>( "GhostBQuarksFinalCount" ); } + case B: { return truJetPtr->auxdata<int>( "GhostBHadronsFinalCount" ); } + case t: { return truJetPtr->auxdata<int>( "GhostTQuarksFinalCount" ); } + case W: { return truJetPtr->auxdata<int>( "GhostWBosonsCount" ); } + case Z: { return truJetPtr->auxdata<int>( "GhostZBosonsCount" ); } + case H: { return truJetPtr->auxdata<int>( "GhostHBosonsCount" ); } + case tau: { return truJetPtr->auxdata<int>( "GhostTausFinalCount" ); } + default: /* No-Op */ return 0; + } + }; + auto count = std::count_if(plEvent.m_jets->begin(), plEvent.m_jets->end(), func); + return checkInt(count, value()); + } + + std::string JetNGhostSelector::name() const { + return m_name; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/KLFitterSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/KLFitterSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..793304c8da591b5e06a8542f688a89631f9a9b5c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/KLFitterSelector.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: KLFitterSelector.cxx 666816 2015-05-13 10:59:36Z morrisj $ +#include "TopEventSelectionTools/KLFitterSelector.h" +#include "TopEvent/Event.h" +#include "TopEvent/KLFitterResult.h" + +namespace top{ + + KLFitterSelector::KLFitterSelector(const std::string& params) : + SignValueSelector("KLFitter", params) + { + } + + bool KLFitterSelector::apply(const top::Event& event) const + { + // check we have a xAOD::KLFitterResultContainer + if (event.m_KLFitterResults == nullptr) { + return false; + } + + for (auto result : *event.m_KLFitterResults) { + // check for errors + if ( + result->minuitDidNotConverge() == 0 && + result->fitAbortedDueToNaN() == 0 && + result->atLeastOneFitParameterAtItsLimit() == 0 && + result->invalidTransferFunctionAtConvergence() == 0 + ) + { + bool passPermutation = checkFloat( result->logLikelihood() , value() ); + if (passPermutation) { + return true; + } + } // check for errors + + } // Loop over Permutations - if we get this far, all Permutations have failed :( + return false; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..64fef85f1b05677101b506deaba2c390d8de9e63 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/LinkDef.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/ToolLoaderBase.h" +#include "TopEventSelectionTools/TopEventSelectionToolsLoader.h" + +#ifdef __CINT__ + +#pragma extra_include "TopEventSelectionTools/ToolLoaderBase.h"; +#pragma extra_include "TopEventSelectionTools/TopEventSelectionToolsLoader.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class top::ToolLoaderBase+; +#pragma link C++ class top::TopEventSelectionToolsLoader+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METMWTSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METMWTSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cc2a2ccc0f2802bbef45c7bf69f132147de388a1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METMWTSelector.cxx @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/METMWTSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +METMWTSelector::METMWTSelector(const std::string& params) : + SignValueSelector("MET+MWT", params) { +} + +bool METMWTSelector::apply(const top::Event& event) const { + const xAOD::IParticle* lepton = 0; + if (!event.m_electrons.empty()) + lepton = event.m_electrons.front(); + else if (!event.m_muons.empty()) + lepton = event.m_muons.front(); + else { + std::cout << "MET+MWT Tool: Not got a charged lepton" << std::endl; + exit(1); + } + + const double metmwt = event.m_met->met() + top::mwt(*lepton, *event.m_met); + return checkFloat(metmwt, value()); +} + +bool METMWTSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons + or not event.m_met ){ + return false; + } + + const xAOD::IParticle* lepton = 0; + if (!event.m_electrons->empty()) + lepton = event.m_electrons->front(); + else if (!event.m_muons->empty()) + lepton = event.m_muons->front(); + else { + std::cout << "MET+MWT Tool: Not got a charged lepton" << std::endl; + exit(1); + } + + const double metmwt = event.m_met->met() + top::mwt(*lepton, *event.m_met); + return checkFloat(metmwt, value()); +} + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6a4c86b13bcd6d390e4c204e96508e490e17a0a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/METSelector.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/METSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +METSelector::METSelector(const std::string& params) : + SignValueSelector("MET", params) { +} + +bool METSelector::apply(const top::Event& event) const { + return checkFloat(event.m_met->met(), value()); +} + +bool METSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_met ){ + return false; + } + + return checkFloat(event.m_met->met(), value()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e23207d4e08eaaa3156cd4fe4bbb54a7bd8944a4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLSelector.cxx @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MLLSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +MLLSelector::MLLSelector(const std::string& params) : + SignValueSelector("MLL", params) { +} + +bool MLLSelector::apply(const top::Event& event) const { + const xAOD::IParticle* lepton0 = 0; + const xAOD::IParticle* lepton1 = 0; + + if (event.m_electrons.size() == 2) { + lepton0 = event.m_electrons[0]; + lepton1 = event.m_electrons[1]; + } else if (event.m_muons.size() == 2) { + lepton0 = event.m_muons[0]; + lepton1 = event.m_muons[1]; + } else if (event.m_electrons.size() == 1 && event.m_muons.size() == 1) { + lepton0 = event.m_electrons[0]; + lepton1 = event.m_muons[0]; + } else { + std::cout << "MLL: Need two charged leptons" << std::endl; + exit(1); + } + + const double mll = top::invariantMass(*lepton0, *lepton1); + return checkFloat(mll, value()); +} + + bool MLLSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + const xAOD::IParticle* lepton0 = 0; + const xAOD::IParticle* lepton1 = 0; + + if (event.m_electrons->size() == 2) { + lepton0 = (*event.m_electrons)[0]; + lepton1 = (*event.m_electrons)[1]; + } else if (event.m_muons->size() == 2) { + lepton0 = (*event.m_muons)[0]; + lepton1 = (*event.m_muons)[1]; + } else if (event.m_electrons->size() == 1 && event.m_muons->size() == 1) { + lepton0 = (*event.m_electrons)[0]; + lepton1 = (*event.m_muons)[0]; + } else { + std::cout << "MLL: Need two charged leptons" << std::endl; + exit(1); + } + + const double mll = top::invariantMass(*lepton0, *lepton1); + return checkFloat(mll, value()); +} + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLWindowSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLWindowSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a23a581b098ba3a6b6efdfbbab2322af5e60d0c3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MLLWindowSelector.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MLLWindowSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +MLLWindow::MLLWindow(std::string params) : + m_cutvalue0(0.), + m_cutvalue1(0.) { + std::istringstream(params) >> m_cutvalue0 >> m_cutvalue1; +} + +bool MLLWindow::apply(const top::Event& event) const { + const xAOD::IParticle* lepton0 = 0; + const xAOD::IParticle* lepton1 = 0; + + if (event.m_electrons.size() == 2) { + lepton0 = event.m_electrons[0]; + lepton1 = event.m_electrons[1]; + } else if (event.m_muons.size() == 2) { + lepton0 = event.m_muons[0]; + lepton1 = event.m_muons[1]; + } else { + std::cout << "need two charged leptons of the same flavour" << std::endl; + exit(1); + } + + const double mll = top::invariantMass(*lepton0, *lepton1); + return mll < m_cutvalue0 || mll > m_cutvalue1; +} + + +bool MLLWindow::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + const xAOD::IParticle* lepton0 = 0; + const xAOD::IParticle* lepton1 = 0; + + if (event.m_electrons->size() == 2) { + lepton0 = (*event.m_electrons)[0]; + lepton1 = (*event.m_electrons)[1]; + } else if (event.m_muons->size() == 2) { + lepton0 = (*event.m_muons)[0]; + lepton1 = (*event.m_muons)[1]; + } else { + std::cout << "need two charged leptons of the same flavour" << std::endl; + exit(1); + } + + const double mll = top::invariantMass(*lepton0, *lepton1); + return mll < m_cutvalue0 || mll > m_cutvalue1; +} + +std::string MLLWindow::name() const { + std::stringstream ss; + ss << "MLLWIN " << m_cutvalue0 << " " << m_cutvalue1; + return ss.str(); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV1Selector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV1Selector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ae0c52beecbfcf5abe55ee62e1c1b08fe65419aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV1Selector.cxx @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MV1Selector.h" +#include "TopEvent/EventTools.h" + +#include <algorithm> + +namespace top { + +MV1Selector::MV1Selector(const std::string& params) : + SignValueSelector("MV1_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool MV1Selector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* const jetPtr) { return jetPtr->btagging()->MV1_discriminant() > value(); }; + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c10Selector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c10Selector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e95e5cd5e203056c4a28728d3f08a33943306b2e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c10Selector.cxx @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MV2c10Selector.h" +#include "TopEvent/EventTools.h" + +#include <algorithm> + +namespace top { + +MV2c10Selector::MV2c10Selector(const std::string& params) : + SignValueSelector("MV2C10_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool MV2c10Selector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* const jetPtr) { + double mv2c10_discriminant = 0.; + const bool hasMv2c10 = jetPtr->btagging()->MVx_discriminant("MV2c10", mv2c10_discriminant); + if (hasMv2c10) + return mv2c10_discriminant > value(); + + return false; + }; + + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c20Selector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c20Selector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..da4ae7a65586dbb90f8fb6a31f3e6c307404162d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MV2c20Selector.cxx @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MV2c20Selector.h" +#include "TopEvent/EventTools.h" + +#include <algorithm> + +namespace top { + +MV2c20Selector::MV2c20Selector(const std::string& params) : + SignValueSelector("MV2C20_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool MV2c20Selector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* const jetPtr) { + double mv2c20_discriminant = 0.; + const bool hasMv2c20 = jetPtr->btagging()->MVx_discriminant("MV2c20", mv2c20_discriminant); + if (hasMv2c20) + return mv2c20_discriminant > value(); + + return false; + }; + + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MWTSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MWTSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ef7bb21c5e332cbc7b9486e38f440e4937d062ca --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/MWTSelector.cxx @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/MWTSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +MWTSelector::MWTSelector(const std::string& params) : + SignValueSelector("MWT", params) { +} + +bool MWTSelector::apply(const top::Event& event) const { + const xAOD::IParticle* lepton = 0; + if (!event.m_electrons.empty()) + lepton = event.m_electrons.front(); + else if (!event.m_muons.empty()) + lepton = event.m_muons.front(); + else { + std::cout << "MWTSelector: Not got a charged lepton" << std::endl; + exit(1); + } + + const double mwt = top::mwt(*lepton, *event.m_met); + return checkFloat(mwt, value()); +} + +bool MWTSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons + or not event.m_met ){ + return false; + } + + const xAOD::IParticle* lepton = 0; + if (!event.m_electrons->empty()) + lepton = event.m_electrons->front(); + else if (!event.m_muons->empty()) + lepton = event.m_muons->front(); + else { + std::cout << "MWTSelector: Not got a charged lepton" << std::endl; + exit(1); + } + + const double mwt = top::mwt(*lepton, *event.m_met); + return checkFloat(mwt, value()); +} + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2405da836f709aa3eb724508c954b6e4895e0f0a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonSelector.cxx @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NElectronNMuonSelector.h" + +namespace top { + +NElectronNMuonSelector::NElectronNMuonSelector(const std::string& params) : + SignValueSelector("EL_N_OR_MU_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NElectronNMuonSelector::apply(const top::Event& event) const { + auto elFunc = [&](const xAOD::Electron* elPtr){return elPtr->pt() > value();}; + auto elCount = std::count_if(event.m_electrons.begin(), event.m_electrons.end(), elFunc); + + auto muFunc = [&](const xAOD::Muon* muPtr){return muPtr->pt() > value();}; + auto muCount = std::count_if(event.m_muons.begin(), event.m_muons.end(), muFunc); + + return checkInt(elCount, multiplicity()) || checkInt(muCount, multiplicity()); +} + +bool NElectronNMuonSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + auto elFunc = [&](const xAOD::TruthParticle* truElPtr){return truElPtr->pt() > value();}; + auto elCount = std::count_if(event.m_electrons->begin(), event.m_electrons->end(), elFunc); + + auto muFunc = [&](const xAOD::TruthParticle* truMuPtr){return truMuPtr->pt() > value();}; + auto muCount = std::count_if(event.m_muons->begin(), event.m_muons->end(), muFunc); + + return checkInt(elCount, multiplicity()) || checkInt(muCount, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bac0a91f46bc1687ffb0829711488338493031db --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronNMuonTightSelector.cxx @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NElectronNMuonTightSelector.h" + +namespace top { + +NElectronNMuonTightSelector::NElectronNMuonTightSelector(const std::string& params) : + SignValueSelector("EL_N_OR_MU_N_TIGHT", params, true) { + checkMultiplicityIsInteger(); +} + +bool NElectronNMuonTightSelector::apply(const top::Event& event) const { + auto elFunc = [&](const xAOD::Electron* elPtr){return elPtr->pt() > value() && elPtr->auxdataConst<char>("passPreORSelection");}; + auto elCount = std::count_if(event.m_electrons.begin(), event.m_electrons.end(), elFunc); + + auto muFunc = [&](const xAOD::Muon* muPtr){return muPtr->pt() > value() && muPtr->auxdataConst<char>("passPreORSelection");}; + auto muCount = std::count_if(event.m_muons.begin(), event.m_muons.end(), muFunc); + + return checkInt(elCount, multiplicity()) || checkInt(muCount, multiplicity()); +} + +bool NElectronNMuonTightSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + auto elFunc = [&](const xAOD::TruthParticle* truElPtr){return truElPtr->pt() > value();}; + auto elCount = std::count_if(event.m_electrons->begin(), event.m_electrons->end(), elFunc); + + auto muFunc = [&](const xAOD::TruthParticle* truMuPtr){return truMuPtr->pt() > value();}; + auto muCount = std::count_if(event.m_muons->begin(), event.m_muons->end(), muFunc); + + return checkInt(elCount, multiplicity()) || checkInt(muCount, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e66390ed04635856df7c1be8559d4293676ab9fa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronSelector.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NElectronSelector.h" + +#include <algorithm> + +namespace top { + +NElectronSelector::NElectronSelector(const std::string& params) : + SignValueSelector("EL_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NElectronSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Electron* elPtr){return elPtr->pt() > value();}; + auto count = std::count_if(event.m_electrons.begin(), event.m_electrons.end(), func); + return checkInt(count, multiplicity()); +} + +bool NElectronSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons ){ + return false; + } + + auto func = [&](const xAOD::TruthParticle* truElPtr){return truElPtr->pt() > value();}; + auto count = std::count_if(event.m_electrons->begin(), event.m_electrons->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e7fb0357f64e93bae91de1bf44cdddd53319d741 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NElectronTightSelector.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NElectronTightSelector.h" + +#include <algorithm> + +namespace top { + +NElectronTightSelector::NElectronTightSelector(const std::string& params) : + SignValueSelector("EL_N_TIGHT", params, true) { + checkMultiplicityIsInteger(); +} + +bool NElectronTightSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Electron* elPtr){return elPtr->pt() > value() && elPtr->auxdataConst<char>("passPreORSelection");}; + auto count = std::count_if(event.m_electrons.begin(), event.m_electrons.end(), func); + return checkInt(count, multiplicity()); +} + +bool NElectronTightSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons ){ + return false; + } + + auto func = [&](const xAOD::TruthParticle* truElPtr){return truElPtr->pt() > value();}; + auto count = std::count_if(event.m_electrons->begin(), event.m_electrons->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetBtagSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetBtagSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0efc659d09a9bedc226cb9e8b1b0831ba708c126 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetBtagSelector.cxx @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NJetBtagSelector.h" +#include "TopConfiguration/TopConfig.h" + +namespace top { + +NJetBtagSelector::NJetBtagSelector(const std::string& params,std::shared_ptr<top::TopConfig> config) : + SignValueSelector("JET_N_BTAG", params, true, true) { + checkMultiplicityIsInteger(); + // check if the provided btag WP is really available + if (std::find(config->bTagWP_available().begin(), config->bTagWP_available().end(), valueString()) == config->bTagWP_available().end()) { + std::cout << "NJetBtagSelector is confused\n"; + std::cout << "B-tagging working point " << valueString() << " doesn't seem to be supported.\n"; + std::cout << "Please provide a real one! Did you specified it in the \"BTaggingWP\" field of your cutfile?\n"; + exit(1); + } +} + +bool NJetBtagSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* jetPtr){ + if(!jetPtr->isAvailable<char>("isbtagged_"+valueString())) { + std::cout << "NJetBtagSelector is confused\n"; + std::cout << "A jet doesn't have the necessady decoration called \"isbtagged_"+valueString()+"\".\n"; + std::cout << "Exiting...\n"; + exit(1); + } + return jetPtr->auxdataConst<char>("isbtagged_"+valueString()); + }; + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..de9c8de7df8467bee34ad821dd4fab54daba9a2a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NJetSelector.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NJetSelector.h" + +namespace top { + +NJetSelector::NJetSelector(const std::string& params) : + SignValueSelector("JET_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NJetSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* jetPtr){return jetPtr->pt() > value();}; + auto count = std::count_if(event.m_jets.begin(), event.m_jets.end(), func); + return checkInt(count, multiplicity()); +} + +bool NJetSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_jets ){ + return false; + } + + auto func = [&](const xAOD::Jet* truJetPtr){return truJetPtr->pt() > value();}; + auto count = std::count_if(event.m_jets->begin(), event.m_jets->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NLargeJetSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NLargeJetSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8670c3b0966e1bddfa445ea5854cb818d2ade196 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NLargeJetSelector.cxx @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NLargeJetSelector.h" + +namespace top{ + + NLargeJetSelector::NLargeJetSelector(const std::string& params) : + SignValueSelector("LJET_N", params, true) { + checkMultiplicityIsInteger(); + } + + bool NLargeJetSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Jet* jetPtr){return jetPtr->pt() > value();}; + auto count = std::count_if(event.m_largeJets.begin(), event.m_largeJets.end(), func); + return checkInt(count, multiplicity()); + } + + bool NLargeJetSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + auto func = [&](const xAOD::Jet* jetPtr){return jetPtr->pt() > value();}; + auto count = std::count_if(event.m_largeRJets->begin(), event.m_largeRJets->end(), func); + return checkInt(count, multiplicity()); + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dc1e90ddbef935e6e3dfeb3755337f6fcb9e6c56 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonSelector.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NMuonSelector.h" + +#include <algorithm> + +namespace top { + +NMuonSelector::NMuonSelector(const std::string& params) : + SignValueSelector("MU_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NMuonSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Muon* muPtr){return muPtr->pt() > value();}; + auto count = std::count_if(event.m_muons.begin(), event.m_muons.end(), func); + return checkInt(count, multiplicity()); +} + +bool NMuonSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_muons ){ + return false; + } + + auto func = [&](const xAOD::TruthParticle* truMuPtr){return truMuPtr->pt() > value();}; + auto count = std::count_if(event.m_muons->begin(), event.m_muons->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5f55ef3eb5d0c7320c60063144b9c58a42808dce --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NMuonTightSelector.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NMuonTightSelector.h" + +#include <algorithm> + +namespace top { + +NMuonTightSelector::NMuonTightSelector(const std::string& params) : + SignValueSelector("MU_N_TIGHT", params, true) { + checkMultiplicityIsInteger(); +} + +bool NMuonTightSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Muon* muPtr){return muPtr->pt() > value() && muPtr->auxdataConst<char>("passPreORSelection");}; + auto count = std::count_if(event.m_muons.begin(), event.m_muons.end(), func); + return checkInt(count, multiplicity()); +} + +bool NMuonTightSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_muons ){ + return false; + } + + auto func = [&](const xAOD::TruthParticle* truMuPtr){return truMuPtr->pt() > value();}; + auto count = std::count_if(event.m_muons->begin(), event.m_muons->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NPhotonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NPhotonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b7f017db57d506d0f9dd24cbe1846719bc9d78b4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NPhotonSelector.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NPhotonSelector.h" + +#include <algorithm> + +namespace top { + +NPhotonSelector::NPhotonSelector(const std::string& params) : + SignValueSelector("PH_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NPhotonSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::Photon* phPtr){return phPtr->pt() > value();}; + auto count = std::count_if(event.m_photons.begin(), event.m_photons.end(), func); + return checkInt(count, multiplicity()); +} + +bool NPhotonSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + auto func = [&](const xAOD::TruthParticle* truPhPtr){return truPhPtr->pt() > value();}; + auto count = std::count_if(event.m_photons->begin(), event.m_photons->end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..45ccc70007563956836273715ac0522c3f9c8765 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauSelector.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NTauSelector.h" + +namespace top { + +NTauSelector::NTauSelector(const std::string& params) : + SignValueSelector("TAU_N", params, true) { + checkMultiplicityIsInteger(); +} + +bool NTauSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::TauJet* tauPtr){return tauPtr->pt() > value();}; + auto count = std::count_if(event.m_tauJets.begin(), event.m_tauJets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..445ecb8a4245ba6e6da94fc9111cb89fe6b51d3a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NTauTightSelector.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NTauTightSelector.h" + +namespace top { + +NTauTightSelector::NTauTightSelector(const std::string& params) : + SignValueSelector("TAU_N_TIGHT", params, true) { + checkMultiplicityIsInteger(); +} + +bool NTauTightSelector::apply(const top::Event& event) const { + auto func = [&](const xAOD::TauJet* tauPtr){return tauPtr->pt() > value() && tauPtr->auxdataConst<char>("passPreORSelection");}; + auto count = std::count_if(event.m_tauJets.begin(), event.m_tauJets.end(), func); + return checkInt(count, multiplicity()); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NoBadMuonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NoBadMuonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9211a78d394a0b85a07682a0f09b88440e608155 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/NoBadMuonSelector.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/NoBadMuonSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + + NoBadMuonSelector::NoBadMuonSelector() : + m_muonSelectionTool("CP::MuonSelectionTool") + { + top::check( m_muonSelectionTool.retrieve() , "Failed to retrieve muonSelectionTool" ); + } + + bool NoBadMuonSelector::apply(const top::Event& event) const + { + for (const auto* const muPtr : event.m_muons) { + if (m_muonSelectionTool->isBadMuon(*muPtr)) { + event.m_info->auxdecor<char>("AnalysisTop_HASBADMUON") = 1 ; + return false; + } + } + return true; + } + + std::string NoBadMuonSelector::name() const + { + return "NOBADMUON"; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0ea7add9c1c54a1a8dcf0950aea0d536096cf5f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonSelector.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/OSLeptonSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +bool OSLeptonSelector::apply(const top::Event& event) const { + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto* const elPtr : event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto* const muPtr : event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 0 && negative_counter > 0; +} + +bool OSLeptonSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto elPtr : * event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto muPtr : * event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 0 && negative_counter > 0; +} + +std::string OSLeptonSelector::name() const { + return "OS"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ec7f4756cc3ec8e0577f1f88a5a00fb82020a3b5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/OSLeptonTightSelector.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/OSLeptonTightSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + +bool OSLeptonTightSelector::apply(const top::Event& event) const { + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto* const elPtr : event.m_electrons) + if (elPtr->charge() > 0 && elPtr->auxdataConst<char>("passPreORSelection")) + ++positive_counter; + else if (elPtr->charge() < 0 && elPtr->auxdataConst<char>("passPreORSelection")) + ++negative_counter; + + for (const auto* const muPtr : event.m_muons) + if (muPtr->charge() > 0 && muPtr->auxdataConst<char>("passPreORSelection")) + ++positive_counter; + else if (muPtr->charge() < 0 && muPtr->auxdataConst<char>("passPreORSelection")) + ++negative_counter; + + return positive_counter > 0 && negative_counter > 0; +} + +bool OSLeptonTightSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto elPtr : * event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto muPtr : * event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 0 && negative_counter > 0; +} + +std::string OSLeptonTightSelector::name() const { + return "OS_TIGHT"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ParticleLevelSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ParticleLevelSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d4ca789831e2a79d0bedab9110f27b5044862b4c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/ParticleLevelSelector.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Tue Oct 27 13:29:16 2015 +// +// (c) by Fabian Wilk +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#include "TopEventSelectionTools/ParticleLevelSelector.h" + +namespace top { + bool ParticleLevelSelector::apply(const top::Event&) const { + return false; + } + + bool ParticleLevelSelector::applyParticleLevel(const top::ParticleLevelEvent&) const { + return true; + } + + std::string ParticleLevelSelector::name() const { + return "PARTICLE_LEVEL"; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PlotManager.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PlotManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e4d37838d33a528de9826dd78ed687f689a5ae2e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PlotManager.cxx @@ -0,0 +1,122 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EventLoop/Worker.h" + +#include "TopEventSelectionTools/PlotManager.h" + +#include "TH1.h" +#include "TH1D.h" +#include "TH2D.h" +#include "TFile.h" +#include "TDirectoryFile.h" + +#include <iostream> + +namespace top { + +PlotManager::PlotManager(const std::string& name, TFile* outputFile, EL::Worker* wk) : + m_wk(wk), + m_name(name), + m_plotDir(nullptr) { + + if (!m_wk) { + m_plotDir = outputFile->GetDirectory(m_name.c_str()); + if (!m_plotDir) + m_plotDir = outputFile->mkdir(m_name.c_str()); + + m_plotDir->cd(); + } +} + +PlotManager::PlotManager(const std::string& sample,const std::string& channel,const std::string& syst,TFile* outputFile) : + m_wk(nullptr), + m_name("SetMe"), + m_plotDir(nullptr) +{ + outputFile->cd(); + gDirectory->cd("/"); + + if( !gDirectory->GetKey(sample.c_str()) ){gDirectory->mkdir(sample.c_str());} + gDirectory->cd(sample.c_str()); + + if( !gDirectory->GetKey(channel.c_str()) ){gDirectory->mkdir(channel.c_str());} + gDirectory->cd(channel.c_str()); + + if( !gDirectory->GetKey(syst.c_str()) ){gDirectory->mkdir(syst.c_str());} + gDirectory->cd(syst.c_str()); + + TString plotDirName = sample + "/" + channel + "/" + syst; + + m_plotDir = outputFile->GetDirectory(plotDirName); + m_plotDir->cd(); +} + +void PlotManager::addHist(const std::string& hname, const std::string& title, int bins, double start, double end) const { + TH1D* h = nullptr; + if (!m_wk) { + m_plotDir->cd(); + h = new TH1D(hname.c_str(), title.c_str(), bins, start, end); + } + else { + std::string pathname = m_name + "/" + hname; + h = new TH1D(pathname.c_str(), title.c_str(), bins, start, end); + m_wk->addOutput(h); + } + + if (m_histograms.find(hname) != m_histograms.end()) { + std::cout << "ERROR: Running addHist with " << hname << std::endl; + std::cout << "but that histogram already exists" << std::endl; + std::cout << "will not continue" << std::endl; + exit(1); + } + + h->Sumw2(); + m_histograms.insert(make_pair(hname, h)); +} + +void PlotManager::addHist(const std::string& hname, const std::string& title, + int xbins, double xstart, double xend, + int ybins, double ystart, double yend) const { + TH2D* h = nullptr; + if (!m_wk) { + m_plotDir->cd(); + h = new TH2D(hname.c_str(), title.c_str(), + xbins, xstart, xend, + ybins, ystart, yend); + } + else { + std::string pathname = m_name + "/" + hname; + h = new TH2D(pathname.c_str(), title.c_str(), + xbins, xstart, xend, + ybins, ystart, yend); + m_wk->addOutput(h); + } + + if (m_histograms.find(hname) != m_histograms.end()) { + std::cout << "ERROR: Running addHist with " << hname << std::endl; + std::cout << "but that histogram already exists" << std::endl; + std::cout << "will not continue" << std::endl; + exit(1); + } + + h->Sumw2(); + m_histograms.insert(make_pair(hname, h)); +} + +TH1* PlotManager::hist(const std::string& name) const { + if (m_histograms.find(name) == m_histograms.end()) { + std::cout << "Histogram doesn\'t exist: " << name << std::endl; + exit(1); + } + + return m_histograms[name]; +} + +void PlotManager::scaleHistograms(double sf) const { + for (std::unordered_map<std::string, TH1*>::iterator it = begin(m_histograms); it != end(m_histograms); ++it) + it->second->Scale(sf); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrimaryVertexSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrimaryVertexSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e4cadfe007aae09e16aee3a0dcd952c09134be43 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrimaryVertexSelector.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/PrimaryVertexSelector.h" +#include "TopEvent/EventTools.h" + +namespace top { + + PrimaryVertexSelector::PrimaryVertexSelector() + { + } + + bool PrimaryVertexSelector::apply(const top::Event& event) const + { + if (event.m_info->isAvailable<char>("AnalysisTop_PRIVTX")) { + if (event.m_info->auxdataConst<char>("AnalysisTop_PRIVTX") == 1) { + return true; + } + } + return false; + } + + std::string PrimaryVertexSelector::name() const + { + return "PRIVTX"; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrintEventSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrintEventSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..39ea8edd6434008c556e800d654db6edec29b0ef --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/PrintEventSelector.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/PrintEventSelector.h" + +#include "TopEvent/EventTools.h" + +#include "TopCorrections/ScaleFactorRetriever.h" + +namespace top { + +bool PrintEventSelector::apply(const top::Event& event) const { + //print some stuff about the event + std::cout << event << std::endl; + + //print the SF if calculated and if MC +// if (top::isSimulation(event)) { +// top::ScaleFactorRetriever::print(event); +// std::cout << std::endl; +// } + + return true; +} + +std::string PrintEventSelector::name() const { + return "PRINT"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RecoLevelSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RecoLevelSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0fe8468d0c682c51215c01ee7676c4657fa99c36 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RecoLevelSelector.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: RecoLevelSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Tue Oct 27 13:28:22 2015 +// +// (c) by Fabian Wilk +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#include "TopEventSelectionTools/RecoLevelSelector.h" + +namespace top { + bool RecoLevelSelector::apply(const top::Event&) const { + return true; + } + + bool RecoLevelSelector::applyParticleLevel(const top::ParticleLevelEvent&) const { + return false; + } + + std::string RecoLevelSelector::name() const { + return "RECO_LEVEL"; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RunNumberSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RunNumberSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..334f6ad4753a5a4720beb4b2c26f1083b960a593 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/RunNumberSelector.cxx @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/RunNumberSelector.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +namespace top { + +RunNumberSelector::RunNumberSelector(const std::string& params,std::shared_ptr<top::TopConfig> config) : + SignValueSelector("RUN_NUMBER", params) { + m_config = config; +} + +bool RunNumberSelector::apply(const top::Event& event) const { + unsigned int number = 0; + if (!m_config->isMC()) + number = event.m_info -> runNumber(); + else { + if (event.m_info->isAvailable<unsigned int>("RandomRunNumber")) + number = event.m_info->auxdataConst<unsigned int>("RandomRunNumber"); + else { + std::cout << "RunNumberSelector: can't find random Run Number - did you setup the pile-up reweighting tool?" << std::endl; + exit(1); + } + } + + return checkInt(number, value()); +} + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80b7462dc54eb6271ca38617ad6b9ba21154e422 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonSelector.cxx @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/SSLeptonSelector.h" +#include "TopEvent/EventTools.h" + +// Note: initial version committed on Dec/18/2014 +// Can't yet fully reproduce the selection used by Run 1 Top/Exotics SS+bjets analysis +// One thing needed to reproduce that is loose leptons +// Need to support selection of leptons with different quality/isolation at once +// Need to support applying SF to leptons with different quality/isolation at once + +namespace top { + +bool SSLeptonSelector::apply(const top::Event& event) const { + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto* const elPtr : event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto* const muPtr : event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 1 || negative_counter > 1; +} + +bool SSLeptonSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto elPtr : * event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto muPtr : * event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 1 || negative_counter > 1; +} + + +std::string SSLeptonSelector::name() const { + return "SS"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonTightSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonTightSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d045f741cf1f7f5edb73aa21fb471093de6b4557 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SSLeptonTightSelector.cxx @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/SSLeptonTightSelector.h" +#include "TopEvent/EventTools.h" + +// Note: initial version committed on Dec/18/2014 +// Can't yet fully reproduce the selection used by Run 1 Top/Exotics SS+bjets analysis +// One thing needed to reproduce that is loose leptons +// Need to support selection of leptons with different quality/isolation at once +// Need to support applying SF to leptons with different quality/isolation at once + +namespace top { + +bool SSLeptonTightSelector::apply(const top::Event& event) const { + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto* const elPtr : event.m_electrons) + if (elPtr->charge() > 0 && elPtr->auxdataConst<char>("passPreORSelection")) + ++positive_counter; + else if (elPtr->charge() < 0 && elPtr->auxdataConst<char>("passPreORSelection")) + ++negative_counter; + + for (const auto* const muPtr : event.m_muons) + if (muPtr->charge() > 0 && muPtr->auxdataConst<char>("passPreORSelection")) + ++positive_counter; + else if (muPtr->charge() < 0 && muPtr->auxdataConst<char>("passPreORSelection")) + ++negative_counter; + + return positive_counter > 1 || negative_counter > 1; +} + +bool SSLeptonTightSelector::applyParticleLevel(const top::ParticleLevelEvent& event) const { + // If any of the required collections is a nullptr (i.e. has not been + // loaded) return false. + if ( not event.m_electrons + or not event.m_muons ){ + return false; + } + + unsigned int negative_counter = 0; + unsigned int positive_counter = 0; + + for (const auto elPtr : * event.m_electrons) + if (elPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + for (const auto muPtr : * event.m_muons) + if (muPtr->charge() > 0) + ++positive_counter; + else + ++negative_counter; + + return positive_counter > 1 || negative_counter > 1; +} + + +std::string SSLeptonTightSelector::name() const { + return "SS_TIGHT"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SaveEventSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SaveEventSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..66dedd6b06c7727ca26af4635d7f1f75c5d21910 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SaveEventSelector.cxx @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/SaveEventSelector.h" + +namespace top { + +bool SaveEventSelector::apply(const top::Event&) const { + return true; +} + +std::string SaveEventSelector::name() const { + return "SAVE"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SignValueSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SignValueSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dc760cfbb5f9c18a1e29bd7f6902490bb00c0530 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/SignValueSelector.cxx @@ -0,0 +1,163 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +SignValueSelector::SignValueSelector(const std::string& name, std::string params, bool multiplicityMode, bool cutValueMode) : + m_sign(signNOIDEA), + m_cutvalue(0), + m_cutvalueString(""), + m_multiplicity(-1) { + //cutValueMode always set to false if multiplicityMode is false + if (!multiplicityMode) cutValueMode=false; + //get the sign and remove it from the params text + m_sign = decodesign(params); + if (!cutValueMode) std::istringstream(params) >> m_cutvalue >> m_multiplicity; + else std::istringstream(params) >> m_cutvalueString >> m_multiplicity; + + //form the name string for the tool + std::stringstream ss; + if (!multiplicityMode) + ss << name << " " << signstring() << " " << m_cutvalue; + else { + if (m_multiplicity < 0) { + std::cout << "Cut value and multiplicity must be set for " << name << std::endl; + exit(1); + } + + if (!cutValueMode) + ss << name << " " << m_cutvalue << " " << signstring() << " " << m_multiplicity; + else + ss << name << " " << m_cutvalueString << " " << signstring() << " " << m_multiplicity; + } + + m_name = ss.str(); +} + +std::string SignValueSelector::name() const { + return m_name; +} + +void SignValueSelector::checkValueIsInteger() { + if (value() != floor(value())) { + std::cout << "The number " << value() << " is not an integer\n"; + std::cout << "As defined in " << name() << "\n"; + std::cout << "Please fix and try again\n"; + exit(1); + } +} + +void SignValueSelector::checkMultiplicityIsInteger() { + if (multiplicity() != floor(multiplicity())) { + std::cout << "The number " << value() << " is not an integer\n"; + std::cout << "As defined in " << name() << "\n"; + std::cout << "Please fix and try again\n"; + exit(1); + } +} + +SignValueSelector::Sign SignValueSelector::sign() const { + return m_sign; +} + +double SignValueSelector::value() const { + return m_cutvalue; +} + +std::string SignValueSelector::valueString() const { + return m_cutvalueString; +} + +double SignValueSelector::multiplicity() const { + return m_multiplicity; +} + +SignValueSelector::Sign SignValueSelector::decodesign(std::string& params) { + Sign tempsign(signNOIDEA); + if (params.find("==") != std::string::npos) { + tempsign = signEQ; + params.erase(params.find("=="), 2); + } else if (params.find("<=") != std::string::npos) { + tempsign = signLTEQ; + params.erase(params.find("<="), 2); + } else if (params.find(">=") != std::string::npos) { + tempsign = signGTEQ; + params.erase(params.find(">="), 2); + } else if (params.find("<") != std::string::npos) { + tempsign = signLT; + params.erase(params.find("<"), 1); + } else if (params.find(">") != std::string::npos) { + tempsign = signGT; + params.erase(params.find(">"), 1); + } + + return tempsign; +} + +bool SignValueSelector::checkFloat(double value, double cut) const { + switch (m_sign) { + case signNOIDEA: { + std::cout << "Do not recognise the sign\n"; + exit(1); + } case signEQ: { + std::cout << "Can't compare floats with ==\n"; + exit(1); + } case signLT: + return value < cut; + case signGT: + return value > cut; + case signLTEQ: + return value <= cut; + case signGTEQ: + return value >= cut; + } + + return false; +} + +bool SignValueSelector::checkInt(int value, int cut) const { + switch (m_sign) { + case signNOIDEA: { + std::cout << "Do not recognise the sign\n"; + exit(1); + } case signEQ: + return value == cut; + case signLT: + return value < cut; + case signGT: + return value > cut; + case signLTEQ: + return value <= cut; + case signGTEQ: + return value >= cut; + } + + return false; +} + +const std::string SignValueSelector::signstring() const { + switch (m_sign) { + case signNOIDEA: { + std::cout << "SignValueSelector is confused\n"; + std::cout << "Please check your cuts have all the correct cuts\n"; + std::cout << "e.g. ==, >, >=, <, <=\n"; + exit(1); + } case signEQ: + return "=="; + case signLT: + return "<"; + case signGT: + return ">"; + case signLTEQ: + return "<="; + case signGTEQ: + return ">="; + } + + return ""; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TopEventSelectionToolsLoader.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TopEventSelectionToolsLoader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e66ba923a4284954bc787a3a21e2a7c009c100b4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TopEventSelectionToolsLoader.cxx @@ -0,0 +1,165 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/TopEventSelectionToolsLoader.h" + + +#include "TopEventSelectionTools/ExamplePlots.h" +#include "TopEventSelectionTools/JetFlavorPlots.h" +#include "TopEventSelectionTools/FakesMMConfigs.h" +#include "TopEventSelectionTools/GRLSelector.h" +#include "TopEventSelectionTools/GoodCaloSelector.h" +#include "TopEventSelectionTools/HTSelector.h" +#include "TopEventSelectionTools/IP3DSV1Selector.h" +#include "TopEventSelectionTools/InitialSelector.h" +#include "TopEventSelectionTools/JetCleaningSelector.h" +#include "TopEventSelectionTools/JetNGhostSelector.h" +#include "TopEventSelectionTools/KLFitterSelector.h" +#include "TopEventSelectionTools/METMWTSelector.h" +#include "TopEventSelectionTools/METSelector.h" +#include "TopEventSelectionTools/MLLSelector.h" +#include "TopEventSelectionTools/MLLWindowSelector.h" +#include "TopEventSelectionTools/MV1Selector.h" +#include "TopEventSelectionTools/MV2c20Selector.h" +#include "TopEventSelectionTools/MV2c10Selector.h" +#include "TopEventSelectionTools/MWTSelector.h" +#include "TopEventSelectionTools/NElectronNMuonSelector.h" +#include "TopEventSelectionTools/NElectronNMuonTightSelector.h" +#include "TopEventSelectionTools/NElectronSelector.h" +#include "TopEventSelectionTools/NElectronTightSelector.h" +#include "TopEventSelectionTools/NJetSelector.h" +#include "TopEventSelectionTools/NJetBtagSelector.h" +#include "TopEventSelectionTools/NMuonSelector.h" +#include "TopEventSelectionTools/NoBadMuonSelector.h" +#include "TopEventSelectionTools/NMuonTightSelector.h" +#include "TopEventSelectionTools/NPhotonSelector.h" +#include "TopEventSelectionTools/NTauSelector.h" +#include "TopEventSelectionTools/NTauTightSelector.h" +#include "TopEventSelectionTools/OSLeptonSelector.h" +#include "TopEventSelectionTools/OSLeptonTightSelector.h" +#include "TopEventSelectionTools/ParticleLevelSelector.h" +#include "TopEventSelectionTools/PrimaryVertexSelector.h" +#include "TopEventSelectionTools/PrintEventSelector.h" +#include "TopEventSelectionTools/RecoLevelSelector.h" +#include "TopEventSelectionTools/SSLeptonSelector.h" +#include "TopEventSelectionTools/SSLeptonTightSelector.h" +#include "TopEventSelectionTools/SaveEventSelector.h" +#include "TopEventSelectionTools/TrigDecisionSelector.h" +#include "TopEventSelectionTools/TrigMatchSelector.h" +#include "TopEventSelectionTools/RunNumberSelector.h" +#include "TopEventSelectionTools/NLargeJetSelector.h" + +#include "TopConfiguration/TopConfig.h" + +#include <iostream> + +#include "TFile.h" + +namespace top { + + top::EventSelectorBase* TopEventSelectionToolsLoader::initTool(const std::string& name, const std::string& line, TFile* outputFile,std::shared_ptr<top::TopConfig> config, EL::Worker* wk) { + //get the first bit of the string and store it in toolname + std::istringstream iss(line); + std::string toolname; + getline(iss, toolname, ' '); + + //any parameters? + std::string param; + if (line.size() > toolname.size()) + param = line.substr(toolname.size() + 1); + + if (toolname == "JET_N") + return new top::NJetSelector(param); + else if (toolname == "JET_N_BTAG") + return new top::NJetBtagSelector(param,config); + else if (toolname == "LJET_N") + return new top::NLargeJetSelector(param); + else if (toolname == "MV1_N") + return new top::MV1Selector(param); + else if (toolname == "MV2C20_N") + return new top::MV2c20Selector(param); + else if (toolname == "MV2C10_N") + return new top::MV2c10Selector(param); + else if (toolname == "IP3DSV1_N") + return new top::IP3DSV1Selector(param); + else if (toolname == "EL_N_OR_MU_N") + return new top::NElectronNMuonSelector(param); + else if (toolname == "EL_N_OR_MU_N_TIGHT") + return new top::NElectronNMuonTightSelector(param); + else if (toolname == "EL_N") + return new top::NElectronSelector(param); + else if (toolname == "EL_N_TIGHT") + return new top::NElectronTightSelector(param); + else if (toolname == "MU_N") + return new top::NMuonSelector(param); + else if (toolname == "MU_N_TIGHT") + return new top::NMuonTightSelector(param); + else if (toolname == "PH_N") + return new top::NPhotonSelector(param); + else if (toolname == "TAU_N") + return new top::NTauSelector(param); + else if (toolname == "TAU_N_TIGHT") + return new top::NTauTightSelector(param); + else if (toolname == "MET+MWT") + return new top::METMWTSelector(param); + else if (toolname == "MET") + return new top::METSelector(param); + else if (toolname == "MWT") + return new top::MWTSelector(param); + else if (toolname == "MLLWIN") + return new top::MLLWindow(param); + else if (toolname == "MLL") + return new top::MLLSelector(param); + else if (toolname == "HT") + return new top::HTSelector(param); + else if (toolname == "NOBADMUON") + return new top::NoBadMuonSelector(); + else if (toolname == "OS") + return new top::OSLeptonSelector(); + else if (toolname == "OS_TIGHT") + return new top::OSLeptonTightSelector(); + else if (toolname == "SS") + return new top::SSLeptonSelector(); + else if (toolname == "SS_TIGHT") + return new top::SSLeptonTightSelector(); + else if (toolname == "INITIAL") + return new top::InitialSelector; + else if (toolname == "SAVE") + return new top::SaveEventSelector; + else if (toolname == "PRINT") + return new top::PrintEventSelector; + else if (toolname == "EXAMPLEPLOTS") + return new top::ExamplePlots(name, outputFile, wk, config); + else if (toolname == "JETFLAVORPLOTS") + return new top::JetFlavorPlots(name, outputFile, wk); + else if (toolname == "GRL") + return new top::GRLSelector(); + else if (toolname == "TRIGDEC") + return new top::TrigDecisionSelector(name,config); + else if (toolname == "TRIGMATCH") + return new top::TrigMatchSelector(name,config); + else if (toolname == "JETCLEAN") + return new top::JetCleaningSelector(param,config); + else if (toolname == "KLFITTER") + return new top::KLFitterSelector(param); + else if (toolname == "JET_N_GHOST") + return new top::JetNGhostSelector(param); + else if (toolname == "GOODCALO") + return new top::GoodCaloSelector(); + else if (toolname == "PRIVTX") + return new top::PrimaryVertexSelector(); + else if (toolname == "RECO_LEVEL") + return new top::RecoLevelSelector(); + else if (toolname == "PARTICLE_LEVEL") + return new top::ParticleLevelSelector(); + else if (toolname == "FAKESMMCONFIGS") + return new top::FakesMMConfigs(param); + else if (toolname == "RUN_NUMBER") + return new top::RunNumberSelector(param,config); + + + return nullptr; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TreeManager.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TreeManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5cec34634396e353dc1642ea4eeaee2e996d87d9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TreeManager.cxx @@ -0,0 +1,142 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/TreeManager.h" + +#include "TFile.h" + +#include <iostream> + +namespace top { + +TreeManager::TreeManager() : + m_name("NULL"), + m_tree(nullptr) { +} + +TreeManager::TreeManager(const std::string& name, TFile* outputFile,const bool setAutoFlushZero) : + m_name(name), + m_tree(nullptr) { + outputFile->cd(); + m_tree = new TTree(name.c_str(), "tree"); + if (setAutoFlushZero) { + // Fix for ANALYSISTO-44 + m_tree->SetAutoFlush(0); + m_tree->SetAutoSave(0); + } +} + +TreeManager::TreeManager(const TreeManager&& rhs) : + m_name(std::move(rhs.m_name)), + m_tree(std::move(rhs.m_tree)), + m_outputVarPointers(std::move(rhs.m_outputVarPointers)) { +} + +void TreeManager::initialize(const std::string& name, TFile* outputFile,const bool setAutoFlushZero) { + if (m_tree) { + std::cerr << "Tried to call initialize, but tree is already created. Doing nothing." << std::endl; + return; + } + + outputFile->cd(); + m_tree = new TTree(name.c_str(), "tree"); + if (setAutoFlushZero) { + // Fix for ANALYSISTO-44 + m_tree->SetAutoFlush(0); + m_tree->SetAutoSave(0); + } +} + +void TreeManager::fill() { + m_tree->Fill(); +} + +const std::string& TreeManager::name() const +{ + return m_name; +} + +const char* TreeManager::RootType(const char* typeid_type) { + + // Check that we received a reasonable input: + if( strlen( typeid_type ) != 1 ) { + // SLogger m_logger( "SCycleBaseNTuple" ); + // REPORT_ERROR( "Received a complex object description: " << typeid_type ); + // throw SError( "SCycleBaseNTuple::RootType received complex object " + // "description", SError::StopExecution ); + } + + // Do the hard-coded translation: + switch( typeid_type[ 0 ] ) { + + case 'c': + return "B"; + break; + case 'h': + return "b"; + break; + case 's': + return "S"; + break; + case 't': + return "s"; + break; + case 'i': + return "I"; + break; + case 'j': + return "i"; + break; + case 'f': + return "F"; + break; + case 'd': + return "D"; + break; + case 'x': + return "L"; + break; + case 'y': + return "l"; + break; + case 'b': + return "O"; + break; + + } + + return ""; +} + +const char* TreeManager::TypeidType(const char* root_type) { + + // Do the hard-coded translation: + if( ! strcmp( root_type, "Char_t" ) ) { + return "c"; + } else if( ! strcmp( root_type, "UChar_t" ) ) { + return "h"; + } else if( ! strcmp( root_type, "Short_t" ) ) { + return "s"; + } else if( ! strcmp( root_type, "UShort_t" ) ) { + return "t"; + } else if( ! strcmp( root_type, "Int_t" ) ) { + return "i"; + } else if( ! strcmp( root_type, "UInt_t" ) ) { + return "j"; + } else if( ! strcmp( root_type, "Float_t" ) ) { + return "f"; + } else if( ! strcmp( root_type, "Double_t" ) ) { + return "d"; + } else if( ! strcmp( root_type, "Long64_t" ) ) { + return "x"; + } else if( ! strcmp( root_type, "ULong64_t" ) ) { + return "y"; + } else if( ! strcmp( root_type, "Bool_t" ) ) { + return "b"; + } + + return ""; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigDecisionSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigDecisionSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d4155381ea1854f3e4f22fa21a6684d5e2ba059c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigDecisionSelector.cxx @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/TrigDecisionSelector.h" +#include "TopEvent/Event.h" +#include "TopConfiguration/TopConfig.h" + +#include <sstream> +#include <iostream> + +namespace top { + + TrigDecisionSelector::TrigDecisionSelector(const std::string& selectorName,std::shared_ptr<top::TopConfig> config) + { + m_triggers = config->allTriggers(selectorName); + + std::cout<<"Triggers for selector = "<<selectorName<<std::endl; + for (auto s : m_triggers) { + std::cout << "--" << s << "--" << std::endl; + } + + } + + bool TrigDecisionSelector::apply(const top::Event& event) const + { + + bool orOfAllTriggers(false); + for (const auto& trigger : m_triggers){ + bool passThisTrigger(false); + if (event.m_info->isAvailable<char>("TRIGDEC_" + trigger)) { + if (event.m_info->auxdataConst<char>("TRIGDEC_" + trigger) == 1) { + passThisTrigger = true; + } + } + + orOfAllTriggers |= passThisTrigger; + } + + return orOfAllTriggers; + } + + std::string TrigDecisionSelector::name() const { + std::string name = "TRIGDEC "; + for (auto trigger : m_triggers) + name += " " + trigger; + + return name; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigMatchSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigMatchSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2565d134261edfa2a0cb1eca393d7d94b8d348e8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/Root/TrigMatchSelector.cxx @@ -0,0 +1,91 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopEventSelectionTools/TrigMatchSelector.h" +#include "TopEvent/Event.h" +#include "TopConfiguration/TopConfig.h" + +#include <sstream> +#include <iostream> + +namespace top { + + TrigMatchSelector::TrigMatchSelector(const std::string& selectorName,std::shared_ptr<top::TopConfig> config) + { + m_electronTriggers = config->electronTriggers(selectorName); + m_muonTriggers = config->muonTriggers(selectorName); + m_tauTriggers = config->tauTriggers(selectorName); + + std::cout<<"Triggers Matching for selector = "<<selectorName<<std::endl; + for (auto s : m_electronTriggers) { + std::cout << "--Electron Trigger = " << s << "--" << std::endl; + } + for (auto s : m_muonTriggers) { + std::cout << "--Muon Trigger = " << s << "--" << std::endl; + } + for (auto s : m_tauTriggers) { + std::cout << "--Tau Trigger = " << s << "--" << std::endl; + } + } + + bool TrigMatchSelector::apply(const top::Event& event) const + { + // if no trigger menu us associated to this selection, return true + // no effect of TRIGMATCH if TRIGDEC wasn't used + if (m_electronTriggers.size()+m_muonTriggers.size()+m_tauTriggers.size() == 0) return true; + + bool trigMatch(false); + + // Loop over electrons + for (const auto* const elPtr : event.m_electrons) { + // Loop over triggers + for (const auto& trigger : m_electronTriggers) { + std::string trig = "TRIGMATCH_" + trigger; + if (elPtr->isAvailable<char>(trig)) { + if (elPtr->auxdataConst<char>(trig) == 1) { + trigMatch = true; + return trigMatch; + } + } // decoration isAvailable + } // Loop over triggers + } // Loop over electrons + + // Loop over muons + for (const auto* const muPtr : event.m_muons) { + // Loop over triggers + for (const auto& trigger : m_muonTriggers) { + std::string trig = "TRIGMATCH_" + trigger; + if (muPtr->isAvailable<char>(trig)) { + if (muPtr->auxdataConst<char>(trig) == 1) { + trigMatch = true; + return trigMatch; + } + } // decoration isAvailable + } // Loop over triggers + } // Loop over muons + + + // Loop over taus + for (const auto* const tauPtr : event.m_tauJets) { + // Loop over triggers + for (const auto& trigger : m_tauTriggers) { + std::string trig = "TRIGMATCH_" + trigger; + if (tauPtr->isAvailable<char>(trig)) { + if (tauPtr->auxdataConst<char>(trig) == 1) { + trigMatch = true; + return trigMatch; + } + } // decoration isAvailable + } // Loop over triggers + } // Loop over taus + + return trigMatch; + } + + std::string TrigMatchSelector::name() const { + std::string name = "TRIGMATCH"; + return name; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/EventSelectorBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/EventSelectorBase.h new file mode 100644 index 0000000000000000000000000000000000000000..b673ca4cb9f84c1a6daa74635bb5abb7364e19bc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/EventSelectorBase.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSELECTORBASE_H_ +#define EVENTSELECTORBASE_H_ + +#include "TopEvent/Event.h" + +#include "TopParticleLevel/ParticleLevelEvent.h" + +namespace top { + +/** + * @brief This should apply event-level cuts and perform simple plotting on + * top::Event objects. + * + * This is the base class, and all classes that do stuff + * to events should inherit from it. + */ +class EventSelectorBase { +public: + /** + * @brief Default constructor, doesn't do anything. + */ + EventSelectorBase() {} + + /** + * @brief Default destructor, doesn't do anything. + */ + virtual ~EventSelectorBase() {} + + /** + * @brief Copy is not allowed. + */ + EventSelectorBase(const EventSelectorBase&) = delete; + + /** + * @brief Move is not allowed. + */ + EventSelectorBase(const EventSelectorBase&&) = delete; + + /** + * @brief Assignment is not allowed. + */ + EventSelectorBase& operator=(const EventSelectorBase &) = delete; + + /** + * @brief This does stuff based on the information in an event. + * + * The idea is that you implement this to return either true or false + * based on the information held within top::Event. If this returns true + * then the event is kept. If it returns false then the event is removed. + * + * @param top::Event The current event. + * @return true if the event should be kept, false otherwise. + */ + virtual bool apply(const top::Event&) const = 0; + + /*! + * @brief This does stuff based on the information in a particle level event. + * + * The idea is that you implement this to return either true or false, based + * on the information held within the top::ParticleLevelEvent. If this + * function returns true, then the event is kept, otherwise it is removed. + * The function has a default implementation (which returns true) because it + * is expected that many EventSelector objects do not operate on + * ParticleLevelEvent objects. + * + * @param top::ParticleLevelEvent the current particle level event. + * @param true if the event should be kept (i.e. it passed the selector + * criteria), false otherwise. + */ + virtual bool applyParticleLevel( const top::ParticleLevelEvent & ) const { return true; } + + /** + * @brief A human readable name. + * + * Mostly used for printing the cut and value to the screen. Must be + * implemented for each tool. + */ + virtual std::string name() const = 0; +}; + +} //namespace top + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ExamplePlots.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ExamplePlots.h new file mode 100644 index 0000000000000000000000000000000000000000..d8047e73705741903e35ebb24b99a0c77cca0322 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ExamplePlots.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EXAMPLEPLOTS_H_ +#define EXAMPLEPLOTS_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +class TFile; + +namespace EL { +class Worker; +} + +namespace top { +class TopConfig; + +/** + * @brief An example of how to quickly make some plots at a certain point in + * the cutflow. + */ +class ExamplePlots : public EventSelectorBase { +public: + /** + * @brief Setup some example plots. + * + * Add a bunch of histograms. + * + * @param name The name of the directory to store histograms in, in the + * output file. e.g. you might have ee, mumu and emu. + * @param outputFile The output file. Needs setting up at the very start + * so that we can attach the files. + * @param wk Only used by EventLoop, ok as nullptr as default. + */ + ExamplePlots(const std::string& name, TFile* outputFile, EL::Worker* wk = nullptr, std::shared_ptr<top::TopConfig> config = nullptr); + + /** + * @brief Fill the histograms. + * + * @return True because it doesn't select any events. + */ + virtual bool apply(const top::Event& event) const override; + + /** + * @brief Return the name for the cutflow table. + * + * @return The word EXAMPLEPLOTS. + */ + std::string name() const override; + +private: + ///File units are MeV and normally people like plots in GeV. + static const double toGeV; + + ///Easy access to histograms. + PlotManager m_hists; + + // Nominal hash value + std::size_t m_nominalHashValue; + + std::shared_ptr<top::TopConfig> m_config; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/FakesMMConfigs.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/FakesMMConfigs.h new file mode 100644 index 0000000000000000000000000000000000000000..f7788592963bc8d7407be448d99aa6b16e24814a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/FakesMMConfigs.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FAKESMMCONFIG_H_ +#define FAKESMMCONFIG_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +class TFile; + +namespace top { + +/** + * @brief An example of how to quickly make some plots at a certain point in + * the cutflow. + */ +class FakesMMConfigs : public EventSelectorBase { +public: + /** + * @brief Setup the matrix-method configurations. + * + * @param configs The MM weights configurations separated by spaces. + */ + FakesMMConfigs(const std::string& configs); + + /** + * @return True because it doesn't select any events. + */ + virtual bool apply(const top::Event& event) const override; + + /** + * @brief Return the name for the cutflow table. + * + * @return The word FAKESMMCONFIGS. + */ + std::string name() const override; + + /** + * @return The MM weight configurations. + */ + std::vector<std::string> configurations() const {return m_configurations;}; + +private: + // Nominal hash value + std::vector<std::string> m_configurations; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GRLSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GRLSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..8d3a1637ce85b9cfe01c470e987747b50738d81e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GRLSelector.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GRLSELECTOR_H_ +#define GRLSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + + /** + * @brief Select events if they are on a GRL specified by the parameter + * GRLFilename in the configuration file. MC simulation events are always + * accepted. + */ + class GRLSelector : public EventSelectorBase { + public: + GRLSelector(); + virtual ~GRLSelector(){}; + + /** + * @brief MC simulation passes, data is checked against the GRL. + * + * @param event The event in question + * @return True for MC simulation, or if the data event is on the GRL. + */ + virtual bool apply(const top::Event& event) const override; + + /** + * @brief The name of the tool. + * + * @return The name of the tool for humans to see. + */ + std::string name() const override; + + }; +} + +#endif /* GRLSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GoodCaloSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GoodCaloSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..76ea93cf59efdf11ea63967e116dceba9982b8ac --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/GoodCaloSelector.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GOODCALOSELECTOR_H_ +#define GOODCALOSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + + /** + * @brief Select data events with good Tile and LAr calorimeters. + * MC simulation events are always accepted. + */ + class GoodCaloSelector : public EventSelectorBase { + public: + GoodCaloSelector(); + virtual ~GoodCaloSelector(){}; + + /** + * @brief MC simulation passes, data is checked against the GRL. + * + * @param event The event in question + * @return True for MC simulation, or if the data event is on the GRL. + */ + virtual bool apply(const top::Event& event) const override; + + /** + * @brief The name of the tool. + * + * @return The name of the tool for humans to see. + */ + std::string name() const override; + + }; +} + +#endif /* GoodCaloSelector */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/HTSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/HTSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..a6ff79cc18c7a18ff659b3fcadde016b232ea92c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/HTSelector.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef HTSELECTOR_H_ +#define HTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Apply a cut on the event HT. + * + * The calculation is done by top::ht(). + */ +class HTSelector : public SignValueSelector { +public: + explicit HTSelector(const std::string& params); + + virtual bool apply(const top::Event& event) const override; + + virtual bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/IP3DSV1Selector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/IP3DSV1Selector.h new file mode 100644 index 0000000000000000000000000000000000000000..b61ac0fc9228dffb1a1ec90e3176d62846ec46c9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/IP3DSV1Selector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef IP3DSV1SELECTOR_H_ +#define IP3DSV1SELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Should count how many jets have an IP3DSV1 weight above some value. + * The user is expected to input something a bit like IP3DSV1 1.8 >= 2, to get + * two jets tagged with 1.8. Maybe in the future we can make this easier to use + * by the person just saying 70% or something for the 0.7 WP? + */ +class IP3DSV1Selector : public SignValueSelector { +public: + explicit IP3DSV1Selector(const std::string& params); + + virtual bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/InitialSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/InitialSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..3cc95512248740a7e3491689f6a87e528192b15f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/InitialSelector.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INITIALSELECTOR_H_ +#define INITIALSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief A cut that accepts all events, more useful than you might think. + * + * Very simple tool that accepts all events so you can see the starting + * number of events in the cutflow. + */ +class InitialSelector : public EventSelectorBase { + /** + * @brief Accept every event + * + * @return Always true, so the event is accepted. + */ + virtual bool apply(const top::Event&) const override; + + /** + * @brief The name printed in the cutflow. + * + * @return The word INITIAL. + */ + virtual std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetCleaningSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetCleaningSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..f86e0e4010891da6ef4adcb70436bfb33bec2168 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetCleaningSelector.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETCLEANINGSELECTOR_H_ +#define JETCLEANINGSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "JetInterface/IJetSelector.h" + +namespace top { + class TopConfig; + +/** + * @brief Event selection using the official jet cleaning tool. + * + * Hurray! The jet cleaning tool is one one of the few that exists in xAOD + * format already) + * + * Call the jet cleaning tool and reject the event if any of the jets that + * passed the event selection are marked as bad. Probably should check that + * this is okay after overlap removal. + */ +class JetCleaningSelector : public EventSelectorBase { +public: + /** + * @brief Setup the jet group's cleaning tool. + * + * The cutlevel is specified in the constructor as a little bit of text. + * + * @param level How harsh you want the cleaning to be. For example + * MediumBad. + */ + explicit JetCleaningSelector(const std::string& level, std::shared_ptr<top::TopConfig> config); + + /** + * @brief Only accept the event if the tool says all the jets are okay. + * + * @return True to accept the event, false otherwise. + */ + bool apply(const top::Event& event) const override; + + /** + * @brief Print the name of the tool and level. + * + * @return The name of the tool and the level that it has been configured + * at. + */ + std::string name() const override; + +private: + ///The jet cleaning tools + ToolHandle<IJetSelector> m_jetCleaningToolLooseBad; + ToolHandle<IJetSelector> m_jetCleaningToolTightBad; + + ///The level to configure to, so we can print it in the name. + std::string m_level; + bool m_useLooseBad; + + std::shared_ptr<top::TopConfig> m_config; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetFlavorPlots.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetFlavorPlots.h new file mode 100644 index 0000000000000000000000000000000000000000..d0f6f11c138c48ac5199b77352f56add76d0f5a6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetFlavorPlots.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPEVENTSELECTIONTOOLS_JETFLAVORPLOTS_H_ +#define TOPEVENTSELECTIONTOOLS_JETFLAVORPLOTS_H_ + +#include <string> + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +class TFile; + +namespace EL { +class Worker; +} + +namespace top { + +/** + * @brief An example of how to quickly make some plots at a certain point in + * the cutflow. + */ +class JetFlavorPlots : public EventSelectorBase { + public: + /** + * @brief Setup some example plots. + * + * Add a bunch of histograms. + * + * @param name The name of the directory to store histograms in, in the + * output file. e.g. you might have ee, mumu and emu. + * @param outputFile The output file. Needs setting up at the very start + * so that we can attach the files. + * @param wk Only used by EventLoop, ok as nullptr as default. + */ + JetFlavorPlots(const std::string& name, TFile* outputFile, + EL::Worker* wk = nullptr); + + /** + * @brief Fill the histograms. + * + * @return True because it doesn't select any events. + */ + bool apply(const top::Event& event) const override; + + /** + * @brief Return the name for the cutflow table. + * + * @return The word JETFLAVORPLOTS. + */ + std::string name() const override; + + private: + // File units are MeV and normally people like plots in GeV. + static const double toGeV; + + // Easy access to histograms. + PlotManager m_hists; + + // Nominal hash value + std::size_t m_nominalHashValue; +}; + +} // namespace top + +#endif // TOPEVENTSELECTIONTOOLS_JETFLAVORPLOTS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetNGhostSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetNGhostSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..7a4756df830e22a6b99b64cb7effcab92d3a9d36 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/JetNGhostSelector.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: JetNGhostSelector.h +// Description: +// Author: Fabian Wilk +// Created: Fri May 8 15:38:21 2015 + +#ifndef _JETNGHOSTSELECTOR_H_ +#define _JETNGHOSTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + + class JetNGhostSelector : public SignValueSelector { + public: + explicit JetNGhostSelector(const std::string& params); + + /*! + * @brief Apply on reco level. + * There is no sensible application for a ghost tagging selector at reco + * level, hence return true for any input. + */ + bool apply(const top::Event&) const override { return true; } + + /*! + * @brief Apply on particle level. + * Will calculate the number of ghost tagged jet for the requested type. + * Will return true if that number is equal to order larger than the cut + * value, false otherwise. + */ + bool applyParticleLevel(const top::ParticleLevelEvent& plEvent) const override; + + std::string name() const override; + private: + std::string parseType( const std::string & params ); + + enum Type { + c = static_cast<int>( 'c' ), + C = static_cast<int>( 'C' ), + b = static_cast<int>( 'b' ), + B = static_cast<int>( 'B' ), + t = static_cast<int>( 't' ), + W = static_cast<int>( 'W' ), + Z = static_cast<int>( 'Z' ), + H = static_cast<int>( 'H' ), + tau, + Invalid + }; + Type m_type; + + std::string m_name; + }; + + +} + +#endif /* _JETNGHOSTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/KLFitterSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/KLFitterSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..98536f770bbb4ba3c94b394ee04c4a9ae8da29a6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/KLFitterSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: KLFitterSelector.h 665436 2015-05-06 19:10:23Z morrisj $ +#ifndef ANALYSISTOP_TOPEVENTSELECTIONTOOLS_KLFITTERSELECTOR_H +#define ANALYSISTOP_TOPEVENTSELECTIONTOOLS_KLFITTERSELECTOR_H + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top{ + + /** + * @brief Apply a cut on the KLFitter Results + */ + + // Forward declare + class Event; + + class KLFitterSelector : public SignValueSelector { + public: + explicit KLFitterSelector(const std::string& params); + bool apply(const top::Event&) const override; + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METMWTSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METMWTSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6cea661a59e32a7501891d4e757a2981bd839e16 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METMWTSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef METMWTSELECTOR_H_ +#define METMWTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Allows a cut on the sum of MET and MWT. + */ +class METMWTSelector : public SignValueSelector { +public: + explicit METMWTSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..4d3dd53103bc3bfd3d826583e1c74836426e49bd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/METSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef METSELECTOR_H_ +#define METSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Apply a cut on the event MET. + */ +class METSelector : public SignValueSelector { +public: + explicit METSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6efd0903f6e8dc7de23bd499ca8be91727b04756 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLSelector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MLLSELECTOR_H_ +#define MLLSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Put a cut on the invariant mass of two same flavour leptons. If you + * want to veto a window (say for the Z mass) you instead want MLLWindow. + */ +class MLLSelector : public SignValueSelector { +public: + explicit MLLSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLWindowSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLWindowSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..5721b9d9ab926b047056c7a6688fe9478ff03bd3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MLLWindowSelector.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MLLWINDOW_H_ +#define MLLWINDOW_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Reject events in the invariant mass (of two charged leptons) window. + */ +class MLLWindow : public EventSelectorBase { +public: + explicit MLLWindow(std::string params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; + + std::string name() const override; + +private: + double m_cutvalue0; + double m_cutvalue1; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV1Selector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV1Selector.h new file mode 100644 index 0000000000000000000000000000000000000000..764096adfab5f8e94ee6702185b23555b679ec0e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV1Selector.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MV1SELECTOR_H_ +#define MV1SELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Should count how many jets have an mv1 weight above some value. + * mv1 Seem to not be filled yet though. + */ +class MV1Selector : public SignValueSelector { +public: + explicit MV1Selector(const std::string& params); + + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c10Selector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c10Selector.h new file mode 100644 index 0000000000000000000000000000000000000000..fe1af683f59ff1a195b554a9b190784a0560c0dd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c10Selector.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MV2C10SELECTOR_H_ +#define MV2C10SELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Should count how many jets have an mv2c10 weight above some value. + */ +class MV2c10Selector : public SignValueSelector { +public: + explicit MV2c10Selector(const std::string& params); + + /** + * @brief Look at the event and check if the required number of tagged jets + * are there. + * + * If MV2C10 is not in the input file (it is for MC15) then you need to + * return false, since no events pass the cut. If it is there we retrieve + * it and check the value against the user specified cut. + * + * @param event The event to analyse + * @return True if the event passes the cut, false otherwise. + */ + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c20Selector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c20Selector.h new file mode 100644 index 0000000000000000000000000000000000000000..8dcbfcc28fe1af06e8f8f745acddb3770688f274 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MV2c20Selector.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MV2C20SELECTOR_H_ +#define MV2C20SELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Should count how many jets have an mv2c20 weight above some value. + * + * Information is taken from these slides presented in PC: + * https://indico.cern.ch/event/394627/contribution/1/5/material/slides/0.pdf + */ +class MV2c20Selector : public SignValueSelector { +public: + explicit MV2c20Selector(const std::string& params); + + /** + * @brief Look at the event and check if the required number of tagged jets + * are there. + * + * If MV2C20 is not in the input file (it is for MC15) then you need to + * return false, since no events pass the cut. If it is there we retrieve + * it and check the value against the user specified cut. + * + * @param event The event to analyse + * @return True if the event passes the cut, false otherwise. + */ + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MWTSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MWTSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6658fe250f468f54951a5c5bfaaa82e9c18615f3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/MWTSelector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MWTSELECTOR_H_ +#define MWTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief Apply a cut on the transverse W mass (taken from the electron or muon + * and MET). + */ +class MWTSelector : public SignValueSelector { +public: + explicit MWTSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..97249a0a86a6c8e90ed839345cde78767af47d1e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonSelector.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NELECTRONNMUONSELECTOR_H_ +#define NELECTRONNMUONSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief To accept an event based on a check of electrons and muons. + */ +class NElectronNMuonSelector : public SignValueSelector { +public: + /** + * @brief Select events based on multiplicity, which should be an integer. + */ + explicit NElectronNMuonSelector(const std::string& params); + + /** + * @brief The 'OR' of a check against electrons and muons. + * + * @return True to keep the event, false otherwise. + */ + bool apply(const top::Event& event) const override; + + /*! + * @brief The 'OR' of a check against electrons and muons. + * + * @return True to keep the event, false otherwise. + */ + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..d3f72175d8d985a881037563809cd3d8d3f28ec7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronNMuonTightSelector.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NELECTRONNMUONTIGHTSELECTOR_H_ +#define NELECTRONNMUONTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief To accept an event based on a check of tight electrons and muons. + * This is identical to NElectronNMuonSelector in the case of tight selection, so only relevant for loose selection. + */ +class NElectronNMuonTightSelector : public SignValueSelector { +public: + /** + * @brief Select events based on multiplicity, which should be an integer. + */ + explicit NElectronNMuonTightSelector(const std::string& params); + + /** + * @brief The 'OR' of a check against electrons and muons. + * + * @return True to keep the event, false otherwise. + */ + bool apply(const top::Event& event) const override; + + /*! + * @brief The 'OR' of a check against electrons and muons. + * + * @return True to keep the event, false otherwise. + */ + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..15b89e60b31f92792a63339410fa358fe859d4f0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NELECTRONSELECTOR_H_ +#define NELECTRONSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good electrons. + */ +class NElectronSelector : public SignValueSelector { +public: + explicit NElectronSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..1c71d916e2d096a2f8900a110bda630a37f23518 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NElectronTightSelector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NELECTRONTIGHTSELECTOR_H_ +#define NELECTRONTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good tight electrons. + * This is identical to NElectronSelector in the case of tight selection, so only relevant for loose selection. + */ +class NElectronTightSelector : public SignValueSelector { +public: + explicit NElectronTightSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetBtagSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetBtagSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..1c440e79d2397b49138c1a6fa4ad43b74e0af685 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetBtagSelector.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NJETBTAGSELECTOR_H_ +#define NJETBTAGSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + class TopConfig; + +/** + * @brief A tool that selects events with a certain number of good jets. + */ +class NJetBtagSelector : public SignValueSelector { +public: + explicit NJetBtagSelector(const std::string& params,std::shared_ptr<top::TopConfig> config); + + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..1b66a8f7a08064c07e4b6594e559bad078627718 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NJetSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NJETSELECTOR_H_ +#define NJETSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good jets. + */ +class NJetSelector : public SignValueSelector { +public: + explicit NJetSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NLargeJetSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NLargeJetSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..5aff1598bf69cf1a0f3736983ee39d1815b7fbad --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NLargeJetSelector.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NLARGEJETSELECTOR_H_ +#define NLARGEJETSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + + +namespace top { + + class NLargeJetSelector : public top::SignValueSelector { + + public: + + explicit NLargeJetSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + bool applyParticleLevel( const top::ParticleLevelEvent & ) const override; + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6dedd2cf3af6b69cd909455a7a6b0f0212279f13 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NMUONSELECTOR_H_ +#define NMUONSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good muons. + */ +class NMuonSelector : public SignValueSelector { +public: + explicit NMuonSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..196485c6aa1d0200441012e5e2887a81d784c55c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NMuonTightSelector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NMUONTIGHTSELECTOR_H_ +#define NMUONTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good tight muons. + * This is identical to NMuonSelector in the case of tight selection, so only relevant for loose selection. + */ +class NMuonTightSelector : public SignValueSelector { +public: + explicit NMuonTightSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NPhotonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NPhotonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..77210fa9371049bee493dd4394f38f790219a8fd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NPhotonSelector.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NPHOTONSELECTOR_H_ +#define NPHOTONSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good photons. + */ +class NPhotonSelector : public SignValueSelector { +public: + explicit NPhotonSelector(const std::string& params); + + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6459759dbfabe64dae5182160bef1ab9835ae565 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauSelector.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NTAUSELECTOR_H_ +#define NTAUSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good taus. + */ +class NTauSelector : public SignValueSelector { +public: + explicit NTauSelector(const std::string& params); + + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..42432ccb6b81a112f397b4b175faa31b38ba4823 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NTauTightSelector.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NTAUTIGHTSELECTOR_H_ +#define NTAUTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + +namespace top { + +/** + * @brief A tool that selects events with a certain number of good taus. + */ +class NTauTightSelector : public SignValueSelector { +public: + explicit NTauTightSelector(const std::string& params); + + bool apply(const top::Event& event) const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NoBadMuonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NoBadMuonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..2d1c9bbc809e24198c37d0aafa13f9068369ac65 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/NoBadMuonSelector.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NOBADMUONSELECTOR_H_ +#define NOBADMUONSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +#include "AsgTools/ToolHandle.h" +#include "MuonSelectorTools/IMuonSelectionTool.h" + +namespace top { + +/** + * @brief A tool that selects events containing no bad muons + * https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool#is_BadMuon_Flag_Event_Veto + * + */ + class NoBadMuonSelector : public EventSelectorBase { +public: + + /** + * @brief Event selection if bad muon detected using the official muon selector tool. + * + * Call the muon selector tool and reject the event if any of the muons that + * passed the event selection are marked as bad. + */ + explicit NoBadMuonSelector(); + + /** + * @brief Events with a muon flagged bad are rejected + * + * @param event The event in question + * @return False if a bad muon is found + */ + bool apply(const top::Event& event) const override; + + /** + * @brief The name of the tool. + * + * @return The name of the tool for humans to see. + */ + std::string name() const override; + +private: + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; + +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..7cf17c830e35fd17ff5cc4939f37e151e52d5366 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonSelector.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef OSSELECTOR_H_ +#define OSSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Keep only events that have at least one opposite sign lepton pair. + * + * Try to find at least one lepton (el, mu) with positive charge, + * and at least one with negative charge. + */ +class OSLeptonSelector : public EventSelectorBase { +public: + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; + + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..fc6c0a2986c8313e22cb9dc11b43febf9f001cad --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/OSLeptonTightSelector.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef OSTIGHTSELECTOR_H_ +#define OSTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Keep only events that have at least one opposite sign tight lepton pair. + * This is identical to OSLeptonSelector in the case of tight selection, so only relevant for loose selection. + * + * Try to find at least one lepton (el, mu) with positive charge, + * and at least one with negative charge. + */ +class OSLeptonTightSelector : public EventSelectorBase { +public: + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; + + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ParticleLevelSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ParticleLevelSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..a78700637a94315b864dc8acb71d65754e1c7801 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ParticleLevelSelector.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelSelector.h +// Description: +// Author: Fabian Wilk +// Created: Tue Oct 27 13:26:19 2015 +// +// (c) by Fabian Wilk +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#ifndef _PARTICLELEVELSELECTOR_H_ +#define _PARTICLELEVELSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + + /** + * @brief An event selector that accepts all particle level events and rejects all + * reco level events. + * + * This can be used to define event selections that shall be applied only to + * particle level events. + */ + class ParticleLevelSelector : public EventSelectorBase { + /** + * @brief Reject every event. + * @return Always false. + */ + virtual bool apply(const top::Event&) const override; + + /** + * @brief Accept every event. + * @return Always true. + */ + virtual bool applyParticleLevel(const top::ParticleLevelEvent&) const override; + + /** + * @brief The name printed in the cutflow. + * @return The word PARTICLE_LEVEL + */ + virtual std::string name() const override; + }; + +} + +#endif /* _PARTICLELEVELSELECTOR_H_ */ + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PlotManager.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PlotManager.h new file mode 100644 index 0000000000000000000000000000000000000000..f9eb9219837626145f719943167fab49909e070c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PlotManager.h @@ -0,0 +1,100 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PLOTMANAGER_H_ +#define PLOTMANAGER_H_ + +#include <string> +#include <unordered_map> + +class TFile; +class TH1; +class TDirectory; + +namespace EL { + class Worker; +} + +namespace top { + +/** + * @brief A map that lets you create a bunch of histograms and get hold of them + * via a string name. It takes care of writing them to the outputfile too - if + * you have one. + */ +class PlotManager { +public: + /** + * @brief A name for the selection. Plots will be stored in a folder + * with this name in the output file. e.g. ejets, mujets etc. + * + * @param name The name of the folder to store stuff in the output file. + * During the run name_ is added to the front of the histogram name, instead + * of a folder because... well... ROOT! + */ + explicit PlotManager(const std::string& name, TFile* outputFile = nullptr, EL::Worker* wk = nullptr); + + PlotManager(const std::string& sample,const std::string& channel,const std::string& syst,TFile* outputFile); + + /** + * @brief Add a histogram to the output file. + * + * @param hname A unique name, notice that we automatically add the name + * of the analysis on to this with an underscore. + * @param title The histogram title, as root expects. + * @param bins The number of bins, passed directly to root. + * @param start The starting value, passed directly to root. + * @param end The ending value, passed directly to root. + */ + void addHist(const std::string& hname, const std::string& title, int bins, double start, double end) const; + + /** + * @brief Add a 2D histogram to the output file. + * + * @param hname A unique name, notice that we automatically add the name + * of the analysis on to this with an underscore. + * @param title The histogram title, as root expects. + * @param xbins The number of x-bins, passed directly to root. + * @param xstart The starting x-value, passed directly to root. + * @param xend The ending x-value, passed directly to root. + * @param xbins The number of y-bins, passed directly to root. + * @param xstart The starting y-value, passed directly to root. + * @param xend The ending y-value, passed directly to root. + */ + void addHist(const std::string& hname, const std::string& title, + int xbins, double xstart, double xend, + int ybins, double ystart, double yend) const; + + /** + * @brief Recover an existing histogram, to fill it for example. + * + * @return A pointer to the histogram if it exists. If it doesn't exist + * then it'll exit, since that's clearly a bug. + */ + TH1* hist(const std::string& name) const; + + /** + * @brief Save the histograms in alphabetical order. + * + * First copy from the unordered map to an ordered one. That helps + * people when they look through the plots in a TBrowser. Then call write + * on each histogram. I'm assuming you have an open file already. + */ + void scaleHistograms(double sf = 1.) const; + +private: + EL::Worker* m_wk; + + ///Name of the folder to store the plots in, in the output file. + std::string m_name; + + ///A map that's hopefully quick to search because it'll be used a lot per event. + mutable std::unordered_map<std::string, TH1*> m_histograms; + + mutable TDirectory* m_plotDir; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrimaryVertexSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrimaryVertexSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..0d8a6976f837c60611b7f3d450ec7399aaef9170 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrimaryVertexSelector.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PRIMARYVERTEXSELECTOR_H_ +#define PRIMARYVERTEXSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + + /** + * @brief Select data events with good Primary vertices + * following: + * https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/InDetTrackingPerformanceGuidelines#Vertexing + * + */ + class PrimaryVertexSelector : public EventSelectorBase { + public: + PrimaryVertexSelector(); + virtual ~PrimaryVertexSelector(){}; + + /** + * @brief MC simulation passes, data is checked against the GRL. + * + * @param event The event in question + * @return True for MC simulation, or if the data event is on the GRL. + */ + virtual bool apply(const top::Event& event) const override; + + /** + * @brief The name of the tool. + * + * @return The name of the tool for humans to see. + */ + std::string name() const override; + + }; +} + +#endif /* PrimaryVertexSelector */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrintEventSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrintEventSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..6ece5e33bf21db4dd99f4f05ecf246d640c9ff66 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/PrintEventSelector.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PRINTEVENTSELECTOR_H_ +#define PRINTEVENTSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Print some information about the event to the screen using cout. + * + * Prints the run number, event number, mu, and lists of 4-vectors for good + * electrons, muons and jets and the event missing ET. + */ +class PrintEventSelector : public EventSelectorBase { + /** + * @brief For each event print some information about it to the terminal. + * + * @return Also marks the event as passed. + */ + bool apply(const top::Event& event) const override; + + /** + * @brief The word PRINT. + */ + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RecoLevelSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RecoLevelSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..30767fd60de01a86f9a58ac27f373cae6c19da2b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RecoLevelSelector.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: RecoLevelSelector.h +// Description: +// Author: Fabian Wilk +// Created: Tue Oct 27 12:07:02 2015 +// +// (c) by Fabian Wilk +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#ifndef _RECOLEVELSELECTOR_H_ +#define _RECOLEVELSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + + /** + * @brief An event selector that accepts all reco level events and rejects all + * particle level events. + * + * This can be used to define event selections that shall be applied only to + * reco level events. + */ + class RecoLevelSelector : public EventSelectorBase { + /** + * @brief Accept every event. + * @return Always true. + */ + virtual bool apply(const top::Event&) const override; + + /** + * @brief Reject every event. + * @return Always false. + */ + virtual bool applyParticleLevel(const top::ParticleLevelEvent&) const override; + + /** + * @brief The name printed in the cutflow. + * @return The word RECO_LEVEL + */ + virtual std::string name() const override; + }; + +} + +#endif /* _RECOLEVELSELECTOR_H_ */ + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RunNumberSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RunNumberSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..034c084136af7dc96b27d248535e5733f0973c2b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/RunNumberSelector.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RUNNUMBERSELECTOR_H_ +#define RUNNUMBERSELECTOR_H_ + +#include "TopEventSelectionTools/SignValueSelector.h" + + +namespace top { +class TopConfig; + +/** + * @brief Apply a cut on the (random) run number. + */ +class RunNumberSelector : public SignValueSelector { +public: + explicit RunNumberSelector(const std::string& params,std::shared_ptr<top::TopConfig> config); + + bool apply(const top::Event& event) const override; + +private: + std::shared_ptr<top::TopConfig> m_config; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..ccc6ca9017311f1985d8fabd41378a067bbbae3a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonSelector.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SSSELECTOR_H_ +#define SSSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Keep only events that have at least one same sign lepton pair. + * + */ +class SSLeptonSelector : public EventSelectorBase{ +public: + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; + + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonTightSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonTightSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..eba687dc27d12bddc649f53156fc1c0267c54f7a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SSLeptonTightSelector.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SSTIGHTSELECTOR_H_ +#define SSTIGHTSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Keep only events that have at least one same sign tight lepton pair. + * This is identical to SSLeptonSelector in the case of tight selection, so only relevant for loose selection. + * + */ +class SSLeptonTightSelector : public EventSelectorBase{ +public: + bool apply(const top::Event& event) const override; + + bool applyParticleLevel(const top::ParticleLevelEvent& event) const override; + + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SaveEventSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SaveEventSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..5100a9a24998125e9c20490b86b6fdee69f90954 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SaveEventSelector.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SAVEEVENTSELECTOR_H_ +#define SAVEEVENTSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Save this event in the output file. + * + * This is special. Not only will it mark the event as passing the event + * selection, but it will also write out the selected objects to the output + * file in the CollectionTree. + */ +class SaveEventSelector : public EventSelectorBase { + /** + * @brief Accept every event + * + * @return Always true, so the event is accepted. + */ + bool apply(const top::Event&) const override; + + /** + * @brief The name printed in the cutflow. The name is extra special for + * this because it is used to check if we should write-out the event too. + * + * @return The word SAVE. + */ + std::string name() const override; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SignValueSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SignValueSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..f84a7fa55a6d9f332601cc840446217cb712f15b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/SignValueSelector.h @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SIGNVALUESELECTOR_H_ +#define SIGNVALUESELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" + +namespace top { + +/** + * @brief Many of the tools need a sign (>=) and a value (2). For example, if + * we want at least two leptons. This is an intermediate 'base' class that + * implements all the functionality these tools need in one place. + */ +class SignValueSelector : public EventSelectorBase { +public: + /** + * @brief Many of the tools will be supplied with an equality (or inequality) by + * the user. They're decoded from the text input and saved in this 'sign' + * format. + */ + enum Sign { + signNOIDEA, //the user clearly did something wrong, expect to exit / crash + signEQ, // == + signLT, // < + signGT, // > + signLTEQ, // <= + signGTEQ // >= + }; + + /** + * @brief Constructor for tools that need a sign and a value. For example + * selectors based on multiplicity and cuts. + * + * @param name The name of the tool to be used in print outs + * @param params The parameters to setup the tool with. Note that it's not + * constant because it's edited by the decodesign function (to remove + * stuff). + * @param multiplicityMode Will this take both a cut value and a + * multiplicity. For example b-tagging. MV1 0.5 >= 2. Two mv1 tags of + * atleast 0.5. The default is the "normal" cut mode for cuts like MET, HT + * etc. + * @param cutValueMode The cut value can also be a string, e.g. FixedCutBEff_77 + * The default behaviour is false (the cut value is not a string). Note that + * cutValueMode = true only makes sense if multiplicityMode = true + */ + SignValueSelector(const std::string& name, std::string params, bool multiplicityMode = false, bool cutValueMode = false); + + /** + * @brief The name is generated in the constructor for this kind of tool. + */ + virtual std::string name() const override; + +protected: + /** + * @brief Integers are annoying in C++. + * + * Mostly used by the NLargeJet selectors. + */ + void checkValueIsInteger(); + + /** + * @brief Integers are annoying in C++. + * + * Your first thought when reading in an integer is probably just to read it + * in with cin to an integer variable. This seems to not work, as it'll + * just read the integer component and ignore the rest of the string. The + * approach here then is to read it in as a floating point number and ask + * that number if it is equal to itself rounded down (integers are, + * fractional numbers are not) + * + * Since the user probably didn't mean to cut on njets >= 2.3 we should + * interrupt the job and print a useful error message if it doesn't work. + */ + void checkMultiplicityIsInteger(); + + /** + * @brief Get the sign setup in the constructor. + */ + Sign sign() const; + + /** + * @brief Get the cut value assigned in the constructor. + */ + double value() const; + + /** + * @brief Get the cut value assigned in the constructor. + * This is for when the cut is a string + */ + std::string valueString() const; + + /** + * @brief Get the cut multiplicity assigned in the constructor. + * + * This is used for cuts that take a value and a multiplicity, for example + * EL_N 25000 >= 2 means at least two electrons with pT > 25 GeV. You + * can chain these together to make non-symmetric cuts. For example + * EL_N 25000 >= 2 + * EL_N 40000 >= 1 + * + * @return The multiplicity is actually integer, but it's stored in a double + * so that we can check it's an integer when we read it in. + */ + double multiplicity() const; + + /** + * @brief Take the string params, look for one of the allowed inequalities + * (or equality) and return that. It also removes the text from the string + * so the string can then be passed on to some code to extract the numerical + * value. + * + * @param params The string that contains something like ">= 2". It will + * return the " 2" via the params parameter. + * + * @return For the above example, the sign ">=" will be configured. + */ + Sign decodesign(std::string& params); + + /** + * @brief Compare a cut supplied by the user with the value calculated in + * the event. For floating point numbers. + * + * @param value The value from the event. + * @param cut The cut the user wants to apply. + * + * @return True if the cut is passed. + */ + bool checkFloat(double value, double cut) const; + + /** + * @brief Compare a cut supplied by the user with the value calculated in + * the event. For integer numbers. + * + * @param value The value from the event. + * @param cut The cut the user wants to apply. + * + * @return True if the cut is passed. + */ + bool checkInt(int value, int cut) const; + + /** + * @brief Convert the sign enum back to a string for use in the name and + * print outs. + * + * @return A short string version of the name + */ + const std::string signstring() const; + +private: + ///Hold the name of the tool, filled by the constructor. + std::string m_name; + + ///The sign of the cut, filled by the constructor. + Sign m_sign; + + ///The value of the cut, filled by the constructor. + double m_cutvalue; + + ///The value of the cut in the case it's a string, filled by the constructor. + std::string m_cutvalueString; + + ///The multiplicity for cuts that take both a value and a multiplicity e.g. EL_N 25000 >= 2 + double m_multiplicity; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ToolLoaderBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ToolLoaderBase.h new file mode 100644 index 0000000000000000000000000000000000000000..da968a368a03a7619e7647fd541e21961ae0ecf0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/ToolLoaderBase.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOOLLOADERBASE_H_ +#define TOOLLOADERBASE_H_ + +#include <string> +#include <memory> + +#include "TClass.h" + +class TFile; + +namespace EL { +class Worker; +} + +namespace top { + class EventSelectorBase; + class TopConfig; + +/** + * @brief This allows user libraries (and TopEventSelectionTools and + * TopEventReconstructionTools) to supply event selection-like tools to the + * main top-xaod executable. + * + * To add one of these to your own library you must inherit from this class and + * implement initTool. The source code for this (or the getting started twiki) + * should act as a good reference. Basically you want an if (blah == "mytool") + * then new MyTool(). + */ +class ToolLoaderBase { +public: + ///Constructor doesn't do anything. + ToolLoaderBase() {} + + ///Destructor doesn't do anything. + virtual ~ToolLoaderBase() {} + + /** + * @brief If you make a new library and you want it to contain some event + * selection tools you must implement this method. + * + * This is the only important method for this class and is loaded at the + * start of top-xaod when constructor the event selection. + * + * @param name The name of the event selection used when saving histograms. + * @param line This should be a line of text like "JET_N 25000 >= 2". The + * exact format of the line depends on which tool you are trying to setup. + * @param outputFile Some of the tools (histograms for example) need access + * to the output file. + * @param wk Used by EventLoop, try not to worry about it too much. + * + * @return Always a valid, configured tool or a nullptr if a tool matching + * the name was not found (since this might not be the only tool loader in + * the program). + */ + virtual top::EventSelectorBase* initTool(const std::string& name, const std::string& line, TFile* outputFile, std::shared_ptr<top::TopConfig> config,EL::Worker* wk = nullptr) = 0; + + ClassDef(top::ToolLoaderBase, 0); +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TopEventSelectionToolsLoader.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TopEventSelectionToolsLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..16799d188300ad461d4803765957d9b1e5a8bfe5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TopEventSelectionToolsLoader.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTSELECTIONTOOLLOADER_H_ +#define EVENTSELECTIONTOOLLOADER_H_ + +#include "TopEventSelectionTools/ToolLoaderBase.h" + +namespace top { + +/** + * @brief This is used to load tools in this package in a factory like way. It + * has one important function. After that has been called, you can dispose of + * this class. + * + * A few tricky aspects are: + * 1) Don't use C++11 in this because of the ClassDef and Root5. In Root6 + * you'll be glad to hear that it's fine but we're not there yet. + * 2) Don't put any xAOD headers in here. Same reason. + */ +class TopEventSelectionToolsLoader : public ToolLoaderBase { +public: + /** + * @brief Convert the string name into a tool-object. + * + * If the tool is not found by the function then it will print an error + * message and terminate the program execution. No point running the whole + * analysis if you made a typo in the cuts. + * + * Any new tools that you write will have to be added to this function so + * it knows how to correctly load them. The order is a bit important, because + * it's done by string matching. So MET+MWT has to come before MET, for + * example. + * + * @param name The name of the event selection used when saving histograms. + * @param line This should be a line of text like "JET_N 25000 >= 2". The + * exact format of the line depends on which tool you are trying to setup. + * @param outputFile Some of the tools (histograms for example) need access + * to the output file. + * @param wk Used by EventLoop, try not to worry about it too much. + * + * @return Always a valid, configured tool or a nullptr if a tool matching + * the name was not found (since this might not be the only tool loader in + * the program). + */ + top::EventSelectorBase* initTool(const std::string& name, const std::string& line, TFile* outputFile, std::shared_ptr<top::TopConfig> config,EL::Worker* wk = nullptr); + + ClassDef(top::TopEventSelectionToolsLoader, 0) +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TreeManager.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TreeManager.h new file mode 100644 index 0000000000000000000000000000000000000000..62c76f601c30c5573e1c15196aaf6d75e3bb19e9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TreeManager.h @@ -0,0 +1,178 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TREEMANAGER_H_ +#define TREEMANAGER_H_ + +#include "TTree.h" + +#include <string> +#include <list> +#include <sstream> +#include <functional> +#include <vector> + +class TFile; + +namespace top { + +/** + * @brief A class that hopefully makes making a flat ntuple tree a bit easier + * since you don't need to worry about what type to make the branches and stuff. + * + * Almost all this code is stolen from SFrame: + * http://sourceforge.net/p/sframe + */ +class TreeManager { +public: + /** + * @brief Default constructor - note need to initialize the class if you use this. + */ + TreeManager(); + + /** + * @brief You need to construct this at the start (in the same way as for + * the plot manager. + * + * @param file The file to write the tree to. + * @param name The name of the tree (e.g. nominal, systematic1 etc). + */ + TreeManager(const std::string& name, TFile* outputFile,const bool setAutoFlushZero = false); + + ///We do allow you to move it + TreeManager(const TreeManager&& rhs); + + ///But not to copy it. + TreeManager(const TreeManager&)= delete; + + ///Or assign it. + TreeManager& operator=(TreeManager const&) = delete; + + /** + * @brief Initialize the class with a new output file + */ + void initialize(const std::string& name, TFile* outputFile,const bool setAutoFlushZero = false); + + /** + * @brief Calls TTree::Fill. Needed to fill the tree. + */ + void fill(); + + /** + * @brief name of the TTree + */ + const std::string& name() const; + + /** @brief function object type used for branch filters */ + typedef std::function<int(TreeManager const *, std::string const &)> BranchFilter; + + /** @copydoc TreeManager::m_branchFilters */ + std::vector<BranchFilter> & branchFilters() { return m_branchFilters; } + + /** @copydoc TreeManager::m_branchFilters */ + std::vector<BranchFilter> const & branchFilters() const { return m_branchFilters; } + + /** + * @brief The idea is to simplify the creation of branches so that you don't + * have to write tree->Branch("blah", &blah, "blah/I") because the computer + * can figure out the "blah/I" bit for you. + * + * Stolen from SFrame. + * + * @param obj The object that you would like to save in a branch. This can + * be a primitive type (e.g. int, unsigned int, etc.) or an object (e.g. + * std::vector<float>). + * @param name The name you would like to give this branch. + */ + template<class T> + void makeOutputVariable(T& obj, const std::string name) { + for (auto branchFilter : branchFilters()) { + int status = branchFilter(this, name); + if (status > 0) + break; + if (status == 0) + return; + } + const char* type_name = typeid(obj).name(); + if (strlen( type_name ) == 1) { + std::ostringstream leaflist; + leaflist << name << "/" << RootType( type_name ); + m_tree->Branch(name.c_str(), &obj, leaflist.str().c_str()); + } else { + m_outputVarPointers.push_back( &obj ); + T** pointer = reinterpret_cast< T** >( &m_outputVarPointers.back() ); + m_tree->Branch( name.c_str(), pointer ); + } + } + +private: + /** + * name of the tree + */ + std::string m_name; + + + /** + * @brief Stolen from SFrame code. + * + * This is a tricky one. In SCycleBaseNTuple::DeclareVariable(...) the function + * automatically detects the type of the variable to be put into the output + * tree. Since ROOT uses a different naming scheme for the primitives than C++'s + * typeid call, the typeid names have to be translated for ROOT. This is the + * function doing that. + * + * @warning The translation is probably only valid on various UNIX systems, + * probably doesn't work on Windows. (Did anyone ever try SFrame on + * Windows anyway???) + * + * @param typeid_type Primitive type name in the "typeid" format + * @returns The primitive type name in ROOT's format + */ + const char* RootType(const char* typeid_type); + + /** + * @brief Stolen from SFrame code. + * + * This function is used internally to check whether the user tries to connect + * the correct type of primitive to the branches. ROOT can have some trouble + * identifying such code problems... + * + * @warning The implementation might be platform specific! + * + * @param root_type ROOT primitive type name + * @returns The typeid type name for the ROOT primitive type + */ + const char* TypeidType(const char* root_type); + + ///Pointer to the TTree, created by this class in the constructor. + TTree* m_tree; + + /** + * @brief Stolen from SFrame code. + * + * We have to keep the pointers to the output variables defined by the user. + * ROOT keeps track of the objects by storing pointers to pointers to the + * objects. Since the user probably wants to use the output objects directly + * and not through pointers, the base class has to take care of this + * pointer issue by itself... + */ + std::list< void* > m_outputVarPointers; + + /** + * @brief list of functions that control which variables are written out + * + * The function objects are called in order, with the TreeManager instance + * and the variable name as parameters. A return value of 1 (0) tells the + * TreeManager that the variable should (not) be written to the n-tuple. If + * the function returns -1, the decision is left to the next function in the + * list. If there are no functions in the list, or all functions return -1, + * the variable is written to the n-tuple. + */ + std::vector<BranchFilter> m_branchFilters; + +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigDecisionSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigDecisionSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..f28926146e7c1cbfccd443dd293893bce9f366cb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigDecisionSelector.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGDECISIONSELECTOR_H_ +#define TRIGDECISIONSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include <memory> + + +namespace top { + // Forward declare + class Event; + class TopConfig; + /** + * @brief Sometimes you may want to select events that pass a certain trigger, + * or triggers. + * + * This code only accepts the event if it passes at least one of the triggers + * that it was configured with. It does an 'OR' of all the trigger decisions. + * + * For example: + * + * @code + * TRIGDEC HLT_e24_tight_L1EM20V HLT_e60_medium1 + * @endcode + * + * Would select the event if either of those passes. + */ + class TrigDecisionSelector : public EventSelectorBase { + public: + /** + * @brief A tool to select events that pass a certain trigger (or any + * trigger in a list). + * + * @param name The name of the current event selection - e.g. ee + * @param config - this will give use a std::vector<std::string> of triggers to check + */ + TrigDecisionSelector(const std::string& selectorName,std::shared_ptr<top::TopConfig> config); + + /** + * @brief Select events based on the 'OR' of a few user defined triggers. + * The thinking is you might want to pass e25i or e30 so "TRIGDEC e25i e30". + * + * @param event The event in question. Not used by the trigger decision + * tool. I guess it finds out the information some other, internal, way. + * + * @return True if at least one of the triggers in the string list passed. + */ + virtual bool apply(const top::Event& event) const override; + + ///TRIGDEC because we might have a tool for trigger matching too at some point + std::string name() const override; + + private: + ///List of triggers to 'or' together for each event. If any one passes, the event passes + std::vector<std::string> m_triggers; + }; +} + +#endif /* TRIGDECISIONSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigMatchSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigMatchSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..7c59a84f7be310bb9653197be8642c6d7a72d4d9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/TopEventSelectionTools/TrigMatchSelector.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGMATCHSELECTOR_H_ +#define TRIGMATCHSELECTOR_H_ + +#include "TopEventSelectionTools/EventSelectorBase.h" +#include <memory> + +namespace top { + // Forward declare + class Event; + class TopConfig; + + /** + * @brief Match offline object to trigger. + * + */ + class TrigMatchSelector : public EventSelectorBase { + public: + + TrigMatchSelector(const std::string& selectorName,std::shared_ptr<top::TopConfig> config); + + virtual bool apply(const top::Event& event) const override; + + std::string name() const override; + + private: + ///List of triggers to 'or' together for each event. If any one passes, the event passes + std::vector<std::string> m_electronTriggers; + std::vector<std::string> m_muonTriggers; + std::vector<std::string> m_tauTriggers; + }; +} + +#endif /* TRIGDECISIONSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..2755da80c2b3506646cb4810a38aaa7e779b32e4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopEventSelectionTools + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = EventLoop AsgTools JetInterface TopEvent TopCorrections TopParticleLevel MuonSelectorTools + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimisation (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..639af95d160da1859f0153ecd9c5f636d55c977e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/share/mainpage.h @@ -0,0 +1,49 @@ +/** + * @page testpage TopEventSelectionTools + * + * These can be loaded via the configuration file, which calls this function. + * If you write a new tool (in this package) you have to make sure you add it + * to this, which is loaded by ROOT at run-time. + * + * - top::TopEventSelectionToolsLoader: Code that loads a tool from the name. + * + * @section es Event Selection Tools + * + * - Random tools + * - top::InitialSelector: Select all events. + * - top::SaveEventSelector: Save the event to the output Tree. + * - top::PrintEventSelector: Print some info about the selected events to the screen. + * - top::ExamplePlots: An example of plotting some kinematic variables. + * - top::GRLSelector: For data only accept events that are on the GRL. + * - top::JetCleaningSelector: Select events only if they have no bad jets. + * - top::TrigDecisionSelector: Select events based on the trigger decision. + * - top::TrigMatchSelector: Select events with reconstructed charged leptons matching the triggers + * + * - Selection based on object multiplicity + * - top::NElectronSelector: Cut on the number of electrons. + * - top::NMuonSelector: Cut on the number of muons. + * - top::NTauSelector: Cut on the number of taus. + * - top::NElectronNMuonSelector: Cut on the sum of electrons and muons. + * - top::NJetSelector: Cut on the number of jets. + * - top::IP3DSV1Selector: Cut on the number of jets passing a certain working point. + * - top::MV1Selector: Cut on the number of jets passing a certain working point. + * - top::MV2c20Selector: Cut on the number of jets passing a working point for MV2c20 (run-II start-up). + * + * - Selection based on event kinematic quantities + * - top::METSelector: Place a cut on MET. + * - top::MWTSelector: Place a cut on the W transverse mass. + * - top::METMWTSelector: Place a cut on the sum of MET and W transverse mass. + * - top::HTSelector: Place a cut on HT (electrons, muons and jets). + * - top::OSLeptonSelector: Require at least two opposite sign leptons (e, mu). + * - top::SSLeptonSelector: Require at least two same sign leptons (e, mu). + * - top::MLLSelector: Place a cut on the dilepton (e, mu) invariant mass. + * - top::MLLWindow: Place a window on the dilepton (e, mu) invariant mass. + * + * @section fd For Developers + * + * - top::EventSelectorBase: Base class for all tools that select events. + * - top::SignValueSelector: For tools that need a sign (equality, inequality) and a value (number). + * - top::PlotManager: For book-keeping our histograms. + * - top::TreeManager: For book-keeping variables in a tree. + * - top::ToolLoaderBase: Base class for tool loaders. + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb7a8522b0a0785a64e5e63b677a7ee99719af3f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt @@ -0,0 +1,99 @@ +# Auto-generated on: 2017-03-08 14:47:36.923782 + +# Declare the name of this package: +atlas_subdir( TopExamples None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + AsgTools + xAODCore + xAODRootAccess + TopCPTools + TopCorrections + TopAnalysis + TopEvent + TopEventSelectionTools + TopEventReconstructionTools + TopConfiguration + PathResolver ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathMore MathCore Graf Physics ) + + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Build a library that other components can link against: +atlas_add_library( TopExamples Root/*.cxx Root/*.h Root/*.icc + TopExamples/*.h TopExamples/*.icc TopExamples/*/*.h + TopExamples/*/*.icc + PUBLIC_HEADERS TopExamples + LINK_LIBRARIES AsgTools + xAODCore + xAODRootAccess + TopCPTools + TopCorrections + TopAnalysis + TopEvent + TopEventSelectionTools + TopEventReconstructionTools + TopConfiguration + PathResolver + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install the Python modules of the package: +atlas_install_python_modules( python/*.py ) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Build the executables of the package: +atlas_add_executable( mini-to-flat + util/mini-to-flat.cxx + LINK_LIBRARIES AsgTools + xAODCore + xAODRootAccess + TopCPTools + TopCorrections + TopAnalysis + TopEvent + TopEventSelectionTools + TopEventReconstructionTools + TopConfiguration + PathResolver + ${ROOT_LIBRARIES} + TopExamples ) +atlas_add_executable( mini-xaod + util/mini-xaod.cxx + LINK_LIBRARIES AsgTools + xAODCore + xAODRootAccess + TopCPTools + TopCorrections + TopAnalysis + TopEvent + TopEventSelectionTools + TopEventReconstructionTools + TopConfiguration + PathResolver + ${ROOT_LIBRARIES} + TopExamples ) +atlas_add_executable( mini-to-plots + util/mini-to-plots.cxx + LINK_LIBRARIES AsgTools + xAODCore + xAODRootAccess + TopCPTools + TopCorrections + TopAnalysis + TopEvent + TopEventSelectionTools + TopEventReconstructionTools + TopConfiguration + PathResolver + ${ROOT_LIBRARIES} + TopExamples ) + +atlas_install_scripts( scripts/* ) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/AnalysisTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/AnalysisTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..da3fe026d52cae881519d1130ea1bcdaf33348aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/AnalysisTools.cxx @@ -0,0 +1,142 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/AnalysisTools.h" +#include "TopExamples/NoSelectionAnalysis.h" +#include "TopExamples/LJetsAnalysis.h" +#include "TopExamples/LJetsTtresAnalysis.h" +#include "TopExamples/DileptonAnalysis.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +// PathResolver include(s): +#include "PathResolver/PathResolver.h" + +#include "TopDataPreparation/SampleXsection.h" + +#include "xAODRootAccess/TEvent.h" + +#include "xAODEventInfo/EventInfo.h" + +#include "TH1D.h" +#include "TFile.h" + +#include <iostream> +#include <memory> + +namespace top { + +std::unique_ptr<top::AnalysisBase> loadAnalysis(const std::string& name, TFile* outputFile, EL::Worker* wk) { + if (name == "Dilepton") + return std::unique_ptr<top::AnalysisBase>(new top::DileptonAnalysis(outputFile, wk)); + else if (name == "LJets") + return std::unique_ptr<top::AnalysisBase>(new top::LJetsAnalysis(outputFile, wk)); + else if (name == "NoSelection") + return std::unique_ptr<top::AnalysisBase>(new top::NoSelectionAnalysis(outputFile, wk)); + else if (name == "LJetsTtres") + return std::unique_ptr<top::AnalysisBase>(new top::LJetsTtresAnalysis(outputFile)); + else { + std::cout << "I only know about:\n"; + std::cout << "NoSelection\n"; + std::cout << "LJets\n"; + std::cout << "Dilepton\n"; + std::cout << "LJetsTtres\n"; + exit(1); + } + + //make sure this never happens with the if statement above + return nullptr; +} + +const std::string getSampleNumberAsString(const std::string& filename, const std::string& infoContainerName) { + xAOD::TEvent xaodEvent(xAOD::TEvent::kBranchAccess); + std::unique_ptr<TFile> fileForSampleNumber(TFile::Open(filename.c_str())); + top::check(xaodEvent.readFrom(fileForSampleNumber.get()), "xAOD::TEvent readFrom failed"); + xaodEvent.getEntry(0); + + const xAOD::EventInfo* info(0); + if (!xaodEvent.retrieve(info, infoContainerName)) + throw std::string("xAOD::TEvent couldn't get hold of ") + infoContainerName; + + //data is padded with zero until it's 8 char long in ATLAS + std::stringstream ss; + ss << std::setw(8) << std::setfill('0') << info->runNumber(); + + //but MC simulation is not padded in dataset names :) + if (info->eventType(xAOD::EventInfo::IS_SIMULATION)) { + ss.str(""); + ss << info->mcChannelNumber(); + } + + return ss.str(); +} + +double sfToOneInversefb(unsigned int mcChannelNumber, double mcWeightsInSample) { + //load the x-section from a file + SampleXsection tdp; +// const char* const rc = getenv("ROOTCOREBIN"); +// std::string filename = std::string(rc) + "/data/TopDataPreparation/XSection-MC15-13TeV-fromSusyGrp.data"; + std::string filename = PathResolverFindCalibFile("TopDataPreparation/XSection-MC15-13TeV-fromSusyGrp.data"); + if (!tdp.readFromFile(filename.c_str())) { + std::cout << "TopDataPreparation - could not read file\n"; + std::cout << filename << "\n"; + std::cout << "Maybe check it exists, first?" << std::endl; + exit(1); + } + + //calculate + double xsection = tdp.getXsection(mcChannelNumber); + if (xsection < 0) { // try exotics samples + // std::string filenameExot = std::string(rc) + "/data/TopDataPreparation/XSection-MC12-8TeV-4gt.data"; + //if (!tdp.readFromFile(filenameExot.c_str())) { + // do not exit since it is an Exotic sample and the file could not be there + //} + // xsection = tdp.getXsection(mcChannelNumber); + } + const double integratedluminosity = mcWeightsInSample / xsection; + const double sf = 1000. / integratedluminosity; + + //useful information + std::cout << "mcChannelNumber : " << mcChannelNumber << "\n"; + std::cout << "X-section : " << xsection << " pb\n"; + std::cout << "Sum weights before cuts : " << mcWeightsInSample << "\n"; + std::cout << "Integrated Lumi for sample: " << integratedluminosity << " pb-1\n"; + std::cout << "Scale factor to 1 fb-1 : " << sf << "\n"; + + return sf; +} + +void updateCutflow(const std::string& name, TH1D*& histogram, TFile* inputFile) { + const auto* const temp = dynamic_cast<TH1D*> (inputFile->Get(name.c_str())); + if (histogram == nullptr) { + histogram = dynamic_cast<TH1D*> (temp->Clone()); + histogram->SetDirectory(0); + } else + histogram->Add(temp); +} + +std::string gridTagFromDirectoryName(const std::string inputFile) { + std::string gridTag = inputFile; + + try { + gridTag.erase(gridTag.rfind("/")); + gridTag = gridTag.substr(gridTag.rfind("/") + 1); + + for (int i = 0; i < 3; ++i) + gridTag = gridTag.erase(0, gridTag.find(".") + 1); + + gridTag = gridTag.erase(gridTag.rfind(".")); + } catch (...) { + gridTag = "unkown"; + } + + return gridTag; +} + +bool passesPreSelection(const top::Event& topEvent, const std::string& name) { + return topEvent.m_info->auxdata<int>(name); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/ContainerNames.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/ContainerNames.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ca8b4a924da73ccdfbdc57d9b5afd40d08336796 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/ContainerNames.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/ContainerNames.h" + +#include <ostream> + +std::ostream& operator<<(std::ostream& os, const top::ContainerNames& names) { + os << "EventInfo " << names.eventInfoName << "\n"; + os << "ElectronCollection: " << names.electronCollectionName << "\n"; + os << "MuonCollection: " << names.muonCollectionName << "\n"; + os << "JetCollection: " << names.jetCollectionName << "\n"; + os << "LargeJetCollection: " << names.largeJetCollectionName << "\n"; + os << "MET: " << names.metName << "\n"; + os << "TauCollection: " << names.tauCollectionName << "\n"; + os << "TruthCollection: " << names.truthCollectionName << "\n"; + + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DefaultPlots.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DefaultPlots.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6fb972a4bb32fa3051c7559467c7b4a9bb3a973d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DefaultPlots.cxx @@ -0,0 +1,156 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/DefaultPlots.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEventSelectionTools/PlotManager.h" + +#include "TopCorrections/ScaleFactorRetriever.h" + +#include <cmath> +#include <array> + +#include "TH1.h" + +namespace top { + +void addPlots(top::PlotManager& manager) { + manager.addHist("control_sig_njet", ";Number of selected jets;Events", 12, -0.5, 11.5); + manager.addHist("control_sig_met", ";E_{T}^{miss} [GeV];Events / 10 GeV", 22, 0, 220); + manager.addHist("control_met", ";E_{T}^{miss} [GeV];Events / 5 GeV", 45, 0, 225); + manager.addHist("control_njet", ";Number of selected jets;Events", 12, -0.5, 11.5); + manager.addHist("control_invmass", ";Invariant mass [GeV];Events / 5 GeV", 34, 15, 185); + manager.addHist("control_sig_invmass", ";Invariant mass [GeV];Events / 10 GeV", 40, 11, 411); + manager.addHist("control_sig_invmass_cut", ";Invariant mass [GeV];Events / 10 GeV", 40, 11, 411); + manager.addHist("dy_dphi",";#Delta#phi;Events", 10, 0., M_PI); + manager.addHist("dy_dphi_zpt",";Z p_{T} [GeV];Events", 30., 0., 300.); + manager.addHist("dy_counter",";DD norm;Events", 5., 0., 5.); + + manager.addHist("mu", ";<#mu>;Events", 50, 0., 50.); + manager.addHist("mc_weight", ";MC Event Weight", 100, -1.5, 5e6); + + manager.addHist("pileup_weight", ";Pileup Weight", 20, -1.5, 10); + + manager.addHist("el_n", ";Number of electrons;Events", 5, -0.5, 4.5); + manager.addHist("el_pt", ";Electron p_{T} / GeV;Electrons / 10 GeV", 20, 5, 205); + manager.addHist("el_eta", ";Electron #eta;Electrons", 20, -2.5, 2.5); + manager.addHist("el_phi", ";Electron #phi;Electrons", 20, -M_PI, M_PI); + manager.addHist("el_e", ";Electron E / GeV;Electrons", 40, 0, 200); + manager.addHist("el_m", ";Electron m / GeV;Electrons", 40, 0, 200); + manager.addHist("el_charge", ";Electron charge;Electrons", 2, -1.5, 1.5); + + manager.addHist("mu_n", ";Number of muons;Events", 5, -0.5, 4.5); + manager.addHist("mu_pt", ";Muon p_{T} / GeV;Muons / 10 GeV", 20, 5, 205); + manager.addHist("mu_eta", ";Muon #eta;Muons", 20, -2.5, 2.5); + manager.addHist("mu_phi", ";Muon #phi;Muons", 20, -M_PI, M_PI); + manager.addHist("mu_e", ";Muon E / GeV;Muons", 40, 0, 200); + manager.addHist("mu_m", ";Muon m / GeV;Muons", 40, 0, 200); + manager.addHist("mu_charge", ";Muon charge;Muons", 2, -1.5, 1.5); + + manager.addHist("jet_n", ";Number of jets;Events", 12, -0.5, 11.5); + manager.addHist("jet_pt", ";Jet p_{T} / GeV;Jets / 10 GeV", 25, 5, 255); + manager.addHist("jet_eta", ";Jet #eta;Jets", 25, -2.5, 2.5); + manager.addHist("jet_phi", ";Jet #phi;Jets", 25, -M_PI, M_PI); + manager.addHist("jet_e", ";Jet E / GeV;Jets", 50, 0, 250); + manager.addHist("jet_mv2c20", ";Jet mv2c20;Jets", 50, 0, 1); + + manager.addHist("jet0_pt", ";Jet0 p_{T} / GeV; Events / 10 GeV", 25, 5, 255); + manager.addHist("jet0_eta", ";Jet0 #eta; Jets", 25, -2.5, 2.5); + manager.addHist("jet0_phi", ";Jet0 #phi; Jets", 25, -M_PI, M_PI); + manager.addHist("jet0_e", ";Jet0 E / GeV; Jets", 50, 0, 250); + manager.addHist("jet0_mv2c20", ";Jet0 mv2c20; Jets", 50, 0, 1); + + manager.addHist("jet1_pt", ";Jet1 p_{T} / GeV; Events / 10 GeV", 25, 5, 255); + manager.addHist("jet1_eta", ";Jet1 #eta; Jets", 25, -2.5, 2.5); + manager.addHist("jet1_phi", ";Jet1 #phi; Jets", 25, -M_PI, M_PI); + manager.addHist("jet1_e", ";Jet1 E / GeV; Jets", 50, 0, 250); + manager.addHist("jet1_mv2c20", ";Jet1 mv2c20; Jets", 50, 0, 1); + + manager.addHist("jet2_pt", ";Jet2 p_{T} / GeV; Events / 10 GeV", 25, 5, 255); + manager.addHist("jet2_eta", ";Jet2 #eta; Jets", 25, -2.5, 2.5); + manager.addHist("jet2_phi", ";Jet2 #phi; Jets", 25, -M_PI, M_PI); + manager.addHist("jet2_e", ";Jet2 E / GeV; Jets", 50, 0, 250); + manager.addHist("jet2_mv2c20", ";Jet2 mv2c20; Jets", 50, 0, 1); + + manager.addHist("jet3_pt", ";Jet3 p_{T} / GeV; Events / 10 GeV", 25, 5, 255); + manager.addHist("jet3_eta", ";Jet3 #eta; Jets", 25, -2.5, 2.5); + manager.addHist("jet3_phi", ";Jet3 #phi; Jets", 25, -M_PI, M_PI); + manager.addHist("jet3_e", ";Jet3 E / GeV; Jets", 50, 0, 250); + manager.addHist("jet3_mv2c20", ";Jet3 mv2c20; Jets", 50, 0, 1); + + manager.addHist("met_et", ";MET / GeV;Events / 5 GeV", 40, 0, 200); + manager.addHist("met_phi", ";MET #phi;Events", 40, -M_PI, M_PI); +} + +void fillPlots(const top::Event& topEvent, top::PlotManager& manager, double eventWeight) { + const double toGeV = 0.001; + + manager.hist("mu")->Fill(topEvent.m_info->averageInteractionsPerCrossing(), eventWeight); + + if (top::isSimulation(topEvent)) { +// manager.hist("mc_weight")->Fill(topEvent.m_info->mcEventWeight(), eventWeight); + manager.hist("mc_weight")->Fill(topEvent.m_truthEvent->at(0)->weights()[0], eventWeight);// FIXME temporary bugfix + + if (top::ScaleFactorRetriever::hasPileupSF(topEvent)) + manager.hist("pileup_weight")->Fill(top::ScaleFactorRetriever::pileupSF(topEvent), eventWeight); + } + + manager.hist("el_n")->Fill(topEvent.m_electrons.size(), eventWeight); + manager.hist("mu_n")->Fill(topEvent.m_muons.size(), eventWeight); + manager.hist("jet_n")->Fill(topEvent.m_jets.size(), eventWeight); + + //loop over all the electrons - new for loop style is cool + for (const auto* const elPtr : topEvent.m_electrons) { + manager.hist("el_pt")->Fill(elPtr->pt() * toGeV, eventWeight); + manager.hist("el_eta")->Fill(elPtr->eta(), eventWeight); + manager.hist("el_phi")->Fill(elPtr->phi(), eventWeight); + manager.hist("el_e")->Fill(elPtr->e() * toGeV, eventWeight); + manager.hist("el_m")->Fill(elPtr->m() * toGeV, eventWeight); + manager.hist("el_charge")->Fill(elPtr->charge(), eventWeight); + } + + for (const auto* const muPtr : topEvent.m_muons) { + manager.hist("mu_pt")->Fill(muPtr->pt() * toGeV, eventWeight); + manager.hist("mu_eta")->Fill(muPtr->eta(), eventWeight); + manager.hist("mu_phi")->Fill(muPtr->phi(), eventWeight); + manager.hist("mu_e")->Fill(muPtr->e() * toGeV, eventWeight); + manager.hist("mu_m")->Fill(muPtr->m() * toGeV, eventWeight); + manager.hist("mu_charge")->Fill(muPtr->charge(), eventWeight); + } + + //plot for all jets, and also the four leading jets separately + unsigned int i = 0; + std::array<std::string, 4> numbers{ {"jet0", "jet1", "jet2", "jet3"} }; + for (const auto* const jetPtr : topEvent.m_jets) { + manager.hist("jet_pt")->Fill(jetPtr->pt() * toGeV, eventWeight); + manager.hist("jet_eta")->Fill(jetPtr->eta(), eventWeight); + manager.hist("jet_phi")->Fill(jetPtr->phi(), eventWeight); + manager.hist("jet_e")->Fill(jetPtr->e() * toGeV, eventWeight); + + double mv2c20_discriminant = 0.; + jetPtr->btagging()->MVx_discriminant("MV2c20", mv2c20_discriminant); + + manager.hist("jet_mv2c20")->Fill(mv2c20_discriminant, eventWeight); + + if (i < numbers.size()) { + manager.hist(numbers[i] + "_pt")->Fill(jetPtr->pt() * toGeV, eventWeight); + manager.hist(numbers[i] + "_eta")->Fill(jetPtr->eta(), eventWeight); + manager.hist(numbers[i] + "_phi")->Fill(jetPtr->phi(), eventWeight); + manager.hist(numbers[i] + "_e")->Fill(jetPtr->e() * toGeV, eventWeight); + manager.hist(numbers[i] + "_mv2c20")->Fill(mv2c20_discriminant, eventWeight); + } + + ++i; + } + + + manager.hist("met_et")->Fill(topEvent.m_met->met() * toGeV, eventWeight); + manager.hist("met_phi")->Fill(topEvent.m_met->phi(), eventWeight); + + +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DileptonAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DileptonAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2d242c8ce9fa363b8730412547f692dacbca1033 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/DileptonAnalysis.cxx @@ -0,0 +1,335 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/DileptonAnalysis.h" +#include "TopExamples/DefaultPlots.h" +#include "TopExamples/AnalysisTools.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TFile.h" +#include "TH1.h" + +#include <sstream> +#include <iostream> +#include <fstream> + +namespace top { + +/** + * @brief Setup the analysis, add some histograms. + * + * This sets up a histogram manager for each of the three channels (ee, mumu, + * emu). It also defaults the histograms used to save cutflows for each channel + * and with / without weights to nullptr. They are loaded from the input files. + * Also three counters are set to 0 for the number of processed events. + */ +DileptonAnalysis::DileptonAnalysis(TFile* outputFile, EL::Worker* wk) : + m_mcChannelNumber(0), + m_runNumber(0), + m_histsElEl("ee", outputFile, wk), + m_histsMuMu("mumu", outputFile, wk), + m_histsElMu("emu", outputFile, wk), + m_cutflowEventsElEl(nullptr), + m_cutflowMCWeightsElEl(nullptr), + m_cutflowEventsMuMu(nullptr), + m_cutflowMCWeightsMuMu(nullptr), + m_cutflowEventsElMu(nullptr), + m_cutflowMCWeightsElMu(nullptr), + m_counterElEl(0), + m_counterMuMu(0), + m_counterElMu(0) { + //add some default histograms for each channel + top::addPlots(m_histsElEl); + top::addPlots(m_histsMuMu); + top::addPlots(m_histsElMu); + + //a special histogram for emu + m_histsElMu.addHist("ht", ";HT / GeV;Events / 20 GeV", 40, 0, 800); +} + +DileptonAnalysis::~DileptonAnalysis() { +} + +/** + * @brief When a new input file is opened we want to grab the cutflow histograms + * from it and update. + * + * @param inputFile The file that was just opened. + */ +void DileptonAnalysis::newFile(TFile* inputFile) { + updateCutflow("ee/cutflow", m_cutflowEventsElEl, inputFile); + updateCutflow("ee/cutflow_mc", m_cutflowMCWeightsElEl, inputFile); + updateCutflow("mumu/cutflow", m_cutflowEventsMuMu, inputFile); + updateCutflow("mumu/cutflow_mc", m_cutflowMCWeightsMuMu, inputFile); + updateCutflow("emu/cutflow", m_cutflowEventsElMu, inputFile); + updateCutflow("emu/cutflow_mc", m_cutflowMCWeightsElMu, inputFile); +} + +/** + * @brief Work out if it's ee, mumu or emu and send the event to the correct + * analysis. + * + * Before filling any plots figure out if this is data or MC simulation and get + * the event weight if appropriate. + * + * Use the number of electrons or muons to figure out which channel this + * is. Note that overlap removal and some of the cuts have been done already. + * + * @param topEvent The event in question + */ +void DileptonAnalysis::event(const top::Event& topEvent) { + m_runNumber = topEvent.m_info->runNumber(); + + double eventWeight = 1.; + if (top::isSimulation(topEvent)) { + m_mcChannelNumber = topEvent.m_info->mcChannelNumber(); +// eventWeight = topEvent.m_info->mcEventWeight(); + eventWeight = topEvent.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + } + + //std::cout << topEvent << std::endl; + + if (top::passesPreSelection(topEvent, "ee")) + eeAnalysis(topEvent, eventWeight); + + if (top::passesPreSelection(topEvent, "mumu")) + mumuAnalysis(topEvent, eventWeight); + + if (top::passesPreSelection(topEvent, "emu")) + emuAnalysis(topEvent, eventWeight); +} + +/** + * @brief Plot some control regions, then the final plots for the analysis. + * + * Most of the code here is spent defining different combinations of cuts for + * the control plots. The very last few lines make the plots in the signal + * region. + * + * Note that for now we are manually calculating TLorentzVectors for the two + * leptons, since this appears to be broken in the current xAOD code. + * + * @param topEvent The event to perform the analysis on. We assume it has + * exactly two electrons for the rest of this function. + * @param eventWeight The event weight to be used when filling plots. + */ +void DileptonAnalysis::eeAnalysis(const top::Event& topEvent, double eventWeight) { + ++m_counterElEl; + + const auto* e0 = topEvent.m_electrons[0]; + const auto* e1 = topEvent.m_electrons[1]; + const TLorentzVector Z = e0->p4() + e1->p4(); + + //does it pass some cuts? + const bool gteq2jets = topEvent.m_jets.size() >= 2; + const bool metgt30 = topEvent.m_met->met() > 30000.; + const bool metgt60 = topEvent.m_met->met() > 60000.; + const bool inZWindow = fabs(Z.M() - 91000.) < 10000.; + + //plot the met for all events in the Z-window + if (inZWindow && gteq2jets) + m_histsElEl.hist("control_met")->Fill(topEvent.m_met->met() * toGeV, eventWeight); + + //plot the invariant mass for low MET events + if (!metgt60 && gteq2jets) + m_histsElEl.hist("control_invmass")->Fill(Z.M() / 1000., eventWeight); + + //plot njet in zwindow for low MET events + if (inZWindow && !metgt60) + m_histsElEl.hist("control_njet")->Fill(topEvent.m_jets.size(), eventWeight); + + //DY control region: inside Z window, but lower pt cut to signal region + if (inZWindow && metgt30 && gteq2jets) { + m_histsElEl.hist("dy_dphi")->Fill(fabs(top::deltaPhi(*e0, *e1)), eventWeight); + m_histsElEl.hist("dy_dphi_zpt")->Fill(Z.Pt() * toGeV, eventWeight); + m_histsElEl.hist("dy_counter")->Fill(1., eventWeight); + } + + //signal region - all cuts except Z mass + if (gteq2jets && metgt60) + m_histsElEl.hist("control_sig_invmass")->Fill(Z.M() * toGeV, eventWeight); + + if (!inZWindow && gteq2jets && metgt60) + m_histsElEl.hist("control_sig_invmass_cut")->Fill(Z.M() * toGeV, eventWeight); + + //signal region - all cuts except njet + if (!inZWindow && metgt60) + m_histsElEl.hist("control_sig_njet")->Fill(topEvent.m_jets.size(), eventWeight); + + //signal region - all cuts except met + if (!inZWindow && gteq2jets) + m_histsElEl.hist("control_sig_met")->Fill(topEvent.m_met->met() * toGeV, eventWeight); + + //pretag selection + if (gteq2jets && !inZWindow && metgt60) + top::fillPlots(topEvent, m_histsElEl, eventWeight); +} + +void DileptonAnalysis::mumuAnalysis(const top::Event& topEvent, double eventWeight) { + ++m_counterMuMu; + + const auto* mu0 = topEvent.m_muons[0]; + const auto* mu1 = topEvent.m_muons[1]; + const TLorentzVector Z = mu0->p4() + mu1->p4(); + + //does it pass some cuts? + const bool gteq2jets = topEvent.m_jets.size() >= 2; + const bool metgt30 = topEvent.m_met->met() > 30000.; + const bool metgt60 = topEvent.m_met->met() > 60000.; + const bool inZWindow = fabs(Z.M() - 91000.) < 10000.; + + //plot the met for all events in the Z-window + if (inZWindow && gteq2jets) + m_histsMuMu.hist("control_met")->Fill(topEvent.m_met->met() * toGeV, eventWeight); + + //plot the invariant mass for low MET events + if (!metgt60 && gteq2jets) + m_histsMuMu.hist("control_invmass")->Fill(Z.M() / 1000., eventWeight); + + //plot njet in zwindow for low MET events + if (inZWindow && !metgt60) + m_histsMuMu.hist("control_njet")->Fill(topEvent.m_jets.size(), eventWeight); + + //DY control region: inside Z window, but lower pt cut to signal region + if (inZWindow && metgt30 && gteq2jets) { + m_histsMuMu.hist("dy_dphi")->Fill(fabs(top::deltaPhi(*mu0, *mu1)), eventWeight); + m_histsMuMu.hist("dy_dphi_zpt")->Fill(Z.Pt() * toGeV, eventWeight); + m_histsMuMu.hist("dy_counter")->Fill(1., eventWeight); + } + + //signal region - all cuts except Z mass + if (gteq2jets && metgt60) + m_histsMuMu.hist("control_sig_invmass")->Fill(Z.M() * toGeV, eventWeight); + + if (!inZWindow && gteq2jets && metgt60) + m_histsMuMu.hist("control_sig_invmass_cut")->Fill(Z.M() * toGeV,eventWeight); + + //signal region - all cuts except njet + if (!inZWindow && metgt60) + m_histsMuMu.hist("control_sig_njet")->Fill(topEvent.m_jets.size(), eventWeight); + + //signal region - all cuts except met + if (!inZWindow && gteq2jets) + m_histsMuMu.hist("control_sig_met")->Fill(topEvent.m_met->met() * toGeV, eventWeight); + + //pretag selection + if (gteq2jets && !inZWindow && metgt60) + top::fillPlots(topEvent, m_histsMuMu, eventWeight); +} + +/** + * @brief emu channel + * + * The way it's setup at the moment we just need to add a cut on jet + * multiplicity and ht to get a "full" set of pretag cuts. Apply these + * and then fill the plots. + * + * @param topEvent The event in question + * @param eventWeight The weights that are used when filling the histograms. + */ +void DileptonAnalysis::emuAnalysis(const top::Event& topEvent, double eventWeight) { + ++m_counterElMu; + + //does it pass some cuts? + const bool gteq2jets = topEvent.m_jets.size() >= 2; + const double ht = top::ht(topEvent); + + if (gteq2jets && ht > 120. * toGeV) { + m_histsElMu.hist("ht")->Fill(ht * toGeV, eventWeight); + top::fillPlots(topEvent, m_histsElMu, eventWeight); + } +} + +/** + * @brief Print cutflows for each of the three channels. Save any histograms + * that we've made. If running on MC simulation then normalise the histograms + * to 1 fb-1. + * + * @param outputFile Root file to save the histograms to. + */ +void DileptonAnalysis::finalise(TFile* outputFile) { + //to screen + std::cout << "Cutflows directly from the input files:\n"; + printCutflow(std::cout, m_cutflowEventsElEl, m_cutflowMCWeightsElEl, "ee", m_counterElEl); + printCutflow(std::cout, m_cutflowEventsMuMu, m_cutflowMCWeightsMuMu, "mumu", m_counterMuMu); + printCutflow(std::cout, m_cutflowEventsElMu, m_cutflowMCWeightsElMu, "emu", m_counterElMu); + + //tofile - mc use channel number, data use run number + std::stringstream ss; + if (m_mcChannelNumber > 0) + ss << m_mcChannelNumber; + else + ss << m_runNumber; + + std::ofstream cutflowfile_ee(ss.str() + "_ee_cutflow.txt"); + std::ofstream cutflowfile_mumu(ss.str() + "_mumu_cutflow.txt"); + std::ofstream cutflowfile_emu(ss.str() + "_emu_cutflow.txt"); + + printCutflow(cutflowfile_ee, m_cutflowEventsElEl, m_cutflowMCWeightsElEl, "ee", m_counterElEl); + printCutflow(cutflowfile_mumu, m_cutflowEventsMuMu, m_cutflowMCWeightsMuMu, "mumu", m_counterMuMu); + printCutflow(cutflowfile_emu, m_cutflowEventsElMu, m_cutflowMCWeightsElMu, "emu", m_counterElMu); + + cutflowfile_ee.close(); + cutflowfile_mumu.close(); + cutflowfile_emu.close(); + + //if MC then calculate a SF to 1 fb-1 + double sf = 1.; + if (m_mcChannelNumber != 0) { + const double mcWeightsInSample = m_cutflowMCWeightsElEl->GetBinContent(1); + sf = sfToOneInversefb(m_mcChannelNumber, mcWeightsInSample); + } + + //save the plots for the three channels + m_histsElEl.scaleHistograms(sf); + m_histsMuMu.scaleHistograms(sf); + m_histsElMu.scaleHistograms(sf); + outputFile->Write(); + +} + +/** + * @brief Prints the cutflow table to the screen or a file. This is not scaled + * to the integrated to 1fb-1 like the output histograms are for MC simulation. + * Should it be? + * + * @param out For the screen use std::cout, for a text file use an ofstream, e.g. + * std::ofstream file("myfile"). + * @param eventHist Histogram containing the raw event yield. No weights. Also + * used for the row headings / cut names. The numbers here come from the grid, + * not from the local analysis code. + * @param mcWeightHist Histogram containing yield weighted by the mc event + * weight. The numbers here come from the grid/ input file, not from the local + * analysis code. + * @param name The name of the current selection (e.g. ee, mumu, emu) + * @param localYield Yield that the local code ran over. It should match the + * number from the grid (since you ran on the same events). + */ +void DileptonAnalysis::printCutflow(std::ostream& out, const TH1D* const eventHist, const TH1D* const mcWeightHist, const std::string& name, const unsigned int localYield) { + out << name << " cutflow:\n"; + out << " " << + std::setw(4) << "Num" << + std::setw(30) << "Name" << + std::setw(20) << "Grid (Events)" << + std::setw(20) << "Grid (MC Weights)" << + std::setw(20) << "Local (Events)" << "\n"; + + for (int i = 1; i <= eventHist->GetNbinsX(); ++i) { + out << " " << std::setw(4) << i + << std::setw(30) << eventHist->GetXaxis()->GetBinLabel(i) + << std::setw(20) << eventHist->GetBinContent(i) + << std::setw(20) << mcWeightHist->GetBinContent(i); + + if (i == eventHist->GetNbinsX()) + out << std::setw(20) << localYield; + + out << "\n"; + } + + out << "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/EventLoaderDirect.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/EventLoaderDirect.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bbcf69ec9151df6afedb48e6c6e0b59fcbefa088 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/EventLoaderDirect.cxx @@ -0,0 +1,94 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/EventLoaderDirect.h" + +#include "TopEvent/EventTools.h" + +#include "xAODRootAccess/TEvent.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODTruth/TruthParticleContainer.h" + +namespace top { + +EventLoaderDirect::EventLoaderDirect(const ContainerNames& names) : + m_containerNames(names) { +} + +EventLoaderDirect::~EventLoaderDirect() { +} + +top::Event EventLoaderDirect::loadEvent(xAOD::TEvent& xaodEvent) { + top::Event te; + + //EventInfo + top::check(xaodEvent.retrieve(te.m_info, m_containerNames.eventInfoName), "xAOD::TEvent retrieve failed to get " + m_containerNames.eventInfoName); + + //Electrons + if (m_containerNames.electronCollectionName != "None") { + const xAOD::ElectronContainer* electrons(0); + top::check(xaodEvent.retrieve(electrons, m_containerNames.electronCollectionName), "xAOD::TEvent retrieve failed to get " + m_containerNames.electronCollectionName); + te.m_electrons = *electrons; + } + + //Muons + if (m_containerNames.muonCollectionName != "None") { + const xAOD::MuonContainer* muons(0); + top::check(xaodEvent.retrieve(muons, m_containerNames.muonCollectionName), "xAOD::TEvent retrieve failed to get " + m_containerNames.muonCollectionName); + te.m_muons = *muons; + } + + //Jets + if (m_containerNames.jetCollectionName != "None") { + const xAOD::JetContainer* jets(0); + top::check(xaodEvent.retrieve(jets, m_containerNames.jetCollectionName), "xAOD::TEvent retrieve failed to get " + m_containerNames.jetCollectionName); + te.m_jets = *jets; + } + + //LargeJets + if (m_containerNames.largeJetCollectionName != "None") { + const xAOD::JetContainer* largeJets(0); + top::check(xaodEvent.retrieve(largeJets, m_containerNames.largeJetCollectionName), "xAOD::TEvent retrieve failed to get " + m_containerNames.largeJetCollectionName); + te.m_largeJets = *largeJets; + } + + //Taus + if (m_containerNames.tauCollectionName != "None") { + const xAOD::TauJetContainer* taus(0); + top::check(xaodEvent.retrieve(taus, m_containerNames.tauCollectionName), "xAOD::TEvent retrieve failed to get " + m_containerNames.tauCollectionName); + te.m_tauJets = *taus; + } + + //MET + if (m_containerNames.metName != "None") { + + const xAOD::MissingETContainer* mets(0); + check(xaodEvent.retrieve(mets, m_containerNames.metName), "xAOD::TEvent retrieve failed to get " + m_containerNames.metName); + te.m_met = (*mets)[MissingETBase::Source::total()]; + + } + + return te; +} + +void EventLoaderDirect::print(std::ostream& os) const { + os << "EventLoaderDirect Configuration\n"; + os << "No object corrections and no object selection\n"; + + os << "\n"; + os << "Electron ContainerName: " << m_containerNames.electronCollectionName << "\n"; + os << "Muon ContainerName: " << m_containerNames.muonCollectionName << "\n"; + os << "Tau ContainerName: " << m_containerNames.tauCollectionName << "\n"; + os << "Jet ContainerName: " << m_containerNames.jetCollectionName << "\n"; + os << "LargeJet ContainerName: " << m_containerNames.largeJetCollectionName << "\n"; + os << "MET ContainerName: " << m_containerNames.metName << "\n"; +} + +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dff88a5bc5e6862501ae5bec99e73e2d880437ce --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsAnalysis.cxx @@ -0,0 +1,153 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/LJetsAnalysis.h" +#include "TopExamples/DefaultPlots.h" +#include "TopExamples/AnalysisTools.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TFile.h" +#include "TH1.h" + +#include <sstream> +#include <iostream> +#include <fstream> + +namespace top { + +LJetsAnalysis::LJetsAnalysis(TFile* outputFile, EL::Worker* wk) : + m_mcChannelNumber(0), + m_runNumber(0), + m_histsEl("ejets", outputFile, wk), + m_histsMu("mujets", outputFile, wk), + m_cutflowEventsEl(nullptr), + m_cutflowMCWeightsEl(nullptr), + m_cutflowEventsMu(nullptr), + m_cutflowMCWeightsMu(nullptr), + m_counterEl(0), + m_counterMu(0) { + //add some default histograms for each channel + top::addPlots(m_histsEl); + top::addPlots(m_histsMu); + + //some extra histograms + m_histsEl.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); + m_histsMu.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); +} + +LJetsAnalysis::~LJetsAnalysis() { +} + +void LJetsAnalysis::newFile(TFile* inputFile) { + updateCutflow("ejets/cutflow", m_cutflowEventsEl, inputFile); + updateCutflow("ejets/cutflow_mc", m_cutflowMCWeightsEl, inputFile); + updateCutflow("mujets/cutflow", m_cutflowEventsMu, inputFile); + updateCutflow("mujets/cutflow_mc", m_cutflowMCWeightsMu, inputFile); +} + +void LJetsAnalysis::event(const top::Event& topEvent) { + m_runNumber = topEvent.m_info->runNumber(); + + double eventWeight = 1.; + if (top::isSimulation(topEvent)) { + m_mcChannelNumber = topEvent.m_info->mcChannelNumber(); +// eventWeight = topEvent.m_info->mcEventWeight(); + eventWeight = topEvent.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + } + + //std::cout << topEvent << std::endl; + + if (top::passesPreSelection(topEvent, "ejets")) { + top::fillPlots(topEvent, m_histsEl, eventWeight); + const double mwt = top::mwt(*topEvent.m_electrons[0], *topEvent.m_met); + m_histsEl.hist("mwt")->Fill(mwt * top::toGeV, eventWeight); + ++m_counterEl; + } + + if (top::passesPreSelection(topEvent, "mujets")) { + top::fillPlots(topEvent, m_histsMu, eventWeight); + const double mwt = top::mwt(*topEvent.m_muons[0], *topEvent.m_met); + m_histsMu.hist("mwt")->Fill(mwt * top::toGeV, eventWeight); + ++m_counterMu; + } +} + +void LJetsAnalysis::finalise(TFile* outputFile) { + //to screen + std::cout << "Cutflows directly from the input files:\n"; + printCutflow(std::cout, m_cutflowEventsEl, m_cutflowMCWeightsEl, "ejets", m_counterEl); + printCutflow(std::cout, m_cutflowEventsMu, m_cutflowMCWeightsMu, "mujets", m_counterMu); + + //tofile - mc use channel number, data use run number + std::stringstream ss; + if (m_mcChannelNumber > 0) + ss << m_mcChannelNumber; + else + ss << m_runNumber; + + std::ofstream cutflowfile_ejets(ss.str() + "_ejets_cutflow.txt"); + std::ofstream cutflowfile_mujets(ss.str() + "_mujets_cutflow.txt"); + + printCutflow(cutflowfile_ejets, m_cutflowEventsEl, m_cutflowMCWeightsEl, "ejets", m_counterEl); + printCutflow(cutflowfile_mujets, m_cutflowEventsMu, m_cutflowMCWeightsMu, "mujets", m_counterMu); + + cutflowfile_ejets.close(); + cutflowfile_mujets.close(); + + //normalise to 1 fb-1 for MC simulation + double sf = 1.; + if (m_mcChannelNumber != 0) { + const double mcWeightsInSample = m_cutflowMCWeightsEl->GetBinContent(1); + sf = sfToOneInversefb(m_mcChannelNumber, mcWeightsInSample); + } + + m_histsEl.scaleHistograms(sf); + m_histsMu.scaleHistograms(sf); + outputFile->Write(); +} + +/** + * @brief Prints the cutflow table to the screen or a file. This is not scaled + * to the integrated to 1fb-1 like the output histograms are for MC simulation. + * Should it be? + * + * @param out For the screen use std::cout, for a text file use an ofstream, e.g. + * std::ofstream file("myfile"). + * @param eventHist Histogram containing the raw event yield. No weights. Also + * used for the row headings / cut names. The numbers here come from the grid, + * not from the local analysis code. + * @param mcWeightHist Histogram containing yield weighted by the mc event + * weight. The numbers here come from the grid/ input file, not from the local + * analysis code. + * @param name The name of the current selection (e.g. ee, mumu, emu) + * @param localYield Yield that the local code ran over. It should match the + * number from the grid (since you ran on the same events). + */ +void LJetsAnalysis::printCutflow(std::ostream& out, const TH1D* const eventHist, const TH1D* const mcWeightHist, const std::string& name, const unsigned int localYield) { + out << name << " cutflow:\n"; + out << " " << + std::setw(4) << "Num" << + std::setw(20) << "Name" << + std::setw(20) << "Grid (Events)" << + std::setw(20) << "Grid (MC Weights)" << + std::setw(20) << "Local (Events)" << "\n"; + + for (int i = 1; i <= eventHist->GetNbinsX(); ++i) { + out << " " << std::setw(4) << i + << std::setw(20) << eventHist->GetXaxis()->GetBinLabel(i) + << std::setw(20) << eventHist->GetBinContent(i) + << std::setw(20) << mcWeightHist->GetBinContent(i); + + if (i == eventHist->GetNbinsX()) + out << std::setw(20) << localYield; + + out << "\n"; + } + + out << "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsTtresAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsTtresAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..10b610aaff076f52e04e0576be442d73d88684a1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/LJetsTtresAnalysis.cxx @@ -0,0 +1,366 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/LJetsTtresAnalysis.h" +#include "TopExamples/DefaultPlots.h" +#include "TopExamples/AnalysisTools.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TFile.h" +#include "TH1.h" + +#include <sstream> +#include <iostream> + +#include "TopEventReconstructionTools/TtresNeutrinoBuilder.h" +#include "TopEventReconstructionTools/TtresChi2.h" + + +namespace top { + +LJetsTtresAnalysis::LJetsTtresAnalysis(TFile* outputFile) : + m_mcChannelNumber(0), + m_histsREl("rejets", outputFile), + m_histsRMu("rmujets", outputFile), + m_histsBEl("bejets", outputFile), + m_histsBMu("bmujets", outputFile), + m_cutflowEventsREl(nullptr), + m_cutflowMCWeightsREl(nullptr), + m_cutflowEventsRMu(nullptr), + m_cutflowMCWeightsRMu(nullptr), + m_cutflowEventsBEl(nullptr), + m_cutflowMCWeightsBEl(nullptr), + m_cutflowEventsBMu(nullptr), + m_cutflowMCWeightsBMu(nullptr), + m_counterREl(0), + m_counterRMu(0), + m_counterBEl(0), + m_counterBMu(0), + m_neutrinoBuilder("MeV"), + m_chi2("MeV") + { + + //tell it to load AKT10 + SetContainerNames()->largeJetCollectionName = "CorrectedSelectedAntiKt10LCTopoTrimmedPtFrac30SmallR5Jets"; // AntiKt10LCTopoTrimmedPtFrac30SmallR5Jets + //SetContainerNames()->largeJetCollectionName = "CorrectedSelectedAntiKt10LCTopoJets"; + m_chi2.Init(TtresChi2::DATA2012SUMMER2013); + + //add some default histograms for each channel + top::addPlots(m_histsREl); + top::addPlots(m_histsRMu); + + top::addPlots(m_histsBEl); + top::addPlots(m_histsBMu); + + //some extra histograms + m_histsREl.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); + m_histsRMu.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); + + m_histsREl.addHist("met", ";MET [GeV];Events", 30, 0, 300); + m_histsRMu.addHist("met", ";MET [GeV];Events", 30, 0, 300); + + m_histsREl.addHist("lep_pt", ";lepton p_{T} [GeV];Events", 50, 0, 500); + m_histsRMu.addHist("lep_pt", ";lepton p_{T} [GeV];Events", 50, 0, 500); + m_histsREl.addHist("lep_eta", ";lepton #eta ;Events", 40, -2.0, 2.0); + m_histsRMu.addHist("lep_eta", ";lepton #eta ;Events", 40, -2.0, 2.0); + m_histsREl.addHist("lep_phi", ";lepton #phi ;Events", 64, -3.2, 3.2); + m_histsRMu.addHist("lep_phi", ";lepton #phi ;Events", 64, -3.2, 3.2); + + m_histsREl.addHist("overlap", ";Overlap boosted resolved ;Events", 3, -0.5, 2.5); + m_histsRMu.addHist("overlap", ";Overlap boosted resolved ;Events", 3, -0.5, 2.5); + + m_histsBEl.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); + m_histsBMu.addHist("mwt", ";MWT [GeV];Events", 20, 0, 200); + + m_histsBEl.addHist("met", ";MET [GeV];Events", 30, 0, 300); + m_histsBMu.addHist("met", ";MET [GeV];Events", 30, 0, 300); + + m_histsBEl.addHist("lep_pt", ";lepton p_{T} [GeV];Events", 50, 0, 500); + m_histsBMu.addHist("lep_pt", ";lepton p_{T} [GeV];Events", 50, 0, 500); + m_histsBEl.addHist("lep_eta", ";lepton #eta ;Events", 40, -2.0, 2.0); + m_histsBMu.addHist("lep_eta", ";lepton #eta ;Events", 40, -2.0, 2.0); + m_histsBEl.addHist("lep_phi", ";lepton #phi ;Events", 64, -3.2, 3.2); + m_histsBMu.addHist("lep_phi", ";lepton #phi ;Events", 64, -3.2, 3.2); + + m_histsBEl.addHist("overlap", ";Overlap boosted resolved ;Events", 3, -0.5, 2.5); + m_histsBMu.addHist("overlap", ";Overlap boosted resolved ;Events", 3, -0.5, 2.5); + + m_histsBEl.addHist("ljet_pt", ";large-R jet p_{T} [GeV];Events", 50, 0, 500); + m_histsBMu.addHist("ljet_pt", ";large-R jet p_{T} [GeV];Events", 50, 0, 500); + m_histsBEl.addHist("ljet_m", ";large-R jet mass [GeV];Events", 30, 0, 300); + m_histsBMu.addHist("ljet_m", ";large-R jet mass [GeV];Events", 30, 0, 300); + m_histsBEl.addHist("ljet_eta", ";large-R jet #eta ;Events", 40, -2.0, 2.0); + m_histsBMu.addHist("ljet_eta", ";large-R jet #eta ;Events", 40, -2.0, 2.0); + m_histsBEl.addHist("ljet_phi", ";large-R jet #phi ;Events", 64, -3.2, 3.2); + m_histsBMu.addHist("ljet_phi", ";large-R jet #phi ;Events", 64, -3.2, 3.2); + m_histsBEl.addHist("ljet_sd12", ";large-R jet #sqrt{d_{12}} [GeV];Events", 10, 0, 100); + m_histsBMu.addHist("ljet_sd12", ";large-R jet #sqrt{d_{12}} [GeV];Events", 10, 0, 100); + + m_histsBEl.addHist("ljetSel_pt", ";large-R jet p_{T} [GeV];Events", 50, 0, 500); + m_histsBMu.addHist("ljetSel_pt", ";large-R jet p_{T} [GeV];Events", 50, 0, 500); + m_histsBEl.addHist("ljetSel_m", ";large-R jet mass [GeV];Events", 30, 0, 300); + m_histsBMu.addHist("ljetSel_m", ";large-R jet mass [GeV];Events", 30, 0, 300); + m_histsBEl.addHist("ljetSel_eta", ";large-R jet #eta ;Events", 40, -2.0, 2.0); + m_histsBMu.addHist("ljetSel_eta", ";large-R jet #eta ;Events", 40, -2.0, 2.0); + m_histsBEl.addHist("ljetSel_phi", ";large-R jet #phi ;Events", 64, -3.2, 3.2); + m_histsBMu.addHist("ljetSel_phi", ";large-R jet #phi ;Events", 64, -3.2, 3.2); + m_histsBEl.addHist("ljetSel_sd12", ";large-R jet #sqrt{d_{12}} [GeV];Events", 10, 0, 100); + m_histsBMu.addHist("ljetSel_sd12", ";large-R jet #sqrt{d_{12}} [GeV];Events", 10, 0, 100); + + m_histsREl.addHist("mtt", ";boosted m_{tt} [GeV];Events", 30, 0, 3000); + m_histsRMu.addHist("mtt", ";boosted m_{tt} [GeV];Events", 30, 0, 3000); + + m_histsBEl.addHist("mtt", ";boosted m_{tt} [GeV];Events", 30, 0, 3000); + m_histsBMu.addHist("mtt", ";boosted m_{tt} [GeV];Events", 30, 0, 3000); +} + +LJetsTtresAnalysis::~LJetsTtresAnalysis() { +} + +void LJetsTtresAnalysis::newFile(TFile* inputFile) { + updateCutflow("rejets/cutflow", m_cutflowEventsREl, inputFile); + updateCutflow("rejets/cutflow_mc", m_cutflowMCWeightsREl, inputFile); + updateCutflow("rmujets/cutflow", m_cutflowEventsRMu, inputFile); + updateCutflow("rmujets/cutflow_mc", m_cutflowMCWeightsRMu, inputFile); + updateCutflow("bejets/cutflow", m_cutflowEventsBEl, inputFile); + updateCutflow("bejets/cutflow_mc", m_cutflowMCWeightsBEl, inputFile); + updateCutflow("bmujets/cutflow", m_cutflowEventsBMu, inputFile); + updateCutflow("bmujets/cutflow_mc", m_cutflowMCWeightsBMu, inputFile); +} + +void LJetsTtresAnalysis::fillIt(top::PlotManager &hists, const top::Event& topEvent, bool isBoosted) { + double eventWeight = 1.; + if (top::isSimulation(topEvent)) { + m_mcChannelNumber = topEvent.m_info->mcChannelNumber(); +// eventWeight = topEvent.m_info->mcEventWeight(); + eventWeight = topEvent.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + } + top::fillPlots(topEvent, hists, eventWeight); + + double mwt = -1; + if (topEvent.m_electrons.size() == 1) + mwt = top::mwt(*topEvent.m_electrons[0], *topEvent.m_met); + if (topEvent.m_muons.size() == 1) + mwt = top::mwt(*topEvent.m_muons[0], *topEvent.m_met); + + hists.hist("mwt")->Fill(mwt * top::toGeV, eventWeight); + hists.hist("met")->Fill(topEvent.m_met->met() * top::toGeV, eventWeight); + + TLorentzVector lepton; + if (topEvent.m_electrons.size() == 1) + lepton.SetPtEtaPhiE(topEvent.m_electrons[0]->pt(), topEvent.m_electrons[0]->eta(), topEvent.m_electrons[0]->phi(), topEvent.m_electrons[0]->e()); + if (topEvent.m_muons.size() == 1) + lepton.SetPtEtaPhiE(topEvent.m_muons[0]->pt(), topEvent.m_muons[0]->eta(), topEvent.m_muons[0]->phi(), topEvent.m_muons[0]->e()); + + hists.hist("lep_pt")->Fill(lepton.Pt() * top::toGeV, eventWeight); + hists.hist("lep_eta")->Fill(lepton.Eta(), eventWeight); + hists.hist("lep_phi")->Fill(lepton.Phi(), eventWeight); + + if (isBoosted) { + const xAOD::Jet *selJet = nullptr; + for (const auto* const jetPtr : topEvent.m_jets) { + if (jetPtr->auxdata<int>("closeToLepton") == 1) { + selJet = jetPtr; + break; + } + } + + const xAOD::Jet *largeJet = nullptr; + for (const auto* const jetPtr : topEvent.m_largeJets) { + if (jetPtr->auxdata<int>("good") == 1) { + largeJet = jetPtr; + break; + } + } + if (largeJet != nullptr && selJet != nullptr) { + hists.hist("ljetSel_m")->Fill(largeJet->m() * top::toGeV, eventWeight); + double d12 = 0; + largeJet->getAttribute("Split12", d12); + hists.hist("ljetSel_sd12")->Fill(d12 * top::toGeV, eventWeight); + hists.hist("ljetSel_pt")->Fill(largeJet->pt() * top::toGeV, eventWeight); + hists.hist("ljetSel_eta")->Fill(largeJet->eta(), eventWeight); + hists.hist("ljetSel_phi")->Fill(largeJet->phi(), eventWeight); + + TLorentzVector tt(0,0,0,0); + tt += largeJet->p4(); + tt += lepton; + tt += selJet->p4(); + std::vector<TLorentzVector*> vec_nu = m_neutrinoBuilder.candidatesFromWMass_Rotation(&lepton, topEvent.m_met->met(), topEvent.m_met->phi(), true); + TLorentzVector nu(0,0,0,0); + if (vec_nu.size() > 0) { + nu = *(vec_nu[0]); + for (size_t z = 0; z < vec_nu.size(); ++z) delete vec_nu[z]; + vec_nu.clear(); + } + tt += nu; + + hists.hist("mtt")->Fill(tt.M() * top::toGeV, eventWeight); + } + + if (topEvent.m_largeJets.size() > 0) { + hists.hist("ljet_m")->Fill(topEvent.m_largeJets[0]->m() * top::toGeV, eventWeight); + double d12 = 0; + topEvent.m_largeJets[0]->getAttribute("Split12", d12); + hists.hist("ljet_sd12")->Fill(d12 * top::toGeV, eventWeight); + hists.hist("ljet_pt")->Fill(topEvent.m_largeJets[0]->pt() * top::toGeV, eventWeight); + hists.hist("ljet_eta")->Fill(topEvent.m_largeJets[0]->eta(), eventWeight); + hists.hist("ljet_phi")->Fill(topEvent.m_largeJets[0]->phi(), eventWeight); + } + } else { // is resolved + // inputs + // LEPTON --> TLorentzVector for your lepton + // vjets --> std::vector<TLorentzVector*> for the jets + // vjets_btagged --> std::vector<bool> to say if the jets are btagged or not + // met --> TLorentzVector for your MET + + // outputs, they will be filled by the TTBarLeptonJetsBuilder_chi2 + int igj3, igj4; // index for the Whad + int igb3, igb4; // index for the b's + int ign1; // index for the neutrino (because chi2 can test both pz solution) + double chi2ming1, chi2ming1H, chi2ming1L; + std::vector<TLorentzVector *> vjets; + std::vector<bool> vjets_btagged; + for (size_t z = 0; z < topEvent.m_jets.size(); ++z) { + vjets.push_back(new TLorentzVector(0,0,0,0)); + vjets[z]->SetPtEtaPhiE(topEvent.m_jets[z]->pt(), topEvent.m_jets[z]->eta(), topEvent.m_jets[z]->phi(), topEvent.m_jets[z]->e()); + const xAOD::BTagging *myBTag = topEvent.m_jets[z]->btagging(); + // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/BTagingxAODEDM + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTaggingBenchmarks + vjets_btagged.push_back(myBTag->SV1plusIP3D_discriminant() > 1.85); // best discriminant available for 8 TeV (cut at 70%) + } + TLorentzVector met(0,0,0,0); + met.SetPtEtaPhiM(topEvent.m_met->met(), 0, topEvent.m_met->phi(), 0); + bool status = m_chi2.findMinChiSquare(&lepton, &vjets, &vjets_btagged, &met, igj3, igj4, igb3, igb4, ign1, chi2ming1, chi2ming1H, chi2ming1L); // status has to be true + + double mtt = -1; + if (status) mtt = m_chi2.getResult_Mtt(); + hists.hist("mtt")->Fill(mtt * top::toGeV, eventWeight); + for (size_t z = 0; z < vjets.size(); ++z) { + delete vjets[z]; + } + vjets.clear(); + vjets_btagged.clear(); + } +} + +void LJetsTtresAnalysis::event(const top::Event& topEvent) { + double eventWeight = 1.; + if (top::isSimulation(topEvent)) { + m_mcChannelNumber = topEvent.m_info->mcChannelNumber(); +// eventWeight = topEvent.m_info->mcEventWeight(); + eventWeight = topEvent.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + } + + int pass_rejets = top::passesPreSelection(topEvent, "rejets"); + int pass_rmujets = top::passesPreSelection(topEvent, "rmujets"); + + int pass_bejets = top::passesPreSelection(topEvent, "bejets"); + int pass_bmujets = top::passesPreSelection(topEvent, "bmujets"); + + if (pass_rejets) fillIt(m_histsREl, topEvent, false); + if (pass_rmujets) fillIt(m_histsRMu, topEvent, false); + + if (pass_bejets) fillIt(m_histsBEl, topEvent, true); + if (pass_bmujets) fillIt(m_histsBMu, topEvent, true); + + // fill overlap histogram with 1 if there is an overlap + // fill it with 0 for resolved only or 2 if it is boosted only + if (pass_rejets && pass_bejets) + m_histsREl.hist("overlap")->Fill(1.0, eventWeight); + + if (pass_rejets && !pass_bejets) + m_histsREl.hist("overlap")->Fill(0.0, eventWeight); + + if (!pass_rejets && pass_bejets) + m_histsREl.hist("overlap")->Fill(2.0, eventWeight); + + if (pass_rmujets && pass_bmujets) + m_histsRMu.hist("overlap")->Fill(1.0, eventWeight); + + if (pass_rmujets && !pass_bmujets) + m_histsRMu.hist("overlap")->Fill(0.0, eventWeight); + + if (!pass_rmujets && pass_bmujets) + m_histsRMu.hist("overlap")->Fill(2.0, eventWeight); + + if (pass_rejets && pass_bejets) + m_histsBEl.hist("overlap")->Fill(1.0, eventWeight); + + if (pass_rejets && !pass_bejets) + m_histsBEl.hist("overlap")->Fill(0.0, eventWeight); + + if (!pass_rejets && pass_bejets) + m_histsBEl.hist("overlap")->Fill(2.0, eventWeight); + + if (pass_rmujets && pass_bmujets) + m_histsBMu.hist("overlap")->Fill(1.0, eventWeight); + + if (pass_rmujets && !pass_bmujets) + m_histsBMu.hist("overlap")->Fill(0.0, eventWeight); + + if (!pass_rmujets && pass_bmujets) + m_histsBMu.hist("overlap")->Fill(2.0, eventWeight); + + if (pass_rejets) + m_counterREl++; + if (pass_rmujets) + m_counterRMu++; + if (pass_bejets) + m_counterBEl++; + if (pass_bmujets) + m_counterBMu++; + +} + +void LJetsTtresAnalysis::finalise(TFile* outputFile) { + std::cout << "Cutflows directly from the input files:\n"; + printCutflow(m_cutflowEventsREl, m_cutflowMCWeightsREl, "rejets", m_counterREl); + printCutflow(m_cutflowEventsRMu, m_cutflowMCWeightsRMu, "rmujets", m_counterRMu); + + printCutflow(m_cutflowEventsBEl, m_cutflowMCWeightsBEl, "bejets", m_counterBEl); + printCutflow(m_cutflowEventsBMu, m_cutflowMCWeightsBMu, "bmujets", m_counterBMu); + + //normalise to 1 fb-1 for MC simulation + double sf = 1.; + if (m_mcChannelNumber != 0) { + const double mcWeightsInSample = m_cutflowMCWeightsREl->GetBinContent(1); + sf = sfToOneInversefb(m_mcChannelNumber, mcWeightsInSample); + } + + m_histsREl.scaleHistograms(sf); + m_histsRMu.scaleHistograms(sf); + + m_histsBEl.scaleHistograms(sf); + m_histsBMu.scaleHistograms(sf); + outputFile->Write(); +} + + +void LJetsTtresAnalysis::printCutflow(TH1D* eventHist, TH1D* mcWeightHist, const std::string& name, unsigned int localYield) { + std::cout << name << " cutflow:\n"; + std::cout << " " << + std::setw(4) << "Num" << + std::setw(20) << "Name" << + std::setw(20) << "Grid (Events)" << + std::setw(20) << "Grid (MC Weights)" << + std::setw(20) << "Local (Events)" << "\n"; + + for (int i = 1; i <= eventHist->GetNbinsX(); ++i) { + std::cout << " " << std::setw(4) << i + << std::setw(20) << eventHist->GetXaxis()->GetBinLabel(i) + << std::setw(20) << eventHist->GetBinContent(i) + << std::setw(20) << mcWeightHist->GetBinContent(i); + + if (i == eventHist->GetNbinsX()) + std::cout << std::setw(20) << localYield; + + std::cout << "\n"; + } + + std::cout << "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MakeTopConfig.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MakeTopConfig.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ed837826902d6dd554f215666dbe4b8602e30955 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MakeTopConfig.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/MakeTopConfig.h" +#include "TopConfiguration/TopConfig.h" +#include "TopConfiguration/TopPersistentSettings.h" +#include "TopEvent/EventTools.h" + +namespace top{ + MakeTopConfig::MakeTopConfig( const std::string& name ) : + asg::AsgMetadataTool( name ) + { + } + + std::shared_ptr<top::TopConfig> MakeTopConfig::makeTopConfig() + { + ///-- Get the settings from the input file + const top::TopPersistentSettings* settings(nullptr); + top::check( inputMetaStore()->retrieve(settings,"TopPersistentSettings") , "Failed to retrieve TopPersistentSettings"); + + ///-- Create the top::TopConfig from the TopPersistentSettings --/// + std::shared_ptr<top::TopConfig> config( new top::TopConfig( settings ) ); + + return config; + } +} \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MiniToFlatAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MiniToFlatAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6e5577de23e0f03dd430573d1e8defd3ecc663ab --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MiniToFlatAnalysis.cxx @@ -0,0 +1,100 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/MiniToFlatAnalysis.h" + +#include <string> + +#include "TopConfiguration/TopConfig.h" + +#include "TopEvent/EventTools.h" +#include "TopEvent/TopEventMaker.h" +#include "TopEvent/Event.h" + +#include "TopEventSelectionTools/PlotManager.h" +#include "TH1.h" +#include "TH1D.h" +#include "TFile.h" +#include "TDirectoryFile.h" + +namespace top { + MiniToFlatAnalysis::MiniToFlatAnalysis(const std::string& name) : + asg::AsgTool(name), + m_config(nullptr), + + m_topTools(nullptr), + m_sfCalc(nullptr), + m_evtMaker(nullptr), + + m_outputFileName("SetMe"), + m_outputFile(nullptr) { + declareProperty("config" , m_config); + declareProperty("outputFileName" , m_outputFileName = "miniout.root"); + } + + StatusCode MiniToFlatAnalysis::initialize() { + m_topTools = std::unique_ptr<top::TopToolStore> (new top::TopToolStore("top::TopToolStore")); + top::check(m_topTools->setProperty("config", m_config) , + "Failed to set config for topTools"); + top::check(m_topTools->initialize() , "Failed to initialize"); + + m_sfCalc = std::unique_ptr<top::ScaleFactorCalculator> (new top::ScaleFactorCalculator("top::ScaleFactorCalculator")); + top::check(m_sfCalc->setProperty("config", m_config) , + "Failed to set config for sfCalc"); + top::check(m_sfCalc->initialize() , "Failed to initialize"); + + m_evtMaker = std::unique_ptr<top::TopEventMaker>(new top::TopEventMaker("top::TopEventMaker")); + top::check(m_evtMaker->setProperty("config", m_config), + "Failed to set config for evtMaker"); + top::check(m_evtMaker->initialize(), "Failed to initialize"); + + m_outputFile = new TFile(m_outputFileName.c_str(), "RECREATE"); + + m_event_saver = std::unique_ptr<top::EventSaverFlatNtuple>(new top::EventSaverFlatNtuple()); + m_event_saver->initialize(m_config, m_outputFile, *(m_config->allSelectionNames().get())); + + return StatusCode::SUCCESS; + } + + StatusCode MiniToFlatAnalysis::execute() { + // Re-do Scale Factors - You cannot do this with a flat ntuple + top::check(m_sfCalc->execute() , "Failed to calculate scale factors"); + + const xAOD::SystematicEventContainer* allSystematics = m_evtMaker->systematicEvents(m_config->sgKeyTopSystematicEvents()); + // ATH_MSG_INFO(" Total number of SystematicEvents (inc Nominal) = "<<allSystematics->size()); + + for (auto currentSystematic : *allSystematics) { + // Make a top::Event + top::Event topEvent = m_evtMaker->makeTopEvent(*currentSystematic); + topEvent.m_saveEvent = false; + + // Reset the ttree indicies (probably should be done somewhere else) + if (topEvent.m_isLoose) { + topEvent.m_ttreeIndex = m_config->ttreeIndexLoose(topEvent.m_hashValue); + } else { + topEvent.m_ttreeIndex = m_config->ttreeIndex(topEvent.m_hashValue); + } + + for (auto sel : *m_config->allSelectionNames()) { + if (currentSystematic->auxdataConst<int>(sel) == 1) { + topEvent.m_saveEvent = true; + break; + } + } + + m_event_saver->saveEvent(topEvent); + } + + return StatusCode::SUCCESS; + } + + + StatusCode MiniToFlatAnalysis::finalize() { + m_outputFile->cd(); + m_event_saver->finalize(); + + return StatusCode::SUCCESS; + } + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MinixAODAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MinixAODAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7500728ba29c4f874aabef5d8a078c123fc9850d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/MinixAODAnalysis.cxx @@ -0,0 +1,137 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples//MinixAODAnalysis.h" + +#include "TopConfiguration/TopConfig.h" + +#include "TopEvent/EventTools.h" +#include "TopEvent/TopEventMaker.h" +#include "TopEvent/Event.h" + +#include "TopExamples/DefaultPlots.h" + +#include "TopEventSelectionTools/PlotManager.h" +#include "TH1.h" +#include "TH1D.h" +#include "TFile.h" +#include "TDirectoryFile.h" + +namespace top{ + MinixAODAnalysis::MinixAODAnalysis( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_topTools(nullptr), + m_sfCalc(nullptr), + m_evtMaker(nullptr), + + m_outputFileName("SetMe"), + m_outputFile(nullptr), + + m_firstEvent(true), + m_sampleName("SetMe"), + m_plots() + { + declareProperty( "config" , m_config ); + declareProperty( "outputFileName" , m_outputFileName = "miniout.root" ); + declareProperty( "sampleName" , m_sampleName = "Example" ); + } + + StatusCode MinixAODAnalysis::initialize() + { + + m_topTools = std::unique_ptr<top::TopToolStore> ( new top::TopToolStore( "top::TopToolStore" ) ); + top::check( m_topTools->setProperty("config",m_config) , "Failed to set property" ); + top::check( m_topTools->initialize() , "Failed to initialize" ); + + m_sfCalc = std::unique_ptr<top::ScaleFactorCalculator> ( new top::ScaleFactorCalculator( "top::ScaleFactorCalculator" ) ); + top::check( m_sfCalc->setProperty("config",m_config) , "Failed to set property" ); + top::check( m_sfCalc->initialize() , "Failed to initialize" ); + + m_evtMaker = std::unique_ptr<top::TopEventMaker> ( new top::TopEventMaker( "top::TopEventMaker" ) ); + top::check( m_evtMaker->setProperty("config",m_config) , "Failed to set property" ); + top::check( m_evtMaker->initialize() , "Failed to initialize" ); + + m_outputFile = new TFile(m_outputFileName.c_str(),"RECREATE"); + + + return StatusCode::SUCCESS; + } + + StatusCode MinixAODAnalysis::execute() + { + + ///-- Re-do Scale Factors - You cannot do this with a flat ntuple --/// + top::check( m_sfCalc->execute() , "Failed to calculate scale factors" ); + + const xAOD::SystematicEventContainer* allSystematics = m_evtMaker->systematicEvents( m_config->sgKeyTopSystematicEvents() ); +// ATH_MSG_INFO(" Total number of SystematicEvents (inc Nominal) = "<<allSystematics->size()); + + ///-- OK, this is a bit ugly, it will be cleaned up massively in future versions --/// + ///-- This is a demonstration program only --/// + + + if (m_firstEvent) { + m_firstEvent = false; + + // Setup a top::PlotManager for each channel and each syst + for (auto channel : *m_config->allSelectionNames()) { + std::unordered_map<std::string,top::PlotManager*> channelPlotMap; + for (auto currentSystematic : *allSystematics) { + channelPlotMap.insert( std::make_pair( + m_config->systematicName( currentSystematic->hashValue() ) , + new top::PlotManager(m_sampleName,channel,m_config->systematicName( currentSystematic->hashValue() ) ,m_outputFile) + ) ); + } + m_plots.insert( std::make_pair( channel , channelPlotMap ) ); + } + + for (Itr i=m_plots.begin();i!=m_plots.end();++i) { + for (Itr2 j=(*i).second.begin();j!=(*i).second.end();++j) { + top::addPlots( *((*j).second) ); + } + } + + } + + for (auto currentSystematic : *allSystematics) { + ///-- Make a top::Event --/// + top::Event topEvent = m_evtMaker->makeTopEvent( *currentSystematic ); + + ///-- Loop over all selections --/// + for (auto sel : *m_config->allSelectionNames()) { + Itr channelPlotMap = m_plots.find( sel ); + if (channelPlotMap != m_plots.end()) { + + ///-- If selection passes, plot the top::Event --/// + if (currentSystematic->isAvailable<int>(sel)){ + bool passSelection = currentSystematic->auxdataConst<int>(sel) == 1 ? true : false; + if (passSelection){ + + Itr2 systPlotMap = (*channelPlotMap).second.find( m_config->systematicName( currentSystematic->hashValue() ) ); + if (systPlotMap != (*channelPlotMap).second.end()) { + top::fillPlots(topEvent ,*((*systPlotMap).second) , 1. ); + } + + } + + } + } + } + } + + return StatusCode::SUCCESS; + } + + + StatusCode MinixAODAnalysis::finalize() + { + m_outputFile->cd(); + m_outputFile->Write(); + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/NoSelectionAnalysis.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/NoSelectionAnalysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..06738694bfa3fd33fb6836477e448077be79fb67 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/Root/NoSelectionAnalysis.cxx @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopExamples/NoSelectionAnalysis.h" +#include "TopExamples/DefaultPlots.h" +#include "TopExamples/AnalysisTools.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TFile.h" +#include "TH1.h" + +#include <iostream> + +namespace top { + +NoSelectionAnalysis::NoSelectionAnalysis(TFile* outputFile, EL::Worker* wk) : + m_hists("all", outputFile, wk), + m_cutflowEvents(nullptr), + m_cutflowMCWeights(nullptr), + m_counter(0) { + top::addPlots(m_hists); +} + +NoSelectionAnalysis::~NoSelectionAnalysis() { +} + +void NoSelectionAnalysis::newFile(TFile* inputFile) { + top::updateCutflow("all/cutflow", m_cutflowEvents, inputFile); + top::updateCutflow("all/cutflow_mc", m_cutflowMCWeights, inputFile); +} + +void NoSelectionAnalysis::event(const top::Event& topEvent) { + ++m_counter; + + double eventWeight = 1.; + if (top::isSimulation(topEvent)) +// eventWeight = topEvent.m_info->mcEventWeight(); + eventWeight = topEvent.m_truthEvent->at(0)->weights()[0];// FIXME temporary bugfix + + //std::cout << topEvent << std::endl; + top::fillPlots(topEvent, m_hists, eventWeight); +} + +void NoSelectionAnalysis::finalise(TFile* outputFile) { + std::cout << "Cutflow directly from the input files:\n"; + printCutflow(m_cutflowEvents, m_cutflowMCWeights, "all", m_counter); + + //write out plots + outputFile->Write(); +} + +void NoSelectionAnalysis::printCutflow(TH1D* eventHist, TH1D* mcWeightHist, const std::string& name, unsigned int localYield) { + std::cout << name << " cutflow:\n"; + std::cout << " " << + std::setw(4) << "Num" << + std::setw(20) << "Name" << + std::setw(20) << "Grid (Events)" << + std::setw(20) << "Grid (MC Weights)" << + std::setw(20) << "Local (Events)" << "\n"; + + for (int i = 1; i <= eventHist->GetNbinsX(); ++i) { + std::cout << " " << std::setw(4) << i + << std::setw(20) << eventHist->GetXaxis()->GetBinLabel(i) + << std::setw(20) << eventHist->GetBinContent(i) + << std::setw(20) << mcWeightHist->GetBinContent(i); + + if (i == eventHist->GetNbinsX()) + std::cout << std::setw(20) << localYield; + + std::cout << "\n"; + } + + std::cout << "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisBase.h new file mode 100644 index 0000000000000000000000000000000000000000..0b7568412561ba32151fb808de70213841c0ff7b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisBase.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISBASE_H_ +#define ANALYSISBASE_H_ + +#include "TopExamples/ContainerNames.h" + +class TFile; + +namespace top { +class Event; + +/** + * @brief An interface so that the analysis codes look the same and can be + * run by the mini-to-plots executable. + */ +class AnalysisBase { +public: + /** + * @brief This is run once only at the very start. You might want to book + * some histograms or something. + */ + AnalysisBase() { + //container names + m_containerNames.eventInfoName ="EventInfo"; + m_containerNames.electronCollectionName = "CorrectedSelectedElectrons"; + m_containerNames.muonCollectionName = "CorrectedSelectedMuons"; + m_containerNames.jetCollectionName = "CorrectedSelectedAntiKt4EMTopoJets"; + m_containerNames.largeJetCollectionName = "None"; + m_containerNames.tauCollectionName = "None"; + m_containerNames.truthCollectionName = "None"; + m_containerNames.metName = "MET_Reference_AntiKt4EMTopo"; + } + + /** + * @brief Do nothing. + */ + virtual ~AnalysisBase() {} + + /** + * @brief Perform some task only when a new file is opened. + * + * For example, in the current system we save the cutflow that was generated + * by the grid job in the file. Every time we open a new file we want to + * add this to the cutflow from the previous file. + * + * Don't try to delete the file - maybe we should change this to a reference? + */ + virtual void newFile(TFile*) = 0; + + /** + * @brief Write the analysis code that needs to be run for every event in + * this function. + */ + virtual void event(const top::Event&) = 0; + + /** + * @brief This is run once at the very end. You might want to save your + * histograms. And / or normalise them. Or something like that. The file + * will be opened for you at the end of the job to save your output to. + */ + virtual void finalise(TFile*) = 0; + + const ContainerNames containerNames() const { return m_containerNames; } + + ContainerNames* SetContainerNames() { return &m_containerNames; } + +private: + top::ContainerNames m_containerNames; +}; + +} + +#endif /* ANALYSISBASE_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisTools.h new file mode 100644 index 0000000000000000000000000000000000000000..6754d7278bed1961b2f083074b49721d7786bbdf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/AnalysisTools.h @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOOLS_H +#define ANALYSISTOOLS_H + +#include <string> +#include <memory> + +#include "TopExamples/AnalysisBase.h" +#include "TopExamples/ContainerNames.h" + +class TH1D; +class TFile; + +namespace EL { + class Worker; +} + +/** + * @file AnalysisTools.h + * + * @brief A few functions for analysis code in the final stages. + */ + +namespace top { + +///Sometimes you want things in GeV, no. Do by multiplication. +const double toGeV = 0.001; + +/** + * @brief Load one of the three analyses in a factory like way. + * + * Allows you to specify a string name which is mapped to the analysis code + * using this function. Note that if you add some new analysis code and want + * to actually run it then you also need to modify this function in a hopefully + * trivial way. + * + * @param name The name of the analysis to load (Dilepton, LJets, NoSelection etc) + * + * @return a unique ptr (these things are magic, they delete themselves when they + * are no longer needed) to the analysis code. + */ +std::unique_ptr<top::AnalysisBase> loadAnalysis(const std::string& name, TFile* outputFile, EL::Worker* wk=nullptr); + +/** + * @brief Open an xAOD and return the sample number as a string. + * + * For data this is the run number but for MC simulation this returns the + * MC channel number. Not that for data we also pad it to 8 characters long + * with a zero or two. Because this is how the grid datasets are named to. For + * MC simulation datasets are not padded out to 8 characters long. + * + * @param filename Name of an xAOD file to extract the information from. + * @param containerNames Name of the containers to load. In theory only the + * EventInfo is important, but this seemed easier for now. + * + * @return run number for data, MC channel number for MC simulation. + */ +const std::string getSampleNumberAsString(const std::string& filename, const std::string& infoContainerName); + +/** + * @brief Calculate a scale factor to one inverse fb given the sum of weights + * and the mc channel number. + * + * This loads the TopDataPreparation code and text file to get the cross-section + * for the MC sample. + * + * @param mcChannelNumber The MC channel number, so we can look up the cross- + * section using TopDataPreparation + * @param mcWeightsInSample The sum of the MC weights in the MC sample + */ +double sfToOneInversefb(unsigned int mcChannelNumber, double mcWeightsInSample); + +/** + * @brief We want to add a histogram with name "name" from file "inputFile" to + * the histogram "histogram". Note that if "histogram" is nullptr this function + * will create it using the first one it finds in a file. Otherwise it just adds + * the new histogram to this one. + * + * @param name The name of the cutflow histogram in the input file (e.g. + * ee/cutflow). + * @param histogram The histogram in our code that we want to add to. This is + * modified by this function! + * @param inputFile The inputFile to read the histogram from. + */ +void updateCutflow(const std::string& name, TH1D*& histogram, TFile* inputFile); + +/** + * @brief Messy. + * + * Given a path /this/is/a/path/user.simon.117050.e1727_s1933_s1911_r5591.MC_31_07_1/input.txt. + * Strip off the input.txt and all the stuff before the very last directory. + * Then remove user.simon.117050 (i.e. the first three items between dots). + * Then strip off the end bit to leave e1727_s1933_s1911_r5591. + * + * @param inputFile A path with a specific naming convention for the last directory. + * @return The e<blah>_s<blah>_r<blah> or equivalent. + */ +std::string gridTagFromDirectoryName(const std::string inputFile); + +/** + * @brief The top-xaod code is decorating events with a integer (not bool!) + * flag for every event that passes/fails the pre-selection. The name of the + * decoration is the analysis channel (e.g. ee, mumu, emu). So we can check + * if the event passes or fails the selection done on the grid by looking at + * this. + * + * @param topEvent The top event we want to know about. + * @param name The channel we're interested in. e.g. ee + * @return True if the event passed the grid selection, false otherwise. + */ +bool passesPreSelection(const top::Event& topEvent, const std::string& name); + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/ContainerNames.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/ContainerNames.h new file mode 100644 index 0000000000000000000000000000000000000000..da373bec6f88063d69513c7d1a9ea1127aa13f54 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/ContainerNames.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CONTAINERNAMES_H_ +#define CONTAINERNAMES_H_ + +#include <string> + +namespace top { + +struct ContainerNames { + std::string eventInfoName; + std::string electronCollectionName; + std::string muonCollectionName; + std::string jetCollectionName; + std::string largeJetCollectionName; + std::string metName; + std::string tauCollectionName; + std::string truthCollectionName; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::ContainerNames& names); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DefaultPlots.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DefaultPlots.h new file mode 100644 index 0000000000000000000000000000000000000000..6b1e6238de553005bb730401c31bdc00de410772 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DefaultPlots.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DEFAULTPLOTS_H_ +#define DEFAULTPLOTS_H_ + +namespace top { +class PlotManager; +class Event; + +/** + * @brief Since a few of the analyses might want some 'default' plots we've put + * the code to make them in this little function. + * + * Hopefully the names and axis labels make it clear what they should contain. + * + * @param manager This is a little package that lets you store a bunch of + * histograms and then refer to them by name. + */ +void addPlots(top::PlotManager& manager); + +/** + * @brief Fill the plots made by the addPlots function. This should be run every + * event. + * + * @param topEvent The 'event' which contains electrons, muons, jets, met etc. + * @param manager The histogram manager that the plots were added to. It's used + * to access them via their name, and then fill them. + * @param eventWeight Maybe you're running on MC simulation and the events are + * weighted and you want to plot them with weights? + */ +void fillPlots(const top::Event& topEvent, top::PlotManager& manager, double eventWeight); + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DileptonAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DileptonAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..33bc7a81cff360068ed169170b05d8310c0c475a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/DileptonAnalysis.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DILEPTONANALYSIS_H_ +#define DILEPTONANALYSIS_H_ + +#include "TopExamples/AnalysisBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +class TH1D; +class TFile; + +namespace EL { + class Worker; +} + +namespace top { + +class DileptonAnalysis : public AnalysisBase { +public: + DileptonAnalysis(TFile* outputFile, EL::Worker* wk=nullptr); + ~DileptonAnalysis(); + + void newFile(TFile* inputFile) override; + void event(const top::Event& topEvent) override; + void finalise(TFile* outputFile) override; + +private: + void eeAnalysis(const top::Event& topEvent, double eventWeight); + void mumuAnalysis(const top::Event& topEvent, double eventWeight); + void emuAnalysis(const top::Event& topEvent, double eventWeight); + + void printCutflow(std::ostream& out, const TH1D* const eventHist, const TH1D* const mcWeightHist, const std::string& name, const unsigned int localYield); + + ///MC Channel number is needed to calculate the SF (to 1 fb-1) at the end of the job + unsigned int m_mcChannelNumber; + + ///runNumber used for output filename + unsigned int m_runNumber; + + ///Histograms for the ee, mumu and emu channels + top::PlotManager m_histsElEl; + top::PlotManager m_histsMuMu; + top::PlotManager m_histsElMu; + + ///Cutflows for (1) raw events and (2) events with MC weights + TH1D* m_cutflowEventsElEl; + TH1D* m_cutflowMCWeightsElEl; + TH1D* m_cutflowEventsMuMu; + TH1D* m_cutflowMCWeightsMuMu; + TH1D* m_cutflowEventsElMu; + TH1D* m_cutflowMCWeightsElMu; + + ///Counters for events running locally + unsigned int m_counterElEl; + unsigned int m_counterMuMu; + unsigned int m_counterElMu; +}; + +} + +#endif /* DILEPTONANALYSIS_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/EventLoaderDirect.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/EventLoaderDirect.h new file mode 100644 index 0000000000000000000000000000000000000000..bfcb184a5c784669ab56f2062dfaa0aa6c9d9022 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/EventLoaderDirect.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LOADALL_H_ +#define LOADALL_H_ + +#include "TopExamples/ContainerNames.h" + +#include "TopEvent/Event.h" + +namespace top { + +class EventLoaderDirect { +public: + EventLoaderDirect(const ContainerNames& names); + + ~EventLoaderDirect(); + + top::Event loadEvent(xAOD::TEvent& xaodEvent); + + void print(std::ostream& os) const; + + ///Get hold of the container names (in derived classes too). + const ContainerNames containerNames() const { return m_containerNames; } + +private: + ///Store the container names + ContainerNames m_containerNames; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..b03b50b7119cb8973d5bfe427d531b39b4bea7bc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsAnalysis.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LJETSANALYSIS_H_ +#define LJETSANALYSIS_H_ + +#include "TopExamples/AnalysisBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +#include <string> + +class TH1D; +class TFile; + +namespace EL { + class Worker; +} + +namespace top { + +class LJetsAnalysis : public AnalysisBase { +public: + LJetsAnalysis(TFile* outputFile, EL::Worker* wk=nullptr); + ~LJetsAnalysis(); + + void newFile(TFile* inputFile) override; + void event(const top::Event& topEvent) override; + void finalise(TFile* outputFile) override; + +private: + void printCutflow(std::ostream& out, const TH1D* const eventHist, const TH1D* const mcWeightHist, const std::string& name, const unsigned int localYield); + + ///used for output filename (for MC) + unsigned int m_mcChannelNumber; + + ///runNumber used for output filename + unsigned int m_runNumber; + + top::PlotManager m_histsEl; + top::PlotManager m_histsMu; + + TH1D* m_cutflowEventsEl; + TH1D* m_cutflowMCWeightsEl; + TH1D* m_cutflowEventsMu; + TH1D* m_cutflowMCWeightsMu; + + unsigned int m_counterEl; + unsigned int m_counterMu; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsTtresAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsTtresAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..f7101f61b7dbd45f9029f0611ede9289278ef2f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/LJetsTtresAnalysis.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LJETSTTRESANALYSIS_H_ +#define LJETSTTRESANALYSIS_H_ + +#include "TopExamples/AnalysisBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +#include "TopEventReconstructionTools/TtresNeutrinoBuilder.h" +#include "TopEventReconstructionTools/TtresChi2.h" + +#include <string> + +class TH1D; +class TFile; + +namespace top { + +class LJetsTtresAnalysis : public AnalysisBase { +public: + LJetsTtresAnalysis(TFile* outputFile); + ~LJetsTtresAnalysis(); + + void newFile(TFile* inputFile) override; + void event(const top::Event& topEvent) override; + void finalise(TFile* outputFile) override; + +private: + void printCutflow(TH1D* eventHist, TH1D* mcWeightHist, const std::string& name, unsigned int localYield); + + void fillIt(top::PlotManager &hist, const top::Event& topEvent, bool isBoosted); + + unsigned int m_mcChannelNumber; + + top::PlotManager m_histsREl; + top::PlotManager m_histsRMu; + top::PlotManager m_histsBEl; + top::PlotManager m_histsBMu; + + TH1D* m_cutflowEventsREl; + TH1D* m_cutflowMCWeightsREl; + TH1D* m_cutflowEventsRMu; + TH1D* m_cutflowMCWeightsRMu; + + TH1D* m_cutflowEventsBEl; + TH1D* m_cutflowMCWeightsBEl; + TH1D* m_cutflowEventsBMu; + TH1D* m_cutflowMCWeightsBMu; + + unsigned int m_counterREl; + unsigned int m_counterRMu; + + unsigned int m_counterBEl; + unsigned int m_counterBMu; + + TtresNeutrinoBuilder m_neutrinoBuilder; + TtresChi2 m_chi2; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MakeTopConfig.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MakeTopConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..ccd2505a1f348f0a205c14e95f5d05ebdad1d93f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MakeTopConfig.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MakeTopConfig.h 681944 2015-07-09 21:59:27Z morrisj $ +#ifndef ANALYSISTOP_NEXTGEN_MAKETOPCONFIG_H +#define ANALYSISTOP_NEXTGEN_MAKTOPCONFIG_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief MakeTopConfig - it makes a top::TopConfig from the metadata + * + * $Revision: 681944 $ + * $Date: 2015-07-09 23:59:27 +0200 (Thu, 09 Jul 2015) $ + * + * + **/ + +#include <memory> + +// Framework include(s): +#include "AsgTools/AsgMetadataTool.h" + +namespace top{ + class TopConfig; + class MakeTopConfig : public asg::AsgMetadataTool { + public: + explicit MakeTopConfig( const std::string& name ); + + std::shared_ptr<top::TopConfig> makeTopConfig(); + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MiniToFlatAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MiniToFlatAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..92c2f8888ce8f674cade28139e437546b5a9c607 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MiniToFlatAnalysis.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MiniToFlatAnalysis.h 733950 2016-04-05 11:21:48Z tneep $ +#ifndef TOPEXAMPLES_MINITOFLATANALYSIS_H_ +#define TOPEXAMPLES_MINITOFLATANALYSIS_H_ + +/** + * @author Tom Neep <tom.neep@cern.ch> + * + * @brief MiniToFlatAnalysis + * + * $Revision: 683667 $ + * $Date: 2015-07-17 04:24:59 +0200 (Fri, 17 Jul 2015) $ + * + * + **/ + +#include <memory> +#include <unordered_map> +#include <string> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Forward declaration(s): +namespace top { +class TopConfig; +class PlotManager; +} + +class TFile; + +#include "TopCPTools/TopToolStore.h" +#include "TopCorrections/ScaleFactorCalculator.h" +#include "TopEvent/TopEventMaker.h" +#include "TopAnalysis/EventSaverFlatNtuple.h" + +namespace top { +class MiniToFlatAnalysis : public asg::AsgTool { + public: + explicit MiniToFlatAnalysis(const std::string& name); + virtual ~MiniToFlatAnalysis() {} + + // Delete Standard constructors + MiniToFlatAnalysis(const MiniToFlatAnalysis& rhs) = delete; + MiniToFlatAnalysis(MiniToFlatAnalysis&& rhs) = delete; + MiniToFlatAnalysis& operator=(const MiniToFlatAnalysis& rhs) = delete; + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::unique_ptr<top::TopToolStore> m_topTools; + std::unique_ptr<top::ScaleFactorCalculator> m_sfCalc; + std::unique_ptr<top::TopEventMaker> m_evtMaker; + std::unique_ptr<top::EventSaverFlatNtuple> m_event_saver; + + std::string m_outputFileName; + ::TFile* m_outputFile; +}; +} // namespace top +#endif // TOPEXAMPLES_MINITOFLATANALYSIS_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MinixAODAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MinixAODAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..26f2398ca648746d4e350976b50c46e65deee0cd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/MinixAODAnalysis.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MinixAODAnalysis.h 683667 2015-07-17 02:24:59Z morrisj $ +#ifndef ANALYSISTOP_TOPEXAMPLES_MINIXAODANALYSIS_H +#define ANALYSISTOP_TOPEXAMPLES_MINIXAODANALYSIS_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief MinixAODAnalysis + * + * $Revision: 683667 $ + * $Date: 2015-07-17 04:24:59 +0200 (Fri, 17 Jul 2015) $ + * + * + **/ + +#include <memory> +#include <unordered_map> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; + class PlotManager; +} +class TFile; + +#include "TopCPTools/TopToolStore.h" +#include "TopCorrections/ScaleFactorCalculator.h" +#include "TopEvent/TopEventMaker.h" + +namespace top{ + class MinixAODAnalysis : public asg::AsgTool { + public: + explicit MinixAODAnalysis( const std::string& name ); + virtual ~MinixAODAnalysis(){} + + // Delete Standard constructors + MinixAODAnalysis(const MinixAODAnalysis& rhs) = delete; + MinixAODAnalysis(MinixAODAnalysis&& rhs) = delete; + MinixAODAnalysis& operator=(const MinixAODAnalysis& rhs) = delete; + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::unique_ptr<top::TopToolStore> m_topTools; + std::unique_ptr<top::ScaleFactorCalculator> m_sfCalc; + std::unique_ptr<top::TopEventMaker> m_evtMaker; + + std::string m_outputFileName; + ::TFile* m_outputFile; + + // Analysis + bool m_firstEvent; + std::string m_sampleName; + std::unordered_map<std::string,std::unordered_map<std::string,top::PlotManager*>> m_plots; + typedef std::unordered_map<std::string,std::unordered_map<std::string,top::PlotManager*>>::const_iterator Itr; + typedef std::unordered_map<std::string,top::PlotManager*>::const_iterator Itr2; + + }; +} +#endif \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/NoSelectionAnalysis.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/NoSelectionAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..0f6ca4c7490d20173c16cfed600d7d85ae20a070 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/TopExamples/NoSelectionAnalysis.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef NOSELECTIONANALYSIS_H_ +#define NOSELECTIONANALYSIS_H_ + +#include <string> + +#include "TopExamples/AnalysisBase.h" +#include "TopEventSelectionTools/PlotManager.h" + +class TH1D; +class TFile; + +namespace EL { + class Worker; +} + +namespace top { + +class NoSelectionAnalysis : public AnalysisBase { +public: + NoSelectionAnalysis(TFile* outputFile, EL::Worker* wk=nullptr); + ~NoSelectionAnalysis(); + + void newFile(TFile* inputFile) override; + void event(const top::Event& topEvent) override; + void finalise(TFile* outputFile) override; + +private: + void printCutflow(TH1D* eventHist, TH1D* mcWeightHist, const std::string& name, unsigned int localYield); + + top::PlotManager m_hists; + + TH1D* m_cutflowEvents; + TH1D* m_cutflowMCWeights; + + unsigned int m_counter; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..6cce5e52120f08ff34bf963ecda693b31408d022 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopExamples + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = AsgTools xAODCore xAODRootAccess TopCPTools TopCorrections TopAnalysis TopEvent TopEventSelectionTools TopEventReconstructionTools TopDataPreparation TopConfiguration PathResolver + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimisation (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/AtlasStyle.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/AtlasStyle.py new file mode 100644 index 0000000000000000000000000000000000000000..987ae94ffcb02ee8441f0d03f66ae7efe3efa414 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/AtlasStyle.py @@ -0,0 +1,80 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import ROOT + +def SetAtlasStyle(): + print 'Applying ATLAS style settings...' + atlasStyle = AtlasStyle() + ROOT.gROOT.SetStyle("ATLAS") + ROOT.gROOT.ForceStyle() + +def AtlasStyle(): + atlasStyle = ROOT.TStyle("ATLAS", "Atlas style") + + #use plain black on white colors + icol = 0 #WHITE + atlasStyle.SetFrameBorderMode(icol) + atlasStyle.SetFrameFillColor(icol) + atlasStyle.SetCanvasBorderMode(icol) + atlasStyle.SetCanvasColor(icol) + atlasStyle.SetPadBorderMode(icol) + atlasStyle.SetPadColor(icol) + atlasStyle.SetStatColor(icol) + #atlasStyle.SetFillColor(icol) # don't use white fill color for *all* objects + + # set the paper & margin sizes + atlasStyle.SetPaperSize(20, 26) + + # set margin sizes + atlasStyle.SetPadTopMargin(0.06) + atlasStyle.SetPadRightMargin(0.06) + atlasStyle.SetPadBottomMargin(0.16) + atlasStyle.SetPadLeftMargin(0.16) + + # set title offsets (for axis label) + atlasStyle.SetTitleXOffset(1.4) + atlasStyle.SetTitleYOffset(1.4) + + # use large fonts + font = 42 #Helvetica + tsize = 0.05 + atlasStyle.SetTextFont(font) + + atlasStyle.SetTextSize(tsize) + atlasStyle.SetLabelFont(font,"x") + atlasStyle.SetTitleFont(font,"x") + atlasStyle.SetLabelFont(font,"y") + atlasStyle.SetTitleFont(font,"y") + atlasStyle.SetLabelFont(font,"z") + atlasStyle.SetTitleFont(font,"z") + + atlasStyle.SetLabelSize(tsize,"x") + atlasStyle.SetTitleSize(tsize,"x") + atlasStyle.SetLabelSize(tsize,"y") + atlasStyle.SetTitleSize(tsize,"y") + atlasStyle.SetLabelSize(tsize,"z") + atlasStyle.SetTitleSize(tsize,"z") + + #use bold lines and markers + atlasStyle.SetMarkerStyle(20) + atlasStyle.SetMarkerSize(1.2) + #########atlasStyle.SetHistLineWidth(2.) + atlasStyle.SetLineStyleString(2,"[12 12]") # postscript dashes + + # get rid of X error bars + #atlasStyle.SetErrorX(0.001) + # get rid of error bar caps + atlasStyle.SetEndErrorSize(0.) + + # do not display any of the standard histogram decorations + atlasStyle.SetOptTitle(0) + #atlasStyle.SetOptStat(1111) + atlasStyle.SetOptStat(0) + #atlasStyle.SetOptFit(1111) + atlasStyle.SetOptFit(0) + + # put tick marks on top and RHS of plots + atlasStyle.SetPadTickX(1) + atlasStyle.SetPadTickY(1) + +SetAtlasStyle() \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/__init__.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..74583d364ec2ca794156596c7254d9b234a940c6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/ami.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/ami.py new file mode 100755 index 0000000000000000000000000000000000000000..0277362e58df1dd3906d8d9bc0412487a5fd23c2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/ami.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import os +import sys +from xml.dom.minidom import parse, parseString + +import logger + +try: + import pyAMI.client + import pyAMI.atlas.api + #import pyAMI +except: + print "Maybe you didn't do localSetupPyAMI?" + sys.exit() + +def getContainerContents(containerName): + amiclient = pyAMI.client.Client('atlas') + + query = containerName.rstrip('/') + data = "'%"+query+"%'" + + argument = 'SearchQuery -glite="select dataset.logicalDatasetName, dataset.identifier where dataset.logicalDatasetName like %s" -processingStep=real_data -project=dataSuper_001' % data + #print 'argument', argument + + maxTries = 3 + + #print argument + failures = 0 + for i in range(maxTries): + try: + results = amiclient.execute(argument, format='xml') + except: + failures += 1 + + if failures == maxTries: + print '' + print logger.FAIL + 'is your voms proxy okay?' + logger.ENDC + print 'Try voms-proxy-init -voms atlas' + sys.exit(1) + + #print 'made it' + + #txt = results.output('xml') + #print txt + dom = parseString(results) + rows = dom.getElementsByTagName('row') + + #final = {} + datasets = [] + #print 'found', len(rows) + for row in rows: + #print 'here', row + fields = row.getElementsByTagName('field') + for field in fields: + #print field.attributes['name'].value + if field.attributes['name'].value == 'logicalDatasetName': + retName=field.firstChild.nodeValue + #print retName +# + if field.attributes['name'].value == 'identifier': + identifier = field.firstChild.nodeValue + + #print identifier + #Now search for all datasets that match that + #print 'PART 2' + #argument.append("entity=contained_dataset") + argument = 'SearchQuery -glite="SELECT contained_dataset.contained_datasetName WHERE dataset.identifier=%s" -processingStep=real_data -project=dataSuper_001' % identifier + + results = amiclient.execute(argument, format='xml') + #print results + #txt = results.output('xml') + #print txt + dom = parseString(results) + container = dom.getElementsByTagName('row') + + #print len(container) + for dataset in container: + fields = dataset.getElementsByTagName('field') + for field in fields: + if field.attributes['name'].value == 'contained_datasetName': + #print 'hello' + #print field.firstChild.nodeValue + datasets.append(field.firstChild.nodeValue.encode('ascii','ignore') + '/') + + return sorted(datasets) + +def askAmi(query, property = 'totalEvents'): + amiclient = pyAMI.client.Client('atlas') + + #swap * for % - databases + query = query.replace('*', '%%') + data = "'"+query+"'" + + #argument.append("entity=dataset") + argument = 'SearchQuery -glite="SELECT dataset.logicalDatasetName, dataset.%s WHERE dataset.logicalDatasetName LIKE %s"' % (property, data) + #print argument + + if data.find('data') > -1: + argument += ' -processingStep=real_data' + if data.find('data15') > -1: + argument += ' -project=data15_001' + elif data.find('data16') > -1: + argument += ' -project=data16_001' + elif data.find('data12') > -1: + argument += ' -project=data12_001' + elif data.find('data11') > -1: + argument += ' -project=data11_001' + else: + argument += ' -project=data10_001' + else: + argument += ' -processingStep=production' + if data.find('mc09') > -1: + argument += ' -project=mc09' + elif data.find('mc10') > -1: + argument += ' -project=mc10' + elif data.find('mc11') > -1: + argument += ' -project=mc11_001' + elif data.find('mc12') > -1: + argument += ' -project=mc12_001' + elif data.find('mc14') > -1: + argument += ' -project=mc14_001' + elif data.find('mc15') > -1: + argument += ' -project=mc15_001' + + maxTries = 3 + + #print argument + + failures = 0 + for i in range(maxTries): + final = {} + + if not "period" in query: + try: + results = amiclient.execute(argument, format='xml') + except: + failures += 1 + + if failures == maxTries: + print '' + print logger.FAIL + 'is your voms proxy okay?' + logger.ENDC + print 'Try voms-proxy-init -voms atlas' + sys.exit(1) + + #print results.getElementsByTagName('error') + #txt = results.output('xml') + #print txt + dom = parseString(results) + + #they changed it so that a voms-proxy-init error now returns a search + #result with error in it. That's annoying. + mayBeAnError = dom.getElementsByTagName('error') + for row in mayBeAnError: + print row.firstChild.nodeValue + sys.exit(1) + + rows = dom.getElementsByTagName('row') + + for row in rows: + #print 'here', row.toprettyxml() + + fields = row.getElementsByTagName('field') + retName = '' + retNev = 0 + + for field in fields: + if field.attributes['name'].value == 'logicalDatasetName': + retName = field.firstChild.nodeValue + + if field.attributes['name'].value == property: + if field.firstChild != None: + retNev = field.firstChild.nodeValue + + #print retName, retNev + final[retName] = retNev + else: + try: + results = pyAMI.atlas.api.list_datasets(amiclient, query, fields="ldn,events,modified") + except: + failures += 1 + + if failures == maxTries: + print '' + print logger.FAIL + 'is your voms proxy okay?' + logger.ENDC + print 'Try voms-proxy-init -voms atlas' + sys.exit(1) + + for row in results: + retName = row["ldn"] + retNev = row["events"] + + #print retName, retNev + final[retName] = retNev + + + #unicode -> normalcode + results = {} + for k in final.keys(): + results[str(k)] = int(final[k]) + + + + return results + +if __name__ == '__main__': + #data + print 'Testing data15' + results = askAmi('data15_comm.%.physics_Main.%.DAOD_TOPQ1.%p2356') + for ds in sorted(results): + print ds + + #MC simulation + print 'Testing MC15' + results = askAmi('mc15_13TeV.%.DAOD_TOPQ1.%p2352') + for ds in sorted(results): + print ds diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/analysis.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..704290bf991a145d355fa4ab53d33303afd0d66b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/analysis.py @@ -0,0 +1,324 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import logger +import ami + +import ROOT + +import glob +import os +import sys +import pickle + +ROOT.TFile.SetReadStreamerInfo(False) + +class DS: + def __init__(self, id, xsec, kfac, shower): + self.id = id + self.xsec = xsec + self.kfac = kfac + self.shower = shower + +class TopDataPreparation: + def __init__(self, filename): + self.datasets = {} + self.filename = filename + + input = open(filename) + + for l in input: + #print l + if l.find('#') > -1: + l = l.split('#')[0] + + l = l.strip().split() + + #print l + if len(l) >= 3: + id = int(l[0]) + xsec = float(l[1]) + kfac = float(l[2]) + + shower = 'not available' + if len(l) >= 4: + shower = l[3] + + self.datasets[id] = DS(id, xsec, kfac, shower) + + #print l + input.close() + + def getFilename(self): + return self.filename + + def hasID(self, id): + return self.datasets.has_key(id) + + def getRawXsection(self, id): + if self.datasets.has_key(id): + ds = self.datasets[id] + return ds.xsec + + return 0 + + def getKfactor(self, id): + if self.datasets.has_key(id): + ds = self.datasets[id] + return ds.kfac + + return 0 + + def getXsection(self, id): + if self.datasets.has_key(id): + ds = self.datasets[id] + return ds.xsec * ds.kfac + + return 0 + + def getShower(self, id): + if self.datasets.has_key(id): + ds = self.datasets[id] + return ds.shower + + return 0 + +def queryAmi(amiSamples, tag): + sys.stdout.write('-> %s: ' % tag) + sys.stdout.flush() + print tag + ds = ami.askAmi(tag) + print len(ds), 'datasets' + amiSamples.update(ds) + +def cacheAmi(ptaglist): + try: + amiSamples = pickle.load(open("amiyields.pickle", "rb" )) + print logger.OKBLUE + 'Using cached yields - to force me to query AMI delete amiyields.pickle' + logger.ENDC + except IOError, ioex: + if ioex.errno == 2: + print logger.OKBLUE + 'Asking AMI' + logger.ENDC + + amiSamples = {} + + for ptag in ptaglist: + #data15_13TeV.periodD.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667 + queryAmi(amiSamples, 'data16_13TeV.%.physics_Main.%.DAOD_TOPQ%' + ptag) + queryAmi(amiSamples, 'data15_13TeV.%.physics_Main.%.DAOD_TOPQ%' + ptag) + queryAmi(amiSamples, 'data16_13TeV.period%physics_Main.PhysCont.DAOD_TOPQ%' + ptag) + queryAmi(amiSamples, 'data15_13TeV.period%physics_Main.PhysCont.DAOD_TOPQ%' + ptag) + queryAmi(amiSamples, 'mc15_13TeV.%.DAOD_TOPQ%.%' + ptag) + + if len(amiSamples) == 0: + print logger.FAIL + 'Something went wrong when trying to get the data from ami' + logger.ENDC + sys.exit(1) + else: + pickle.dump(amiSamples, open("amiyields.pickle", "wb")) + + return amiSamples + +def getDatasetYield(directoryName): + counter = 0 + + #this sucks - think of a better way + histogramsIKnowAbout = ["all/cutflow", + "ee/cutflow", + "mumu/cutflow", + "emu/cutflow", + "ejets/cutflow", + "mujets/cutflow"] + + #i = 0 + for fileName in glob.glob(directoryName + '/*root*'): + #print i, fileName + #i += 1 + f = ROOT.TFile.Open(fileName) + + if not f: + print logger.FAIL + 'ERROR: Failed to open %s' % fileName + logger.ENDC + continue + + #Look for TDirectory file (not TTree) and read the cutflow from + #the first one that we come to (since we only want the initial events) + for key in f.GetListOfKeys(): + if key.ReadObj().ClassName() == 'TDirectoryFile': + h = f.Get(key.GetName() + '/cutflow') + if h: + counter += h.GetBinContent(1) + break + + f.Close() + + return counter + +#Make a directory if it doesn't exist +def makeDirectory(outputDirectory): + try: + os.makedirs(outputDirectory) + print 'Made directory', outputDirectory + except: + #directory already exists + pass + +def makeNameFitOnTerminal(name, maxlength): + evenshortername = name + + if len(evenshortername) > maxlength: + ar = evenshortername.split('.') + maxlen = maxlength - len(ar[0]) - len(ar[1]) - len(ar[2]) - 5 + shortened = ar[1][0:maxlen] + '...' + evenshortername = ar[0] + '.' + shortened + '.' + ar[2] + + return evenshortername + +def makeFileNameFitOnTerminal(name, maxlength): + evenshortername = name + + if len(evenshortername) > maxlength: + ar = evenshortername.split('.') + ar[3] = '.' + evenshortername = '.'.join(ar) + + return evenshortername + +def check(analysis, directory, runDirectory, samples): + + localDatasetFolders = sorted(glob.glob(directory + '/*')) + + #print localDatasetFolders + + ptaglist = [] + + localMap = {} + for l in localDatasetFolders: + justfile = os.path.basename(l) + #print 'justfile', justfile + #print justfile.split('.') + shortname = justfile.split('.')[2] + '.' + justfile.split('.')[4] + '.' + justfile.split('.')[5] + localMap[shortname] = l + #print 'localMap:', localMap.keys() + taglist = (justfile.split('.')[5]).split('_') + + for tag in taglist: + if "p" in tag and not "grp" in tag: + IsInList = False + for helptag in ptaglist: + if tag in helptag: + IsInList = True + if not IsInList: + ptaglist.append(tag) + + print ptaglist + + amiSamples = cacheAmi(ptaglist) + + #print amiSamples + + #Organise into dsid.derivation.tags: yield + amiSamples2 = {} + for l in amiSamples.keys(): + newname = l.replace('/','').split('.') + #print newname, + newname = newname[1] + '.' + newname[-2] + '.' + newname[-1] + #print newname + amiSamples2[newname] = amiSamples[l] + + #for k in sorted(amiSamples2.keys()): + # print k, amiSamples2[k] + + analyses = [] + bad = [] + + print '%s%50s %90s %12s %12s%s' % (logger.OKBLUE, 'dsid.gridtag', 'local location', 'local yield', 'ami yield', logger.ENDC) + for sample in samples: + existingSampleFilenames = [] + + print logger.OKBLUE + sample.name + logger.ENDC + for ds in sample.datasets: + splitName = ds.replace('/','').split('.') + shortname = splitName[1] + '.' + splitName[-2] + '.' + splitName[-1] + #print 'shortname', shortname + + #local yield + directory = '' + directoryYield = 0 + if localMap.has_key(shortname): + #print 'key ', localMap[shortname] + directory = localMap[shortname] + directoryYield = getDatasetYield(directory) + + #ami yield + amiYield = 0 + if amiSamples2.has_key(shortname): + #print 'here', amiSamples2[shortname] + amiYield = amiSamples2[shortname] + + colourstart = '' + colourend = '' + + #no events in local copy + if directoryYield == 0: + colourstart = logger.FAIL + colourend = logger.ENDC + + #local not the same as ami + if directoryYield != amiYield: + colourstart = logger.FAIL + colourend = logger.ENDC + + evenshortername = makeNameFitOnTerminal(shortname, 50) + eventshorterfilename = makeFileNameFitOnTerminal(directory.split('/')[-1], 60) + + print '%s%50s %90s %12d %12d%s' % (colourstart, evenshortername, eventshorterfilename, directoryYield, amiYield, colourend) + + if amiYield > 0 and directoryYield != amiYield: + bad.append(ds) + + if localMap.has_key(shortname): + out = open('%s/input.txt' % directory, 'w') + for l in sorted(glob.glob('%s/*root*' % directory)): + out.write(l + '\n') + out.close() + + #only run on files that contain events + if directoryYield > 0: + analyses.append('cd %s;mini-to-plots %s %s/input.txt' % (runDirectory, analysis, directory)) + + #figure out the output filename from mini-to-plots so we can merge them + components = directory.split('/')[-1].split('.') + outputName = '.'.join(components[2:8]) + existingSampleFilenames.append(outputName) + + #generate the command to merge them together + if len(existingSampleFilenames) > 0: + mergelist = ' '.join(existingSampleFilenames) + analyses.append('cd %s;hadd -f %s.root %s' % (runDirectory, sample.name, mergelist)) + + if '--debug' in sys.argv: + print '' + print '' + print 'These commands are going to be run:' + for l in analyses: + print l + + if '--bad' in sys.argv: + print '' + print '' + print 'These are datasets where the ami yield does not match' + print 'TopExamples.grid.Add("Resubmit").datasets = [' + + for l in bad: + print '"%s",' % l + + print ']' + print "resubmit = TopExamples.grid.Samples(['Resubmit'])" + print 'TopExamples.grid.submit(config, resubmit)' + + if '--run' in sys.argv: + makeDirectory(runDirectory) + + print '' + print '' + print analyses + for i, l in enumerate(analyses): + print logger.OKBLUE + l + logger.ENDC + os.system(l) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/grid.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/grid.py new file mode 100644 index 0000000000000000000000000000000000000000..2930dd177421917656563efd71640368653034e4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/grid.py @@ -0,0 +1,403 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# -*- coding: utf-8 -*- +import os +import sys +import distutils.spawn +import logger +import analysis + +try: + import rucio.client +except: + print logger.FAIL + 'DANGER DANGER DANGER' + logger.ENDC + print 'Could not find rucio.client.Client. If you use setupATLAS (you should) then' + print '"localSetupRucioClients" and run this again' + sys.exit(1) + +try: + rucio = rucio.client.Client() +except: + print logger.FAIL + 'DANGER DANGER DANGER' + logger.ENDC + print 'Could not setup rucio.client.Client.' + print 'Did you do voms-proxy-init -voms atlas ?' + sys.exit(1) + +availableDatasets = {} + +class Sample: + def __init__(self, name): + self.name = name + self.datasets = [] + + def shortNameDatasets(self): + output = [] + for ds in self.datasets: + name = ds.replace('/','').split('.') + output.append(name[1] + '.' + name[-1]) + return output + + def details(self, actuallyExists = []): + n = len(self.datasets) + + suffix = '' + if n != 1: + suffix = 's' + + print logger.OKGREEN + ' %s ' % self.name + logger.ENDC + '(%d dataset%s)' % (n, suffix) + for i, l in enumerate(self.datasets): + note = 'Not found' + if l in actuallyExists: + note = 'Found' + + print ' -%2d %s %s' % (i, l, note) + +def Add(name): + availableDatasets[name] = Sample(name) + return availableDatasets[name] + +def AvailableDatasets(): + return availableDatasets + +def Samples(names): + samples = [] + for n in names: + samples.append(availableDatasets[n]) + return samples + +class Config: + code = 'top-xaod' + cutsFile = 'nocuts.txt' + + gridUsername = '' + suffix = '' + excludedSites = '' + forceSite = '' + noSubmit = False + CMake = False # False by default - need to set to True for CMake-based releases (release 21) + mergeType = 'Default' #None, Default, xAOD + destSE = '' + memory = '2000' #in MB + maxNFilesPerJob = '' + otherOptions = '' + + def details(self): + cutsFileIsARealFile = checkForFile(self.settingsFile) + txt = '(' + logger.FAIL + 'not found' + logger.ENDC + ')' + if cutsFileIsARealFile: + txt = '(exists)' + + print logger.OKBLUE + 'Analysis Settings:' + logger.ENDC + print ' -Code: ', self.code + print ' -CutsFile: ', self.settingsFile, txt + + print logger.OKBLUE + 'Grid Settings:' + logger.ENDC + print ' -GridUsername: ', self.gridUsername + print ' -Suffix: ', self.suffix + print ' -ExcludedSites: ', self.excludedSites + print ' -ForceSite: ', self.forceSite + print ' -NoSubmit: ', self.noSubmit + print ' -MergeType: ', self.mergeType, 'out of (None, Default, xAOD)' + print ' -memory: ', self.memory, 'in MB' + print ' -maxNFilesPerJob', self.maxNFilesPerJob + print ' -OtherOptions: ', self.otherOptions + + txt = self.destSE + if len(txt) == 0: + txt = '<not set>' + print ' -DestSE ', txt + + print '' + +def checkMergeType(configuration): + type = configuration.mergeType + if type != "None" and type != "Default" and type != "xAOD": + print "MergeType must be set to either None, Default or xAOD" + print 'Not', type, "Since that doesn't make sense" + sys.exit() + +#If settings.txt doesn't exist your grid job will fail +def checkForFile(filename): + return os.path.exists(filename) + +def checkForPrun(): + if distutils.spawn.find_executable('prun') == None: + print logger.FAIL + 'DANGER DANGER DANGER' + logger.ENDC + print 'Could not find prun. If you use setupATLAS (you should) then' + print '"localSetupPandaClient --noAthenaCheck" and run this again' + sys.exit() + +#I see a crash if I setup with rcSetup Top,1.4.0 +#and don't run rc find_packages +#so let's run this by default +def findPackages(): + cmd = 'cd $ROOTCOREBIN/../; rc find_packages' + + debug = False + + if debug: + print 'finding packages' + print cmd + + for l in os.popen(cmd).readlines(): + if debug: + print l.strip() + + if debug: + print 'done' + +#Given a list of datasets, the command to run and a mode (egamma, muons) this +#submits one prun job per run +#This is mostly for internal use of the code +def submit(config, allSamples): + checkForPrun() + checkMergeType(config) + config.details() + checkForShowerAlgorithm(allSamples) + + tarfile = 'top-xaod.tar.gz' + + #We don't want to use an old, out-of-date file + #Delete the file if it exists + try: + os.remove(tarfile) + except OSError, e: + #Number 2 is 'file doesn't exist' which is okay for us + if e.errno == 2: + pass + else: + raise + + + #Check for cuts file + if not checkForFile(config.settingsFile): + print logger.FAIL + "DANGER DANGER. HIGH VOLTAGE" + logger.ENDC + print '%s does not exist in this directory' % config.settingsFile + print 'please make it before submitting' + + if config.settingsFile == 'dil-cuts.txt' or config.settingsFile == 'ljets-cuts.txt': + print 'or... copy it with' + print 'cp $ROOTCOREBIN/data/TopAnalysis/%s .' % config.settingsFile + + sys.exit(1) + + #Look in the cuts file for the output filename + outputFilename = 'EMPTY' + for l in open(config.settingsFile): + #ignore text after comments + if l.find('#') > -1: + l = l.split('#')[0] + + if l.find('OutputFilename') > -1: + outputFilename = l.replace('OutputFilename', '').strip() + + if outputFilename == 'EMPTY': + print 'OutputFilename not found in %s' % config.settingsFile + sys.exit(1) + + #print outputFilename + + these = [] + print logger.OKBLUE + 'For these samples' + logger.ENDC + + #Only submit jobs if the dataset actually exists (check with rucio) + for sample in allSamples: + currentDatasets = sample.datasets + actuallyExists = [] + for ds in currentDatasets: + if checkDatasetExists(ds): + actuallyExists.append(ds) + + sample.details(actuallyExists) + these += actuallyExists + + #check if it's a release - which automatically would set rootVer and cmtConfig + if not config.CMake: + findPackages() + + plural = '' + if len(these) > 1: + plural = 's' + + print '' + print logger.OKBLUE + 'Starting submission of %d sample%s' % (len(these), plural) + logger.ENDC + print '' + + isfirst = True + for i, d in enumerate(these): + print logger.OKBLUE + 'Submitting %d of %d' % (i+1, len(these)) + logger.ENDC + + splitted = d.split('.') + + runNumber = splitted[1] + txt = splitted[2] + if splitted[0] == "user": + runNumber = splitted[2] + txt = splitted[3] + derivation = splitted[-2] + tags = splitted[-1].replace('/','') + + #grid complains dataset names are too long + #stupid grid + if len(txt) > 20: + txt = txt.split('_')[0] + + n = runNumber + '.' + txt + '.' + derivation + '.' + tags + + #Make the output dataset name + output = 'user.' + config.gridUsername + '.' + n + '.' + config.suffix + + cmd = 'prun \\\n' + cmd += '--inDS=' + d + ' \\\n' + cmd += '--outDS=' + output + ' \\\n' + if config.CMake: + cmd += '--useAthenaPackages --cmtConfig=x86_64-slc6-gcc49-opt \\\n' + else: + cmd += '--useRootCore \\\n' + cmd += '--writeInputToTxt=IN:in.txt \\\n' + cmd += '--outputs=%s \\\n' % outputFilename + cmd += '--exec="%s %s in.txt" \\\n' % (config.code, config.settingsFile) + + #you might really hate a certain site + if len(config.excludedSites) > 0: + cmd += '--excludedSite=' + config.excludedSites + ' \\\n' + + #you might really like a certain site + if len(config.forceSite) > 0: + cmd += '--site ' + config.forceSite + ' \\\n' + + #tar-up the first time only, to save time when submitting + if isfirst: + cmd += '--outTarBall=%s \\\n' % tarfile + isfirst = False + else: + cmd += '--inTarBall=%s \\\n' % tarfile + + #maybe you don't want to submit the job? + if config.noSubmit: + cmd += '--noSubmit \\\n' + + #fewer files = happy grid + if config.mergeType != "None": + cmd += '--mergeOutput \\\n' + + #Write the output to a specific storage element? + if len(config.destSE) > 0: + cmd += '--destSE=\"%s\" \\\n' % config.destSE + + #xAOD merging - slide 9 https://indico.cern.ch/event/401703/contribution/2/2/material/slides/0.pdf + #Only add TriggerMenuMetaDataTool option when xAODTriggerCnv is in the release (not in 2.3.15) + #--mergeScript="xAODMerge -m xAODMaker::TriggerMenuMetaDataTool %OUT \`echo %IN | sed \'s/,/ /g\'\`" \\\n' + if config.mergeType == "xAOD": + cmd += '--mergeScript="xAODMerge %OUT \`echo %IN | sed \'s/,/ /g\'\`" \\\n' + + #how much memory, not sure what default is when not set + if len(config.memory) > 0: + cmd += '--memory=%s \\\n' % config.memory + + #how many files + if len(config.maxNFilesPerJob) > 0: + cmd += '--maxNFilesPerJob=%s \\\n' % config.maxNFilesPerJob + + #other options + if len(config.otherOptions) > 0: + cmd += '%s \\\n' % config.otherOptions + + #Make sure the command actually ends + cmd += '\n' + + #show people what you're about to do + print cmd + + #then do it + for l in os.popen(cmd).readlines(): + print '>> ', l.strip() + +#Make a directory if it doesn't exist +def makeDirectory(outputDirectory): + try: + os.makedirs(outputDirectory) + print 'Made directory', outputDirectory + except: + #directory already exists + pass + +#Loop through the samples and change the AOD-style name to a DAOD_TOPQ one +#The user needs to give derivationToUse (DAOD_TOPQ1 or DAOD_TOPQ2) +#The p-tag for the production +#And the list of samples +def convertAODtoTOPQ(derivationToUse, ptag, samples): + for sample in samples: + for i, ds in enumerate(sample.datasets): + sample.datasets[i] = ds.replace('AOD', derivationToUse).replace('/', '') + '_' + ptag + +#Get a list of dataset names matching some pattern with stars in, using dq2-ls +def listDatasets(theScope, datasetPattern): + response = rucio.list_dids(scope = theScope, filters = {'name' : datasetPattern}) + + names = [] + for l in response: + names.append(l) + + return names + +#Download all datasets that match the pattern, to the outputDirectory +def download(theScope, datasetPattern, outputDirectory): + #Make sure the directory where these need to go exists + makeDirectory(outputDirectory) + + #Get datasets matching the pattern + intdatasets = listDatasets(theScope, datasetPattern) + txt = '' + if len(intdatasets) != 1: + txt = 's' + + print 'Found %d dataset%s:' % (len(intdatasets), txt) + + for ds in intdatasets: + print ' %s' % ds + + for j, d in enumerate(intdatasets): + cmd = 'rucio download %s:%s --dir %s' % (theScope, d, outputDirectory) + print logger.OKBLUE + 'Dataset %d of %d: %s' % (j+1, len(intdatasets), cmd) + logger.ENDC + + #Run the dq2 command + os.system(cmd) + +#Prun submits to datasets that don't exist, so do a quick check first... +def checkDatasetExists(name): + theScope = name.split('.')[0] + #name = 'data15_13TeV.00266904.physics_Main.merge.DAOD_TOPQ1.f594_m1435_p2361' + if theScope == "user" or theScope == "group": + theScope = name.split('.')[0] + "." + name.split('.')[1] + reply = listDatasets(theScope, name) + #print reply + return len(reply) == 1 + +if __name__ == '__main__': + print "You don't run this directly!" + print 'For an example, see 01SubmitToGrid.py' + + +def checkForShowerAlgorithm(Samples): + noShowerDatasets = [] + tdp = analysis.TopDataPreparation(os.getenv('ROOTCOREBIN') + '/data/TopDataPreparation/XSection-MC15-13TeV.data') + for TopSample in availableDatasets.values(): + for List in Samples: + SublistSamples = List.datasets + for sample in SublistSamples: + scope = sample.split('.')[0] + if 'mc' not in scope: + continue + dsid = sample.split('.')[1] + dsid = int(dsid) + hasShower = tdp.getShower(dsid) in ['sherpa','sherpa21','pythia','pythia8','herwigpp'] + #print hasShower," ",sample + if not tdp.hasID(dsid) or not hasShower: + noShowerDatasets += [dsid] + + if len(noShowerDatasets) > 0: + print 'The following datasets do not have a showering algorithm defined in TopDataPreparation and will fail on the grid. Please ask for this to be fixed in TopDataPreparation!' + for ds in set(noShowerDatasets): + print ds + raise RuntimeError("Datasets without shower.") diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/logger.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/logger.py new file mode 100644 index 0000000000000000000000000000000000000000..e34f34601a339cf44f8d0781cbd7aa665bb57e9a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/logger.py @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +HEADER = '\033[95m' +OKBLUE = '\033[94m' +OKGREEN = '\033[92m' +WARNING = '\033[93m' +FAIL = '\033[91m' +ENDC = '\033[m' \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/plot.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/plot.py new file mode 100755 index 0000000000000000000000000000000000000000..dca8f4cb7181e4a7b8216ff3025f41e92eed93e3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/plot.py @@ -0,0 +1,193 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import ROOT + +import sys +import os + +import logger +import AtlasStyle + +ROOT.gROOT.SetBatch(True) + +#Make a directory if it doesn't exist +def makeDirectory(outputDirectory): + try: + os.makedirs(outputDirectory) + print 'Made directory', outputDirectory + except: + print 'directory already exists:', outputDirectory + pass + +class Proc: + def __init__(self, filename, colour, caption, isMC = True): + self.name = filename + self.colour = colour + self.caption = caption + self.isMC = isMC + +class Plotter: + def __init__(self, htmlOutputName, stack, mcSF): + self.out = open(htmlOutputName, 'w') + self.out.write('<html>\n') + self.out.write('<title>Plots plots plots</title>\n') + + self.imgDirectory = 'output/' + self.c1 = ROOT.TCanvas('c1', '', 400, 400) + self.files = {} + self.stack = stack + + self.showLegend = True + self.mcSF = mcSF + + makeDirectory(self.imgDirectory) + + print logger.OKBLUE +'Stack configuration'+ logger.ENDC + for currentProcess in stack: + print ' Name %s Colour %d Caption %s' % (currentProcess.name, currentProcess.colour, currentProcess.caption) + + def doneAndDusted(self): + self.out.write('</html>\n') + self.out.close() + + def getPlot(self, fileName, histName): + if not self.files.has_key(fileName): + f = ROOT.TFile.Open(fileName) + if not f: + print logger.FAIL + 'Failed to open %s' % fileName + logger.ENDC + raise Exception('Failed to open %s' % fileName) + + self.files[fileName] = f + + return self.files[fileName].Get(histName) + + def thumbnail(self, plot, width, height): + img = ROOT.TASImage(plot) + img.Scale(width, height) + img.WriteImage(plot.replace('.gif', '_tn.gif')) + + #Legend of plot, not Zelda, sorry + def genLegend(self, entries): + legend = ROOT.TLegend(0.56, 0.67, 0.8, 0.93) + legend.SetFillColor(0) + legend.SetFillStyle(0) + legend.SetBorderSize(0) + legend.SetTextFont(72) + legend.SetTextSize(0.04) + + for l in reversed(entries): + legend.AddEntry(l[0], l[1], l[2]) + + return legend + + def plot(self, histName): + print 'plotting ', histName + self.c1.Clear() + + entries = [] + ths = ROOT.THStack() + blackoutline = None + + nonStackHistograms = [] + + counterForMCSamples = 0 + for c, currentProcess in enumerate(reversed(self.stack)): + h = self.getPlot(currentProcess.name, histName) + + #if it's MC scale to the integrated luminosity. Assume it's already + #scaled to 1 fb-1 + style = 'f' + if currentProcess.isMC: + h.SetFillColor(currentProcess.colour) + h.SetLineColor(currentProcess.colour) + counterForMCSamples += 1 + + h.Scale(self.mcSF) + ths.Add(h) + + if blackoutline == None: + blackoutline = h.Clone() + else: + blackoutline.Add(h) + else: + nonStackHistograms.append(h) + style = 'p' + + entries.append([h, currentProcess.caption, style]) + + #calculate max y + ymax = 0 + if blackoutline: + ymax = blackoutline.GetBinContent(blackoutline.GetMaximumBin()) + + for h in nonStackHistograms: + current = h.GetBinContent(h.GetMaximumBin()) + if current > ymax: + ymax = current + + if counterForMCSamples > 0: + ths.SetMinimum(0.) + ths.SetMaximum(1.2 * ymax) + ths.Draw('hist') + + ths.GetHistogram().SetXTitle(h.GetXaxis().GetTitle()) + ths.GetHistogram().SetYTitle(h.GetYaxis().GetTitle()) + ths.GetHistogram().GetYaxis().SetTitleOffset(1.6) + + #outline around all plots in the stack + blackoutline.SetLineColor(ROOT.kBlack) + blackoutline.SetFillStyle(0) + blackoutline.Draw('hist same') + + options = '' + if counterForMCSamples > 0: + options += ' same' + + for h in nonStackHistograms: + h.Draw(options) + + if self.showLegend: + legend = self.genLegend(entries) + legend.Draw("same") + + showIntLumi = True + if showIntLumi: + s = "#int Ldt = " + str(round(self.mcSF, 1)) + " fb^{-1}" + lmode = ROOT.TLatex() + lmode.SetNDC() + lmode.SetTextColor(1) + lmode.SetTextSize(0.04) + lmode.DrawLatex(0.2, 0.84, s) + + showCaption = True + if showCaption: + lmode = ROOT.TLatex() + lmode.SetTextAlign(31); #right, obviously + lmode.SetNDC() + lmode.SetTextColor(1) + lmode.SetTextFont(72) + lmode.SetTextSize(0.05) + + x = 0.95 + y = 0.955 + lmode.DrawLatex(x, y, histName.split('/')[0]) + + #save a gif (and a little thumbnail) + #and an eps version of the plot + imgname = histName.replace('/','.') + '.gif' + self.c1.Print(self.imgDirectory + imgname) + self.c1.Print(self.imgDirectory + imgname.replace('.gif','.eps')) + self.thumbnail(self.imgDirectory + imgname, 200, 200) + self.out.write('<a href="%s"><img src="%s"></a>\n' % (self.imgDirectory + imgname, self.imgDirectory +imgname.replace('.gif', '_tn.gif'))) + + def br(self): + self.out.write('<br>\n') + + def h1(self, txt): + self.out.write('<h1>%s</h1>\n' % txt) + + def h2(self, txt): + self.out.write('<h2>%s</h2>\n' % txt) + + def h3(self, txt): + self.out.write('<h3>%s</h3>\n' % txt) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/sizes.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/sizes.py new file mode 100644 index 0000000000000000000000000000000000000000..193de30a9ab2b3897a28abca738eef2457e05db9 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/sizes.py @@ -0,0 +1,159 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import ROOT +import AtlasStyle +import ami +import sys +import datetime + +c1 = ROOT.TCanvas('c1', '', 400, 400) + +location = '/disk/homedisk/home/sjh2/public_web/twiki/' +derivationTag = 'p1851' + +def printTable(out, stream, quantity, topq1Only=False): + toGB = 1. + if quantity == 'totalSize': + toGB = 1. / 1000. / 1000. / 1000. + + primaryxAOD = ami.askAmi('data12_8TeV.*' + stream + '.merge.AOD.r572*_p1751_p2309', quantity) + topq1_round1 = ami.askAmi('data12_8TeV.*' + stream + '*DAOD_TOPQ1*' + derivationTag, quantity) + + topq2_round1 = {} + if not topq1Only: + topq2_round1 = ami.askAmi('data12_8TeV.*' + stream + '*DAOD_TOPQ2*' + derivationTag, quantity) + + h_topq1_frac = ROOT.TH1D('h_topq1_frac', ';TOPQ1 Size / Primary Size [%];Number of datasets', 20, 0, 10) + h_topq2_frac = ROOT.TH1D('h_topq2_frac', ';TOPQ2 Size / Primary Size [%];Number of datasets', 20, 0, 1) + + h_topq1_abs = ROOT.TH1D('h_topq1_abs', ';TOPQ1 Size [GB];Number of datasets', 20, 0, 200) + h_topq2_abs = ROOT.TH1D('h_topq2_abs', ';TOPQ2 Size [GB];Number of datasets', 30, 0, 15) + + out.write('---+ !%s\n' % stream) + if not topq1Only: + out.write('| *%s* | *%s* | *%s* | *%s* | *%s* | *%s* |\n' % ('Primary xAOD name', 'Size [GB]', 'TOPQ1 size [GB]', '%', 'TOPQ2 size [GB]', '%')) + else: + out.write('| *%s* | *%s* | *%s* | *%s* |\n' % ('Primary xAOD name', 'Size [GB]', 'TOPQ1 size [GB]', '%')) + + tot_prim = 0 + tot_topq1 = 0 + tot_topq2 = 0 + for k in sorted(primaryxAOD.keys()): + primaryNum = primaryxAOD[k] * toGB + + topq1_name = k.replace('AOD', 'DAOD_TOPQ1') + '_' + derivationTag + topq1Num = -1 + if topq1_round1.has_key(topq1_name): + topq1Num = topq1_round1[topq1_name] * toGB + + topq2_name = k.replace('AOD', 'DAOD_TOPQ2') + '_' + derivationTag + topq2Num = -1 + if topq2_round1.has_key(topq2_name): + topq2Num = topq2_round1[topq2_name] * toGB + + note = '' + + cstart = '%RED%' + cend = "%ENDCOLOR%" + + topq1Frac = 0 + topq2Frac = 0 + if topq1Num > 0: + tot_prim += primaryNum + tot_topq1 += topq1Num + topq1Frac = 100. * topq1Num / primaryNum + h_topq1_frac.Fill(topq1Frac) + h_topq1_abs.Fill(topq1Num) + cstart= '' + cend = '' + topq1Num = cstart + ('%4.2f' % topq1Num) + cend + topq1Frac = cstart + ('%4.2f' % topq1Frac) + cend + else: + topq1Num = cstart + '-' + cend + topq1Frac = cstart + '-' + cend + + if topq2Num > 0: + tot_topq2 += topq2Num + topq2Frac = 100. * topq2Num / primaryNum + h_topq2_frac.Fill(topq2Frac) + h_topq2_abs.Fill(topq2Num) + cstart = '' + cend = '' + topq2Num = cstart + ('%4.2f' % topq2Num) + cend + topq2Frac = cstart + ('%4.2f' % topq2Frac) + cend + else: + topq2Num = cstart + '-' + cend + topq2Frac = cstart + '-' + cend + + k = cstart + k + cend + primaryNum = cstart + ('%4.2f' % primaryNum) + cend + + if not topq1Only: + txt = '| %s | %s | %s | %s | %s | %s |\n' % (k, primaryNum, topq1Num, topq1Frac, topq2Num, topq2Frac) + else: + txt = '| %s | %s | %s | %s |\n' % (k, primaryNum, topq1Num, topq1Frac) + + out.write(txt) + + if not topq1Only: + txt = '| total (only include primary that have derivation) | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f |\n' % (tot_prim, tot_topq1, 100. * tot_topq1 / tot_prim, tot_topq2, 100. * tot_topq2 / tot_prim) + else: + txt = '| total (only include primary that have derivation) | %4.2f | %4.2f | %4.2f |\n' % (tot_prim, tot_topq1, 100. * tot_topq1 / tot_prim) + + out.write(txt) + out.write('\n') + + name = stream + '_topq1_abs.gif' + h_topq1_abs.SetFillColor(ROOT.kRed) + h_topq1_abs.Draw('hist') + c1.Print(location + name) + out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name) + + name = stream + '_topq1_frac.gif' + h_topq1_frac.SetFillColor(ROOT.kRed) + h_topq1_frac.Draw('hist') + c1.Print(location + name) + out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name) + + if not topq1Only: + name = stream + '_topq2_abs.gif' + h_topq2_abs.SetFillColor(ROOT.kRed) + h_topq2_abs.Draw('hist') + c1.Print(location + name) + out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name) + + name = stream + '_topq2_frac.gif' + h_topq2_frac.SetFillColor(ROOT.kRed) + h_topq2_frac.Draw('hist') + c1.Print(location + name) + out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name) + +if __name__ == "__main__": + qunatityFromAmi = 'totalEvents' + qunatityFromAmi = 'totalSize' + + out = open(location + 'derivation_progress.html', 'w') + out.write('%TOC%\n') + + d_string = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + + out.write('---+ Introduction\n') + txt = ''' + Generated: %s + + Hello, this page lists the most recent round of top derivations for DC14 (2012 Period B, about 5 fb-1). + + For more information on which containers are kept and the cuts that are applied in TOPQ1, and TOPQ2, see TopDerivations) + + The p-tag used for this page is %s + + You can find derivations on rucio with: + =rucio list-dids data12_8TeV:*DAOD_TOPQ1*p1851= (or =TOPQ2=) + + ''' % (d_string, derivationTag) + out.write(txt + '\n') + + printTable(out, 'Egamma', qunatityFromAmi) + printTable(out, 'Muons', qunatityFromAmi) + printTable(out, 'JetTauEtmiss', qunatityFromAmi, True) + out.close() diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/web.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/web.py new file mode 100644 index 0000000000000000000000000000000000000000..4628028985ab7811dbf9817b22ed465217e7598b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/python/web.py @@ -0,0 +1,173 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# -*- coding: utf-8 -*- +import sys + +import grid +import ami + +toGB = 1. / 1000. / 1000. / 1000. + +def makeDict(scope, query): + map = {} + map2 = {} + #print scope, query + for ds in grid.listDatasets(scope, query): + ar = ds.replace('/','').split('.') + tag = ar[5] + + if tag.find('_p'): + tag = tag.split('_p')[0] + + short = ar[1] + '.' + tag + map[short] = ds + map2[int(ar[1])] = ds + + return map, map2 + +def makeTable(name, ids): + + print '---++ %s (%d)' % (name, len(ids)) + + print '''%TABLE{tablewidth="100%" columnwidths="6%,70%,12%,12%"}%''' + print '| %8s | %60s | %22s | %22s | %22s | %22s |' % ( '*DSID*', '*Description*', '*Primary xAOD yield*', '*TOPQ1 yield*', '*Primary size [GB]*', '*xAOD size [GB]*' ) + + for id in ids: + dsids_sofar.append(id) + + primary_name = '' + topq1_name = 'Not Available (requested?)' + aod_yield = 0 + topq1_yield = 0 + aod_size = 0 + topq1_size = 0 + + if aods_idonly.has_key(id): + primary_name = aods_idonly[id] + + if topq1_idonly.has_key(id): + topq1_name = topq1_idonly[id] + + if aods_ami.has_key(primary_name.replace('/','')): + aod_yield = aods_ami[primary_name.replace('/','')] + + if topq1_ami.has_key(topq1_name.replace('/','')): + topq1_yield = topq1_ami[topq1_name.replace('/','')] + + + if aods_ami_size.has_key(primary_name.replace('/','')): + aod_size = aods_ami_size[primary_name.replace('/','')] + + if topq1_ami_size.has_key(topq1_name.replace('/','')): + topq1_size = topq1_ami_size[topq1_name.replace('/','')] + + + #print id, primary_name + desc = primary_name.split('.')[2] + + #%TWISTY{mode="div"showlink="AOD: 6.298.988"hidelink="Collapse"showimgleft="%ICONURLPATH{toggleopen-small}%"hideimgleft="%ICONURLPATH{toggleclose-small}%"}%INPUT%ICON{choice-no}% + + twisty = '''%TWISTY{ + mode="div" + showlink="'''+desc+'''" + hidelink="'''+desc+'''" + showimgleft="%ICONURLPATH{toggleopen-small}%" + hideimgleft="%ICONURLPATH{toggleclose-small}%"}%''' + '<b>Primary:</b> ' + primary_name + '<br><b>TOPQ1:</b> ' + topq1_name + '<br>' + '%ENDTWISTY%' + + frac = 0 + if aod_yield > 0: + frac = 100. * topq1_yield / aod_yield + + topq1_yield_txt = "%15d (%0.0f%%)" % (topq1_yield, frac) + cstart = '' + cend = '' + if aod_yield < topq1_yield: + cstart = '%RED%' + cend = "%ENDCOLOR%" + elif aod_yield > topq1_yield: + cstart = '%ORANGE%' + cend = "%ENDCOLOR%" + + topq1_yield_txt = cstart + topq1_yield_txt + cend + + frac = 0 + if topq1_size > 0: + frac = 100. * topq1_size / aod_size + + topq1_size_txt = "%15d (%0.0f%%)" % (topq1_size * toGB, frac) + + print '| %d|%s| %d| %s| %4.2f| %s|' % (id, twisty, aod_yield, topq1_yield_txt, aod_size * toGB, topq1_size_txt) + + print '' + +if __name__ == '__main__': + query = '*.AOD.*_r5591_r5625' + query13 = '*.merge.AOD.*_r5787_r5853' + + print '%TOC%' + + print ''' +On this page we have listed the main DC14 samples. You can find more details on +the DC14StartPage and DC14DataMCSampleInfo. + +For 8 !TeV we list + * *Primary xAOD:* =%s= + * *TOPQ1:* =%s= + +For 13 !TeV we list + * *Primary xAOD:* =%s= + * *TOPQ1:* =%s= + +For more details on which containers are removed see TopDerivations. +No event selection is currently applied to MC in TOPQ1. +Since the only difference between TOPQ1 and TOPQ2 is the event selection we +don't make TOPQ2 for MC. +''' % (query, query.replace('AOD','DAOD_TOPQ1') + '_p1854', query13, query13.replace('AOD','DAOD_TOPQ1') + '_p1852') + + print '---+ Introduction' + + aods_idtag, aods_idonly = makeDict('mc14_8TeV', query) + topq1_idtag, topq1_idonly = makeDict('mc14_8TeV', query.replace('AOD','DAOD_TOPQ1') + '_p1854') + aods_ami = ami.askAmi('mc14_8TeV.' + query) + topq1_ami = ami.askAmi('mc14_8TeV.' + query.replace('AOD','DAOD_TOPQ1') + '_p1854') + + aods_ami_size = ami.askAmi('mc14_8TeV.' + query, 'totalSize') + topq1_ami_size = ami.askAmi('mc14_8TeV.' + query.replace('AOD','DAOD_TOPQ1') + '_p1854', 'totalSize') + + #print len(aods_ami), len(topq1_ami) + #sys.exit() + dsids_sofar = [] + + print '---+ 8 !TeV' + + makeTable('ttbar', [117050]) + makeTable('single top', [110101, 110119, 110140]) + makeTable('Z+jets sherpa', [147770, 147771]) + makeTable('Z+jets sherpa with massive b/c', range(167749, 167758) + range(167797, 167806) + range(167809, 167818) + range(167821, 167830) + range(167833, 167842)) + makeTable('W+jets sherpa with massive b/c', range(167740, 167750) + range(180534, 180543) + range(167761, 167770) + range(167770, 167779) + range(167779, 167788) + range(167788, 167797)) + makeTable('Diboson powheg+pythia8', range(126928, 126937)) + + remaining = set(aods_idonly.keys()).difference(set(dsids_sofar)) + makeTable('Remaining / uncategorised (as of now)', sorted(remaining)) + + + ####13 TEV + query = query13 + aods_idtag, aods_idonly = makeDict('mc14_13TeV', query) + topq1_idtag, topq1_idonly = makeDict('mc14_13TeV', query.replace('AOD','DAOD_TOPQ1') + '_p1852') + + aods_ami = ami.askAmi('mc14_13TeV.' + query) + topq1_ami = ami.askAmi('mc14_13TeV.' + query.replace('AOD','DAOD_TOPQ1') + '_p1852') + aods_ami_size = ami.askAmi('mc14_13TeV.' + query, 'totalSize') + topq1_ami_size = ami.askAmi('mc14_13TeV.' + query.replace('AOD','DAOD_TOPQ1') + '_p1852', 'totalSize') + + dsids_sofar = [] + + print '---+ 13 !TeV' + + makeTable('ttbar', [110401]) + makeTable('single top', [110070, 110071, 110305]) + + remaining = set(aods_idonly.keys()).difference(set(dsids_sofar)) + makeTable('Remaining / uncategorised (as of now)', sorted(remaining)) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid.py new file mode 100755 index 0000000000000000000000000000000000000000..33a6e28001b324b8370ae9b36eaa03c7dc897e93 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.grid +import DerivationTags +import Data +import MC15c_TOPQ1 + +config = TopExamples.grid.Config() +config.code = 'top-xaod' +config.settingsFile = 'dil-cuts.txt' + +config.gridUsername = 'aknue' +config.suffix = '02-04-24' +config.excludedSites = '' +config.noSubmit = False +config.mergeType = 'Default' #'None', 'Default' or 'xAOD' +config.destSE = '' #This is the default (anywhere), or try e.g. 'UKI-SOUTHGRID-BHAM-HEP_LOCALGROUPDISK' +# by default the requested memory is set to 2GB, if you need to increase this, please disable the line below!!! +# config.memory = '4000' + +############################################################################### + +###Command line interface +###If you want a script that ask you what you want to run on interactively, +###and uses lists of primary xAODs to convert them as TOPQ derivations +###Otherwise you can edit the automatic scripts below +#names, derivation, ptag = DerivationTags.InteractiveSubmission() +#samples = TopExamples.grid.Samples(names) +#TopExamples.grid.convertAODtoTOPQ(derivation, ptag, samples) +#TopExamples.grid.submit(config, samples) + +############################################################################### + +# Data - look in Data.py +# Change if you want TOPQ2/3/4 +names = ['Data15_TOPQ1', 'Data16_TOPQ1'] +samples = TopExamples.grid.Samples(names) +TopExamples.grid.submit(config, samples) + +############################################################################### + +###MC Simulation - look in MC15c_TOPQ1.py +###Using list of TOPQ1 25ns MC samples, consistent mixture of p-tags +###Edit these lines if you don't want to run everything! +names = [ + 'TOPQ1_ttbar_PowPy6', + 'TOPQ1_singleTop_PowPy6', + 'TOPQ1_ttV', + 'TOPQ1_Wjets_Sherpa221', + 'TOPQ1_Zjets_Sherpa221', + 'TOPQ1_Diboson_Sherpa', +] + +samples = TopExamples.grid.Samples(names) +TopExamples.grid.submit(config, samples) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py new file mode 100755 index 0000000000000000000000000000000000000000..c27371a1b709c27f41db1f2f66fad4af53787722 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.grid +import DerivationTags +import Data_rel21 +import MC16_TOPQ1 + +config = TopExamples.grid.Config() +config.code = 'top-xaod' +config.settingsFile = 'dil-cuts.txt' +config.gridUsername = 'aknue' +config.suffix = '02-06-02' +config.excludedSites = '' +config.noSubmit = False # set to True if you just want to test the submission +config.CMake = True # need to set to True for CMake-based releases (release 21) +config.mergeType = 'Default' #'None', 'Default' or 'xAOD' +config.destSE = '' #This is the default (anywhere), or try e.g. 'UKI-SOUTHGRID-BHAM-HEP_LOCALGROUPDISK' + + +###Data - look in Data_rel21.py +###MC Simulation - look in MC16_TOPQ1.py +###Using a few test samples produced with release 21 +###Edit these lines if you don't want to run everything! +names = [ + 'TOPQ1_ttbar_PowPy8', +# 'Data16_TOPQ1', +] + +samples = TopExamples.grid.Samples(names) +TopExamples.grid.submit(config, samples) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/02DownloadFromGrid.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/02DownloadFromGrid.py new file mode 100755 index 0000000000000000000000000000000000000000..71d23be89c3983e6cc208c5fa90a723f67ad314c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/02DownloadFromGrid.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.grid + +scope = 'user.aknue' +datasetPattern = '*test_02-03-45a_output.root' +directory = '/tmp/YOURUSERNAME/DownloadFolder/' + +TopExamples.grid.download(scope, datasetPattern, directory) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis.py new file mode 100755 index 0000000000000000000000000000000000000000..01a9aa72bb0ffb08dbf9065ffe2731351313421a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.analysis +import TopExamples.grid +import TopExamples.logger as logger +import DerivationTags +import Data +import MC15c_TOPQ1 + +inputDirectory = '/ptmp/mpp/knand/TopAnalysis_13TeV/Downloads_2.4.24/Downloads/' +runDirectory = 'test1/' +analysis = 'Dilepton' + +#For data +print logger.OKGREEN + 'Data' + logger.ENDC +names = ['Data15_TOPQ1', 'Data16_TOPQ1'] +samples = TopExamples.grid.Samples(names) +TopExamples.analysis.check(analysis, inputDirectory, runDirectory, samples) + +print '\n\n' +print logger.OKGREEN + 'MC simulation' + logger.ENDC +names = [ + 'TOPQ1_ttbar_PowPy6', + 'TOPQ1_singleTop_PowPy6', + 'TOPQ1_ttV', + 'TOPQ1_Diboson_Sherpa', + 'TOPQ1_Wjets_Sherpa22', + 'TOPQ1_Zjets_Sherpa22', +] + +samples = TopExamples.grid.Samples(names) +TopExamples.analysis.check(analysis, inputDirectory, runDirectory, samples) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis_Tutorial.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis_Tutorial.py new file mode 100755 index 0000000000000000000000000000000000000000..0ceb76cdcedbefcb95b807ce70931cb2e74a7cd6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/03LocalAnalysis_Tutorial.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.analysis +import TopExamples.grid +import TopExamples.logger as logger +import DerivationTags +import Data_rel21 +import MC16_TOPQ1 + +inputDirectory = '/tmp/YOURUSERNAME/DownloadFolder/' +runDirectory = 'test1/' +analysis = 'Dilepton' + +print '\n\n' +print logger.OKGREEN + 'MC simulation' + logger.ENDC +names = [ +'TOPQ1_ttbar_PowPy8', +] + +samples = TopExamples.grid.Samples(names) +TopExamples.analysis.check(analysis, inputDirectory, runDirectory, samples) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/04Plot.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/04Plot.py new file mode 100755 index 0000000000000000000000000000000000000000..5e6c79e8db769da1dd6184b9d79777399ce3d509 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/04Plot.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.plot +import ROOT + +integratedLuminosity = 1. #fb-1 +dilepton = True + +stack = [ + TopExamples.plot.Proc('test1/Data15.root', ROOT.kBlack, 'Data', False), + TopExamples.plot.Proc('test1/13TeV_FS_ttbar_PowhegPythiaEvtGen.root', ROOT.kRed, 'Powheg+Pythia t#bar{t}'), +# TopExamples.plot.Proc('test1/147770.Sherpa_CT10_Zee.e1434_s1933_s1911_r5591_r5625.22_08_1_output.root', ROOT.kBlue, 'Sherpa Zee'), +# TopExamples.plot.Proc('test1/147771.Sherpa_CT10_Zmumu.e1434_s1933_s1911_r5591_r5625.22_08_1_output.root', ROOT.kGreen, 'Sherpa Zmumu'), +] + +channels = ['ejets', 'mujets'] +if dilepton: + channels = ['ee', 'mumu', 'emu'] + +p = TopExamples.plot.Plotter('index.html', stack, integratedLuminosity) + +if dilepton: + p.h2('Some control plots') + + p.h3('met in Z window, at least two jets') + p.plot('ee/control_met') + p.plot('mumu/control_met') + p.br() + + p.h3('invariant mass for met < 60 + >= 2 jets') + p.plot('ee/control_invmass') + p.plot('mumu/control_invmass') + p.br() + + p.h3('njet for met < 60 in Z-window') + p.plot('ee/control_njet') + p.plot('mumu/control_njet') + p.br() + + p.h3('dilepton invariant mass for met < 60 GeV, >= 2 jets') + p.plot('ee/control_invmass') + p.plot('mumu/control_invmass') + p.br() + + p.h3('in Z window, met > 30, >= 2 jet') + p.plot('ee/dy_dphi') + p.plot('mumu/dy_dphi') + p.br() + + p.plot('ee/dy_dphi_zpt') + p.plot('mumu/dy_dphi_zpt') + p.br() + + p.plot('ee/dy_counter') + p.plot('mumu/dy_counter') + p.br() + + p.h2('All cuts except <something> style plots') + + p.h3('all cuts except Z window (then with Z window)') + p.plot('ee/control_sig_invmass') + p.plot('mumu/control_sig_invmass') + p.br() + + p.plot('ee/control_sig_invmass_cut') + p.plot('mumu/control_sig_invmass_cut') + p.br() + + p.h3('all cuts except njet') + p.plot('ee/control_sig_njet') + p.plot('mumu/control_sig_njet') + p.br() + + p.h3('all cuts except met') + p.plot('ee/control_sig_met') + p.plot('mumu/control_sig_met') + p.br() + + p.h3('emu channel ht') + p.plot('emu/ht') + p.br() + +for channel in channels: + p.h2(channel) + + p.h3('event') + p.plot(channel + '/mu') + p.plot(channel + '/mc_weight') + p.br() + + p.h3('el') + p.plot(channel + '/el_n') + p.plot(channel + '/el_pt') + p.plot(channel + '/el_eta') + p.plot(channel + '/el_phi') + p.plot(channel + '/el_e') + p.plot(channel + '/el_m') + p.plot(channel + '/el_charge') + p.br() + + p.h3('mu') + p.plot(channel + '/mu_n') + p.plot(channel + '/mu_pt') + p.plot(channel + '/mu_eta') + p.plot(channel + '/mu_phi') + p.plot(channel + '/mu_e') + p.plot(channel + '/mu_m') + p.plot(channel + '/mu_charge') + p.br() + + p.h3('jet') + p.plot(channel + '/jet_n') + p.plot(channel + '/jet_pt') + p.plot(channel + '/jet_eta') + p.plot(channel + '/jet_phi') + p.plot(channel + '/jet_e') + p.plot(channel + '/jet_mv2c20') + p.br() + + p.h3('leading jet') + p.plot(channel + '/jet0_pt') + p.plot(channel + '/jet0_eta') + p.plot(channel + '/jet0_phi') + p.plot(channel + '/jet0_e') + p.br() + + p.h3('sub-leading jet') + p.plot(channel + '/jet1_pt') + p.plot(channel + '/jet1_eta') + p.plot(channel + '/jet1_phi') + p.plot(channel + '/jet1_e') + p.br() + + p.h3('sub-sub-leading jet') + p.plot(channel + '/jet2_pt') + p.plot(channel + '/jet2_eta') + p.plot(channel + '/jet2_phi') + p.plot(channel + '/jet2_e') + p.br() + + p.h3('sub-sub-sub-leading jet') + p.plot(channel + '/jet3_pt') + p.plot(channel + '/jet3_eta') + p.plot(channel + '/jet3_phi') + p.plot(channel + '/jet3_e') + p.br() + + p.h3('met') + p.plot(channel + '/met_et') + p.plot(channel + '/met_phi') + +p.doneAndDusted() diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/10AmiYield.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/10AmiYield.py new file mode 100755 index 0000000000000000000000000000000000000000..1e7d15ca2222c6a45f727334444dac2043b0e437 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/10AmiYield.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.ami +import TopExamples.logger as logger +import sys + +if len(sys.argv) != 2: + print 'Use like this:' + print 'python %s %s' % (sys.argv[0], 'mc15_13TeV.410000.*.AOD.e3698_s2608_s2183_r6630_r6264') + print sys.exit(1) + +nameYields = TopExamples.ami.askAmi(sys.argv[1]) + +if len(nameYields) > 0: + print logger.OKBLUE + '%80s %10s' % ('Dataset name', 'Yield') + logger.ENDC + for k in sorted(nameYields.keys()): + print '%80s %10d' % (k, nameYields[k]) +else: + print 'No datasets found' \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/11CrossSection.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/11CrossSection.py new file mode 100755 index 0000000000000000000000000000000000000000..f442327f19ee54ceb53f4d275a727bc5ebd107a1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/11CrossSection.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +import TopExamples.analysis +import os +import sys + +if len(sys.argv) != 2: + print 'Use like this:' + print 'python %s %s' % (sys.argv[0], '410000') + print sys.exit(1) + +id = 0 +try: + id = int(sys.argv[1]) +except: + print sys.argv[1], 'is not a number' + print 'Use like this:' + print 'python %s %s' % (sys.argv[0], '410000') + sys.exit() + +filename = 'XSection-MC15-13TeV.data' +tdp = TopExamples.analysis.TopDataPreparation(os.getenv('ROOTCOREBIN') + '/data/TopDataPreparation/' + filename) + +print 'Using', tdp.getFilename() +print '' + +if tdp.hasID(id): + print 'ID: %s' % id + print ' Cross-section: %f (%f * %f)' % (tdp.getXsection(id), tdp.getRawXsection(id), tdp.getKfactor(id)) + print ' Shower : %s' % tdp.getShower(id) +else: + print 'ID: %s not available' % id diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data.py new file mode 100644 index 0000000000000000000000000000000000000000..766c4a0a5dacfe84a0f32f3e4270ea1a003ead75 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data.py @@ -0,0 +1,38 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import TopExamples.grid +import TopExamples.ami + +# Reprocessed 2015 data +# includes runs in: +# http://atlas.web.cern.ch/Atlas/GROUPS/DATABASE/GroupData/GoodRunsLists/data15_13TeV/20160622/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml +DATA15 = ['data15_13TeV.periodD.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667', + 'data15_13TeV.periodE.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667', + 'data15_13TeV.periodF.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667', + 'data15_13TeV.periodG.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667', + 'data15_13TeV.periodH.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667', + 'data15_13TeV.periodJ.physics_Main.PhysCont.DAOD_{}.grp15_v01_p2667'] + +# Full 2016 data (periods A-L, lumi = 33257.2 pb^{-1}) +# includes runs in: +# http://atlas.web.cern.ch/Atlas/GROUPS/DATABASE/GroupData/GoodRunsLists/data16_13TeV/20161101/data16_13TeV.periodAllYear_DetStatus-v83-pro20-15_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml +DATA16 = ['data16_13TeV.periodA.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2667', + 'data16_13TeV.periodB.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2667', + 'data16_13TeV.periodC.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2667_p2689', + 'data16_13TeV.periodD.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2689', + 'data16_13TeV.periodE.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2689', + 'data16_13TeV.periodF.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2689', + 'data16_13TeV.periodG.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2769', + 'data16_13TeV.periodI.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2769', + 'data16_13TeV.periodK.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2769', + 'data16_13TeV.periodL.physics_Main.PhysCont.DAOD_{}.grp16_v01_p2769_p2840',] + +TopExamples.grid.Add('Data15_TOPQ1').datasets = [i.format('TOPQ1') for i in DATA15] +TopExamples.grid.Add('Data15_TOPQ2').datasets = [i.format('TOPQ2') for i in DATA15] +TopExamples.grid.Add('Data15_TOPQ3').datasets = [i.format('TOPQ3') for i in DATA15] +TopExamples.grid.Add('Data15_TOPQ4').datasets = [i.format('TOPQ4') for i in DATA15] + +TopExamples.grid.Add('Data16_TOPQ1').datasets = [i.format('TOPQ1') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ2').datasets = [i.format('TOPQ2') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ3').datasets = [i.format('TOPQ3') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ4').datasets = [i.format('TOPQ4') for i in DATA16] diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data_rel21.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data_rel21.py new file mode 100644 index 0000000000000000000000000000000000000000..f9593fb3a49b205d1d3520cbd1b80f20113934f1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/Data_rel21.py @@ -0,0 +1,19 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import TopExamples.grid +import TopExamples.ami + +# Just a few runs processed with 21.0.19.2 +DATA16 = [ + 'data16_13TeV.00297730.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + 'data16_13TeV.00304008.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + 'data16_13TeV.00307126.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + 'data16_13TeV.00311071.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + 'data16_13TeV.00311287.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + 'data16_13TeV.00311321.physics_Main.deriv.DAOD_{}.r9264_p3083_p3142', + ] + +TopExamples.grid.Add('Data16_TOPQ1').datasets = [i.format('TOPQ1') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ2').datasets = [i.format('TOPQ2') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ3').datasets = [i.format('TOPQ3') for i in DATA16] +TopExamples.grid.Add('Data16_TOPQ4').datasets = [i.format('TOPQ4') for i in DATA16] diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/DerivationTags.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/DerivationTags.py new file mode 100644 index 0000000000000000000000000000000000000000..708194248934b25158e83d13099ea4e9409ef6b6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/DerivationTags.py @@ -0,0 +1,46 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import TopExamples + +#Moving the definition of ptags here, so we only have to modify them in a +#single place from now on + +#DefaultDataPtag = 'p2411' +DefaultMCSkimmedPtag = 'p2411' +DefaultMCUnskimmedPtag = 'p2413' + +#https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TopDerivations#Production_Caches +def InteractiveSubmission(): + samples = TopExamples.grid.AvailableDatasets() + + keys = sorted(samples.keys()) + + for i, s in enumerate(keys): + nsamples = len(samples[s].datasets) + txt = '' + if nsamples != 1: + txt = 's' + print ' (%d) %s (%s sample%s)' % (i, s, nsamples, txt) + + print '' + print 'Type the numbers you want to submit, separated by a comma e.g. 0,1,2,3' + data = raw_input('Type it here -> : ') + + txt_list = data.strip().split(',') + names = [keys[int(x)] for x in txt_list] + + derivation = 'DAOD_TOPQ1' + print 'Which derivation would you like [%s]? ' % derivation + input = raw_input('Type it here -> : ') + if len(input) > 0: + derivation = input + + ptag = DefaultMCSkimmedPtag + + print 'Which ptag would you like %s = skimmed, %s = not skimmed [%s] ' % (DefaultMCSkimmedPtag, DefaultMCUnskimmedPtag, ptag) + input = raw_input('Type it here -> : ') + if len(input) > 0: + ptag = input + + print names, derivation, ptag + return names, derivation, ptag diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC15c_TOPQ1.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC15c_TOPQ1.py new file mode 100644 index 0000000000000000000000000000000000000000..b9b9798ba5813c02c96e8d077b2f2d5935607e43 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC15c_TOPQ1.py @@ -0,0 +1,651 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import TopExamples.grid +# list of 25ns MC samples for the MC15c campaign +# this is a consistent mixture of different ptags + +TopExamples.grid.Add("TOPQ1_ttbar_PowPy6").datasets = [ + "mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.DAOD_TOPQ1.e3698_s2608_s2183_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_PowPy8").datasets = [ + "mc15_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.DAOD_TOPQ1.e5458_s2726_r7772_r7676_p2877", +] + +TopExamples.grid.Add("TOPQ1_ttbar_Sherpa221").datasets = [ + "mc15_13TeV.410250.Sherpa_221_NNPDF30NNLO_ttbar_SingleLeptonP_MEPS_NLO.merge.DAOD_TOPQ1.e5450_s2726_r7772_r7676_p2877", + "mc15_13TeV.410251.Sherpa_221_NNPDF30NNLO_ttbar_SingleLeptonM_MEPS_NLO.merge.DAOD_TOPQ1.e5450_s2726_r7772_r7676_p2877", + "mc15_13TeV.410252.Sherpa_221_NNPDF30NNLO_ttbar_dilepton_MEPS_NLO.merge.DAOD_TOPQ1.e5450_s2726_r7772_r7676_p2877", +] + +TopExamples.grid.Add("TOPQ1_ttbar_PowPy6_MassVar").datasets = [ + "mc15_13TeV.410037.PowhegPythiaEvtGen_P2012_ttbar_hdamp170_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2771", + "mc15_13TeV.410038.PowhegPythiaEvtGen_P2012_ttbar_hdamp171p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2771", + "mc15_13TeV.410039.PowhegPythiaEvtGen_P2012_ttbar_hdamp173p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2771", + "mc15_13TeV.410040.PowhegPythiaEvtGen_P2012_ttbar_hdamp175_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2771", + "mc15_13TeV.410041.PowhegPythiaEvtGen_P2012_ttbar_hdamp177p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2771", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_Alt").datasets = [ + "mc15_13TeV.410001.PowhegPythiaEvtGen_P2012radHi_ttbar_hdamp345_down_nonallhad.merge.DAOD_TOPQ1.e3783_s2608_r7725_r7676_p2669", + "mc15_13TeV.410002.PowhegPythiaEvtGen_P2012radLo_ttbar_hdamp172_up_nonallhad.merge.DAOD_TOPQ1.e3783_s2608_r7725_r7676_p2669", + "mc15_13TeV.410003.aMcAtNloHerwigppEvtGen_ttbar_nonallhad.merge.DAOD_TOPQ1.e4441_s2726_r7772_r7676_p2669", + "mc15_13TeV.410004.PowhegHerwigppEvtGen_UEEE5_ttbar_hdamp172p5_nonallhad.merge.DAOD_TOPQ1.e3836_a766_a821_r7676_p2669", + "mc15_13TeV.410159.aMcAtNloPythia8EvtGen_A14_NNPDF23_NNPDF30ME_ttbar_nonallhad.merge.DAOD_TOPQ1.e4683_s2726_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_TTH_aMCatNLO").datasets = [ + "mc15_13TeV.341177.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_ttH125_dil.merge.DAOD_TOPQ1.e4277_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.341270.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_ttH125_semilep.merge.DAOD_TOPQ1.e4277_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.341271.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_ttH125_allhad.merge.DAOD_TOPQ1.e4277_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.343365.aMcAtNloPythia8EvtGen_A14_NNPDF23_NNPDF30ME_ttH125_dilep.merge.DAOD_TOPQ1.e4706_s2726_r7772_r7676_p2669", + "mc15_13TeV.343366.aMcAtNloPythia8EvtGen_A14_NNPDF23_NNPDF30ME_ttH125_semilep.merge.DAOD_TOPQ1.e4706_s2726_r7772_r7676_p2669", + "mc15_13TeV.343367.aMcAtNloPythia8EvtGen_A14_NNPDF23_NNPDF30ME_ttH125_allhad.merge.DAOD_TOPQ1.e4706_s2726_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Hplus").datasets = [ + "mc15_13TeV.341541.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H200_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341542.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H225_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341543.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H250_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341544.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H275_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341545.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H300_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341546.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H350_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341547.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H400_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341548.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H500_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341549.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H600_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341550.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H700_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341551.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H800_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341552.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H900_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341553.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H1000_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341554.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H1200_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341555.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H1400_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341556.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H1600_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341557.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H1800_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + "mc15_13TeV.341558.aMcAtNloPythia8EvtGen_A14NNPDF23LO_Hplus4FS_H2000_tb.merge.DAOD_TOPQ1.e4336_a766_a821_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_OtherHiggs").datasets = [ + "mc15_13TeV.342283.PowhegPythia8EvtGen_CT10_AZNLOCTEQ6L1_VBFH125_inc.merge.DAOD_TOPQ1.e4246_s2726_r7772_r7676_p2669", + "mc15_13TeV.342284.Pythia8EvtGen_A14NNPDF23LO_WH125_inc.merge.DAOD_TOPQ1.e4246_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.342285.Pythia8EvtGen_A14NNPDF23LO_ZH125_inc.merge.DAOD_TOPQ1.e4246_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.342286.aMcAtNloPythia8EvtGen_A14NNPDF23LO_bbH125_yb2_inc.merge.DAOD_TOPQ1.e4259_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.342287.aMcAtNloPythia8EvtGen_A14NNPDF23LO_bbH125_ybyt_inc.merge.DAOD_TOPQ1.e4259_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.342299.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_ttH125_inc.merge.DAOD_TOPQ1.e4346_s2608_s2183_a821_r7676_p2669", + "mc15_13TeV.342299.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_ttH125_inc.merge.DAOD_TOPQ1.e4346_s2608_s2183_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_MadGraph").datasets = [ + "mc15_13TeV.343852.MadGraphPythia8EvtGen_A14NNPDF23LO_ttbar_Np0.merge.DAOD_TOPQ1.e4849_a766_a818_r7676_p2669", + "mc15_13TeV.343853.MadGraphPythia8EvtGen_A14NNPDF23LO_ttbar_Np1.merge.DAOD_TOPQ1.e4849_a766_a818_r7676_p2669", + "mc15_13TeV.343854.MadGraphPythia8EvtGen_A14NNPDF23LO_ttbar_Np2.merge.DAOD_TOPQ1.e4849_a766_a818_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Diboson_Sherpa").datasets = [ + "mc15_13TeV.361063.Sherpa_CT10_llll.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361064.Sherpa_CT10_lllvSFMinus.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361065.Sherpa_CT10_lllvOFMinus.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361066.Sherpa_CT10_lllvSFPlus.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361067.Sherpa_CT10_lllvOFPlus.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361068.Sherpa_CT10_llvv.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361070.Sherpa_CT10_llvvjj_ss_EW6.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361071.Sherpa_CT10_lllvjj_EW6.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361072.Sherpa_CT10_lllljj_EW6.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361073.Sherpa_CT10_ggllll.merge.DAOD_TOPQ1.e3836_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361077.Sherpa_CT10_ggllvv.merge.DAOD_TOPQ1.e4641_s2726_r7772_r7676_p2669", + "mc15_13TeV.361091.Sherpa_CT10_WplvWmqq_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7725_r7676_p2669", + "mc15_13TeV.361092.Sherpa_CT10_WpqqWmlv_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7725_r7676_p2669", + "mc15_13TeV.361093.Sherpa_CT10_WlvZqq_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7725_r7676_p2669", + "mc15_13TeV.361094.Sherpa_CT10_WqqZll_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7725_r7676_p2669", + "mc15_13TeV.361095.Sherpa_CT10_WqqZvv_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7772_r7676_p2669", + "mc15_13TeV.361096.Sherpa_CT10_ZqqZll_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7725_r7676_p2669", + "mc15_13TeV.361097.Sherpa_CT10_ZqqZvv_SHv21_improved.merge.DAOD_TOPQ1.e4607_s2726_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Wjets_PowhegPy8").datasets = [ + "mc15_13TeV.361100.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplusenu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361101.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplusmunu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361102.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wplustaunu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361103.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wminusenu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361104.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wminusmunu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361105.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Wminustaunu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Zjets_PowhegPy8").datasets = [ + "mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.merge.DAOD_TOPQ1.e3601_s2576_s2132_r7725_r7676_p2669", + "mc15_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.merge.DAOD_TOPQ1.e3601_s2726_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Wjets_Sherpa").datasets = [ + "mc15_13TeV.361300.Sherpa_CT10_Wenu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361301.Sherpa_CT10_Wenu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361302.Sherpa_CT10_Wenu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361303.Sherpa_CT10_Wenu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361304.Sherpa_CT10_Wenu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361305.Sherpa_CT10_Wenu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361306.Sherpa_CT10_Wenu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361307.Sherpa_CT10_Wenu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361308.Sherpa_CT10_Wenu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361309.Sherpa_CT10_Wenu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361310.Sherpa_CT10_Wenu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361311.Sherpa_CT10_Wenu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361312.Sherpa_CT10_Wenu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361313.Sherpa_CT10_Wenu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361314.Sherpa_CT10_Wenu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361315.Sherpa_CT10_Wenu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361316.Sherpa_CT10_Wenu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361317.Sherpa_CT10_Wenu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361318.Sherpa_CT10_Wenu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361319.Sherpa_CT10_Wenu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361320.Sherpa_CT10_Wenu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361321.Sherpa_CT10_Wenu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361322.Sherpa_CT10_Wenu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361323.Sherpa_CT10_Wenu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361324.Sherpa_CT10_Wmunu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361325.Sherpa_CT10_Wmunu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361326.Sherpa_CT10_Wmunu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3651_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361327.Sherpa_CT10_Wmunu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361328.Sherpa_CT10_Wmunu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361329.Sherpa_CT10_Wmunu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361330.Sherpa_CT10_Wmunu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361331.Sherpa_CT10_Wmunu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361332.Sherpa_CT10_Wmunu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361333.Sherpa_CT10_Wmunu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361334.Sherpa_CT10_Wmunu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361335.Sherpa_CT10_Wmunu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361336.Sherpa_CT10_Wmunu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361337.Sherpa_CT10_Wmunu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361338.Sherpa_CT10_Wmunu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361339.Sherpa_CT10_Wmunu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361340.Sherpa_CT10_Wmunu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361341.Sherpa_CT10_Wmunu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361342.Sherpa_CT10_Wmunu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361343.Sherpa_CT10_Wmunu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361344.Sherpa_CT10_Wmunu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361345.Sherpa_CT10_Wmunu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361346.Sherpa_CT10_Wmunu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361347.Sherpa_CT10_Wmunu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361348.Sherpa_CT10_Wtaunu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361349.Sherpa_CT10_Wtaunu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361350.Sherpa_CT10_Wtaunu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361351.Sherpa_CT10_Wtaunu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361352.Sherpa_CT10_Wtaunu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361353.Sherpa_CT10_Wtaunu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361354.Sherpa_CT10_Wtaunu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361355.Sherpa_CT10_Wtaunu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361356.Sherpa_CT10_Wtaunu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361357.Sherpa_CT10_Wtaunu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361358.Sherpa_CT10_Wtaunu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361359.Sherpa_CT10_Wtaunu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361360.Sherpa_CT10_Wtaunu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361361.Sherpa_CT10_Wtaunu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361362.Sherpa_CT10_Wtaunu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361363.Sherpa_CT10_Wtaunu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361364.Sherpa_CT10_Wtaunu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361365.Sherpa_CT10_Wtaunu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361366.Sherpa_CT10_Wtaunu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361367.Sherpa_CT10_Wtaunu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361368.Sherpa_CT10_Wtaunu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361369.Sherpa_CT10_Wtaunu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361370.Sherpa_CT10_Wtaunu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.361371.Sherpa_CT10_Wtaunu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Zjets_Sherpa").datasets = [ + "mc15_13TeV.361372.Sherpa_CT10_Zee_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361373.Sherpa_CT10_Zee_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361374.Sherpa_CT10_Zee_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361375.Sherpa_CT10_Zee_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361376.Sherpa_CT10_Zee_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361377.Sherpa_CT10_Zee_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361378.Sherpa_CT10_Zee_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361379.Sherpa_CT10_Zee_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361380.Sherpa_CT10_Zee_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361381.Sherpa_CT10_Zee_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361382.Sherpa_CT10_Zee_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361383.Sherpa_CT10_Zee_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361384.Sherpa_CT10_Zee_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361385.Sherpa_CT10_Zee_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361386.Sherpa_CT10_Zee_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361387.Sherpa_CT10_Zee_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361388.Sherpa_CT10_Zee_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361389.Sherpa_CT10_Zee_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361390.Sherpa_CT10_Zee_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361391.Sherpa_CT10_Zee_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361392.Sherpa_CT10_Zee_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361393.Sherpa_CT10_Zee_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361394.Sherpa_CT10_Zee_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361395.Sherpa_CT10_Zee_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361396.Sherpa_CT10_Zmumu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361397.Sherpa_CT10_Zmumu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361398.Sherpa_CT10_Zmumu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361399.Sherpa_CT10_Zmumu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361400.Sherpa_CT10_Zmumu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361401.Sherpa_CT10_Zmumu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361402.Sherpa_CT10_Zmumu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361403.Sherpa_CT10_Zmumu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361404.Sherpa_CT10_Zmumu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3651_s2586_s2174_r7772_r7676_p2669", + "mc15_13TeV.361405.Sherpa_CT10_Zmumu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361406.Sherpa_CT10_Zmumu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361407.Sherpa_CT10_Zmumu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361408.Sherpa_CT10_Zmumu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361409.Sherpa_CT10_Zmumu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361410.Sherpa_CT10_Zmumu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361411.Sherpa_CT10_Zmumu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361412.Sherpa_CT10_Zmumu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361413.Sherpa_CT10_Zmumu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361414.Sherpa_CT10_Zmumu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361415.Sherpa_CT10_Zmumu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361416.Sherpa_CT10_Zmumu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361417.Sherpa_CT10_Zmumu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361418.Sherpa_CT10_Zmumu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361419.Sherpa_CT10_Zmumu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361420.Sherpa_CT10_Ztautau_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361421.Sherpa_CT10_Ztautau_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361422.Sherpa_CT10_Ztautau_Pt0_70_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361423.Sherpa_CT10_Ztautau_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361424.Sherpa_CT10_Ztautau_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361425.Sherpa_CT10_Ztautau_Pt70_140_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361426.Sherpa_CT10_Ztautau_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361427.Sherpa_CT10_Ztautau_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361428.Sherpa_CT10_Ztautau_Pt140_280_BFilter.merge.DAOD_TOPQ1.e3733_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361429.Sherpa_CT10_Ztautau_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361430.Sherpa_CT10_Ztautau_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361431.Sherpa_CT10_Ztautau_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361432.Sherpa_CT10_Ztautau_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361433.Sherpa_CT10_Ztautau_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361434.Sherpa_CT10_Ztautau_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361435.Sherpa_CT10_Ztautau_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361436.Sherpa_CT10_Ztautau_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361437.Sherpa_CT10_Ztautau_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361438.Sherpa_CT10_Ztautau_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361439.Sherpa_CT10_Ztautau_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361440.Sherpa_CT10_Ztautau_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361441.Sherpa_CT10_Ztautau_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361442.Sherpa_CT10_Ztautau_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361443.Sherpa_CT10_Ztautau_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4133_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361468.Sherpa_CT10_Zee_Mll10to40_Pt0_70_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361469.Sherpa_CT10_Zee_Mll10to40_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361470.Sherpa_CT10_Zee_Mll10to40_Pt70_140_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361471.Sherpa_CT10_Zee_Mll10to40_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361472.Sherpa_CT10_Zee_Mll10to40_Pt140_400_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361473.Sherpa_CT10_Zee_Mll10to40_Pt140_400_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361474.Sherpa_CT10_Zee_Mll10to40_Pt400_E_CMS_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361475.Sherpa_CT10_Zee_Mll10to40_Pt400_E_CMS_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361476.Sherpa_CT10_Zmumu_Mll10to40_Pt0_70_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361477.Sherpa_CT10_Zmumu_Mll10to40_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361478.Sherpa_CT10_Zmumu_Mll10to40_Pt70_140_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361479.Sherpa_CT10_Zmumu_Mll10to40_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361480.Sherpa_CT10_Zmumu_Mll10to40_Pt140_400_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361481.Sherpa_CT10_Zmumu_Mll10to40_Pt140_400_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361482.Sherpa_CT10_Zmumu_Mll10to40_Pt400_E_CMS_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361483.Sherpa_CT10_Zmumu_Mll10to40_Pt400_E_CMS_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361484.Sherpa_CT10_Ztautau_Mll10to40_Pt0_70_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361485.Sherpa_CT10_Ztautau_Mll10to40_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361486.Sherpa_CT10_Ztautau_Mll10to40_Pt70_140_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361487.Sherpa_CT10_Ztautau_Mll10to40_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361488.Sherpa_CT10_Ztautau_Mll10to40_Pt140_400_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361489.Sherpa_CT10_Ztautau_Mll10to40_Pt140_400_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361490.Sherpa_CT10_Ztautau_Mll10to40_Pt400_E_CMS_BVeto.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361491.Sherpa_CT10_Ztautau_Mll10to40_Pt400_E_CMS_BFilter.merge.DAOD_TOPQ1.e4198_s2608_s2183_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Triboson_Sherpa").datasets = [ + "mc15_13TeV.361620.Sherpa_CT10_WWW_3l3v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r8112_r7676_p2669", + "mc15_13TeV.361621.Sherpa_CT10_WWZ_4l2v.merge.DAOD_TOPQ1.e4053_s2608_s2183_r8112_r7676_p2669", + "mc15_13TeV.361622.Sherpa_CT10_WWZ_2l4v.merge.DAOD_TOPQ1.e4053_s2608_s2183_r8112_r7676_p2669", + "mc15_13TeV.361623.Sherpa_CT10_WZZ_5l1v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r8112_r7676_p2669", + "mc15_13TeV.361624.Sherpa_CT10_WZZ_3l3v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r8112_r7676_p2669", + "mc15_13TeV.361625.Sherpa_CT10_ZZZ_6l0v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361626.Sherpa_CT10_ZZZ_4l2v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r7772_r7676_p2669", + "mc15_13TeV.361627.Sherpa_CT10_ZZZ_2l4v.merge.DAOD_TOPQ1.e4093_s2608_s2183_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_Zjets_Sherpa22").datasets = [ + "mc15_13TeV.363102.Sherpa_NNPDF30NNLO_Ztautau_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363103.Sherpa_NNPDF30NNLO_Ztautau_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363104.Sherpa_NNPDF30NNLO_Ztautau_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4792_s2726_r7725_r7676_p2669", + "mc15_13TeV.363105.Sherpa_NNPDF30NNLO_Ztautau_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363106.Sherpa_NNPDF30NNLO_Ztautau_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363107.Sherpa_NNPDF30NNLO_Ztautau_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363108.Sherpa_NNPDF30NNLO_Ztautau_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363109.Sherpa_NNPDF30NNLO_Ztautau_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4792_s2726_r7725_r7676_p2669", + "mc15_13TeV.363110.Sherpa_NNPDF30NNLO_Ztautau_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4792_s2726_r7725_r7676_p2669", + "mc15_13TeV.363111.Sherpa_NNPDF30NNLO_Ztautau_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363112.Sherpa_NNPDF30NNLO_Ztautau_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363113.Sherpa_NNPDF30NNLO_Ztautau_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363114.Sherpa_NNPDF30NNLO_Ztautau_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363115.Sherpa_NNPDF30NNLO_Ztautau_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4792_s2726_r7725_r7676_p2669", + "mc15_13TeV.363116.Sherpa_NNPDF30NNLO_Ztautau_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4742_s2726_r7725_r7676_p2669", + "mc15_13TeV.363117.Sherpa_NNPDF30NNLO_Ztautau_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363118.Sherpa_NNPDF30NNLO_Ztautau_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363119.Sherpa_NNPDF30NNLO_Ztautau_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4666_s2726_r7725_r7676_p2669", + "mc15_13TeV.363120.Sherpa_NNPDF30NNLO_Ztautau_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4690_s2726_r7725_r7676_p2669", + "mc15_13TeV.363121.Sherpa_NNPDF30NNLO_Ztautau_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4690_s2726_r7725_r7676_p2669", + "mc15_13TeV.363122.Sherpa_NNPDF30NNLO_Ztautau_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4792_s2726_r7725_r7676_p2669", + "mc15_13TeV.363361.Sherpa_NNPDF30NNLO_Ztautau_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4689_s2726_r7725_r7676_p2669", + "mc15_13TeV.363362.Sherpa_NNPDF30NNLO_Ztautau_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4689_s2726_r7725_r7676_p2669", + "mc15_13TeV.363363.Sherpa_NNPDF30NNLO_Ztautau_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4743_s2726_r7725_r7676_p2669", + "mc15_13TeV.363364.Sherpa_NNPDF30NNLO_Zmumu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363365.Sherpa_NNPDF30NNLO_Zmumu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363366.Sherpa_NNPDF30NNLO_Zmumu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363367.Sherpa_NNPDF30NNLO_Zmumu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363368.Sherpa_NNPDF30NNLO_Zmumu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363369.Sherpa_NNPDF30NNLO_Zmumu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363370.Sherpa_NNPDF30NNLO_Zmumu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363371.Sherpa_NNPDF30NNLO_Zmumu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363372.Sherpa_NNPDF30NNLO_Zmumu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363373.Sherpa_NNPDF30NNLO_Zmumu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363374.Sherpa_NNPDF30NNLO_Zmumu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363375.Sherpa_NNPDF30NNLO_Zmumu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363376.Sherpa_NNPDF30NNLO_Zmumu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363377.Sherpa_NNPDF30NNLO_Zmumu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363378.Sherpa_NNPDF30NNLO_Zmumu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363379.Sherpa_NNPDF30NNLO_Zmumu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363380.Sherpa_NNPDF30NNLO_Zmumu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363381.Sherpa_NNPDF30NNLO_Zmumu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363382.Sherpa_NNPDF30NNLO_Zmumu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363383.Sherpa_NNPDF30NNLO_Zmumu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363384.Sherpa_NNPDF30NNLO_Zmumu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363385.Sherpa_NNPDF30NNLO_Zmumu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363386.Sherpa_NNPDF30NNLO_Zmumu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363387.Sherpa_NNPDF30NNLO_Zmumu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363388.Sherpa_NNPDF30NNLO_Zee_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363389.Sherpa_NNPDF30NNLO_Zee_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363390.Sherpa_NNPDF30NNLO_Zee_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363391.Sherpa_NNPDF30NNLO_Zee_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363392.Sherpa_NNPDF30NNLO_Zee_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363393.Sherpa_NNPDF30NNLO_Zee_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363394.Sherpa_NNPDF30NNLO_Zee_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363395.Sherpa_NNPDF30NNLO_Zee_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363396.Sherpa_NNPDF30NNLO_Zee_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363397.Sherpa_NNPDF30NNLO_Zee_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363398.Sherpa_NNPDF30NNLO_Zee_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363399.Sherpa_NNPDF30NNLO_Zee_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363400.Sherpa_NNPDF30NNLO_Zee_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363401.Sherpa_NNPDF30NNLO_Zee_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363402.Sherpa_NNPDF30NNLO_Zee_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363403.Sherpa_NNPDF30NNLO_Zee_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363404.Sherpa_NNPDF30NNLO_Zee_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363405.Sherpa_NNPDF30NNLO_Zee_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363406.Sherpa_NNPDF30NNLO_Zee_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363407.Sherpa_NNPDF30NNLO_Zee_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363408.Sherpa_NNPDF30NNLO_Zee_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + "mc15_13TeV.363409.Sherpa_NNPDF30NNLO_Zee_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363410.Sherpa_NNPDF30NNLO_Zee_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4716_s2726_r7725_r7676_p2669", + "mc15_13TeV.363411.Sherpa_NNPDF30NNLO_Zee_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4772_s2726_r7725_r7676_p2669", + + ] + +TopExamples.grid.Add("TOPQ1_Wjets_Sherpa22").datasets = [ + "mc15_13TeV.363331.Sherpa_NNPDF30NNLO_Wtaunu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363332.Sherpa_NNPDF30NNLO_Wtaunu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363333.Sherpa_NNPDF30NNLO_Wtaunu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363334.Sherpa_NNPDF30NNLO_Wtaunu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363335.Sherpa_NNPDF30NNLO_Wtaunu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363336.Sherpa_NNPDF30NNLO_Wtaunu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363337.Sherpa_NNPDF30NNLO_Wtaunu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363338.Sherpa_NNPDF30NNLO_Wtaunu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363339.Sherpa_NNPDF30NNLO_Wtaunu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363340.Sherpa_NNPDF30NNLO_Wtaunu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363341.Sherpa_NNPDF30NNLO_Wtaunu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363342.Sherpa_NNPDF30NNLO_Wtaunu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363343.Sherpa_NNPDF30NNLO_Wtaunu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363344.Sherpa_NNPDF30NNLO_Wtaunu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363345.Sherpa_NNPDF30NNLO_Wtaunu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363346.Sherpa_NNPDF30NNLO_Wtaunu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363347.Sherpa_NNPDF30NNLO_Wtaunu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363348.Sherpa_NNPDF30NNLO_Wtaunu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363349.Sherpa_NNPDF30NNLO_Wtaunu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363350.Sherpa_NNPDF30NNLO_Wtaunu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363351.Sherpa_NNPDF30NNLO_Wtaunu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4779_s2726_r7725_r7676_p2669", + "mc15_13TeV.363352.Sherpa_NNPDF30NNLO_Wtaunu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363353.Sherpa_NNPDF30NNLO_Wtaunu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363354.Sherpa_NNPDF30NNLO_Wtaunu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4709_s2726_r7725_r7676_p2669", + "mc15_13TeV.363436.Sherpa_NNPDF30NNLO_Wmunu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363437.Sherpa_NNPDF30NNLO_Wmunu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363438.Sherpa_NNPDF30NNLO_Wmunu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363439.Sherpa_NNPDF30NNLO_Wmunu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363440.Sherpa_NNPDF30NNLO_Wmunu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363441.Sherpa_NNPDF30NNLO_Wmunu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4771_s2726_r7725_r7676_p2669", + "mc15_13TeV.363442.Sherpa_NNPDF30NNLO_Wmunu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363443.Sherpa_NNPDF30NNLO_Wmunu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363444.Sherpa_NNPDF30NNLO_Wmunu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363445.Sherpa_NNPDF30NNLO_Wmunu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363446.Sherpa_NNPDF30NNLO_Wmunu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363447.Sherpa_NNPDF30NNLO_Wmunu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363448.Sherpa_NNPDF30NNLO_Wmunu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363449.Sherpa_NNPDF30NNLO_Wmunu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363450.Sherpa_NNPDF30NNLO_Wmunu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363451.Sherpa_NNPDF30NNLO_Wmunu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363452.Sherpa_NNPDF30NNLO_Wmunu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363453.Sherpa_NNPDF30NNLO_Wmunu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363454.Sherpa_NNPDF30NNLO_Wmunu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363455.Sherpa_NNPDF30NNLO_Wmunu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363456.Sherpa_NNPDF30NNLO_Wmunu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363457.Sherpa_NNPDF30NNLO_Wmunu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363458.Sherpa_NNPDF30NNLO_Wmunu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363459.Sherpa_NNPDF30NNLO_Wmunu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363460.Sherpa_NNPDF30NNLO_Wenu_Pt0_70_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363461.Sherpa_NNPDF30NNLO_Wenu_Pt0_70_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363462.Sherpa_NNPDF30NNLO_Wenu_Pt0_70_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363463.Sherpa_NNPDF30NNLO_Wenu_Pt70_140_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363464.Sherpa_NNPDF30NNLO_Wenu_Pt70_140_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363465.Sherpa_NNPDF30NNLO_Wenu_Pt70_140_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363466.Sherpa_NNPDF30NNLO_Wenu_Pt140_280_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363467.Sherpa_NNPDF30NNLO_Wenu_Pt140_280_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363468.Sherpa_NNPDF30NNLO_Wenu_Pt140_280_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363469.Sherpa_NNPDF30NNLO_Wenu_Pt280_500_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363470.Sherpa_NNPDF30NNLO_Wenu_Pt280_500_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363471.Sherpa_NNPDF30NNLO_Wenu_Pt280_500_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363472.Sherpa_NNPDF30NNLO_Wenu_Pt500_700_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363473.Sherpa_NNPDF30NNLO_Wenu_Pt500_700_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363474.Sherpa_NNPDF30NNLO_Wenu_Pt500_700_BFilter.merge.DAOD_TOPQ1.e4771_s2726_r7725_r7676_p2669", + "mc15_13TeV.363475.Sherpa_NNPDF30NNLO_Wenu_Pt700_1000_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363476.Sherpa_NNPDF30NNLO_Wenu_Pt700_1000_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363477.Sherpa_NNPDF30NNLO_Wenu_Pt700_1000_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363478.Sherpa_NNPDF30NNLO_Wenu_Pt1000_2000_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363479.Sherpa_NNPDF30NNLO_Wenu_Pt1000_2000_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363480.Sherpa_NNPDF30NNLO_Wenu_Pt1000_2000_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363481.Sherpa_NNPDF30NNLO_Wenu_Pt2000_E_CMS_CVetoBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", + "mc15_13TeV.363482.Sherpa_NNPDF30NNLO_Wenu_Pt2000_E_CMS_CFilterBVeto.merge.DAOD_TOPQ1.e4715_s2726_r7772_r7676_p2669", + "mc15_13TeV.363483.Sherpa_NNPDF30NNLO_Wenu_Pt2000_E_CMS_BFilter.merge.DAOD_TOPQ1.e4715_s2726_r7725_r7676_p2669", +] + +TopExamples.grid.Add("TOPQ1_Zjets_Sherpa221").datasets = [ + "mc15_13TeV.364114.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364115.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364116.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364117.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364118.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364119.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364120.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364121.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364122.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364123.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364124.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364125.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364126.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364127.Sherpa_221_NNPDF30NNLO_Zee_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5299_s2726_r7772_r7676_p2722", + "mc15_13TeV.364100.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364101.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364102.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364103.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364104.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364105.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364106.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364107.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364108.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364109.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364110.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364111.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364112.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364113.Sherpa_221_NNPDF30NNLO_Zmumu_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5271_s2726_r7772_r7676_p2722", + "mc15_13TeV.364128.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364129.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364130.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364131.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364132.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364133.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364134.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364135.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364136.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364137.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364138.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5313_s2726_r7772_r7676_p2722", + "mc15_13TeV.364139.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5313_s2726_r7772_r7676_p2722", + "mc15_13TeV.364140.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + "mc15_13TeV.364141.Sherpa_221_NNPDF30NNLO_Ztautau_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5307_s2726_r7772_r7676_p2722", + ] + +TopExamples.grid.Add("TOPQ1_Wjets_Sherpa221").datasets = [ + "mc15_13TeV.364170.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364171.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364172.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364173.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364174.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364175.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364176.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364177.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364178.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364179.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364180.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364181.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364182.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364183.Sherpa_221_NNPDF30NNLO_Wenu_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364156.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364157.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364158.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364159.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364160.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364161.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364162.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364163.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364164.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364165.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364166.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364167.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364168.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364169.Sherpa_221_NNPDF30NNLO_Wmunu_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364184.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV0_70_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364185.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV0_70_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364186.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV0_70_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364187.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV70_140_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364188.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV70_140_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364189.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV70_140_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364190.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV140_280_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364191.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV140_280_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364192.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV140_280_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364193.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV280_500_CVetoBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364194.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV280_500_CFilterBVeto.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364195.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV280_500_BFilter.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364196.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV500_1000.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + "mc15_13TeV.364197.Sherpa_221_NNPDF30NNLO_Wtaunu_MAXHTPTV1000_E_CMS.merge.DAOD_TOPQ1.e5340_s2726_r7772_r7676_p2842", + ] + + + +TopExamples.grid.Add("TOPQ1_ttbar_allhad").datasets = [ + "mc15_13TeV.410007.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_allhad.merge.DAOD_TOPQ1.e4135_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410008.aMcAtNloHerwigppEvtGen_ttbar_allhad.merge.DAOD_TOPQ1.e3964_s2726_r7772_r7676_p2669", + "mc15_13TeV.410160.aMcAtNloPythia8EvtGen_A14_NNPDF23_NNPDF30ME_ttbar_allhad.merge.DAOD_TOPQ1.e4683_s2726_r7725_r7676_p2669", + "mc15_13TeV.410161.PowhegPythiaEvtGen_P2012radHi_ttbar_hdamp345_down_allhad.merge.DAOD_TOPQ1.e4837_s2726_r7772_r7676_p2669", + "mc15_13TeV.410162.PowhegPythiaEvtGen_P2012radLo_ttbar_hdamp172p5_up_allhad.merge.DAOD_TOPQ1.e4837_s2726_r7772_r7676_p2669", + "mc15_13TeV.410163.PowhegHerwigppEvtGen_UEEE5_ttbar_hdamp172p5_allhad.merge.DAOD_TOPQ1.e4836_s2726_r7772_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_dil").datasets = [ + "mc15_13TeV.410009.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_dil.merge.DAOD_TOPQ1.e4511_s2608_s2183_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_singleTop_PowPy6").datasets = [ + "mc15_13TeV.410011.PowhegPythiaEvtGen_P2012_singletop_tchan_lept_top.merge.DAOD_TOPQ1.e3824_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410012.PowhegPythiaEvtGen_P2012_singletop_tchan_lept_antitop.merge.DAOD_TOPQ1.e3824_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410013.PowhegPythiaEvtGen_P2012_Wt_inclusive_top.merge.DAOD_TOPQ1.e3753_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410014.PowhegPythiaEvtGen_P2012_Wt_inclusive_antitop.merge.DAOD_TOPQ1.e3753_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410025.PowhegPythiaEvtGen_P2012_SingleTopSchan_noAllHad_top.merge.DAOD_TOPQ1.e3998_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410026.PowhegPythiaEvtGen_P2012_SingleTopSchan_noAllHad_antitop.merge.DAOD_TOPQ1.e3998_s2608_s2183_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_tchan_ScaleVar").datasets = [ + "mc15_13TeV.410017.PowhegPythiaEvtGen_P2012radLo_singletop_tchan_lept_top.merge.DAOD_TOPQ1.e3978_a766_a818_r7676_p2669", + "mc15_13TeV.410018.PowhegPythiaEvtGen_P2012radHi_singletop_tchan_lept_top.merge.DAOD_TOPQ1.e3978_a766_a818_r7676_p2669", + "mc15_13TeV.410019.PowhegPythiaEvtGen_P2012radLo_singletop_tchan_lept_antitop.merge.DAOD_TOPQ1.e3978_a766_a818_r7676_p2669", + "mc15_13TeV.410020.PowhegPythiaEvtGen_P2012radHi_singletop_tchan_lept_antitop.merge.DAOD_TOPQ1.e3978_a766_a818_r7676_p2669", + "mc15_13TeV.410047.PowhegHerwigppEvtGen_UEEE5_singletop_tchan_lept_top.merge.DAOD_TOPQ1.e4775_a766_a818_r7676_p2669", + "mc15_13TeV.410048.PowhegHerwigppEvtGen_UEEE5_singletop_tchan_lept_antitop.merge.DAOD_TOPQ1.e4775_a766_a818_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_Sherpa").datasets = [ + "mc15_13TeV.410021.Sherpa_CT10_ttbar_DiLepton_MEPS_NLO.merge.DAOD_TOPQ1.e3957_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410022.Sherpa_CT10_ttbar_SingleLeptonP_MEPS_NLO.merge.DAOD_TOPQ1.e3957_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410023.Sherpa_CT10_ttbar_SingleLeptonM_MEPS_NLO.merge.DAOD_TOPQ1.e3957_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410024.Sherpa_CT10_ttbar_AllHadron_MEPS_NLO.merge.DAOD_TOPQ1.e3957_s2608_s2183_r7725_r7676_p2669", +] + +TopExamples.grid.Add("TOPQ1_ttbar_MassVar").datasets = [ + "mc15_13TeV.410037.PowhegPythiaEvtGen_P2012_ttbar_hdamp170_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410038.PowhegPythiaEvtGen_P2012_ttbar_hdamp171p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410039.PowhegPythiaEvtGen_P2012_ttbar_hdamp173p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410040.PowhegPythiaEvtGen_P2012_ttbar_hdamp175_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410041.PowhegPythiaEvtGen_P2012_ttbar_hdamp177p5_nonallhad.merge.DAOD_TOPQ1.e4529_s2608_s2183_r7725_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_ttbar_MassVar_allhad").datasets = [ + "mc15_13TeV.410042.PowhegPythiaEvtGen_P2012_ttbar_hdamp170_allhad.merge.DAOD_TOPQ1.e4510_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410043.PowhegPythiaEvtGen_P2012_ttbar_hdamp171p5_allhad.merge.DAOD_TOPQ1.e4510_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410044.PowhegPythiaEvtGen_P2012_ttbar_hdamp173p5_allhad.merge.DAOD_TOPQ1.e4510_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410045.PowhegPythiaEvtGen_P2012_ttbar_hdamp175_allhad.merge.DAOD_TOPQ1.e4510_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410046.PowhegPythiaEvtGen_P2012_ttbar_hdamp177p5_allhad.merge.DAOD_TOPQ1.e4510_s2608_s2183_r7725_r7676_p2669", + ] + + +TopExamples.grid.Add("TOPQ1_ttV").datasets = [ + "mc15_13TeV.410050.MadGraphPythiaEvtGen_P2012_tZ_4fl_tchan_noAllHad.merge.DAOD_TOPQ1.e4279_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410080.MadGraphPythia8EvtGen_A14NNPDF23_4topSM.merge.DAOD_TOPQ1.e4111_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410081.MadGraphPythia8EvtGen_A14NNPDF23_ttbarWW.merge.DAOD_TOPQ1.e4111_s2608_s2183_r7725_r7676_p2669", + "mc15_13TeV.410155.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_ttW.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410156.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_ttZnunu.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410157.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_ttZqq.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410218.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_ttee.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410219.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_ttmumu.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410220.aMcAtNloPythia8EvtGen_MEN30NLO_A14N23LO_tttautau.merge.DAOD_TOPQ1.e5070_s2726_r7772_r7676_p2669", + "mc15_13TeV.410215.aMcAtNloPythia8EvtGen_A14_NNPDF23LO_260000_tWZDR.merge.DAOD_TOPQ1.e4851_s2726_r7725_r7676_p2669", + "mc15_13TeV.410217.aMcAtNloHerwigppEvtGen_UEEE5_CTEQ6L1_CT10ME_260000_tWZDR.merge.DAOD_TOPQ1.e4851_s2726_r7725_r7676_p2669", +] + +TopExamples.grid.Add("TOPQ1_Wt_schan_ScaleVar").datasets = [ + "mc15_13TeV.410099.PowhegPythiaEvtGen_P2012radHi_Wt_inclusive_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410100.PowhegPythiaEvtGen_P2012radLo_Wt_inclusive_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410101.PowhegPythiaEvtGen_P2012radHi_Wt_inclusive_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410102.PowhegPythiaEvtGen_P2012radLo_Wt_inclusive_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410103.PowhegPythiaEvtGen_P2012radHi_Wt_dilepton_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410104.PowhegPythiaEvtGen_P2012radLo_Wt_dilepton_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410105.PowhegPythiaEvtGen_P2012radHi_Wt_dilepton_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410106.PowhegPythiaEvtGen_P2012radLo_Wt_dilepton_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410107.PowhegPythiaEvtGen_P2012radHi_SingleTopSchan_lept_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410108.PowhegPythiaEvtGen_P2012radLo_SingleTopSchan_lept_top.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410109.PowhegPythiaEvtGen_P2012radHi_SingleTopSchan_lept_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + "mc15_13TeV.410110.PowhegPythiaEvtGen_P2012radLo_SingleTopSchan_lept_antitop.merge.DAOD_TOPQ1.e4403_a766_a818_r7676_p2669", + ] + +TopExamples.grid.Add("TOPQ1_").datasets = [ + "mc15_13TeV.410111.MadGraphPythia8EvtGen_A14NNPDF23LO_ttee_Np0.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", + "mc15_13TeV.410112.MadGraphPythia8EvtGen_A14NNPDF23LO_ttee_Np1.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", + "mc15_13TeV.410113.MadGraphPythia8EvtGen_A14NNPDF23LO_ttmumu_Np0.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", + "mc15_13TeV.410114.MadGraphPythia8EvtGen_A14NNPDF23LO_ttmumu_Np1.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", + "mc15_13TeV.410115.MadGraphPythia8EvtGen_A14NNPDF23LO_tttautau_Np0.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", + "mc15_13TeV.410116.MadGraphPythia8EvtGen_A14NNPDF23LO_tttautau_Np1.merge.DAOD_TOPQ1.e4632_s2726_r7725_r7676_p2669", +] + +TopExamples.grid.Add("TOPQ1_ttbb_PowhegPy6").datasets = [ + "mc15_13TeV.410120.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad_bfilter.merge.DAOD_TOPQ1.e4373_s2608_r7725_r7676_p2669", + "mc15_13TeV.410121.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_dil_bfilter.merge.DAOD_TOPQ1.e4426_s2726_r7725_r7676_p2669", +] + +TopExamples.grid.Add("TOPQ1_ttbar_Sherpa22").datasets = [ + "mc15_13TeV.410186.Sherpa_NNPDF30NNLO_ttbar_AllHadronic_MEPS_NLO.merge.DAOD_TOPQ1.e4714_s2726_r7725_r7676_p2669", + "mc15_13TeV.410187.Sherpa_NNPDF30NNLO_ttbar_SingleLeptonP_MEPS_NLO.merge.DAOD_TOPQ1.e4714_s2726_r7725_r7676_p2669", + "mc15_13TeV.410188.Sherpa_NNPDF30NNLO_ttbar_SingleLeptonM_MEPS_NLO.merge.DAOD_TOPQ1.e4714_s2726_r7725_r7676_p2669", + "mc15_13TeV.410189.Sherpa_NNPDF30NNLO_ttbar_dilepton_MEPS_NLO.merge.DAOD_TOPQ1.e4714_s2726_r7725_r7676_p2669", +] + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC16_TOPQ1.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC16_TOPQ1.py new file mode 100644 index 0000000000000000000000000000000000000000..ff488b4cc8afbc19d61a60f5ed9d9d54230d5675 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/MC16_TOPQ1.py @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import TopExamples.grid + +# just a test sample processed with 21.0.19.2+DerivationFrameworkTop-00-04-06 +TopExamples.grid.Add("TOPQ1_ttbar_PowPy8").datasets = [ + "group.phys-top.mc15_13TeV.410501.PowPy8EG_A14_ttbar_hdamp258p75_lep.DAOD_TOPQ1.AOD.e5458_s3126_r9364_r9315_p3144.v1_EXT0", + ] \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/getExamples b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/getExamples new file mode 100755 index 0000000000000000000000000000000000000000..71008675d5497606523cc5a69306eebd5fc73bac --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/getExamples @@ -0,0 +1,25 @@ +#!/usr/bin/env python +import sys +import os + +output = os.getcwd() + '/grid' +if len(sys.argv) == 2: + output = sys.argv[1] +elif len(sys.argv) > 2: + print 'I dont understand you' + print 'Use me like' + print sys.argv[0] + print 'or' + print sys.argv[0], '<directory>' + sys.exit() + +print 'copying scripts to', output +start = os.getenv('ROOTCOREBIN') + '/user_scripts/TopExamples/*.py' +#print start + +if not os.path.exists(output): + os.makedirs(output) + +cmd = 'cp ' + start + ' ' + output +#print cmd +os.system(cmd) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..09dc31ddf2f9d28401e885697823ecfa05379631 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/share/mainpage.h @@ -0,0 +1,61 @@ +/** + * @page tepage TopExamples + * + * @section in Introduction + * + * If you're looking for a tutorial on how to submit a grid job, you might like to try + * https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TopxAODStartGuide. + * + * Here I'll just try to just go over the code that's included: + * + * - top::NoSelectionAnalysis: If the grid part didn't do any selection, use me! + * - top::DileptonAnalysis: If the grid part did ee, mumu and emu, use me! + * - top::LJetsAnalysis: For e+jets and mu+jets use me! + * - top::LJetsTtresAnalysis: Includes largeR jets! + * + * All the codes above use (mostly) the same histograms which are added and filled by + * using DefaultPlots.h. + * + * The event loop is run by mini-to-plots.cxx, something like this: + * + * @code + * ./mini-to-plots Dilepton /path/to/file/grid_datasetname/input.txt + * @endcode + * + * The word Dilepton tells it to load the top::DileptonAnalysis. You can see how this + * works in AnalysisTools.h addPlots(). The grid tag is extracted from the path, so that's important + * to keep in. + * + * @section ps Example python scripts scripts + * + * This packages also contains a bunch of python scripts to help with grid related book- + * keeping. To get them (for analysis) you need to do: + * + * @code + * $ROOTCOREBIN/user_scripts/TopExamples/getExamples + * @endcode + * + * This will make a directory called grid which contains the scripts you can edit and run + * like this: + * @code + * ./01SubmitToGrid.py + * ./02DownloadFromGrid.py + * ./03LocalAnalysis.py --run + * ./04Plot.py + * @endcode + * + * @section bcs Boring code stuff + * + * The C++ analysis code has to inherit from top::AnalysisBase. If you make a new class + * you'll need to tell the loader about it in AnalysisTools.h (and the python scripts). + * + * Some useful code is: + * - top::ContainerNames: Names of the xAOD containers to use in the analysis + * - top::EventLoaderDirect: Loads xAOD objects from an input file in a speedy way + * - top::AnalysisBase: Base class for implementing analysis code + * - mini-to-plots.cxx: The one and only executable + * - AnalysisTools.h: Some tools for scaling, cutflows, loading analysis, + * decoding grid tags etc. + * + * The python scripts live in the TopExamples/python and TopExamples/scripts directories. + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-flat.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-flat.cxx new file mode 100644 index 0000000000000000000000000000000000000000..85db11d171cca010b115c5aeac3426d956c94fea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-flat.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <memory> +#include <string> +#include <vector> + +#include "TFile.h" +#include "TTree.h" +#include "TTreeFormula.h" + +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#include "xAODRootAccess/TActiveStore.h" + +// bits for I/O performance monitoring +#include "xAODCore/tools/ReadStats.h" +#include "xAODCore/tools/PerfStats.h" +#include "xAODCore/tools/IOStats.h" + +#include "TopAnalysis/Tools.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/ConfigurationSettings.h" + +#include "TopExamples/MakeTopConfig.h" +#include "TopExamples/MiniToFlatAnalysis.h" + +int main(int argc, char** argv) { + if (argc != 3) { + std::cout << "Please provide a file containing input files!!!" << std::endl; + } + + // magic xAOD stuff + // true = fail at even the slightest xaod issue + top::xAODInit(true); + StatusCode::enableFailure(); + + std::cout << "Configuration Files:\n"; + std::string settingsFilename = std::string(argv[1]); + std::cout << " " << settingsFilename << "\n"; + std::cout << " " << std::string(argv[2]) << "\n\n"; + + // load the settings from the input file + auto* const settings = top::ConfigurationSettings::get(); + settings->loadFromFile(settingsFilename); + // std::cout << "Configuration:\n"; + // std::cout << *settings << "\n"; + + // open the files (to check they exist) and count how many events we have + std::vector<std::string> filenames = top::fileList(std::string(argv[2])); + if (filenames.size() == 0) { + std::cout << "Please supply an input file in the filelist" << std::endl; + exit(1); + } + + // Create a TEvent object: + xAOD::TEvent xaodevent(xAOD::TEvent::kBranchAccess); + // Create a transient object store. Needed for the tools. + xAOD::TStore store; + + // Make a Top::TopConfig from the input file metadata + top::MakeTopConfig mkConfig("top::MakeTopConfig"); + std::unique_ptr<TFile> firstInputFile(TFile::Open(filenames[0].c_str())); + top::check(xaodevent.readFrom(firstInputFile.get()), + "xAOD::TEvent readFrom failed"); + std::shared_ptr<top::TopConfig> topConfig = mkConfig.makeTopConfig(); + topConfig->setConfigSettings(settings); + // Analysis + top::MiniToFlatAnalysis analysis("top::MiniToFlatAnalysis"); + top::check(analysis.setProperty("config", topConfig), + "Failed to set property"); + top::check(analysis.initialize() , "Failed to initialize"); + + xAOD::PerfStats::instance().start(); + + // Loop over files, and events in files + for (const auto& filename : filenames) { + std::cout << "Opening " << filename << std::endl; + std::unique_ptr<TFile> inputFile(TFile::Open(filename.c_str())); + top::check(xaodevent.readFrom(inputFile.get()), + "xAOD::TEvent readFrom failed"); + Long64_t entries = xaodevent.getEntries(); + for (Long64_t entry=0; entry < entries; ++entry) { + // clear the TStore - get rid of the last events objects + xAOD::TActiveStore::store()->clear(); + // increment the event + xaodevent.getEntry(entry); + top::check(analysis.execute() , "Failed to execute event"); + } + } + + top::check(analysis.finalize() , "Failed to finalize"); + + xAOD::PerfStats::instance().stop(); + // xAOD::IOStats::instance().stats().Print("Summary"); + // xAOD::IOStats::instance().stats().Print(); + + return 0; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-plots.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-plots.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2194e47a316097ac4c6b31f76e8b0a12be692790 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-to-plots.cxx @@ -0,0 +1,126 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <memory> +#include <cstdlib> +#include <sstream> + +#include "TFile.h" + +#include "xAODRootAccess/TEvent.h" + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" + +#include "TopAnalysis/Tools.h" + +#include "TopExamples/EventLoaderDirect.h" +#include "TopExamples/AnalysisTools.h" + +/** + * @file mini-to-plots.cxx + * + * @brief Executable for the 'local' part of the analysis. + * + */ + +/** + * @brief The main executable + * + * Does the xAOD stuff, then makes an output file (root) based on the name of + * the input file directory (hopefully useful for grid running). Then goes on + * to loop over all the files in that directory and make some plots / do some + * analysis. + * + * The output plots are normalised to 1fb-1. + */ +int main(int argc, char** argv) { + if (argc != 3) { + std::cout << "Use like:\n"; + std::cout << argv[0] << " Dilepton /path/with/user.simon.117050.e1727_s1933_s1911_r5591.MC_31_07_1/input.txt\n"; + std::cout << "\n"; + std::cout << "note that the directory has user.simon.117050.GRIDTAG.stuff/input.txt\n"; + std::cout << "i.e. something.something.something.GRIDTAG.something\n"; + exit(1); + } + + //magic xAOD stuff + top::xAODInit(); + + //attempt to extract the tag from the directory that the input files lives in + std::vector<std::string> filenames = top::fileList(argv[2]); + + //attempt to extract the tag from the directory name + const std::string gridTag = top::gridTagFromDirectoryName(argv[2]); + + //get the sample number (run or mc-sample number depending on data / MC sim) + //todo should this be in a function instead? + //padded to 8 char for data, not padded for MC to match dataset naming convention + std::string sampleNumberString; + size_t firstIdx = 0; + while (firstIdx < filenames.size()) { + try { + sampleNumberString = top::getSampleNumberAsString(filenames[firstIdx], "EventInfo"); + break; + } catch(std::string &e) { // can fail if no events passed selection in a specific job + std::cout << "Error getting MC sample number: " << e.c_str() << std::endl; + ++firstIdx; + } + } + if (firstIdx >= filenames.size()) { + std::cout << "No events passed in any of the jobs. No entries available. Abort!" << std::endl; + exit(1); + } + + //generate the output filename + //pad the run number to 8 digits + std::stringstream s; + s << sampleNumberString << "." << gridTag << ".root"; + std::cout << "Writing plots to: " << s.str() << "\n"; + + //output file + std::unique_ptr<TFile> plotsFile(TFile::Open(s.str().c_str(), "RECREATE")); + + //user analysis code to make histograms + std::unique_ptr<top::AnalysisBase> analy(top::loadAnalysis(argv[1], plotsFile.get())); + const unsigned int totalYield = top::checkFiles(filenames); + + //event loop + xAOD::TEvent xaodEvent(xAOD::TEvent::kBranchAccess); //don't use kClassAccess on non-primary xAOD, obviously. + + top::EventLoaderDirect loader(analy->containerNames()); + + //loop over input files + unsigned int totalYieldSoFar = 0; + unsigned int fileCounter = 0; + for (const auto& filename : filenames) { + std::cout << "Opening " << fileCounter << " of " << filenames.size() << ": " << filename << std::endl; + std::unique_ptr<TFile> inputFile(TFile::Open(filename.c_str())); + top::check(xaodEvent.readFrom(inputFile.get()), "xAOD::TEvent readFrom failed"); + + //update any cutflow / meta stuff we might need to get per-file + analy->newFile(inputFile.get()); + + //loop over events in the file + const unsigned int entries = xaodEvent.getEntries(); + for (unsigned int entry = 0; entry < entries; ++entry, ++totalYieldSoFar) { + if (entry % 100 == 0) + std::cout << " Processing event " << totalYieldSoFar << " / " << totalYield << " (this file: " << entry << " / " << entries << ")" << std::endl; + + //read the event and do stuff + xaodEvent.getEntry(entry); + top::Event topEvent = loader.loadEvent(xaodEvent); + analy->event(topEvent); + } + + ++fileCounter; + } + + //save output histograms + analy->finalise(plotsFile.get()); + + + return 0; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-xaod.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-xaod.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6360acc87a5f449f1b09e97dd1845a5a1d61a214 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/util/mini-xaod.cxx @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <memory> + +#include "TFile.h" +#include "TTree.h" +#include "TTreeFormula.h" + +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#include "xAODRootAccess/TActiveStore.h" + +// bits for I/O performance monitoring +#include "xAODCore/tools/ReadStats.h" +#include "xAODCore/tools/PerfStats.h" +#include "xAODCore/tools/IOStats.h" + +#include "TopAnalysis/Tools.h" +#include "TopEvent/EventTools.h" + +#include "TopExamples/MakeTopConfig.h" +#include "TopExamples/MinixAODAnalysis.h" + +int main(int argc, char** argv) { + + if (argc != 2) { + std::cout<<"Please provide a file containing input files!!!"<<std::endl; + } + + //magic xAOD stuff + //true = fail at even the slightest xaod issue + top::xAODInit(true); + StatusCode::enableFailure(); + + //open the files (to check they exist) and count how many events we have + std::vector<std::string> filenames = top::fileList(std::string(argv[1])); + if (filenames.size() == 0){ + std::cout<<"Please supply an input file in the filelist"<<std::endl; + exit(1); + } + + // Create a TEvent object: + xAOD::TEvent xaodevent( xAOD::TEvent::kBranchAccess ); + // Create a transient object store. Needed for the tools. + xAOD::TStore store; + + // Make a Top::TopConfig from the input file metadata + top::MakeTopConfig mkConfig( "top::MakeTopConfig" ); + std::unique_ptr<TFile> firstInputFile(TFile::Open(filenames[0].c_str())); + top::check(xaodevent.readFrom(firstInputFile.get()), "xAOD::TEvent readFrom failed"); + std::shared_ptr<top::TopConfig> topConfig = mkConfig.makeTopConfig(); + + // Analysis + top::MinixAODAnalysis analysis( "top::MinixAODAnalysis" ); + top::check( analysis.setProperty( "config" , topConfig ) , "Failed to set property" ); + top::check( analysis.initialize() , "Failed to initialize" ); + + xAOD::PerfStats::instance().start(); + + // Loop over files, and events in files + for (const auto& filename : filenames) { + std::cout << "Opening " << filename << std::endl; + std::unique_ptr<TFile> inputFile(TFile::Open(filename.c_str())); + top::check(xaodevent.readFrom(inputFile.get()), "xAOD::TEvent readFrom failed"); + Long64_t entries = xaodevent.getEntries(); + for (Long64_t entry=0; entry<entries;++entry) { + // clear the TStore - get rid of the last events objects + xAOD::TActiveStore::store()->clear(); + // increment the event + xaodevent.getEntry( entry ); + top::check( analysis.execute() , "Failed to execute event" ); + } + } + + top::check( analysis.finalize() , "Failed to finalize" ); + + xAOD::PerfStats::instance().stop(); +// xAOD::IOStats::instance().stats().Print("Summary"); +// xAOD::IOStats::instance().stats().Print(); + + return 0; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf87cf3d7c5417042e15eb18f38040220f581ef4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt @@ -0,0 +1,31 @@ +# Auto-generated on: 2017-03-08 14:47:37.318937 + +# Declare the name of this package: +atlas_subdir( TopFakes None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + TopEvent + TopConfiguration ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathCore MathMore Graf Matrix ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopFakes _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopFakes Root/*.cxx Root/*.h Root/*.icc + TopFakes/*.h TopFakes/*.icc TopFakes/*/*.h + TopFakes/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopFakes + LINK_LIBRARIES TopEvent + TopConfiguration + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( data/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/FakesWeights.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/FakesWeights.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5d5a3222c876c11091919341e5edcc0a6b76a01d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/FakesWeights.cxx @@ -0,0 +1,596 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////// +// +// Author : +// Anna Henrichs <anna.henrichs@cern.ch> +// Michele Pinamonti <michele.pinamonti@cern.ch> +// Creation : +// Purpose : main method to retrieve event-by-event weights +// from the Matrix Method +// Updated : +// 2016-07-14 : TTP: replace _isRun1 by _period +// 2016-01-29 : FD: set _isRun1 = false +// set default weighter +// remove pt/dR variable, never used +// 2016-02-02 : FD update SetupWeighterDefault +// 2016-02-12 : SetupWeighterDefault : default do not use dPhi +////////////////////////////////////////////////////////////////////// + +#include "TopFakes/FakesWeights.h" +#include "TopFakes/MMEffSet.h" +#include "TopFakes/MMEfficiency.h" +#include "TopFakes/MatrixUtils.h" + +#include "TH1F.h" +#include "TH2F.h" +#include "TFile.h" +#include "TString.h" +#include "TObjString.h" +#include <cmath> +#include <iostream> + + +using namespace std; + +// CONSTRUCTOR +FakesWeights::FakesWeights() : _mmUtil(0) { + _channel = EJETS; + _dataPath = "data"; + _dataPathIsSet = false; + _isInitialized = false; + _debug = false; + + _period = MMEffSet::Period::Year2015; + _trig1_el = ""; + _trig2_el = ""; + _trig3_el = ""; + _trig1_mu = ""; + _trig2_mu = ""; + _trig3_mu = ""; + _ps1_el = 1; + _ps2_el = 1; + _ps3_el = 1; + _ps1_mu = 1; + _ps2_mu = 1; + _ps3_mu = 1; + _ptTres_el = 0; + _ptTres_mu = 0; + + for (int i = 0; i < 4; ++i) + _EffSet[i] = 0; +} + +// DESTRUCTOR +FakesWeights::~FakesWeights(){ + delete _mmUtil; + + for (int i = 0; i < 4; ++i) + delete _EffSet[i]; +} + +// =============================================== +void FakesWeights::SetDataPath(std::string path) { + // method to set the path were efficiencies are + _dataPath = path; + if(_isInitialized) for(int i=0;i<4;i++) _EffSet[i]->SetDataPath(path); + _dataPathIsSet = true; +} + +// =============================================== +void FakesWeights::SetDebug(bool debug){ + _debug = debug; +} + +// =============================================== +void FakesWeights::SetPeriod(int period){ + _period = period; +} + +// =============================================== +void FakesWeights::SetTriggerNamesEl(std::string trig1,std::string trig2,std::string trig3){ + _trig1_el = trig1; + _trig2_el = trig2; + _trig3_el = trig3; +} + +// =============================================== +void FakesWeights::SetTriggerNamesMu(std::string trig1,std::string trig2,std::string trig3){ + _trig1_mu = trig1; + _trig2_mu = trig2; + _trig3_mu = trig3; +} + +// =============================================== +void FakesWeights::SetTriggerPrescalesEl(float ps1,float ps2,float ps3){ + _ps1_el = ps1; + _ps2_el = ps2; + _ps3_el = ps3; +} + +// =============================================== +void FakesWeights::SetTriggerPrescalesMu(float ps1,float ps2,float ps3){ + _ps1_mu = ps1; + _ps2_mu = ps2; + _ps3_mu = ps3; +} + +// =============================================== +void FakesWeights::SetTriggerThresholdEl(float thres){ + _ptTres_el = thres; +} + +// =============================================== +void FakesWeights::SetTriggerThresholdMu(float thres){ + _ptTres_mu = thres; +} + +// =============================================== +void FakesWeights::SetupWeighter(int channel, std::string aReal, std::string aFake, std::string aReal2, std::string aFake2) { + // method to set up tools which calculate the weights + + std::cout << "--------------------------------------------------------" << std::endl; + std::cout << " FakesWeights::INFO: Setting-up Matrix Method Weighter." << std::endl; + if(channel==EJETS) std::cout << " channel: e+jets" << std::endl; + if(channel==MUJETS) std::cout << " channel: µ+jets" << std::endl; + if(channel==EE) std::cout << " channel: ee" << std::endl; + if(channel==MUMU) std::cout << " channel: µµ" << std::endl; + if(channel==EMU) std::cout << " channel: eµ" << std::endl; + if(channel==EMU){ + std::cout << " real eff(e): " << aReal << std::endl; + std::cout << " fake eff(e): " << aFake << std::endl; + std::cout << " real eff(µ): " << aReal2 << std::endl; + std::cout << " fake eff(µ): " << aFake2 << std::endl; + } + else{ + std::cout << " real eff: " << aReal << std::endl; + std::cout << " fake eff: " << aFake << std::endl; + } + std::cout << "--------------------------------------------------------" << std::endl; + _channel = channel; + _mmUtil = new MatrixUtils(); + _EffSet[0] = new MMEffSet(channel==EJETS || channel==EE || channel==EMU, true, _debug); // isEle, isReal + _EffSet[1] = new MMEffSet(channel==EJETS || channel==EE || channel==EMU, false, _debug); + _EffSet[2] = new MMEffSet(channel==EE, true, _debug); + _EffSet[3] = new MMEffSet(channel==EE, false, _debug); + for(int i=0;i<4;i++){ + _EffSet[i]->SetPeriod(_period); + } + if(_period!=MMEffSet::Period::Year2012){ + if(channel==EJETS || channel==EE || channel==EMU){ + _EffSet[0]->SetTriggerNames(_trig1_el,_trig2_el,_trig3_el); + _EffSet[1]->SetTriggerNames(_trig1_el,_trig2_el,_trig3_el); + _EffSet[0]->SetTriggerPrescales(_ps1_el,_ps2_el,_ps3_el); + _EffSet[1]->SetTriggerPrescales(_ps1_el,_ps2_el,_ps3_el); + _EffSet[0]->SetTriggerThreshold(_ptTres_el); + _EffSet[1]->SetTriggerThreshold(_ptTres_el); + } + else if(channel==MUJETS || channel==MUMU){ + _EffSet[0]->SetTriggerNames(_trig1_mu,_trig2_mu,_trig3_mu); + _EffSet[1]->SetTriggerNames(_trig1_mu,_trig2_mu,_trig3_mu); + _EffSet[0]->SetTriggerPrescales(_ps1_mu,_ps2_mu,_ps3_mu); + _EffSet[1]->SetTriggerPrescales(_ps1_mu,_ps2_mu,_ps3_mu); + _EffSet[0]->SetTriggerThreshold(_ptTres_mu); + _EffSet[1]->SetTriggerThreshold(_ptTres_mu); + } + if(channel==EE){ + _EffSet[2]->SetTriggerNames(_trig1_el,_trig2_el,_trig3_el); + _EffSet[3]->SetTriggerNames(_trig1_el,_trig2_el,_trig3_el); + _EffSet[2]->SetTriggerPrescales(_ps1_el,_ps2_el,_ps3_el); + _EffSet[3]->SetTriggerPrescales(_ps1_el,_ps2_el,_ps3_el); + _EffSet[2]->SetTriggerThreshold(_ptTres_el); + _EffSet[3]->SetTriggerThreshold(_ptTres_el); + } + else if(channel==MUMU || channel==EMU){ + _EffSet[2]->SetTriggerNames(_trig1_mu,_trig2_mu,_trig3_mu); + _EffSet[3]->SetTriggerNames(_trig1_mu,_trig2_mu,_trig3_mu); + _EffSet[2]->SetTriggerPrescales(_ps1_mu,_ps2_mu,_ps3_mu); + _EffSet[3]->SetTriggerPrescales(_ps1_mu,_ps2_mu,_ps3_mu); + _EffSet[2]->SetTriggerThreshold(_ptTres_mu); + _EffSet[3]->SetTriggerThreshold(_ptTres_mu); + } + } + _isInitialized = true; + // setup data path if already specified + if(_dataPathIsSet){ + if(_debug) std::cout << " --> Setting-up data-path = " << _dataPath << std::endl; + SetDataPath(_dataPath); + } + // setup firt lepton, for all the channels + _EffSet[0]->SetupEff(aReal); + _EffSet[1]->SetupEff(aFake); + // setup the second lepton in the same way as the first one for ee and µµ, but following aReal2/aFake2 for eµ + if(channel==EE || channel==EMU || channel==MUMU){ + if(aReal2!="") _EffSet[2]->SetupEff(aReal2); + else _EffSet[2]->SetupEff(aReal); + if(aFake2!="") _EffSet[3]->SetupEff(aFake2); + else _EffSet[3]->SetupEff(aFake); + } +} + +// ======================================================= +float FakesWeights::GetFakesWeightLJets(bool tight){ + // retrieve MM weight for semileptonic events + + float f = GetFakeEff(); // fake efficiency of lepton + float r = GetRealEff(); // real efficiency of lepton + if(f<0 || r<0) return 0.; // added for events which are neglected by trigger splitting + + double nf, nr; + // + float weight = _mmUtil->lepton_weight(!tight, r, f, (double&)nf, (double&)nr); + // protection against too large weights : this should not happen + // and is due in general to histo bins with large statistical fluctuations + if( weight > 5 || weight < -5 ){ + r = _EffSet[0]->GetEff(true); + f = _EffSet[1]->GetEff(true); + weight = _mmUtil->lepton_weight(!tight, r, f, (double&)nf, (double&)nr); + } + + // scale by prescales! FIXME + if(_EffSet[0]->GetPrescale()!=1) weight *= _EffSet[0]->GetPrescale(); + + return weight; +} + +// ======================================================= +float FakesWeights::GetFakesWeightDilep(bool tight1,bool tight2){ + // retrieve MM weight for dilepton events + + float f1 = GetFakeEff(); // fake efficiency of 1st lepton + float r1 = GetRealEff(); // real efficiency of 1st lepton + float f2 = GetFakeEff2(); // fake efficiency of 2nd lepton + float r2 = GetRealEff2(); // real efficiency of 2nd lepton + if(f1<0 || f2<0 || r1<0 || r2<0) return 0.; // added for events which are neglected by trigger splitting + + double nrf, nfr, nff; + // fill the 4*4 matrix with efficiencies + _mmUtil->fill_matrix(r1,f1,r2,f2); + // retrieve the weights + return _mmUtil->dilepton_weight(!tight1, r1, f1, !tight2, r2, f2, (double&)nrf, (double&)nfr, (double&)nff); +} + +// ======================================================= +float FakesWeights::GetFakesWeightDilepLL(bool tight1,bool tight2){ + // retrieve MM weight for dilepton events (loose-loose) + return _mmUtil->dilepton_LL_weight(!tight1,!tight2); +} + +// ======================================================= +float FakesWeights::GetFakesWeightDilepLT(bool tight1,bool tight2){ + // retrieve MM weight for dilepton events (loose-tight) + return _mmUtil->dilepton_LT_weight(!tight1,!tight2); +} + +// ======================================================= +float FakesWeights::GetFakesWeightDilepTL(bool tight1,bool tight2){ + // retrieve MM weight for dilepton events (tight-loose) + return _mmUtil->dilepton_TL_weight(!tight1,!tight2); +} + +// ======================================================= +float FakesWeights::GetFakesWeightDilepTT(bool tight1,bool tight2){ + // retrieve MM weight for dilepton events (tight-tight) + return _mmUtil->dilepton_TT_weight(!tight1,!tight2); +} + +// ======================================================= +float FakesWeights::GetRealEff(){ + // method to get the real efficiency + float R = _EffSet[0]->GetEff(); + return R; +} + +// ======================================================= +float FakesWeights::GetFakeEff(){ + // method to get the fake efficiency + float F = _EffSet[1]->GetEff(); + return F; +} + +// ======================================================= +float FakesWeights::GetRealEff2(){ + // method to get the real efficiency (of 2nd lepton) + float R = _EffSet[2]->GetEff(); + return R; +} + +// ======================================================= +float FakesWeights::GetFakeEff2(){ + // method to get the real efficiency (of 2nd lepton) + float F = _EffSet[3]->GetEff(); + return F; +} + +// ======================================================= +void FakesWeights::SetLepton(MMEvent event,MMLepton lepton){ + // set the MMEvent and MMLepton objects for l+jet case + _EffSet[0]->SetLepton(event,lepton); + _EffSet[1]->SetLepton(event,lepton); +} + +// ======================================================= +void FakesWeights::SetLeptons(MMEvent event,MMLepton lepton1,MMLepton lepton2){ + // set the MMEvent and MMLepton objects for dilepton case + + // hack by Finn & Xiaowen to treat the trigger bias in the correct way + // a. if any lepton in the event matches the high pt trigger + if( (lepton1.trigger&2)>0 || (lepton2.trigger&2)>0 ){ + // -- > apply pt dependent nonbiased efficiencies ( e.g. e24vh if pt<61 and e60 if pt>61 ) + // ~~ > hack: switch the biased trigger off ;) + if( (lepton1.trigger&1)>0 ) { + lepton1.trigger -= 1; + if( (lepton1.trigger&4)==0 ) lepton1.trigger += (1 << 2); + } + if( (lepton2.trigger&1)>0 ){ + lepton2.trigger -= 1; + if( (lepton2.trigger&4)==0 ) lepton2.trigger += (1 << 2); + } + } + // b. if no lepton in the event matches this trigger + else{ + // -- > apply the low pt biased trigger efficiency ( e24vhi ) to one lepton that matches this trigger and pt dependent unbiased efficiencies to the others ( e.g. e24vh if pt<61 and e60 if pt>61 ) + // -- > if more than one lepton matches e24vhi than apply that efficiency to the highest pt one and the unbiased e24vh to the other(s). + // ~~ > hack: if both leptons are matched to the biased trigger, switch off the trigger for the lowest pt one + if( (lepton1.trigger&1)>0 && (lepton2.trigger&1)>0 ){ + if( lepton1.pt > lepton2.pt ) lepton2.trigger -= 1; + if( lepton2.pt > lepton1.pt ) lepton1.trigger -= 1; + } + } + + _EffSet[0]->SetLepton(event,lepton1); + _EffSet[1]->SetLepton(event,lepton1); + _EffSet[2]->SetLepton(event,lepton2); + _EffSet[3]->SetLepton(event,lepton2); +} + +// ======================================================= +MatrixUtils* FakesWeights::GetMatrixUtils(){ + // retrieve the matrix + return _mmUtil; +} + +// ======================================================= +void FakesWeights::SetupWeighterDefault(int channel, std::string syst){ + // + // default set up + // + + // default efficiencies + if (syst=="") _syst = NONE; + // fake eff with removal of real lepton contamination from W/Z MC +30% - correlates electron and muon + else if(syst=="MCup") _syst = MCup; + // fake eff with removal of real lepton contamination from W/Z MC -30% - correlates electron and muon + else if(syst=="MCdown") _syst = MCdown; + // fake eff with removal of real lepton contamination from W/Z MC +30% - only for electron + else if(syst=="MCupel") _syst = MCupel; + // fake eff with removal of real lepton contamination from W/Z MC -30% - only for electron + else if(syst=="MCdownel") _syst = MCdownel; + // fake eff with removal of real lepton contamination from W/Z MC +30% - only for muon + else if(syst=="MCupmu") _syst = MCupmu; + // fake eff with removal of real lepton contamination from W/Z MC -30% - only for muon + else if(syst=="MCdownmu") _syst = MCdownmu; + // fake eff from alternative region - returns nominal for emu channel, otherwise equivalent to CRfakeel (CRfakemu) for e+jets and ee (mu+jets and mumu) channels + else if(syst=="CRfake") _syst = CRfake; + // fake eff from alternative region (only for electrons, useful for dilepton) + else if(syst=="CRfakeel") _syst = CRfakeel; + // fake eff from alternative region (only for muons, useful for dilepton) + else if(syst=="CRfakemu") _syst = CRfakemu; + // real eff from alternative region - correlates electron and muon + else if(syst=="CRreal") _syst = CRreal; + // real eff from alternative region - only for electron + else if(syst=="CRrealel") _syst = CRrealel; + // real eff from alternative region - only for muon + else if(syst=="CRrealmu") _syst = CRrealmu; + // efficiencies with alternative parametrisation (only for l+jet) + else if(syst=="EffPar") _syst = EffPar; + else { + std::cout << " FakesWeights::ERROR: Specified systematic NOT supported: " << syst << std::endl; + return; + } + + // E + JETS + if(channel == FakesWeights::EJETS){ + if(_syst==NONE) SetupWeighter( FakesWeights::EJETS, "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==MCup || _syst==MCupel) SetupWeighter( FakesWeights::EJETS, "Default:NS:eta:pt:jetpt:dR", "Default_MCup:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==MCdown || _syst==MCdownel) SetupWeighter( FakesWeights::EJETS, "Default:NS:eta:pt:jetpt:dR", "Default_MCdown:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==CRreal || _syst==CRrealel) SetupWeighter( FakesWeights::EJETS, "Default_CRreal:NB:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==CRfake || _syst==CRfakeel) SetupWeighter( FakesWeights::EJETS, "Default:NS:eta:pt:jetpt:dR", "Default_CRfake:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==EffPar) SetupWeighter( FakesWeights::EJETS, "Default:NS:eta:pt:jetpt:dR:dPhi", "Default:NB/NS:eta:pt:jetpt:dR:dPhi"); + else if(_syst==MCupmu || _syst==MCdownmu || _syst==CRrealmu || _syst==CRfakemu ) { + std::cout << " FakesWeights::WARNING: Requested muon-specific systematic "<<syst<<" in e+jets channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::EJETS); + } + } + + // MU + JETS + else if(channel == FakesWeights::MUJETS){ + if(_syst==NONE) SetupWeighter( FakesWeights::MUJETS, "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==MCup || _syst==MCupmu) SetupWeighter( FakesWeights::MUJETS, "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCup:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==MCdown || _syst==MCdownmu) SetupWeighter( FakesWeights::MUJETS, "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCdown:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==CRreal || _syst==CRrealmu) SetupWeighter( FakesWeights::MUJETS, "Default_CRreal:NB/TR:eta:pt:jetpt:dR","Default:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==CRfake || _syst==CRfakemu) SetupWeighter( FakesWeights::MUJETS, "Default:NS/TR:eta:pt:jetpt:dR", "Default_CRfake:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==EffPar) SetupWeighter( FakesWeights::MUJETS, "Default:NS/TR:eta:pt:jetpt:dR:dPhi", "Default:NB/NS/TR:eta:pt:jetpt:dR:dPhi"); + else if(_syst==MCupel || _syst==MCdownel || _syst==CRrealel || _syst==CRfakeel ) { + std::cout << " FakesWeights::WARNING: Requested electron-specific systematic "<<syst<<" in mu+jets channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::MUJETS); + } + } + + // E E + else if(channel == FakesWeights::EE){ + if(_syst==NONE) SetupWeighter( FakesWeights::EE, "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR"); + else if (_syst==MCup || _syst==MCupel) SetupWeighter( FakesWeights::EE, "Default:NS:eta:pt:jetpt:dR", "Default_MCup:NB/NS:eta:pt:jetpt:dR"); + else if (_syst==MCdown || _syst==MCdownel) SetupWeighter( FakesWeights::EE, "Default:NS:eta:pt:jetpt:dR", "Default_MCdown:NB/NS:eta:pt:jetpt:dR"); + else if (_syst==CRreal || _syst==CRrealel) SetupWeighter( FakesWeights::EE, "Default_CRreal:NB/TR:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR"); + else if (_syst==CRfake || _syst==CRfakeel) SetupWeighter( FakesWeights::EE, "Default:NS:eta:pt:jetpt:dR", "Default_CRfake:NB/NS:eta:pt:jetpt:dR"); + else if(_syst==EffPar) { + std::cout << " FakesWeights::WARNING: Requested systematic "<<syst<<" is not relevant for dilepton channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::EE); + } + else if(_syst==MCupmu || _syst==MCdownmu || _syst==CRrealmu || _syst==CRfakemu ) { + std::cout << " FakesWeights::WARNING: Requested muon-specific systematic "<<syst<<" in ee channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::EE); + } + } + + // MU MU + else if(channel == FakesWeights::MUMU){ + if(_syst==NONE) SetupWeighter( FakesWeights::MUMU, "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + else if (_syst==MCup || _syst==MCupmu) SetupWeighter( FakesWeights::MUMU, "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCup:NB/NS/TR:eta:pt:jetpt:dR"); + else if (_syst==MCdown || _syst==MCdownmu) SetupWeighter( FakesWeights::MUMU, "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCdown:NB/NS/TR:eta:pt:jetpt:dR"); + else if (_syst==CRreal || _syst==CRrealmu) SetupWeighter( FakesWeights::MUMU, "Default_CRreal:NB/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + else if (_syst==CRfake || _syst==CRfakemu) SetupWeighter( FakesWeights::MUMU, "Default:NS/TR:eta:pt:jetpt:dR", "Default_CRfake:NB/NS/TR:eta:pt:jetpt:dR"); + else if(_syst==EffPar) { + std::cout << " FakesWeights::WARNING: Requested systematic "<<syst<<" is not relevant for dilepton channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::MUMU); + } + else if(_syst==MCupel || _syst==MCdownel || _syst==CRrealel || _syst==CRfakeel ) { + std::cout << " FakesWeights::WARNING: Requested electron-specific systematic "<<syst<<" in mumu channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::MUMU); + } + } + + // E MU + else if(channel == FakesWeights::EMU){ + if(_syst==NONE) { + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==MCup) { + std::cout << " FakesWeights::WARNING: Requested systematic MCup in emu channel will consider this variation totally correlated between the electron and the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCupel and MCupmu to get the systematic variation only for electron and muon, respectively" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default_MCup:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCup:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==MCdown) { + std::cout << " FakesWeights::WARNING: Requested systematic MCdown in emu channel will consider this variation totally correlated between the electron and the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCdownel and MCdownmu to get the systematic variation only for electron and muon, respectively" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default_MCdown:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCdown:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==MCupel) { + std::cout << " FakesWeights::WARNING: Requested systematic MCupel in emu channel will consider this variation only for the electron" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCup instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default_MCup:NB/NS:eta:pt:jetpt:dR", + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR"); + } + else if (_syst==MCdownel) { + std::cout << " FakesWeights::WARNING: Requested systematic MCdownel in emu channel will consider this variation only for the electron" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCdown instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default_MCdown:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==MCupmu) { + std::cout << " FakesWeights::WARNING: Requested systematic MCupmu in emu channel will consider this variation only for the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCup instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCup:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==MCdownmu) { + std::cout << " FakesWeights::WARNING: Requested systematic MCdownmu in emu channel will consider this variation only for the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use MCdown instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default_MCdown:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==CRfake) { + std::cout << " FakesWeights::WARNING: Requested systematic CRfake in emu channel is not possible - using nominal instead" << std::endl; + std::cout << " FakesWeights::WARNING: Please use CRfakeel and CRfakemu to get the systematic variation only for electron and muon, respectively" << std::endl; + SetupWeighterDefault(FakesWeights::EMU); + } + else if (_syst==CRfakeel) { + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default_CRfake:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==CRfakemu) { + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default_CRfake:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==CRreal) { + std::cout << " FakesWeights::WARNING: Requested systematic CRreal in emu channel will consider this variation totally correlated between the electron and the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use CRrealel and CRrealmu to get the systematic variation only for electron and muon, respectively" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default_CRreal:NB/TR:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default_CRreal:NB/TR:eta:pt:jetpt:dR","Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==CRrealel) { + std::cout << " FakesWeights::WARNING: Requested systematic CRrealel in emu channel will consider this variation only for the electron" << std::endl; + std::cout << " FakesWeights::WARNING: Please use CRreal instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default_CRreal:NB/TR:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default:NS/TR:eta:pt:jetpt:dR", "Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if (_syst==CRrealmu) { + std::cout << " FakesWeights::WARNING: Requested systematic CRrealmu in emu channel will consider this variation only for the muon" << std::endl; + std::cout << " FakesWeights::WARNING: Please use CRreal instead to get this systematic variation for both electron and muon totally correlated" << std::endl; + SetupWeighter( FakesWeights::EMU, + "Default:NS:eta:pt:jetpt:dR", "Default:NB/NS:eta:pt:jetpt:dR", + "Default_CRreal:NB/TR:eta:pt:jetpt:dR","Default:NB/NS/TR:eta:pt:jetpt:dR"); + } + else if(_syst==EffPar) { + std::cout << " FakesWeights::WARNING: Requested systematic "<<syst<<" is not relevant for dilepton channel - using nominal instead" << std::endl; + SetupWeighterDefault(FakesWeights::EMU); + } + } + else std::cout << "ERROR: Unsupported channel number: " << channel << std::endl; +} + +// ======================================================= +// for backward compatibility +void FakesWeights::SetupWeighterDefault(int channel,std::string name,std::string syst){ + std::cout << " FakesWeights::INFO: Specifying " << name << " not needed anymore." << std::endl; + SetupWeighterDefault(channel,syst); +} + +// ======================================================= +void FakesWeights::SetLeptonDefault(float lep_pt, float lep_eta, + float el_cl_eta, float dR_lj_min, + float dPhi_lnu, float jet_pt0, + int jet_n, int nJet_tagged, int trigger) +{ + // + // default method to setup MMLepton and MMEvent objects + // + + // turn eta's into abs value, just to be sure + lep_eta = TMath::Abs(lep_eta); + el_cl_eta = TMath::Abs(el_cl_eta); + // + MMLepton lepton; + lepton.pt = lep_pt; + lepton.eta = lep_eta; + lepton.cleta = el_cl_eta; + lepton.dR = dR_lj_min; + lepton.dPhi = dPhi_lnu; // NEW!! + lepton.trigger = trigger; + MMEvent event; + event.njets = jet_n; + event.ntag = nJet_tagged; + event.jetpt = jet_pt0; + SetLepton(event,lepton); +} + +// ======================================================= +float FakesWeights::GetFakesWeightLJetsDefault(bool tight, float lep_pt, + float lep_eta, float el_cl_eta, + float dR_lj_min, + float dPhi_lnu, // NEW!! + float jet_pt0, int jet_n, + int nJet_tagged, int trigger) +{ + + SetLeptonDefault(lep_pt,lep_eta,el_cl_eta,dR_lj_min,dPhi_lnu, + jet_pt0,jet_n,nJet_tagged,trigger); + return GetFakesWeightLJets(tight); +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..fd03d0685a9a00c5d7fa6cae7499bb3f79b65431 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/LinkDef.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef STANDALONE//for standalone compilation only +#include "TopFakes/TopFakesMMWeightCalculator.h" +#endif +#include "TopFakes/FakesWeights.h" +#include "TopFakes/MMEffSet.h" +#include "TopFakes/MMEfficiency.h" +#include "TopFakes/MatrixUtils.h" + +#ifdef __CINT__ + +#ifndef STANDALONE//for standalone compilation only +#pragma extra_include "TopFakes/TopFakesMMWeightCalculator.h"; +#endif +#pragma extra_include "TopFakes/FakesWeights.h"; +#pragma extra_include "TopFakes/MMEffSet.h"; +#pragma extra_include "TopFakes/MMEfficiency.h"; +#pragma extra_include "TopFakes/MatrixUtils.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +//for loading the object selection at run time +#ifndef STANDALONE//for standalone compilation only +#pragma link C++ class top::TopFakesMMWeightCalculator+; +#endif +#pragma link C++ class FakesWeights+; +#pragma link C++ class MMEffSet+; +#pragma link C++ class MMEfficiency+; +#pragma link C++ class MatrixUtils+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEffSet.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEffSet.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7f2f01efd5d8a1c5c469a8f8b9939652d2616560 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEffSet.cxx @@ -0,0 +1,508 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////// +// +// Author : Michele Pinamonti <michele.pinamonti@cern.ch> +// Creation : +// Purpose : base class to set efficiencies for the matrix method +// Updated : +// 2016-01-29 : FD: set _isRun1 = false and set muon triggers for Run2 +////////////////////////////////////////////////////////////////////// + +#include "TopFakes/MMEffSet.h" +#include "TopFakes/MMEfficiency.h" +#include "TopFakes/MatrixUtils.h" + +#include "TH1F.h" +#include "TH2F.h" +#include "TFile.h" +#include "TString.h" +#include "TObjString.h" +#include <cmath> +#include <iostream> + +using namespace std; + +MMEffSet::MMEffSet(bool isEle, bool isReal, bool debug) { + _Estimate = ""; + _dataPath = "data"; + _isEle = isEle; + _isReal = isReal; + _effIsRead = false; + _useCorr = false; + _numCond = 0; + _splitBitMask = 0; + _debug = debug; + _period = Period::Year2015; + _ptTres = 0; + _trig1 = ""; + _trig2 = ""; + _trig3 = ""; + _trigger = -100; + + for (int i = 0; i < 10; ++i) { + _Eff[i] = 0; + _EffCorr[i] = 0; + } +} + +MMEffSet::~MMEffSet(){ + for (int i = 0; i < 10; ++i) { + delete _Eff[i]; + delete _EffCorr[i]; + } +} + +void MMEffSet::SetupEff(std::string aEff){ + _Estimate = aEff; + ParseOptions(_Estimate,&_optMap); + if(_optMap["Conditions"]=="x"){ // if x is there as condition, wait before initializing + if(_debug) std::cout << "Custom conditions. Not setting up efficiencies yet." << std::endl; + return; + } + else if(_optMap["Conditions"].find("NB/NS/TR")!=std::string::npos) AddNumBtagAndNumJetsShortAndTriggerSplit(); + else if(_optMap["Conditions"].find("NB/NJ/TR")!=std::string::npos) AddNumBtagAndNumJetsAndTriggerSplit(); + else if(_optMap["Conditions"].find("NB/NS")!=std::string::npos) AddNumBtagAndNumJetsShortSplit(); + else if(_optMap["Conditions"].find("NB/NJ")!=std::string::npos) AddNumBtagAndNumJetsSplit(); + else if(_optMap["Conditions"].find("NB/TR")!=std::string::npos) AddNumBtagAndTriggerSplit(); + else if(_optMap["Conditions"].find("NS/TR")!=std::string::npos) AddNumJetsShortAndTriggerSplit(); + else if(_optMap["Conditions"].find("NJ/TR")!=std::string::npos) AddNumJetsAndTriggerSplit(); + else if(_optMap["Conditions"].find("NB")!=std::string::npos) AddNumBtagSplit(); + else if(_optMap["Conditions"].find("NS")!=std::string::npos) AddNumJetsShortSplit(); + else if(_optMap["Conditions"].find("NJ")!=std::string::npos) AddNumJetsSplit(); + else if(_optMap["Conditions"].find("TR")!=std::string::npos) AddTriggerSplit(); + else{ + _numCond = 1; + _condVec.push_back(_optMap["Conditions"]); + } + if(_optMap["Conditions"].find("corr")!=std::string::npos) AddCorrection(); + ReadEfficiencies(); +} + +void MMEffSet::SetDataPath(std::string path){ + _dataPath = path; +} + +void MMEffSet::ParseOptions(std::string s,std::map<std::string,std::string> *m){ + TString ss(s); + TObjArray *optArray = ss.Tokenize(":"); + (*m)["Name"] = ((TObjString*)optArray->At(0))->GetString(); + (*m)["Conditions"] = ((TObjString*)optArray->At(1))->GetString(); + for(int i=0;i<(int)optArray->GetEntries()-2;i++){ + (*m)[Form("Histo%d",i)] = ((TObjString*)optArray->At(i+2))->GetString(); + } + delete optArray; +} + +void MMEffSet::AddCustomSplit(std::string config){ + std::vector<std::string> condVec = Tokenize(config,":"); + if(_numCond>0) _condVec = Combine(_condVec,condVec); + else _condVec = condVec; + _numCond = _condVec.size(); +} + +void MMEffSet::ReadEfficiencies(){ + if(_effIsRead) return; + // real + for(int i=0;i<(int)_condVec.size();i++){ + _Eff[i] = new MMEfficiency(); + ReadEfficiency(_Eff[i],_Estimate,_condVec[i]); + if(_useCorr){ + _EffCorr[i] = new MMEfficiency(); + ReadEfficiency(_EffCorr[i],_Estimate,_condVec[i],true); + } + } + _effIsRead = true; +} + +void MMEffSet::AddNumBtagSplit(){ + AddCustomSplit("0b:ge1b"); + _splitBitMask |= (NBTAG_MASK); +} +void MMEffSet::AddNumJetsSplit(){ + AddCustomSplit("1j:2or3j:ge4j"); + _splitBitMask |= (NJETS_MASK); +} +void MMEffSet::AddNumJetsShortSplit(){ + AddCustomSplit("1j:ge2j"); + _splitBitMask |= (NJETSSHORT_MASK); +} +void MMEffSet::AddTriggerSplit(){ + // for Run1 + if(_period == Period::Year2012){ + if(_isEle){ + AddCustomSplit("e24vhi:e60:e24vh"); + _ptTres = 62; + } + else{ + AddCustomSplit("mu24i:mu36:mu24"); + _ptTres = 37; + } + } + else if (_period == Period::Year2015) { // for Run2 + //if(_isEle){ // no trigger splitting for electrons + //} + if(!_isEle) { // for muons + AddCustomSplit("mu20_iloose_L1MU15:mu50:mu20_L1MU15"); + _ptTres = 51; + } + //AddCustomSplit(Form("%s:%s:%s",_trig1.c_str(),_trig2.c_str(),_trig3.c_str())); + } + else if (_period == Period::Year2016) { // for Run2 + if(_isEle){ // no trigger splitting for electrons + AddCustomSplit("e24_lhtight_nod0_ivarloose:e60_lhmedium_nod0:e24_lhmedium_L1EM20VH"); + _ptTres = 62; + } + if(!_isEle) { // for muons + AddCustomSplit("mu24_ivarmedium:mu50:mu24"); + _ptTres = 51; + } + //AddCustomSplit(Form("%s:%s:%s",_trig1.c_str(),_trig2.c_str(),_trig3.c_str())); + } + _splitBitMask |= (TRIGGER_MASK); +} + +// ... and combined +void MMEffSet::AddNumBtagAndTriggerSplit(){ + AddNumBtagSplit(); + AddTriggerSplit(); +} +void MMEffSet::AddNumBtagAndNumJetsSplit(){ + AddNumBtagSplit(); + AddNumJetsSplit(); +} +void MMEffSet::AddNumBtagAndNumJetsShortSplit(){ + AddNumBtagSplit(); + AddNumJetsShortSplit(); +} +void MMEffSet::AddNumJetsAndTriggerSplit(){ + AddNumJetsSplit(); + AddTriggerSplit(); +} +void MMEffSet::AddNumJetsShortAndTriggerSplit(){ + AddNumJetsShortSplit(); + AddTriggerSplit(); +} +void MMEffSet::AddNumBtagAndNumJetsAndTriggerSplit(){ + AddNumBtagSplit(); + AddNumJetsSplit(); + AddTriggerSplit(); +} +void MMEffSet::AddNumBtagAndNumJetsShortAndTriggerSplit(){ + AddNumBtagSplit(); + AddNumJetsShortSplit(); + AddTriggerSplit(); +} + +void MMEffSet::ReadEfficiency(MMEfficiency *eff,std::string aEff,std::string condition,bool isCorrection){ + string effFileName = Form("%s/%s_%s_%s.root", + _dataPath.c_str(), + isCorrection ? (_isReal ? "RCorr" : "FCorr") : (_isReal ? "R" : "F"), + _isEle ? "el" : "mu", + _optMap["Name"].c_str() + ); + if(_debug){ + if(_debug) std::cout << "------------------------------" << std::endl; + if(_isReal) std::cout << " --> Opening file for Real Eff: "; + else std::cout << " --> Opening file for Fake Eff: "; + std::cout << effFileName << std::endl; + } + TFile* effFile = TFile::Open(effFileName.c_str()); + + std::map<std::string,std::string> optMap; + ParseOptions(aEff,&optMap); + + string histoName; + int ndim = 1; + + bool status; + + // take average from histo + histoName = "av"; + if(condition=="") histoName = (string)(isCorrection ? "corr" : "eff")+"_" + histoName + "_" + optMap["Conditions"]; + else histoName = (string)(isCorrection ? "corr" : "eff")+"_" + histoName + "_" + condition; + if(_debug) std::cout << " --> Looking for histogram \"" << histoName << "\" inside file " << effFile->GetName() << std::endl; + eff->SetAverageHist(effFile,histoName); + + for(int i=0;;i++){ + histoName = optMap[Form("Histo%d",i)]; + if(histoName == "") break; + ndim = 1 + CountInString(histoName,'_'); + if(condition=="") histoName = (string)(isCorrection ? "corr" : "eff")+"_" + histoName + "_" + optMap["Conditions"]; + else histoName = (string)(isCorrection ? "corr" : "eff")+"_" + histoName + "_" + condition; + if(_debug){ + std::cout << " --> Looking for histogram \"" << histoName << "\" inside file " << effFile->GetName(); + std::cout << " " << (ndim==1 ?" (1D)" : (ndim==2 ? " (2D)" : " (3D)")); + std::cout << "..... "; + } + status = eff->AddHisto(effFile,histoName,ndim); + if(_debug){ + if(status) std::cout << "OK" << std::endl; + else std::cout << "NO" << std::endl << " MMEfficiency::INFO: Dummy Hstogram added." << std::endl; + } + } + + delete effFile; +} + +void MMEffSet::AddCorrection(){ + _useCorr = true; +} + +void MMEffSet::SetCustom(int value){ + _splitIdx = value; +} + +void MMEffSet::SetNumBtag(int nbtag){ + int value = -100; + value = NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetNumJets(int njets){ + int value = -100; + value = NumJetsValue(njets); + SetCustom(value); +} + +void MMEffSet::SetNumJetsShort(int njets){ + int value = -100; + value = NumJetsShortValue(njets); + SetCustom(value); +} + +void MMEffSet::SetTrigger(int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + SetCustom(value); +} + +void MMEffSet::SetNumBtagAndNumJets(int nbtag,int njets){ + int value = -100; + value = NumJetsValue(njets); + value += 3*NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetNumBtagAndNumJetsShort(int nbtag,int njets){ + int value = -100; + value = NumJetsShortValue(njets); + value += 2*NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetNumBtagAndTrigger(int nbtag,int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + value += 3*NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetNumJetsAndTrigger(int njets,int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + value += 3*NumJetsValue(njets); + SetCustom(value); +} + +void MMEffSet::SetNumJetsShortAndTrigger(int njets,int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + value += 3*NumJetsShortValue(njets); + SetCustom(value); +} + +void MMEffSet::SetNumBtagAndNumJetsAndTrigger(int nbtag,int njets,int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + value += 3*NumJetsValue(njets); + value += 9*NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetNumBtagAndNumJetsShortAndTrigger(int nbtag,int njets,int trigger,float pt){ + int value = -100; + value = TriggerValue(trigger, pt); + value += 3*NumJetsShortValue(njets); + value += 6*NumBtagValue(nbtag); + SetCustom(value); +} + +void MMEffSet::SetTriggerNames(std::string trig1,std::string trig2,std::string trig3){ + _trig1 = trig1; + _trig2 = trig2; + _trig3 = trig3; +} + +void MMEffSet::SetPeriod(int period){ + _period = period; +} + +void MMEffSet::SetTriggerPrescales(float ps1,float ps2,float ps3){ + _ps1 = ps1; + _ps2 = ps2; + _ps3 = ps3; +} + +void MMEffSet::SetTriggerThreshold(float thres){ + _ptTres = thres; +} + +int MMEffSet::TriggerValue(int trigger,float pt){ + _trigger = -100; + if ((trigger & (1 << 0))>0 && (_ptTres<0 || pt < _ptTres)) _trigger = 0; // if matched to the low-pT isolated trigger + if ((trigger & (1 << 1))>0 && (_ptTres<0 || pt >= _ptTres)) _trigger = 1; // if matched to the high-pT trigger + if ((trigger & (1 << 2))>0 && (_ptTres<0 || pt < _ptTres)) _trigger = 2; // if matched to the low-pT non-iso trigger + if ((trigger & 3)==0) _trigger = 2; // if not matched to any trigger -> assign the low-pt non-iso eff + return _trigger; +} + +int MMEffSet::NumJetsValue(int njets){ + if(njets==1) return 0; + if(njets<=3) return 1; + else return 2; +} + +int MMEffSet::NumJetsShortValue(int njets){ + if(njets==1) return 0; + else return 1; +} + +int MMEffSet::NumBtagValue(int nbtag){ + if(nbtag==0) return 0; + else return 1; +} + +void MMEffSet::SetLepton(float v0,float v1,float v2,float v3,float v4,float v5,float v6,float v7,float v8,float v9){ + for(int i=0;i<_numCond;i++) _Eff[i]->SetParVars(v0,v1,v2,v3,v4,v5,v6,v7,v8,v9); + if(_useCorr) + for(int i=0;i<_numCond;i++) _EffCorr[i]->SetParVars(v0,v1,v2,v3,v4,v5,v6,v7,v8,v9); +} + +float MMEffSet::GetEff(bool isAverage){ + int idx = 0; + if(_numCond>0) idx = _splitIdx; + if(idx<0) return -1.; // added for events which are neglected by trigger splitting + float E; + if(isAverage){ + E = _Eff[idx]->GetAverageEfficiency(); + if(_useCorr) E *= _EffCorr[idx]->GetAverageEfficiency(); + } + else{ + E = _Eff[idx]->GetEfficiency(); + if(_useCorr) E *= _EffCorr[idx]->GetEfficiency(); + } + return E; +} + +// to be called after 'AddTriggerSplit' +void MMEffSet::SetPtThres(int thres){ + _ptTres = thres; +} + +void MMEffSet::SetLepton(MMEvent event,MMLepton lepton){ + _event = event; + _lepton = lepton; + // + int njets = _event.njets; + int ntag = _event.ntag; + float jetpt = _event.jetpt; + float sumet = _event.sumet; + // + float pt = _lepton.pt; + float eta = _lepton.eta; + float dR = _lepton.dR; + float dRpt = _lepton.dRpt; + float dPhi = _lepton.dPhi; + float d0sig = _lepton.d0sig; + int trigger = _lepton.trigger; + // + // set the correct splitting + if((_splitBitMask & NBTAG_MASK) && (_splitBitMask & NJETSSHORT_MASK) && (_splitBitMask & TRIGGER_MASK)) + SetNumBtagAndNumJetsShortAndTrigger(ntag,njets,trigger,pt); + else if((_splitBitMask & NBTAG_MASK) && (_splitBitMask & NJETS_MASK) && (_splitBitMask & TRIGGER_MASK)) + SetNumBtagAndNumJetsAndTrigger(ntag,njets,trigger,pt); + else if((_splitBitMask & NBTAG_MASK) && (_splitBitMask & TRIGGER_MASK)) + SetNumBtagAndTrigger(ntag,trigger,pt); + else if((_splitBitMask & NJETSSHORT_MASK) && (_splitBitMask & TRIGGER_MASK)) + SetNumJetsShortAndTrigger(njets,trigger,pt); + else if((_splitBitMask & NJETS_MASK) && (_splitBitMask & TRIGGER_MASK)) + SetNumJetsAndTrigger(njets,trigger,pt); + else if((_splitBitMask & NBTAG_MASK) && (_splitBitMask & NJETSSHORT_MASK)) + SetNumBtagAndNumJetsShort(ntag,njets); + else if((_splitBitMask & NBTAG_MASK) && (_splitBitMask & NJETS_MASK)) + SetNumBtagAndNumJets(ntag,njets); + else if((_splitBitMask & NBTAG_MASK)) + SetNumBtag(ntag); + else if((_splitBitMask & NJETSSHORT_MASK)) + SetNumJetsShort(njets); + else if((_splitBitMask & NJETS_MASK)) + SetNumJets(njets); + else if((_splitBitMask & TRIGGER_MASK)) + SetTrigger(trigger,pt); + // + // set the used variables + float input[] = {0,0,0,0,0,0,0,0,0,0}; + int k = 0; + if(_Estimate.find(":eta_dR")!=string::npos) { input[k] = eta; k++; input[k] = dR; k++; } + else if(_Estimate.find(":eta")!=string::npos) { input[k] = eta; k++; } + if(_Estimate.find(":pt_dR")!=string::npos) { input[k] = pt; k++; input[k] = dR; k++; } + else if(_Estimate.find(":pt_jetpt")!=string::npos) { input[k] = pt; k++; input[k] = jetpt; k++; } + else if(_Estimate.find(":pt")!=string::npos) { input[k] = pt; k++; } + if(_Estimate.find(":jetpt_dR")!=string::npos) { input[k] = jetpt; k++; input[k] = dR; k++; } + else if(_Estimate.find(":jetpt")!=string::npos){ input[k] = jetpt; k++; } + if(_Estimate.find(":sumet")!=string::npos) { input[k] = sumet; k++; } + if(_Estimate.find(":dR")!=string::npos && _Estimate.find(":dRpt")==string::npos) { input[k] = dR; k++; } + if(_Estimate.find(":dRpt")!=string::npos) { input[k] = dRpt; k++; } + if(_Estimate.find(":dPhi")!=string::npos) { input[k] = dPhi; k++; } + if(_Estimate.find(":d0sig")!=string::npos) { input[k] = d0sig; k++; } + if(_Estimate.find(":nbjets")!=string::npos) { input[k] = ntag; k++; } + + SetLepton(input[0],input[1],input[2],input[3],input[4],input[5],input[6],input[7],input[8],input[9]); +} + +float MMEffSet::GetPrescale(){ + if(_trigger==0) return _ps1; + if(_trigger==1) return _ps2; + if(_trigger==2) return _ps3; + return 1.; +} + + +// ------------------------------ + +// Internal methods / functions: + +int MMEffSet::CountInString(std::string s,char c){ + int n = 0; + for(int i=0;i<(int)s.size();i++){ + if(s[i]==c) n++; + } + return n; +} + +std::vector<std::string> MMEffSet::Tokenize(std::string s, std::string c){ + std::vector<std::string> v; + v.clear(); + std::string new_s; + while(true){ + new_s = s.substr(0,s.find(c)); + v.push_back(new_s); + if(new_s == s) break; + else s = s.substr(s.find(c)+1,s.size()); + } + return v; +} + +std::vector<std::string> MMEffSet::Combine(std::vector<std::string> v1,std::vector<std::string> v2){ + std::vector<std::string> v; + v.clear(); + for(int i=0;i<(int)v1.size();i++){ + for(int j=0;j<(int)v2.size();j++){ + v.push_back(v1[i]+"_"+v2[j]); + } + } + return v; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEfficiency.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEfficiency.cxx new file mode 100644 index 0000000000000000000000000000000000000000..64bbec0d5847e438dc689aeef3cfc477425e1a6f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MMEfficiency.cxx @@ -0,0 +1,313 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + ** author: Michele Pinamonti <michele.pinamonti@cern.ch> + * * class used by FakesWeights.cxx +*/ + +#include "TopFakes/MMEfficiency.h" + +#define XXX std::cout << "I am here: " << __FILE__ << ":" << __LINE__ << std::endl; + +// ------------------------ Implementation ------------------------ // + +MMEfficiency::MMEfficiency() : + fAverage(-1), + fNvar(0) { + + for (int i = 0; i < MAXvar; ++i) { + fHist[i] = 0; + fHist2D[i] = 0; + fHist3D[i] = 0; + } +} + +MMEfficiency::~MMEfficiency(){ + for (int i = 0; i < MAXvar; ++i) { + delete fHist[i]; + delete fHist2D[i]; + delete fHist3D[i]; + } +} + +// ------------------------ AddHisto ------------------------ // + +bool MMEfficiency::AddHisto(TH1F *h){ + bool isDummy = false; + if(h==0) isDummy = true; + if(isDummy){ +// std::cout << " MMEfficiency::INFO: Dummy Hstogram added." << std::endl; + h = new TH1F("h_dummmy","h_dummy",1,0,1); + h->SetBinContent(1,1); + } + fHist[fNvar] = (TH1F*)h->Clone(); + fHist[fNvar]->SetDirectory(0); + fHist2D[fNvar] = 0; + fHist3D[fNvar] = 0; + if(fNvar>0 && fAverage<=0){ + std::cout << " MMEfficiency::INFO: No average efficiency set so far. Extracting it from current histogram... " << std::endl; + if(!isDummy) SetAverageFromHist((TH1F*)fHist[fNvar]->Clone()); + else fAverage = 1.; + } + fDim[fNvar] = 1; + fNvar += 1; + if(isDummy) delete h; + return !isDummy; +} + +bool MMEfficiency::AddHisto(TH2F *h){ + bool isDummy = false; + if(h==0) isDummy = true; + if(isDummy){ +// std::cout << " MMEfficiency::INFO: Dummy Hstogram added." << std::endl; + h = new TH2F("h_dummmy","h_dummy",1,0,1,1,0,1); + h->SetBinContent(1,1); + } + fHist[fNvar] = 0; + fHist2D[fNvar] = (TH2F*)h->Clone(); + fHist2D[fNvar]->SetDirectory(0); + fHist3D[fNvar] = 0; + if(fNvar>0 && fAverage<=0){ + std::cout << " MMEfficiency::INFO: No average efficiency set so far. Extracting it from current histogram... " << std::endl; + if(!isDummy) SetAverageFromHist((TH2F*)fHist2D[fNvar]->Clone()); + else fAverage = 1.; + } + fDim[fNvar] = 2; + fNvar += 2; + if(isDummy) delete h; + return !isDummy; +} + +bool MMEfficiency::AddHisto(TH3F *h){ + bool isDummy = false; + if(h==0) isDummy = true; + if(isDummy){ +// std::cout << " MMEfficiency::INFO: Dummy Hstogram added." << std::endl; + h = new TH3F("h_dummmy","h_dummy",1,0,1,1,0,1,1,0,1); + h->SetBinContent(1,1); + } + fHist[fNvar] = 0; + fHist2D[fNvar] = 0; + fHist3D[fNvar] = (TH3F*)h->Clone(); + fHist3D[fNvar]->SetDirectory(0); + if(fNvar>0 && fAverage<=0){ + std::cout << " MMEfficiency::INFO: No average efficiency set so far. Extracting it from current histogram... " << std::endl; + if(!isDummy) SetAverageFromHist((TH3F*)fHist3D[fNvar]->Clone()); + else fAverage = 1.; + } + fDim[fNvar] = 3; + fNvar += 3; + if(isDummy) delete h; + return !isDummy; +} + +bool MMEfficiency::AddHisto(TFile *f, std::string histoName, int ndim){ + f->cd(); + bool res = false; + if (ndim==1) res = AddHisto((TH1F*)f->Get(histoName.c_str())); + else if(ndim==2) res = AddHisto((TH2F*)f->Get(histoName.c_str())); + else if(ndim==3) res = AddHisto((TH3F*)f->Get(histoName.c_str())); + else{ + std::cout << " MMEfficiency::ERROR: ndim != 1,2,3" << std::endl; + return false; + } + return res; +} + +bool MMEfficiency::AddHisto(std::string fileName, std::string histoName, int ndim){ + bool res = false; + TFile *f = TFile::Open(fileName.c_str()); + res = AddHisto(f,histoName,ndim); + delete f; + return res; +} + +// ------------------------ SetAverage ------------------------ // + +void MMEfficiency::SetAverage(float value){ + fAverage = value; +} + +void MMEfficiency::SetAverageHist(std::string fileName, std::string histoName){ + TFile *f = TFile::Open(fileName.c_str()); + if(!f) return; + TH1F *h = (TH1F*)f->Get(histoName.c_str()); + if(!h){ + delete f; + return; + } + fAverage = h->GetBinContent(1); +// cout << "Setting Average Efficiency = " << fAverage << endl; + delete f; +} + +void MMEfficiency::SetAverageHist(TFile *f, std::string histoName){ + TH1F *h = (TH1F*)f->Get(histoName.c_str()); + if(!h) return; + fAverage = h->GetBinContent(1); +// cout << "Setting Average Efficiency = " << fAverage << endl; + delete h; +} + +float MMEfficiency::SetAverageFromHist(TH1F *h){ + TF1 *p = new TF1("p","pol0",h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX())); + h->Fit(p,"I0"); + fAverage = p->GetParameter(0); + delete p; + return fAverage; +} + +float MMEfficiency::SetAverageFromHist(TH2F *h){ + TF2 *p = new TF2("p","[0]+0*x+0*y", + h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()), + h->GetYaxis()->GetBinLowEdge(1),h->GetYaxis()->GetBinUpEdge(h->GetNbinsY()) + ); + h->Fit(p,"I0"); + fAverage = p->GetParameter(0); + delete p; + return fAverage; +} + +float MMEfficiency::SetAverageFromHist(TH3F *h){ + TF3 *p = new TF3("p","[0]+0*x+0*y+0*z", + h->GetXaxis()->GetBinLowEdge(1),h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()), + h->GetYaxis()->GetBinLowEdge(1),h->GetYaxis()->GetBinUpEdge(h->GetNbinsY()), + h->GetZaxis()->GetBinLowEdge(1),h->GetZaxis()->GetBinUpEdge(h->GetNbinsZ()) + ); + h->Fit(p,"I0"); + fAverage = p->GetParameter(0); + delete p; + return fAverage; +} + +float MMEfficiency::SetAverageFromHist(TFile *f, std::string histoName,int ndim){ + float av = -1; + TH1F *h1; + TH2F *h2; + TH3F *h3; + if(ndim==1){ + h1 = (TH1F*)f->Get(histoName.c_str()); + av = SetAverageFromHist(h1); + } + if(ndim==2){ + h2 = (TH2F*)f->Get(histoName.c_str()); + av = SetAverageFromHist(h2); + } + if(ndim==3){ + h3 = (TH3F*)f->Get(histoName.c_str()); + av = SetAverageFromHist(h3); + } + return av; +} + +float MMEfficiency::SetAverageFromHist(std::string fileName, std::string histoName,int ndim){ + float av = -1; + TFile *f = TFile::Open(fileName.c_str()); + av = SetAverageFromHist(f,histoName,ndim); + delete f; + return av; +} + +// ------------------------ GetEfficiency ------------------------ // + +float MMEfficiency::GetEfficiency(){ + float eff = 1; + float eff1 = 0; + float v0, v1, v2; + float xmin, ymin, zmin; + float xmax, ymax, zmax; + for(int i=0;i<fNvar;i+=fDim[i]){ + // ensure that x,y,z are inside hist range + if(fDim[i]==3){ + v0 = fVars[i]; + xmin = fHist3D[i]->GetXaxis()->GetXmin(); + xmax = fHist3D[i]->GetXaxis()->GetXmax(); + if(v0<xmin) v0 = xmin; + if(v0>xmax) v0 = xmax-0.001; + v1 = fVars[i+1]; + ymin = fHist3D[i]->GetYaxis()->GetXmin(); + ymax = fHist3D[i]->GetYaxis()->GetXmax(); + if(v1<ymin) v1 = ymin; + if(v1>ymax) v1 = ymax-0.001; + v2 = fVars[i+2]; + zmin = fHist3D[i]->GetZaxis()->GetXmin(); + zmax = fHist3D[i]->GetZaxis()->GetXmax(); + if(v2<zmin) v2 = zmin; + if(v2>zmax) v2 = zmax-0.001; + eff1 = fHist3D[i]->GetBinContent(fHist3D[i]->FindBin(v0,v1,v2)); + } + if(fDim[i]==2){ + v0 = fVars[i]; + xmin = fHist2D[i]->GetXaxis()->GetXmin(); + xmax = fHist2D[i]->GetXaxis()->GetXmax(); + if(v0<xmin) v0 = xmin; + if(v0>xmax) v0 = xmax-0.001; + v1 = fVars[i+1]; + ymin = fHist2D[i]->GetYaxis()->GetXmin(); + ymax = fHist2D[i]->GetYaxis()->GetXmax(); + if(v1<ymin) v1 = ymin; + if(v1>ymax) v1 = ymax-0.001; + eff1 = fHist2D[i]->GetBinContent(fHist2D[i]->FindBin(v0,v1)); + } + if(fDim[i]==1){ + v0 = fVars[i]; + xmin = fHist[i]->GetXaxis()->GetXmin(); + xmax = fHist[i]->GetXaxis()->GetXmax(); + if(v0<xmin) v0 = xmin; + if(v0>xmax) v0 = xmax-0.001; + // fix by Timothée Theveneaux-Pelzer + if ( fHist[i]->GetXaxis()->FindBin(v0) < fHist[i]->FindFirstBinAbove(0) ) { + int bin=fHist[i]->FindFirstBinAbove(0); + eff1 = fHist[i]->GetBinContent(bin); + } + else if ( fHist[i]->GetXaxis()->FindBin(v0) > fHist[i]->FindLastBinAbove(0) ) { + int bin=fHist[i]->FindLastBinAbove(0); + eff1 = fHist[i]->GetBinContent(bin); + } + else eff1 = fHist[i]->GetBinContent(fHist[i]->FindBin(v0)); +// cout << fHist[i]->GetTitle() << endl; + } + // + if(eff1>0 && eff1<1) eff *= eff1; // this is just to avoid crazy eff values going in + else eff *= fAverage; // ... and if the value is non-physica, just give the average eff + // + if(i>0) eff /= fAverage; // divide by average if it's an additional parametrization + } + return eff; +} + +float MMEfficiency::GetAverageEfficiency(){ + return fAverage; +} + +float MMEfficiency::GetEfficiency(float v0,float v1,float v2,float v3,float v4,float v5,float v6,float v7,float v8,float v9){ + SetParVars(v0,v1,v2,v3,v4,v5,v6,v7,v8,v9); + return GetEfficiency(); +} + +// ------------------------ SetParVar(s) ------------------------ // + +void MMEfficiency::SetParVars(float v0,float v1,float v2,float v3,float v4,float v5,float v6,float v7,float v8,float v9){ + SetParVar(0,v0); + if(fNvar>=2) SetParVar(1,v1); + if(fNvar>=3) SetParVar(2,v2); + if(fNvar>=4) SetParVar(3,v3); + if(fNvar>=5) SetParVar(4,v4); + if(fNvar>=6) SetParVar(5,v5); + if(fNvar>=7) SetParVar(6,v6); + if(fNvar>=8) SetParVar(7,v7); + if(fNvar>=9) SetParVar(8,v8); + if(fNvar>=10) SetParVar(9,v9); +} + +void MMEfficiency::SetParVar(int idx,float value){ + fVars[idx] = value; +} + +// ------------------------ Other ------------------------ // + +int MMEfficiency::GetNvars(){ + return fNvar; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MatrixUtils.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MatrixUtils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d20b2a59d9789d9c2bb51263f6cd3a5337f6f3c5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/MatrixUtils.cxx @@ -0,0 +1,486 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// Generic matrix methods fake lepton estimates for lepton and dilepton. +// +// Given loose/tight lepton ID, real efficiency r, +// and fake efficiency f builds the fake estimate event weight +// +// Authors: +// Karl Gellerstedt (kargel@fysik.su.se) +// Jorgen Sjolin (sjolin@fysik.su.se) +// + +#include "TopFakes/MatrixUtils.h" +#include <iostream> +using namespace std; + +MatrixUtils::MatrixUtils() : + ljets_matrix(2,2), + ljets_matrix_top_corr(2,2), + ll_matrix(4,4), + ll_matrix_top_corr(4,4), + lll_matrix(8,8), + i_ljets_matrix(2,2), + i_ljets_matrix_top_corr(2,2), + i_ll_matrix(4,4), + i_ll_matrix_top_corr(4,4), + i_lll_matrix(8,8) +{ + +} + +double MatrixUtils::lepton_weight(bool loose, double r, double f, + double &nf, double & /*nr*/) { + // fix to not return NaN + if(r == 0 && f == 0) + return nf; + + double nl=loose ? 1 :0; + double nt=!loose ? 1 :0; + double a=1./(r-f); + nf=a*f*r*nl + a*f*(r - 1.)*nt; + if(nf!=nf) nf = 0.; // protect against "nan" + return nf; +} + +void MatrixUtils::fill_matrix(double r, double f) +{ + ljets_matrix[0][0] = r; + ljets_matrix[0][1] = f; + ljets_matrix[1][0] = (1. - r); + ljets_matrix[1][1] = (1. - f); + i_ljets_matrix = ljets_matrix; + i_ljets_matrix.InvertFast(); + + ljets_matrix_top_corr[0][0] = r; + ljets_matrix_top_corr[0][1] = f; + ljets_matrix_top_corr[1][0] = (1. - r); + ljets_matrix_top_corr[1][1] = (1. - f); + i_ljets_matrix_top_corr = ljets_matrix_top_corr; + i_ljets_matrix_top_corr.InvertFast(); +} + +void MatrixUtils::fill_matrix(double r, double f, double t) +{ + ljets_matrix[0][0] = r; + ljets_matrix[0][1] = f; + ljets_matrix[1][0] = (1. - r); + ljets_matrix[1][1] = (1. - f); + i_ljets_matrix = ljets_matrix; + i_ljets_matrix.InvertFast(); + + ljets_matrix_top_corr[0][0] = r*t; + ljets_matrix_top_corr[0][1] = f; + ljets_matrix_top_corr[1][0] = (1. - r*t); + ljets_matrix_top_corr[1][1] = (1. - f); + i_ljets_matrix_top_corr = ljets_matrix_top_corr; + i_ljets_matrix_top_corr.InvertFast(); +} + +double MatrixUtils::lepton_tight_weight(bool loose) +{ + double nl=loose ? 1 :0; + double nt=!loose ? 1 :0; + double nf=i_ljets_matrix[1][0]*nt + i_ljets_matrix[1][1]*nl; + double nf_tight=ljets_matrix[0][1]*nf; + return nf_tight; +} + +double MatrixUtils::lepton_loose_weight(bool loose) +{ + double nl=loose ? 1 :0; + double nt=!loose ? 1 :0; + double nf=i_ljets_matrix[1][0]*nt + i_ljets_matrix[1][1]*nl; + double nf_loose=ljets_matrix[1][1]*nf; + return nf_loose; +} + +double MatrixUtils::lepton_tight_top_corr_weight(bool loose) +{ + double nl=loose ? 1 :0; + double nt=!loose ? 1 :0; + double nf=i_ljets_matrix_top_corr[1][0]*nt + i_ljets_matrix_top_corr[1][1]*nl; + double nf_tight=ljets_matrix_top_corr[0][1]*nf; + return nf_tight; +} + +double MatrixUtils::lepton_loose_top_corr_weight(bool loose) +{ + double nl=loose ? 1 :0; + double nt=!loose ? 1 :0; + double nf=i_ljets_matrix_top_corr[1][0]*nt + i_ljets_matrix_top_corr[1][1]*nl; + double nf_tight=ljets_matrix_top_corr[0][1]*nf; + return nf_tight; +} + + +double MatrixUtils::dilepton_weight(bool l1, double r1, double f1, + bool l2, double r2, double f2, + double &nrf, double &nfr, + double &nff) { + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double a=1./((r1-f1)*(r2-f2)); + + nrf= a*r1*f2*( -(1.-f1)*(1.-r2)*ntt + (1.-f1)*r2*ntl + f1*(1.-r2)*nlt - f1*r2*nll ); + + nfr= a*f1*r2*( -(1.-r1)*(1.-f2)*ntt + (1.-r1)*f2*ntl + r1*(1.-f2)*nlt - r1*f2*nll ); + + nff= a*f1*f2*( +(1.-r1)*(1.-r2)*ntt - (1.-r1)*r2*ntl - r1*(1.-r2)*nlt + r1*r2*nll ); + + if(nrf!=nrf) nrf = 0.; // protect against "nan" + if(nfr!=nfr) nfr = 0.; // protect against "nan" + if(nff!=nff) nff = 0.; // protect against "nan" + return nrf+nfr+nff; +} + +void MatrixUtils::fill_matrix(double r1, double f1, double r2, double f2) +{ + ll_matrix[0][0] = r1 * r2; + ll_matrix[0][1] = r1 * f2; + ll_matrix[0][2] = f1 * r2; + ll_matrix[0][3] = f1 * f2; + ll_matrix[1][0] = r1 * (1. - r2); + ll_matrix[1][1] = r1 * (1. - f2); + ll_matrix[1][2] = f1 * (1. - r2); + ll_matrix[1][3] = f1 * (1. - f2); + ll_matrix[2][0] = (1. - r1) * r2; + ll_matrix[2][1] = (1. - r1) * f2; + ll_matrix[2][2] = (1. - f1) * r2; + ll_matrix[2][3] = (1. - f1) * f2; + ll_matrix[3][0] = (1. - r1) * (1. - r2); + ll_matrix[3][1] = (1. - r1) * (1. - f2); + ll_matrix[3][2] = (1. - f1) * (1. - r2); + ll_matrix[3][3] = (1. - f1) * (1. - f2); + i_ll_matrix = ll_matrix; + i_ll_matrix.InvertFast(); + + ll_matrix_top_corr[0][0] = r1 * r2; // RR + ll_matrix_top_corr[0][1] = r1 * f2; + ll_matrix_top_corr[0][2] = f1 * r2; + ll_matrix_top_corr[0][3] = f1 * f2; + ll_matrix_top_corr[1][0] = r1 * (1. - r2); // RR + ll_matrix_top_corr[1][1] = r1 * (1. - f2); + ll_matrix_top_corr[1][2] = f1 * (1. - r2); + ll_matrix_top_corr[1][3] = f1 * (1. - f2); + ll_matrix_top_corr[2][0] = (1. - r1) * r2; // RR + ll_matrix_top_corr[2][1] = (1. - r1) * f2; + ll_matrix_top_corr[2][2] = (1. - f1) * r2; + ll_matrix_top_corr[2][3] = (1. - f1) * f2; + ll_matrix_top_corr[3][0] = (1. - r1) * (1. - r2); // RR + ll_matrix_top_corr[3][1] = (1. - r1) * (1. - f2); + ll_matrix_top_corr[3][2] = (1. - f1) * (1. - r2); + ll_matrix_top_corr[3][3] = (1. - f1) * (1. - f2); + i_ll_matrix_top_corr = ll_matrix_top_corr; + i_ll_matrix_top_corr.InvertFast(); +} + +void MatrixUtils::fill_matrix(double r1, double f1, double t1, double r2, double f2, double t2) +{ + ll_matrix[0][0] = r1 * r2; + ll_matrix[0][1] = r1 * f2; + ll_matrix[0][2] = f1 * r2; + ll_matrix[0][3] = f1 * f2; + ll_matrix[1][0] = r1 * (1. - r2); + ll_matrix[1][1] = r1 * (1. - f2); + ll_matrix[1][2] = f1 * (1. - r2); + ll_matrix[1][3] = f1 * (1. - f2); + ll_matrix[2][0] = (1. - r1) * r2; + ll_matrix[2][1] = (1. - r1) * f2; + ll_matrix[2][2] = (1. - f1) * r2; + ll_matrix[2][3] = (1. - f1) * f2; + ll_matrix[3][0] = (1. - r1) * (1. - r2); + ll_matrix[3][1] = (1. - r1) * (1. - f2); + ll_matrix[3][2] = (1. - f1) * (1. - r2); + ll_matrix[3][3] = (1. - f1) * (1. - f2); + i_ll_matrix = ll_matrix; + i_ll_matrix.InvertFast(); + + // This is to fill and invert the matrix using the correction applied only to the real/real column + ll_matrix_top_corr[0][0] = r1 * t1 * r2 * t2; // RR + ll_matrix_top_corr[0][1] = r1 * f2; + ll_matrix_top_corr[0][2] = f1 * r2; + ll_matrix_top_corr[0][3] = f1 * f2; + ll_matrix_top_corr[1][0] = r1 * t1 * (1. - r2 * t2); // RR + ll_matrix_top_corr[1][1] = r1 * (1. - f2); + ll_matrix_top_corr[1][2] = f1 * (1. - r2); + ll_matrix_top_corr[1][3] = f1 * (1. - f2); + ll_matrix_top_corr[2][0] = (1. - r1 * t1) * r2 * t2; // RR + ll_matrix_top_corr[2][1] = (1. - r1) * f2; + ll_matrix_top_corr[2][2] = (1. - f1) * r2; + ll_matrix_top_corr[2][3] = (1. - f1) * f2; + ll_matrix_top_corr[3][0] = (1. - r1 * t1) * (1. - r2 * t2); // RR + ll_matrix_top_corr[3][1] = (1. - r1) * (1. - f2); + ll_matrix_top_corr[3][2] = (1. - f1) * (1. - r2); + ll_matrix_top_corr[3][3] = (1. - f1) * (1. - f2); + i_ll_matrix_top_corr = ll_matrix_top_corr; + i_ll_matrix_top_corr.InvertFast(); +} + +double MatrixUtils::dilepton_TT_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix[1][0] * ntt + i_ll_matrix[1][1] * ntl + i_ll_matrix[1][2] * nlt + i_ll_matrix[1][3] * nll; + double nfr = i_ll_matrix[2][0] * ntt + i_ll_matrix[2][1] * ntl + i_ll_matrix[2][2] * nlt + i_ll_matrix[2][3] * nll; + double nff = i_ll_matrix[3][0] * ntt + i_ll_matrix[3][1] * ntl + i_ll_matrix[3][2] * nlt + i_ll_matrix[3][3] * nll; + + double nrf_TT = ll_matrix[0][1] * nrf; + double nfr_TT = ll_matrix[0][2] * nfr; + double nff_TT = ll_matrix[0][3] * nff; + + return nrf_TT + nfr_TT + nff_TT; +} + +double MatrixUtils::dilepton_TL_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix[1][0] * ntt + i_ll_matrix[1][1] * ntl + i_ll_matrix[1][2] * nlt + i_ll_matrix[1][3] * nll; + double nfr = i_ll_matrix[2][0] * ntt + i_ll_matrix[2][1] * ntl + i_ll_matrix[2][2] * nlt + i_ll_matrix[2][3] * nll; + double nff = i_ll_matrix[3][0] * ntt + i_ll_matrix[3][1] * ntl + i_ll_matrix[3][2] * nlt + i_ll_matrix[3][3] * nll; + + double nrf_TL = ll_matrix[1][1] * nrf; + double nfr_TL = ll_matrix[1][2] * nfr; + double nff_TL = ll_matrix[1][3] * nff; + + return nrf_TL + nfr_TL + nff_TL; +} + +double MatrixUtils::dilepton_LT_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix[1][0] * ntt + i_ll_matrix[1][1] * ntl + i_ll_matrix[1][2] * nlt + i_ll_matrix[1][3] * nll; + double nfr = i_ll_matrix[2][0] * ntt + i_ll_matrix[2][1] * ntl + i_ll_matrix[2][2] * nlt + i_ll_matrix[2][3] * nll; + double nff = i_ll_matrix[3][0] * ntt + i_ll_matrix[3][1] * ntl + i_ll_matrix[3][2] * nlt + i_ll_matrix[3][3] * nll; + + double nrf_LT = ll_matrix[2][1] * nrf; + double nfr_LT = ll_matrix[2][2] * nfr; + double nff_LT = ll_matrix[2][3] * nff; + + return nrf_LT + nfr_LT + nff_LT; +} + +double MatrixUtils::dilepton_LL_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix[1][0] * ntt + i_ll_matrix[1][1] * ntl + i_ll_matrix[1][2] * nlt + i_ll_matrix[1][3] * nll; + double nfr = i_ll_matrix[2][0] * ntt + i_ll_matrix[2][1] * ntl + i_ll_matrix[2][2] * nlt + i_ll_matrix[2][3] * nll; + double nff = i_ll_matrix[3][0] * ntt + i_ll_matrix[3][1] * ntl + i_ll_matrix[3][2] * nlt + i_ll_matrix[3][3] * nll; + + double nrf_LL = ll_matrix[3][1] * nrf; + double nfr_LL = ll_matrix[3][2] * nfr; + double nff_LL = ll_matrix[3][3] * nff; + + return nrf_LL + nfr_LL + nff_LL; +} + +double MatrixUtils::dilepton_TT_top_corr_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix_top_corr[1][0] * ntt + i_ll_matrix_top_corr[1][1] * ntl + i_ll_matrix_top_corr[1][2] * nlt + i_ll_matrix_top_corr[1][3] * nll; + double nfr = i_ll_matrix_top_corr[2][0] * ntt + i_ll_matrix_top_corr[2][1] * ntl + i_ll_matrix_top_corr[2][2] * nlt + i_ll_matrix_top_corr[2][3] * nll; + double nff = i_ll_matrix_top_corr[3][0] * ntt + i_ll_matrix_top_corr[3][1] * ntl + i_ll_matrix_top_corr[3][2] * nlt + i_ll_matrix_top_corr[3][3] * nll; + + double nrf_TT = ll_matrix_top_corr[0][1] * nrf; + double nfr_TT = ll_matrix_top_corr[0][2] * nfr; + double nff_TT = ll_matrix_top_corr[0][3] * nff; + + return nrf_TT + nfr_TT + nff_TT; +} + +double MatrixUtils::dilepton_TL_top_corr_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix_top_corr[1][0] * ntt + i_ll_matrix_top_corr[1][1] * ntl + i_ll_matrix_top_corr[1][2] * nlt + i_ll_matrix_top_corr[1][3] * nll; + double nfr = i_ll_matrix_top_corr[2][0] * ntt + i_ll_matrix_top_corr[2][1] * ntl + i_ll_matrix_top_corr[2][2] * nlt + i_ll_matrix_top_corr[2][3] * nll; + double nff = i_ll_matrix_top_corr[3][0] * ntt + i_ll_matrix_top_corr[3][1] * ntl + i_ll_matrix_top_corr[3][2] * nlt + i_ll_matrix_top_corr[3][3] * nll; + + double nrf_TL = ll_matrix_top_corr[1][1] * nrf; + double nfr_TL = ll_matrix_top_corr[1][2] * nfr; + double nff_TL = ll_matrix_top_corr[1][3] * nff; + + return nrf_TL + nfr_TL + nff_TL; +} + +double MatrixUtils::dilepton_LT_top_corr_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix_top_corr[1][0] * ntt + i_ll_matrix_top_corr[1][1] * ntl + i_ll_matrix_top_corr[1][2] * nlt + i_ll_matrix_top_corr[1][3] * nll; + double nfr = i_ll_matrix_top_corr[2][0] * ntt + i_ll_matrix_top_corr[2][1] * ntl + i_ll_matrix_top_corr[2][2] * nlt + i_ll_matrix_top_corr[2][3] * nll; + double nff = i_ll_matrix_top_corr[3][0] * ntt + i_ll_matrix_top_corr[3][1] * ntl + i_ll_matrix_top_corr[3][2] * nlt + i_ll_matrix_top_corr[3][3] * nll; + + double nrf_LT = ll_matrix_top_corr[2][1] * nrf; + double nfr_LT = ll_matrix_top_corr[2][2] * nfr; + double nff_LT = ll_matrix_top_corr[2][3] * nff; + + return nrf_LT + nfr_LT + nff_LT; +} + +double MatrixUtils::dilepton_LL_top_corr_weight(bool l1, bool l2) +{ + double ntt=((!l1)&&(!l2)?1.:0.); + double ntl=((!l1)&&( l2)?1.:0.); + double nlt=(( l1)&&(!l2)?1.:0.); + double nll=(( l1)&&( l2)?1.:0.); + + double nrf = i_ll_matrix_top_corr[1][0] * ntt + i_ll_matrix_top_corr[1][1] * ntl + i_ll_matrix_top_corr[1][2] * nlt + i_ll_matrix_top_corr[1][3] * nll; + double nfr = i_ll_matrix_top_corr[2][0] * ntt + i_ll_matrix_top_corr[2][1] * ntl + i_ll_matrix_top_corr[2][2] * nlt + i_ll_matrix_top_corr[2][3] * nll; + double nff = i_ll_matrix_top_corr[3][0] * ntt + i_ll_matrix_top_corr[3][1] * ntl + i_ll_matrix_top_corr[3][2] * nlt + i_ll_matrix_top_corr[3][3] * nll; + + double nrf_LL = ll_matrix_top_corr[3][1] * nrf; + double nfr_LL = ll_matrix_top_corr[3][2] * nfr; + double nff_LL = ll_matrix_top_corr[3][3] * nff; + + return nrf_LL + nfr_LL + nff_LL; +} + +void MatrixUtils::fill_lll_matrix(double r1, double f1, double r2, double f2, double r3, double f3) +{ + + lll_matrix[0][0] = r1 * r2 * r3; + lll_matrix[0][1] = r1 * r2 * f3; + lll_matrix[0][2] = r1 * f2 * r3; + lll_matrix[0][3] = r1 * f2 * f3; + lll_matrix[0][4] = f1 * r2 * r3; + lll_matrix[0][5] = f1 * r2 * f3; + lll_matrix[0][6] = f1 * f2 * r3; + lll_matrix[0][7] = f1 * f2 * f3; + + lll_matrix[1][0] = r1 * r2 * (1. - r3); + lll_matrix[1][1] = r1 * r2 * (1. - f3); + lll_matrix[1][2] = r1 * f2 * (1. - r3); + lll_matrix[1][3] = r1 * f2 * (1. - f3); + lll_matrix[1][4] = f1 * r2 * (1. - r3); + lll_matrix[1][5] = f1 * r2 * (1. - f3); + lll_matrix[1][6] = f1 * f2 * (1. - r3); + lll_matrix[1][7] = f1 * f2 * (1. - f3); + + lll_matrix[2][0] = r1 * (1. - r2) * r3; + lll_matrix[2][1] = r1 * (1. - r2) * f3; + lll_matrix[2][2] = r1 * (1. - f2) * r3; + lll_matrix[2][3] = r1 * (1. - f2) * f3; + lll_matrix[2][4] = f1 * (1. - r2) * r3; + lll_matrix[2][5] = f1 * (1. - r2) * f3; + lll_matrix[2][6] = f1 * (1. - f2) * r3; + lll_matrix[2][7] = f1 * (1. - f2) * f3; + + lll_matrix[3][0] = r1 * (1. - r2) * (1. - r3); + lll_matrix[3][1] = r1 * (1. - r2) * (1. - f3); + lll_matrix[3][2] = r1 * (1. - f2) * (1. - r3); + lll_matrix[3][3] = r1 * (1. - f2) * (1. - f3); + lll_matrix[3][4] = f1 * (1. - r2) * (1. - r3); + lll_matrix[3][5] = f1 * (1. - r2) * (1. - f3); + lll_matrix[3][6] = f1 * (1. - f2) * (1. - r3); + lll_matrix[3][7] = f1 * (1. - f2) * (1. - f3); + + lll_matrix[4][0] = (1. - r1) * r2 * r3; + lll_matrix[4][1] = (1. - r1) * r2 * f3; + lll_matrix[4][2] = (1. - r1) * f2 * r3; + lll_matrix[4][3] = (1. - r1) * f2 * f3; + lll_matrix[4][4] = (1. - f1) * r2 * r3; + lll_matrix[4][5] = (1. - f1) * r2 * f3; + lll_matrix[4][6] = (1. - f1) * f2 * r3; + lll_matrix[4][7] = (1. - f1) * f2 * f3; + + lll_matrix[5][0] = (1. - r1) * r2 * (1. - r3); + lll_matrix[5][1] = (1. - r1) * r2 * (1. - f3); + lll_matrix[5][2] = (1. - r1) * f2 * (1. - r3); + lll_matrix[5][3] = (1. - r1) * f2 * (1. - f3); + lll_matrix[5][4] = (1. - f1) * r2 * (1. - r3); + lll_matrix[5][5] = (1. - f1) * r2 * (1. - f3); + lll_matrix[5][6] = (1. - f1) * f2 * (1. - r3); + lll_matrix[5][7] = (1. - f1) * f2 * (1. - f3); + + lll_matrix[6][0] = (1. - r1) * (1. - r2) * r3; + lll_matrix[6][1] = (1. - r1) * (1. - r2) * f3; + lll_matrix[6][2] = (1. - r1) * (1. - f2) * r3; + lll_matrix[6][3] = (1. - r1) * (1. - f2) * f3; + lll_matrix[6][4] = (1. - f1) * (1. - r2) * r3; + lll_matrix[6][5] = (1. - f1) * (1. - r2) * f3; + lll_matrix[6][6] = (1. - f1) * (1. - f2) * r3; + lll_matrix[6][7] = (1. - f1) * (1. - f2) * f3; + + lll_matrix[7][0] = (1. - r1) * (1. - r2) * (1. - r3); + lll_matrix[7][1] = (1. - r1) * (1. - r2) * (1. - f3); + lll_matrix[7][2] = (1. - r1) * (1. - f2) * (1. - r3); + lll_matrix[7][3] = (1. - r1) * (1. - f2) * (1. - f3); + lll_matrix[7][4] = (1. - f1) * (1. - r2) * (1. - r3); + lll_matrix[7][5] = (1. - f1) * (1. - r2) * (1. - f3); + lll_matrix[7][6] = (1. - f1) * (1. - f2) * (1. - r3); + lll_matrix[7][7] = (1. - f1) * (1. - f2) * (1. - f3); + + i_lll_matrix = lll_matrix; + i_lll_matrix.InvertFast(); + +} + +double MatrixUtils::trilepton_weight(bool l1, bool l2, bool l3){ + + double nttt=(((!l1)&&(!l2)&&(!l3))?1.:0.); + double nttl=(((!l1)&&(!l2)&&( l3))?1.:0.); + double ntlt=(((!l1)&&( l2)&&(!l3))?1.:0.); + double ntll=(((!l1)&&( l2)&&( l3))?1.:0.); + double nltt=((( l1)&&(!l2)&&(!l3))?1.:0.); + double nltl=((( l1)&&(!l2)&&( l3))?1.:0.); + double nllt=((( l1)&&( l2)&&(!l3))?1.:0.); + double nlll=((( l1)&&( l2)&&( l3))?1.:0.); + + double nrrf = i_lll_matrix[1][0] * nttt + i_lll_matrix[1][1] * nttl + i_lll_matrix[1][2] * ntlt + i_lll_matrix[1][3] * ntll + + i_lll_matrix[1][4] * nltt + i_lll_matrix[1][5] * nltl + i_lll_matrix[1][6] * nllt + i_lll_matrix[1][7] * nlll; + double nrfr = i_lll_matrix[2][0] * nttt + i_lll_matrix[2][1] * nttl + i_lll_matrix[2][2] * ntlt + i_lll_matrix[2][3] * ntll + + i_lll_matrix[2][4] * nltt + i_lll_matrix[2][5] * nltl + i_lll_matrix[2][6] * nllt + i_lll_matrix[2][7] * nlll; + double nrff = i_lll_matrix[3][0] * nttt + i_lll_matrix[3][1] * nttl + i_lll_matrix[3][2] * ntlt + i_lll_matrix[3][3] * ntll + + i_lll_matrix[3][4] * nltt + i_lll_matrix[3][5] * nltl + i_lll_matrix[3][6] * nllt + i_lll_matrix[3][7] * nlll; + double nfrr = i_lll_matrix[4][0] * nttt + i_lll_matrix[4][1] * nttl + i_lll_matrix[4][2] * ntlt + i_lll_matrix[4][3] * ntll + + i_lll_matrix[4][4] * nltt + i_lll_matrix[4][5] * nltl + i_lll_matrix[4][6] * nllt + i_lll_matrix[4][7] * nlll; + double nfrf = i_lll_matrix[5][0] * nttt + i_lll_matrix[5][1] * nttl + i_lll_matrix[5][2] * ntlt + i_lll_matrix[5][3] * ntll + + i_lll_matrix[5][4] * nltt + i_lll_matrix[5][5] * nltl + i_lll_matrix[5][6] * nllt + i_lll_matrix[5][7] * nlll; + double nffr = i_lll_matrix[6][0] * nttt + i_lll_matrix[6][1] * nttl + i_lll_matrix[6][2] * ntlt + i_lll_matrix[6][3] * ntll + + i_lll_matrix[6][4] * nltt + i_lll_matrix[6][5] * nltl + i_lll_matrix[6][6] * nllt + i_lll_matrix[6][7] * nlll; + double nfff = i_lll_matrix[7][0] * nttt + i_lll_matrix[7][1] * nttl + i_lll_matrix[7][2] * ntlt + i_lll_matrix[7][3] * ntll + + i_lll_matrix[7][4] * nltt + i_lll_matrix[7][5] * nltl + i_lll_matrix[7][6] * nllt + i_lll_matrix[7][7] * nlll; + + double nrrf_TT = lll_matrix[0][1] * nrrf; + double nrfr_TT = lll_matrix[0][2] * nrfr; + double nrff_TT = lll_matrix[0][3] * nrff; + double nfrr_TT = lll_matrix[0][4] * nfrr; + double nfrf_TT = lll_matrix[0][5] * nfrf; + double nffr_TT = lll_matrix[0][6] * nffr; + double nfff_TT = lll_matrix[0][6] * nfff; + + return nrrf_TT + nrfr_TT + nrff_TT + nfrr_TT + nfrf_TT + nffr_TT + nfff_TT; + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesMMWeightCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesMMWeightCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3612d0842b562a6019ad7b5acdd26d6e1f27c14c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesMMWeightCalculator.cxx @@ -0,0 +1,864 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////// +// +// Author : +// Timothée Theveneaux-Pelzer +// Creation : +// Purpose : helper to be used in analyses +// +// Updated : +// 2016-01-29 : FD: set default values for Run2 and 1st efficiencies +////////////////////////////////////////////////////////////////////// + +#include "TopFakes/TopFakesMMWeightCalculator.h" +#include "TopFakes/TopFakesxAODUtils.h" +#include "TopConfiguration/TopConfig.h" +#include "TopConfiguration/ConfigurationSettings.h" +// #include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/TopEventMaker.h" +#include "TopFakes/FakesWeights.h" +#include "TopFakes/MMEfficiency.h" +#include "TopFakes/MatrixUtils.h" +#include "TopFakes/MMEffSet.h" +#define XXX std::cout << "I am here: " << __FILE__ << ":" << __LINE__ << std::endl; + +namespace top{ + + TopFakesMMWeightCalculator::TopFakesMMWeightCalculator( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + m_dir(""), + m_debug(false)//, +// m_leptonDefs(fakes::LeptonDefinitions::Standard) + { + ATH_MSG_INFO(" constructor of top::TopFakesMMWeightCalculator "+name ); + declareProperty( "config" , m_config ); + } + + TopFakesMMWeightCalculator::~TopFakesMMWeightCalculator() + { + } + + // ============================================================= + StatusCode TopFakesMMWeightCalculator::initialize() + { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator initialize" ); + + m_dir = m_config->FakesMMDir(); + m_debug = m_config->FakesMMDebug(); + ATH_MSG_INFO(" Directory for efficiencies: "+m_dir ); + if (std::find(m_config->bTagWP_available().begin(), m_config->bTagWP_available().end(), "FixedCutBEff_77") == m_config->bTagWP_available().end()) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator initialize" ); + std::cout<<"B-tagging WP FixedCutBEff_77 is needed to parametrise efficiencies."<<std::endl; + std::cout<<"Please set it up by writing \"BTaggingWP FixedCutBEff_77\" or \"BTaggingWP %77\" in your configuration file."<<std::endl; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + StatusCode TopFakesMMWeightCalculator::setSelectionConfigs(std::string selection, std::vector<std::string> configs) + { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + + auto* const settings = top::ConfigurationSettings::get(); + const std::vector<top::SelectionConfigurationData> selections = settings->selections(); + for(std::string config : configs){ + std::istringstream ss(config); + std::vector<std::string> listofkeys; + std::string token; + while(std::getline(ss, token, ',')) {//parameters are separated by commas + listofkeys.push_back(token); + } + // check if number of parameters is ok + if (listofkeys.size()<3 || listofkeys.size()>7) {//need at least 3 and no more than 7 parameters + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + return StatusCode::FAILURE; + } + + // check if configuration already defined for another selection + if (m_fakesWeightTools.count(selection) !=0) { + if (m_fakesWeightTools[selection].count(listofkeys.at(0)) !=0) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The configuration "<<listofkeys.at(0)<<"is already defined for selection "<<selection<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + } + + // first argument must define the period - check if it's valid + int period = getPeriod(listofkeys.at(1)); + if (period == -1) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"Can't recognise period "<<listofkeys.at(1)<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + } + + // second argument is the channel + if (listofkeys.at(2)=="EJETS") { + if (listofkeys.size()<3 || listofkeys.size()>5) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(2)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Correct syntax (1): <config name>,EJETS"<<std::endl; + std::cout<<"Correct syntax (2): <config name>,EJETS,<systematic variation>"<<std::endl; + std::cout<<"Correct syntax (3): <config name>,EJETS,<real eff configuration>,<fake eff configuration>"<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)] = std::shared_ptr<FakesWeights>(new FakesWeights()); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDebug(m_debug); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDataPath(m_dir); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetPeriod(period); + if (listofkeys.size()==3) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EJETS); + } + else if (listofkeys.size()==4) { + if (listofkeys.at(3)!="MCup" && listofkeys.at(3)!="MCdown" && listofkeys.at(3)!="MCupel" && listofkeys.at(3)!="MCdownel" && listofkeys.at(3)!="CRfake" && listofkeys.at(3)!="CRfakeel" && listofkeys.at(3)!="CRreal" && listofkeys.at(3)!="CRrealel" && listofkeys.at(3)!="EffPar") { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Systematic variation "<<listofkeys.at(2)<<" not recognised."<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EJETS,listofkeys.at(3)); + } + } + else if (listofkeys.size()==5) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighter(FakesWeights::EJETS,listofkeys.at(3),listofkeys.at(4)); + } + } + } + else if (listofkeys.at(2)=="MUJETS") { + if (listofkeys.size()<3 || listofkeys.size()>5) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Correct syntax (1): <config name>,MUJETS"<<std::endl; + std::cout<<"Correct syntax (2): <config name>,MUJETS,<systematic variation>"<<std::endl; + std::cout<<"Correct syntax (3): <config name>,MUJETS,<real eff configuration>,<fake eff configuration>"<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)] = std::shared_ptr<FakesWeights>(new FakesWeights()); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDebug(m_debug); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDataPath(m_dir); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetPeriod(period); + if (listofkeys.size()==3) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::MUJETS); + } + else if (listofkeys.size()==4) { + if (listofkeys.at(3)!="MCup" && listofkeys.at(3)!="MCdown" && listofkeys.at(3)!="MCupmu" && listofkeys.at(3)!="MCdownmu" && listofkeys.at(3)!="CRfake" && listofkeys.at(3)!="CRfakemu" && listofkeys.at(3)!="CRreal" && listofkeys.at(3)!="CRrealmu" && listofkeys.at(3)!="EffPar") { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Systematic variation "<<listofkeys.at(3)<<" not recognised."<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::MUJETS,listofkeys.at(3)); + } + } + else if (listofkeys.size()==5) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighter(FakesWeights::MUJETS,listofkeys.at(3),listofkeys.at(4)); + } + } + } + else if (listofkeys.at(2)=="EE") { + if (listofkeys.size()<3 || listofkeys.size()>5) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Correct syntax (1): <config name>,EE"<<std::endl; + std::cout<<"Correct syntax (2): <config name>,EE,<systematic variation>"<<std::endl; + std::cout<<"Correct syntax (3): <config name>,EE,<real eff configuration>,<fake eff configuration>"<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)] = std::shared_ptr<FakesWeights>(new FakesWeights()); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDebug(m_debug); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDataPath(m_dir); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetPeriod(period); + if (listofkeys.size()==3) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EE); + } + else if (listofkeys.size()==4) { + if (listofkeys.at(3)!="MCup" && listofkeys.at(3)!="MCdown" && listofkeys.at(3)!="MCupel" && listofkeys.at(3)!="MCdownel" && listofkeys.at(3)!="CRfake" && listofkeys.at(3)!="CRfakeel" && listofkeys.at(3)!="CRreal" && listofkeys.at(3)!="CRrealel" && listofkeys.at(3)!="EffPar") { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Systematic variation "<<listofkeys.at(3)<<" not recognised."<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EE,listofkeys.at(3)); + } + } + else if (listofkeys.size()==4) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighter(FakesWeights::EE,listofkeys.at(3),listofkeys.at(4)); + } + } + } + else if (listofkeys.at(2)=="EMU") { + if (listofkeys.size()!=3 && listofkeys.size()!=4 && listofkeys.size()!=7) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Correct syntax (1): <config name>,EMU"<<std::endl; + std::cout<<"Correct syntax (2): <config name>,EMU,<systematic variation>"<<std::endl; + std::cout<<"Correct syntax (3): <config name>,EMU,<electron real eff configuration>,<electron fake eff configuration>,<muon real eff configuration>,<muon fake eff configuration>"<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)] = std::shared_ptr<FakesWeights>(new FakesWeights()); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDebug(m_debug); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDataPath(m_dir); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetPeriod(period); + if (listofkeys.size()==3) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EMU); + } + else if (listofkeys.size()==4) { + if (listofkeys.at(3)!="MCup" && listofkeys.at(3)!="MCdown" && listofkeys.at(3)!="MCupel" && listofkeys.at(3)!="MCdownel" && listofkeys.at(3)!="MCupmu" && listofkeys.at(3)!="MCdownmu" && listofkeys.at(3)!="CRfake" && listofkeys.at(3)!="CRfakeel" && listofkeys.at(3)!="CRfakemu" && listofkeys.at(3)!="CRreal" && listofkeys.at(3)!="CRrealel" && listofkeys.at(3)!="CRrealmu" && listofkeys.at(3)!="EffPar") { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Systematic variation "<<listofkeys.at(3)<<" not recognised."<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::EMU,listofkeys.at(3)); + } + } + else if (listofkeys.size()==7) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighter(FakesWeights::EMU,listofkeys.at(3),listofkeys.at(4),listofkeys.at(5),listofkeys.at(6)); + } + } + } + else if (listofkeys.at(2)=="MUMU") { + if (listofkeys.size()<3 || listofkeys.size()>5) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Correct syntax (1): <config name>,MUMU"<<std::endl; + std::cout<<"Correct syntax (2): <config name>,MUMU,<systematic variation>"<<std::endl; + std::cout<<"Correct syntax (3): <config name>,MUMU,<real eff configuration>,<fake eff configuration>"<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)] = std::shared_ptr<FakesWeights>(new FakesWeights()); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDebug(m_debug); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetDataPath(m_dir); + m_fakesWeightTools[selection][listofkeys.at(0)]->SetPeriod(period); + if (listofkeys.size()==3) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::MUMU); + } + else if (listofkeys.size()==4) { + if (listofkeys.at(3)!="MCup" && listofkeys.at(3)!="MCdown" && listofkeys.at(3)!="MCupmu" && listofkeys.at(3)!="MCdownmu" && listofkeys.at(3)!="CRfake" && listofkeys.at(3)!="CRfakemu" && listofkeys.at(3)!="CRreal" && listofkeys.at(3)!="CRrealmu" && listofkeys.at(3)!="EffPar") { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"The following "<<listofkeys.at(1)<<" configuration is ill-defined:"<<std::endl; + std::cout<<config<<std::endl; + std::cout<<"Systematic variation "<<listofkeys.at(3)<<" not recognised."<<std::endl; + std::cout<<"Exiting.... "<<std::endl; + return StatusCode::FAILURE; + } + else { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighterDefault(FakesWeights::MUMU,listofkeys.at(3)); + } + } + else if (listofkeys.size()==5) { + m_fakesWeightTools[selection][listofkeys.at(0)]->SetupWeighter(FakesWeights::MUMU,listofkeys.at(3),listofkeys.at(4)); + } + } + } + else { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator setSelectionConfigs" ); + std::cout<<"Unknown configuration type "<<listofkeys.at(1)<<" of configuration "<<listofkeys.at(0)<<" for selection "<<selection<<std::endl; + return StatusCode::FAILURE; + } + } + return StatusCode::SUCCESS; + } + + // =========================================================== + StatusCode TopFakesMMWeightCalculator::execute(top::Event* topEvent) + { + const xAOD::EventInfo* event_info = topEvent->m_info; + const xAOD::ElectronContainer* electrons = &topEvent->m_electrons; + const xAOD::MuonContainer* muons = &topEvent->m_muons; + const xAOD::JetContainer* jets = &topEvent->m_jets; + const xAOD::MissingET* MET = topEvent->m_met; + + if (event_info->eventType(xAOD::EventInfo::IS_SIMULATION)) {// no MM weight to be calculated for MC events + return StatusCode::SUCCESS; + } + else { + auto* const settings = top::ConfigurationSettings::get(); + const std::vector<top::SelectionConfigurationData> selections = settings->selections(); + for(auto scd : selections){//loop on selections + bool pass = false; + if (event_info->isAvailable<int>(scd.m_name)) + pass = event_info->auxdataConst<int>(scd.m_name); + if (!pass) + continue;// if the selection is not passed, don't decorate the event with MM weight + for(auto configs : m_fakesWeightTools[scd.m_name]) {// loop on the configurations associated to this selection + std::string config_name = configs.first; + std::string decorName = "MMWeight_"; decorName += scd.m_name; decorName += "_"; decorName += config_name; + if (event_info->isAvailable<float>(decorName)) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Current event already decorated with "<<decorName<<std::endl; + std::cout<<"Don't want to re-calculate it. Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + float mmweight = -999.; + auto weighter = m_fakesWeightTools[scd.m_name][config_name]; + if (weighter==nullptr) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Weighter is not defined for "<<scd.m_name<<" "<<config_name<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + if (m_debug) { + std::cout<<"=====================================>Selection: "<<scd.m_name<<" Configuration: "<<config_name<<std::endl; + } + if (weighter->Channel()==FakesWeights::EJETS) { + try { + mmweight = getMMweightE(weighter, *MET, *electrons, *jets, event_info); + } + catch(std::exception& e) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Could not calculate EJETS MM weight for "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + } + else if (weighter->Channel()==FakesWeights::MUJETS) { + try { + mmweight = getMMweightM(weighter, *MET, *muons, *jets, event_info); + } + catch(std::exception& e) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Could not calculate MUJETS weight for "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + } + else if (weighter->Channel()==FakesWeights::EE) { + try { + mmweight = getMMweightEE(weighter, *MET, *electrons, *jets, event_info); + } + catch(std::exception& e) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Could not calculate EE weight for "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + } + else if (weighter->Channel()==FakesWeights::MUMU) { + try { + mmweight = getMMweightMM(weighter, *MET, *muons, *jets, event_info); + } + catch(std::exception& e) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Could not calculate MUMU weight for "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + } + else if (weighter->Channel()==FakesWeights::EMU) { + try { + mmweight = getMMweightEM(weighter, *MET, *electrons, *muons, *jets, event_info); + } + catch(std::exception& e) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Could not calculate EMU weight for "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + } + else { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator execute" ); + std::cout<<"Unable to retrieve the channel of FakesWeights object while calculating weight "<<decorName<<std::endl; + std::cout<<"Exiting... "<<std::endl; + return StatusCode::FAILURE; + } + event_info->auxdecor<float>(decorName) = mmweight; + } + } + } + return StatusCode::SUCCESS; + } + + // ================================================================== + float TopFakesMMWeightCalculator::getMMweightE(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info) + { + // + // Compute weight for e+jets channel + // + float mmWeightE = 0; + + /// not used for the moment +// std::vector<unsigned int> good_els_index = fakes::GetGoodHighPtLeptons(els); + + if (els.size()<1) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightE" ); + throw std::runtime_error("Need at least one electron to calculate EJETS matrix-method weight"); + } + + // if more than 1 electron, just take the leading one (i.e. the first in the container) + MMLepton *lept = getLeptonMMInfo(*els[0], jets, met, event_info); + MMEvent *evt = getEventMMInfo(jets, met); + + if (lept==0 || evt==0) { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator::getMMweightE" ); + ATH_MSG_INFO(" Unable to define MMLepton or MMEvent object" ); + mmWeightE = -999.; + } + else { + weighter->SetLepton(*evt,*lept); + mmWeightE = weighter->GetFakesWeightLJets(els[0]->auxdataConst<char>("passPreORSelection")); + } + + delete lept; + delete evt; + + if (m_debug) { + std::cout<<"==============>mmWeightE="<<mmWeightE<<std::endl; + std::cout<<"====>r1="<<weighter->GetRealEff()<<" f1="<<weighter->GetFakeEff()<<std::endl; + } + + return mmWeightE; + } + + // ================================================================== + float TopFakesMMWeightCalculator::getMMweightM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info) + { + // + // Compute weight for m+jets channel + // + float mmWeightM = 0; + + /// not used for the moment +// std::vector<unsigned int> good_mus_index = fakes::GetGoodHighPtLeptons(mus); + + if (mus.size()<1) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightM" ); + throw std::runtime_error("Need at least one muon to calculate MUJETS matrix-method weight"); + } + + // if more than 1 muon, just take the leading one (i.e. the first in the container) + MMLepton *lept = getLeptonMMInfo(*mus[0], jets, met, event_info); + MMEvent *evt = getEventMMInfo(jets, met); + + if (lept==0 || evt==0) { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator::getMMweightM" ); + ATH_MSG_INFO(" Unable to define MMLepton or MMEvent object" ); + mmWeightM = -999.; + } + else { + weighter->SetLepton(*evt,*lept); + mmWeightM = weighter->GetFakesWeightLJets(mus[0]->auxdataConst<char>("passPreORSelection")); + } + + delete lept; + delete evt; + + if (m_debug) { + std::cout<<"==============>mmWeightM="<<mmWeightM<<std::endl; + std::cout<<"====>r1="<<weighter->GetRealEff()<<" f1="<<weighter->GetFakeEff()<<std::endl; + } + + return mmWeightM; + } + + // ================================================================== + float TopFakesMMWeightCalculator::getMMweightEE(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info) + { + // + // Compute weight for ee channel + // + float mmWeightEE = 0; + + /// not used for the moment +// std::vector<unsigned int> good_els_index = fakes::GetGoodHighPtLeptons(els); + + if (els.size()<2) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightEE" ); + throw std::runtime_error("Need at least two electrons to calculate EE matrix-method weight"); + } + + // if more than 2 electrons, just take the two leading ones (i.e. the first in the container) + MMLepton *lept_e1 = getLeptonMMInfo(*els[0], jets, met, event_info); + MMLepton *lept_e2 = getLeptonMMInfo(*els[1], jets, met, event_info); + MMEvent *evt = getEventMMInfo(jets, met); + + if (lept_e1==0 || lept_e2==0 || evt==0) { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator::getMMweightEE" ); + ATH_MSG_INFO(" Unable to define MMLepton or MMEvent object" ); + mmWeightEE = 0.; + } + else { + weighter->SetLeptons(*evt,*lept_e1,*lept_e2); + mmWeightEE = weighter->GetFakesWeightDilep(els[0]->auxdataConst<char>("passPreORSelection"),els[1]->auxdataConst<char>("passPreORSelection")); + } + + delete lept_e1; + delete lept_e2; + delete evt; + + if (m_debug) { + std::cout<<"==============>mmWeightEE="<<mmWeightEE<<std::endl; + std::cout<<"====>r1="<<weighter->GetRealEff()<<" f1="<<weighter->GetFakeEff()<<" r2="<<weighter->GetRealEff2()<<" f2="<<weighter->GetFakeEff2()<<std::endl; + } + + return mmWeightEE; + } + + // ================================================================== + float TopFakesMMWeightCalculator::getMMweightMM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info) + { + // + // Compute weight for mm channel + // + float mmWeightMM = 0; + + /// not used for the moment +// std::vector<unsigned int> good_mus_index = fakes::GetGoodHighPtLeptons(mus); + + if (mus.size()<2) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightMM" ); + throw std::runtime_error("Need at least two muons to calculate MUMU matrix-method weight"); + } + + // if more than 2 muons, just take the two leading ones (i.e. the first in the container) + MMLepton *lept_m1 = getLeptonMMInfo(*mus[0], jets, met, event_info); + MMLepton *lept_m2 = getLeptonMMInfo(*mus[1], jets, met, event_info); + MMEvent *evt = getEventMMInfo(jets, met); + + if (lept_m1==0 || lept_m2==0 || evt==0) { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator::getMMweightMM" ); + ATH_MSG_INFO(" Unable to define MMLepton or MMEvent object" ); + mmWeightMM = 0.; + } + else { + weighter->SetLeptons(*evt,*lept_m1,*lept_m2); + mmWeightMM = weighter->GetFakesWeightDilep(mus[0]->auxdataConst<char>("passPreORSelection"),mus[1]->auxdataConst<char>("passPreORSelection")); + } + + delete lept_m1; + delete lept_m2; + delete evt; + + if (m_debug) { + std::cout<<"==============>mmWeightMM="<<mmWeightMM<<std::endl; + std::cout<<"====>r1="<<weighter->GetRealEff()<<" f1="<<weighter->GetFakeEff()<<" r2="<<weighter->GetRealEff2()<<" f2="<<weighter->GetFakeEff2()<<std::endl; + } + + return mmWeightMM; + } + + // ================================================================== + float TopFakesMMWeightCalculator::getMMweightEM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info) + { + // + // Compute weight for em channel + // + float mmWeightEM = 0; + + /// not used for the moment +// std::vector<unsigned int> good_els_index = fakes::GetGoodHighPtLeptons(els); +// std::vector<unsigned int> good_mus_index = fakes::GetGoodHighPtLeptons(mus); + + if (els.size()<1) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightEM" ); + throw std::runtime_error("Need at least one electron to calculate EMU matrix-method weight"); + } + if (mus.size()<1) { + ATH_MSG_ERROR(" top::TopFakesMMWeightCalculator::getMMweightEM" ); + throw std::runtime_error("Need at least one muon to calculate EMU matrix-method weight"); + } + + // if more than 1 electron or 1 muon, just take the two leading ones (i.e. the first in the container) + MMLepton *lept_e = getLeptonMMInfo(*els[0], jets, met, event_info); + MMLepton *lept_m = getLeptonMMInfo(*mus[0], jets, met, event_info); + MMEvent *evt = getEventMMInfo(jets, met); + + if (lept_e==0 || lept_m==0 || evt==0) { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator::getMMweightEMU" ); + ATH_MSG_INFO(" Unable to define MMLepton or MMEvent object" ); + mmWeightEM = 0.; + } + else { + weighter->SetLeptons(*evt,*lept_e,*lept_m); + mmWeightEM = weighter->GetFakesWeightDilep(els[0]->auxdataConst<char>("passPreORSelection"),mus[0]->auxdataConst<char>("passPreORSelection")); + } + + delete lept_e; + delete lept_m; + delete evt; + + if (m_debug) { + std::cout<<"==============>mmWeightEM="<<mmWeightEM<<std::endl; + std::cout<<"====>r1="<<weighter->GetRealEff()<<" f1="<<weighter->GetFakeEff()<<" r2="<<weighter->GetRealEff2()<<" f2="<<weighter->GetFakeEff2()<<std::endl; + } + + return mmWeightEM; + } + + // =============================================================== + MMLepton* TopFakesMMWeightCalculator::getLeptonMMInfo(const xAOD::Electron& el, const xAOD::JetContainer& jets, const xAOD::MissingET& met, const xAOD::EventInfo* event_info) + { + float eta_cl = el.caloCluster()->etaBE(2); +// float eta = el.eta(); +// float phi = el.phi(); + float pt = el.pt()/1.e3; // tool needs GeV + unsigned int runNumber = event_info -> runNumber(); + if (m_config->isMC() && m_config->doPileupReweighting()) { + if (event_info->isAvailable<unsigned int>("RandomRunNumber")) + runNumber = event_info->auxdataConst<unsigned int>("RandomRunNumber"); + } + int trigger = 0.; + top::fakes::GetTrigMatchVariable(el, trigger, runNumber); + + const xAOD::TrackParticle* eltrack = el.trackParticle(); + float d0 = eltrack->d0(); + const xAOD::ParametersCovMatrix_t elcov = eltrack->definingParametersCovMatrix(); + float d0signif = d0/sqrt(elcov(0,0)); + + float dR; + float pTj; + float dRCentral; + float pTjCentral; + float dRpt; + float dRptCentral; + fakes::GetClosestJet (el, jets, dR, pTj, dRpt, dRCentral, pTjCentral, dRptCentral); + + float dphilmet; + fakes::GetdPhiLepMET (el, met, dphilmet); + + MMLepton* lept = new MMLepton(); + lept->pt = pt; + lept->eta = std::fabs(eta_cl); + lept->dR = dR; + lept->dPhi = dphilmet; + lept->trigger = trigger; + lept->d0sig = d0signif; + + if (m_debug) { + std::cout<<"Electron"; + std::cout<<" pt="<<pt; + std::cout<<" eta="<<std::fabs(eta_cl); + std::cout<<" dR="<<dR; + std::cout<<" dPhi="<<dphilmet; + std::cout<<" trigger="<<trigger; + std::cout<<" d0sig="<<d0signif; + std::cout<<std::endl; + } + + return lept; + } + + // =========================================================== + MMLepton* TopFakesMMWeightCalculator::getLeptonMMInfo(const xAOD::Muon& mu, const xAOD::JetContainer& jets, const xAOD::MissingET& met, const xAOD::EventInfo* event_info) + { + float eta = mu.eta(); +// float phi = mu.phi(); + float pt = mu.pt()/1.e3; // tool needs GeV + unsigned int runNumber = event_info -> runNumber(); + if (m_config->isMC() && m_config->doPileupReweighting()) { + if (event_info->isAvailable<unsigned int>("RandomRunNumber")) + runNumber = event_info->auxdataConst<unsigned int>("RandomRunNumber"); + } + int trigger = 0.; + top::fakes::GetTrigMatchVariable(mu, trigger, runNumber); + + const xAOD::TrackParticle* mutrack = mu.primaryTrackParticle(); + float d0 = mutrack->d0(); + const xAOD::ParametersCovMatrix_t mucov=mutrack->definingParametersCovMatrix(); + float d0signif = d0/sqrt(mucov(0,0)); + + float dR; + float pTj; + float dRCentral; + float pTjCentral; + float dRpt; + float dRptCentral; + fakes::GetClosestJet (mu, jets, dR, pTj, dRpt, dRCentral, pTjCentral, dRptCentral); + + float dphilmet; + fakes::GetdPhiLepMET (mu, met, dphilmet); + + MMLepton* lept = new MMLepton(); + lept->pt = pt; + lept->eta = std::fabs(eta); + lept->dR = dR; + lept->dPhi = dphilmet; + lept->trigger = trigger; + lept->d0sig = d0signif; + + if (m_debug) { + std::cout<<"Muon"; + std::cout<<" pt="<<pt; + std::cout<<" eta="<<std::fabs(eta); + std::cout<<" dR="<<dR; + std::cout<<" dRpt="<<dRpt; + std::cout<<" dPhi="<<dphilmet; + std::cout<<" trigger="<<trigger; + std::cout<<" d0sig="<<d0signif; + std::cout<<std::endl; + } + + return lept; + } + + // ============================================================ + MMEvent* TopFakesMMWeightCalculator::getEventMMInfo(const xAOD::JetContainer& jets, const xAOD::MissingET& met) + { + float leadingJetpT = -999.; + float leadingCentralJetpT = -999.; + unsigned int Njets = 0; + unsigned int NCentraljets = 0; + unsigned int nbtag = 0; + for (const auto* const jetPtr : jets) { + if (jetPtr->pt()<25000.) continue; + Njets++; + if (jetPtr->pt()>leadingJetpT) leadingJetpT = jetPtr->pt(); + if (jetPtr->eta()<2.5) { + NCentraljets++; + if (jetPtr->pt()>leadingCentralJetpT) leadingCentralJetpT = jetPtr->pt()/1000.; + } + + if (jetPtr->isAvailable<char>("isbtagged_FixedCutBEff_77")) { + if (jetPtr->auxdataConst<char>("isbtagged_FixedCutBEff_77")) nbtag++; + } + } + + MMEvent* evnt = new MMEvent(); + evnt->njets = NCentraljets; + evnt->ntag = nbtag; + evnt->jetpt = leadingCentralJetpT; + evnt->sumet = met.sumet()/1e3;//tool needs GeV + + if (m_debug) { + std::cout<<"Event"; + std::cout<<" njets="<<NCentraljets; + std::cout<<" ntag="<<nbtag; + std::cout<<" jetpt="<<leadingCentralJetpT; + std::cout<<" sumet="<<met.sumet()/1e3;//tool needs GeV + std::cout<<" met="<<met.met()/1e3;//tool needs GeV + std::cout<<" metx="<<met.mpx()/1e3;//tool needs GeV + std::cout<<" mety="<<met.mpy()/1e3;//tool needs GeV + std::cout<<" metphi="<<met.phi(); + std::cout<<std::endl; + } + + return evnt; + } + + std::vector<std::string> TopFakesMMWeightCalculator::GetFakesMMConfigNames(std::string selection) const + { + std::vector<std::string> configs; + if (m_fakesWeightTools.count(selection) !=0) { + for (auto config : m_fakesWeightTools.at(selection)) + configs.push_back(config.first); + } + return configs; + } + + int TopFakesMMWeightCalculator::getPeriod( const std::string& period_string ) + { + if (period_string == "2012") { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator getPeriod: can't use 2012 fakes in xAOD framework - returning -1" ); + return -1; + } + else if (period_string == "2015") { + return MMEffSet::Period::Year2015; + } + else if (period_string == "2016") { + return MMEffSet::Period::Year2016; + } + else { + ATH_MSG_INFO(" top::TopFakesMMWeightCalculator getPeriod: can't recognise any valid period - returning -1" ); + return -1; + } + } + + // ============================================================= + ///This function checks if the lepton ID, isolation, etc... match one of those supported by Top-Fakes + ///Currently only the "standard" definition is supported + ///The list of definitions could be expanded in TopFakesxAODUtils (the top::fakes::LeptonDefinitions enum class) + ///The function also checks the pT range of the leptons - this allows users to have leptons with pT<25GeV (they are ignored) - and the eta range of the jets - this allows users to have forward jets (they are ignored too) +// void TopFakesMMWeightCalculator::CheckConfiguration() +// { +// if (m_config == nullptr) { +// m_leptonDefs = fakes::LeptonDefinitions::Other; +// std::cout<<"Warning: TopFakesMMWeightCalculator::CheckLeptonDefs() was unable to assess the configuration; therefore dummy matrix-method weights will be returned"<<std::endl; +// } +// else { +// if ( m_config->electronID() == "TightLH" +// && m_config->electronIDLoose() == "MediumLH" +// && m_config->electronIsolation() == "Gradient" +// && m_config->electronIsolationLoose() == "None" +// && m_config->muonQuality() == "Medium" +// && m_config->muonQualityLoose() == "Loose" +// && m_config->muonIsolation() == "Gradient" +// && m_config->muonIsolationLoose() == "None" ) { +// m_leptonDefs = fakes::LeptonDefinitions::Standard; +// //now do checks on object definitions +// //electrons +// if (m_config->electronPtcut() < 25000.) { +// std::cout<<"Warning: electrons below pT=25GeV are used (pT cut is at "<<m_config->electronPtcut()/1000.<<"GeV). This is non-standard and not yet supported by TopFakes; therefore all electrons below this threshold will be ignored in the calculation of matrix-method weights."<<std::endl; +// } +// else if (m_config->electronPtcut() != 25000.) { +// std::cout<<"Warning: non-standard electron pT cut of "<<m_config->electronPtcut()/1000.<<"GeV is used (standard is 25GeV). It may have unexpected behaviour for the calculation of matrix-method weights."<<std::endl; +// } +// if (!m_config->electronVetoLArCrack()) { +// std::cout<<"Warning: veto of electrons on LAr crack was disabled; this is non-standard and not yet supported by TopFakes"<<std::endl; +// } +// +// //muons +// if (m_config->muonPtcut() < 25000.) { +// std::cout<<"Warning: muons below pT=25GeV are used (pT cut is at "<<m_config->muonPtcut()/1000.<<"GeV). This is non-standard and not yet supported by TopFakes; therefore all muons below this threshold will be ignored in the calculation of matrix-method weights."<<std::endl; +// } +// else if (m_config->muonPtcut() != 25000.) { +// std::cout<<"Warning: non-standard muon pT cut of "<<m_config->muonPtcut()/1000.<<"GeV is used (standard is 25GeV). It may have unexpected behaviour for the calculation of matrix-method weights."<<std::endl; +// } +// if (m_config->muonEtacut() != 2.5) { +// std::cout<<"Warning: non-standard muon eta cut of "<<m_config->jetEtacut()<<" is used (standard is 2.5). It may have unexpected behaviour for the calculation of matrix-method weights."<<std::endl; +// } +// +// //jets +// if (m_config->jetEtacut() > 2.5) { +// std::cout<<"Warning: forward jets are used (eta cut is at "<<m_config->jetEtacut()<<"). This is non-standard and not yet supported by TopFakes; therefore all jets above |eta|=2.5 will be ignored in the calculation of matrix-method weights."<<std::endl; +// } +// else if (m_config->jetEtacut() != 2.5) { +// std::cout<<"Warning: non-standard jet eta cut of "<<m_config->jetEtacut()<<" is used (standard is 2.5). It may have unexpected behaviour for the calculation of matrix-method weights."<<std::endl; +// } +// if (m_config->jetPtcut() != 25000.) { +// std::cout<<"Warning: non-standard jet pT cut of "<<m_config->jetPtcut()/1000.<<"GeV is used (standard is 25GeV). It may have unexpected behaviour for the calculation of matrix-method weights."<<std::endl; +// } +// } +// else { +// std::cout<<"Warning: the used lepton definitions are not yet supported by TopFakes; therefore dummy matrix-method weights will be returned"<<std::endl; +// } +// +// +// } +// +// } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesxAODUtils.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesxAODUtils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3b897b603175ad39ad24ce5e4b572a34a6d66672 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/Root/TopFakesxAODUtils.cxx @@ -0,0 +1,363 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////// +// +// Author : +// Timothée Theveneaux-Pelzer +// Creation : +// Purpose : helper to be used in analyses +// +// Updated : +// 2016-02-12 : fixes for muon trigger splitting +// +////////////////////////////////////////////////////////////////////// +#include "TopFakes/TopFakesxAODUtils.h" + +#include "TopEvent/EventTools.h" +#include "TopFakes/FakesWeights.h" + + +void top::fakes::GetClosestJet (const xAOD::Electron& el, + const xAOD::JetContainer& jets, + float& dRClosetJet, + float& PtClosetJet, + float& dROverPtClosetJet, + float& dRClosetCentralJet, + float& PtClosetCentralJet, + float& dROverPtClosetCentralJet) +{ + //the dRs are initialised to a very high positive value + dRClosetJet = 999.; + dRClosetCentralJet = 999.; + //the pTs are initialised to a negative value + PtClosetJet = -999.; + PtClosetCentralJet = -999.; + // these variables are not used in fact! + dROverPtClosetJet = -999.; + dROverPtClosetCentralJet = -999.; + + for (const auto* const jetPtr : jets) { + if (jetPtr->pt()<25000.) continue; + double newdR = top::deltaR(*jetPtr,el); + if (jetPtr->eta()<2.5) { + if (newdR<dRClosetCentralJet) { + dRClosetCentralJet = newdR; + PtClosetCentralJet = jetPtr->pt()/1000.; // tool needs GeV + } + } + if (newdR<dRClosetJet) { + dRClosetJet = newdR; + PtClosetJet = jetPtr->pt()/1000.; // tool needs GeV + } + } + + // these variables are not used ! + if ((dRClosetJet!=999.) && (PtClosetJet!=-999.)) dROverPtClosetJet = dRClosetJet/PtClosetJet; + if ((dRClosetCentralJet!=999.) && (PtClosetCentralJet!=-999.)) dROverPtClosetCentralJet = dRClosetCentralJet/PtClosetCentralJet; + + //if the dRs are at their default value, give them a negative value + if (dRClosetJet == 999.) dRClosetJet = -999.; + if (dRClosetCentralJet == 999.) dRClosetCentralJet = -999.; +} + +// ============================================================ +void top::fakes::GetClosestJet (const xAOD::Muon& mu, + const xAOD::JetContainer& jets, + float& dRClosetJet, + float& PtClosetJet, + float& dROverPtClosetJet, + float& dRClosetCentralJet, + float& PtClosetCentralJet, + float& dROverPtClosetCentralJet) +{ + //the dRs are initialised to a very high positive value + dRClosetJet = 999.; + dRClosetCentralJet = 999.; + //the pTs are initialised to a negative value + PtClosetJet = -999.; + PtClosetCentralJet = -999.; + // these variables are not used + dROverPtClosetJet = -999.; + dROverPtClosetCentralJet = -999.; + + for (const auto* const jetPtr : jets) { + if (jetPtr->pt()<25000.) continue; + double newdR = top::deltaR(*jetPtr,mu); + double newdRCentral = newdR; + if (jetPtr->eta()<2.5) { + if (newdRCentral<dRClosetCentralJet) { + dRClosetCentralJet = newdRCentral; + PtClosetCentralJet = jetPtr->pt()/1000.; // tool needs GeV + } + } + if (newdR<dRClosetJet) { + dRClosetJet = newdR; + PtClosetJet = jetPtr->pt()/1000.; // tool needs GeV + } + } + + // these variables are not used + if ((dRClosetJet!=999.) && (PtClosetJet!=-999.)) dROverPtClosetJet = dRClosetJet/PtClosetJet; + if ((dRClosetCentralJet!=999.) && (PtClosetCentralJet!=-999.)) dROverPtClosetCentralJet = dRClosetCentralJet/PtClosetCentralJet; + + //if the dRs are at their default value, give them a negative value + if (dRClosetJet == 999.) dRClosetJet = -999.; + if (dRClosetCentralJet == 999.) dRClosetCentralJet = -999.; +} + +// ================================================= +void top::fakes::GetdPhiLepMET (const xAOD::Electron& el, const xAOD::MissingET& met, float& dPhi) +{ + dPhi = -999.; + if (met.mpx()!=0. && met.mpx()!=0.) { + TLorentzVector met_4vect; + met_4vect.SetPxPyPzE(met.mpx(),met.mpx(),0.,0.); + dPhi = el.p4().DeltaPhi(met_4vect); + } +} + +// ================================================== +void top::fakes::GetdPhiLepMET (const xAOD::Muon& mu, const xAOD::MissingET& met, float& dPhi) +{ + dPhi = -999.; + if (met.mpx()!=0. && met.mpx()!=0.) { + TLorentzVector met_4vect; + met_4vect.SetPxPyPzE(met.mpx(),met.mpx(),0.,0.); + dPhi = mu.p4().DeltaPhi(met_4vect); + } +} + +// ========================================================= +void top::fakes::GetTrigMatchVariable(const xAOD::Electron& el, int& trigmatch, const unsigned int runNumber) +{ + std::string release_series = ""; + const char* rel_temp = std::getenv("ROOTCORE_RELEASE_SERIES"); + if (rel_temp) { + release_series = std::string(rel_temp); + } else { + std::cerr<<"Can not access ROOTCORE_RELEASE_SERIES - exiting..."<<std::endl; + exit(1); + } + + trigmatch = 0; + bool trig_lowpTIso,trig_hightpTNoIso,trig_veryhightpTNoIso,trig_lowpTNoIso; + + if (release_series == "23") {// for 20.1 samples + try {//not really used - trig_lowpTIso is overriden below + trig_lowpTIso = el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_iloose_L1EM20VH"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_e60_lhmedium"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_veryhightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_e120_lhloose"); + } catch (std::exception& e) { + trig_veryhightpTNoIso = false; + } + try { + trig_lowpTIso = trig_lowpTNoIso = ( el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_L1EM18VH") || el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_L1EM20VH") ); + } catch (std::exception& e) { + trig_lowpTIso = trig_lowpTNoIso = false; + } + } + else if (release_series == "24") {// for 20.7 samples + if (runNumber>=276262 && runNumber<=284484) { + try {//not really used - trig_lowpTIso is overriden below + trig_lowpTIso = el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_iloose_L1EM20VH"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_e60_lhmedium"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_veryhightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_e120_lhloose"); + } catch (std::exception& e) { + trig_veryhightpTNoIso = false; + } + try { + trig_lowpTNoIso = trig_lowpTIso = el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_L1EM20VH"); + } catch (std::exception& e) { + trig_lowpTNoIso = false; + } + } + else if (runNumber>=297730) { + try { + trig_lowpTIso = el.auxdataConst<char>("TRIGMATCH_HLT_HLT_e24_lhtight_nod0_ivarloose"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_HLT_e60_lhmedium_nod0"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_veryhightpTNoIso = el.auxdataConst<char>("TRIGMATCH_HLT_e140_lhloose_nod0"); + } catch (std::exception& e) { + trig_veryhightpTNoIso = false; + } + try { + trig_lowpTNoIso = ( el.auxdataConst<char>("TRIGMATCH_HLT_e24_lhmedium_L1EM20VH") ); + } catch (std::exception& e) { + trig_lowpTNoIso = false; + } + } + else { + std::cerr<<"Nothing is well-defined for runNumber "<<runNumber<<" - exiting..."<<std::endl; + exit(1); + } + } + else { + std::cerr<<"Unknown release series - exiting..."<<std::endl; + exit(1); + } + + //if (trig_lowpTIso) trigmatch |= 0x1 << 0; + //if (trig_hightpTNoIso || trig_veryhightpTNoIso) trigmatch |= 0x1 << 1; + + // NB note used for Run2 2015 as there is no trigger splitting + if (trig_lowpTIso) trigmatch |= 0x1 << 0; + if (trig_hightpTNoIso || trig_veryhightpTNoIso) trigmatch |= 0x1 << 1; + if (trig_lowpTNoIso) trigmatch |= 0x1 << 2; +} + +// =========================================================== +void top::fakes::GetTrigMatchVariable(const xAOD::Muon& mu, int& trigmatch, const unsigned int runNumber) +{ + std::string release_series = ""; + const char* rel_temp = std::getenv("ROOTCORE_RELEASE_SERIES"); + if (rel_temp) { + release_series = std::string(rel_temp); + } else { + std::cerr<<"Can not access ROOTCORE_RELEASE_SERIES - exiting..."<<std::endl; + exit(1); + } + + trigmatch = 0; + bool trig_lowpTIso,trig_hightpTNoIso,trig_lowpTNoIso; + + if (release_series == "23") {// for 20.1 samples + try { + trig_lowpTIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu20_iloose_L1MU15"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu50"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_lowpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu20_L1MU15"); + } catch (std::exception& e) { + trig_lowpTNoIso = false; + } + } + else if (release_series == "24") {// for 20.7 samples + if (runNumber>=276262 && runNumber<=284484) { + try { + trig_lowpTIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu20_iloose_L1MU15"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu50"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_lowpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu20_L1MU15"); + } catch (std::exception& e) { + trig_lowpTNoIso = false; + } + } + else if (runNumber>=297730) { + try { + trig_lowpTIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu24_ivarmedium"); + } catch (std::exception& e) { + trig_lowpTIso = false; + } + try { + trig_hightpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu50"); + } catch (std::exception& e) { + trig_hightpTNoIso = false; + } + try { + trig_lowpTNoIso = mu.auxdataConst<char>("TRIGMATCH_HLT_mu24"); + } catch (std::exception& e) { + trig_lowpTNoIso = false; + } + } + else { + std::cerr<<"Nothing is well-defined for runNumber "<<runNumber<<" - exiting..."<<std::endl; + exit(1); + } + } + else { + std::cerr<<"Unknown release series - exiting..."<<std::endl; + exit(1); + } + + //if (trig_lowpTIso) trigmatch |= 0x1 << 0; + //if (trig_hightpTNoIso) trigmatch |= 0x1 << 1; + + if (trig_lowpTIso) trigmatch |= 0x1 << 0; // mu20i + if (trig_hightpTNoIso) trigmatch |= 0x1 << 1; // mu50 + if (trig_lowpTNoIso) trigmatch |= 0x1 << 2; // mu20 + +} + +// ============================================================= +std::vector<unsigned int> top::fakes::GetGoodHighPtLeptons(const xAOD::ElectronContainer& els) +{ + unsigned int i(0); + std::vector<unsigned int> good_els_index; + for (const auto* const elPtr : els) {//loop on electrons + if ( elPtr->isAvailable<char>("passPreORSelectionLoose") ) {//count only leptons wigth pT>25GeV that pass selection + if ( elPtr->pt()> 25000. && (elPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) ) good_els_index.push_back(i); + } + i++; + }//loop on electrons + return good_els_index; +} + +// ============================================================= +std::vector<unsigned int> top::fakes::GetGoodHighPtLeptons(const xAOD::MuonContainer& mus) +{ + unsigned int i(0); + std::vector<unsigned int> good_mus_index; + for (const auto* const muPtr : mus) {//loop on muons + if ( muPtr->isAvailable<char>("passPreORSelectionLoose") ) {//count only leptons wigth pT>25GeV that pass selection + if ( muPtr->pt()> 25000. && (muPtr->auxdataConst<char>("passPreORSelectionLoose") == 1) ) good_mus_index.push_back(i); + } + i++; + }//loop on muons + return good_mus_index; +} + +// ============================================================ +int top::fakes::GetChannel(const xAOD::ElectronContainer& els, + const xAOD::MuonContainer& mus) +{ + // + // + // + + unsigned int iels = GetGoodHighPtLeptons(els).size(); + unsigned int imus = GetGoodHighPtLeptons(mus).size(); + if (iels==1 && imus==0) return FakesWeights::EJETS; + else if (iels==0 && imus==1) return FakesWeights::MUJETS; + else if (iels==2 && imus==0) return FakesWeights::EE; + else if (iels==0 && imus==2) return FakesWeights::MUMU; + else if (iels==1 && imus==1) return FakesWeights::EMU; + else return -1; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/FakesWeights.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/FakesWeights.h new file mode 100644 index 0000000000000000000000000000000000000000..589036ddcd0bee0f0be73bc0059560e7726cf1e6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/FakesWeights.h @@ -0,0 +1,169 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////////////////////// +// +// Author : +// Anna Henrichs <anna.henrichs@cern.ch> +// Michele Pinamonti <michele.pinamonti@cern.ch> +// Creation : +// Purpose : main method to retrieve event-by-event weights +// from the Matrix Method +// Updated : +// 2016-01-29 : FD: set _isRun1 = false +// set default weighter +// remove pt/dR variable, never used +////////////////////////////////////////////////////////////////////// + +#ifndef FAKESWEIGHTS_h +#define FAKESWEIGHTS_h + +#include <string> +#include <vector> +#include <map> + +#include "TopFakes/MMEffSet.h" + +class TFile; +class TH1F; +class TH2F; +class TH3F; +class MMEfficiency; +class MMEffSet; +class MatrixUtils; +class MMEvent; +class MMLepton; + +class FakesWeights{ + +public: + // CONSTRUCTOR + FakesWeights(); + // DESTRUCTOR + ~FakesWeights(); + + // channels + enum { + EJETS, // 0 + MUJETS, // 1 + EE, // 2 + MUMU, // 3 + EMU // 4 + }; + +// // estimates +// enum{ +// PARIS, // 0 +// UPPSALA +// }; + + // systematics + enum{ + NONE, // 0 + MCup, // fake eff with removal of real lepton contamination from W/Z MC +30% - totally correlated between electron and muon + MCdown, // fake eff with removal of real lepton contamination from W/Z MC -30% - totally correlated between electron and muon + MCupel, // fake eff with removal of real lepton contamination from W/Z MC +30% - only for electron + MCdownel, // fake eff with removal of real lepton contamination from W/Z MC -30% - only for electron + MCupmu, // fake eff with removal of real lepton contamination from W/Z MC +30% - only for muon + MCdownmu, // fake eff with removal of real lepton contamination from W/Z MC -30% - only for muon + CRfake, // fake eff from alternative region - returns nominal for emu channel, otherwise equivalent to CRfakeel (CRfakemu) for e+jets and ee (mu+jets and mumu) channels + CRfakeel, // fake eff from alternative region - only for electron + CRfakemu, // fake eff from alternative region - only for muon + CRreal, // real eff from alternative region - totally correlated between electron and muon + CRrealel, // real eff from alternative region - only for electron + CRrealmu, // real eff from alternative region - only for muon + EffPar //efficiencies with alternative parametrisation (only for l+jet) + }; + + //void SetProtection(bool protection); + + void SetDataPath(std::string path); + void SetDebug(bool debug); + + void SetPeriod(int period); + void SetTriggerNamesEl(std::string trig1,std::string trig2,std::string trig3); + void SetTriggerNamesMu(std::string trig1,std::string trig2,std::string trig3); + void SetTriggerPrescalesEl(float ps1,float ps2,float ps3); + void SetTriggerPrescalesMu(float ps1,float ps2,float ps3); + void SetTriggerThresholdEl(float thres); + void SetTriggerThresholdMu(float thres); + + // method to set up all tools (Weighters) + void SetupWeighter(int channel, std::string aReal, std::string aFake, std::string aReal2="", std::string aFake2=""); + + // method to set the MMEvent and MMLepton objects for l+jets + void SetLepton(MMEvent event, MMLepton lepton); + // method to set the MMEvent and MMLepton objects for dilepton + void SetLeptons(MMEvent event,MMLepton lep1, MMLepton lep2); + // method to get the weight for l+jets + float GetFakesWeightLJets(bool tight); + // method to get the weight for dilepton + float GetFakesWeightDilep(bool tight1,bool tight2); + + // methods to retrieve dilepton weight for loose-loose (LL), loose-tight (LT) + // tigh-loose (TL) and tight-tight (TT) events + float GetFakesWeightDilepLL(bool tight1,bool tight2); + float GetFakesWeightDilepLT(bool tight1,bool tight2); + float GetFakesWeightDilepTL(bool tight1,bool tight2); + float GetFakesWeightDilepTT(bool tight1,bool tight2); + + // method to set up the weighters by default + void SetupWeighterDefault(int channel, std::string name, std::string syst); + // method to set up the weighters by default + void SetupWeighterDefault(int channel, std::string syst=""); + + void SetLeptonDefault(float lep_pt, float lep_eta, float el_cl_eta, + float dR_lj_min, float dPhi_lnu, + float jet_pt0, int jet_n, int nJet_tagged, int trigger); + float GetFakesWeightLJetsDefault(bool tight, float lep_pt, float lep_eta, + float el_cl_eta, float dR_lj_min, + float dPhi_lnu, float jet_pt0, + int jet_n, int nJet_tagged, int trigger); + + // methods to get the real and fake efficiencies + float GetRealEff(); + float GetFakeEff(); + float GetRealEff2(); + float GetFakeEff2(); + + // method to retrieve the matrix + MatrixUtils* GetMatrixUtils(); + + // method to access the channel + int Channel() const {return _channel;}; + +private: + int _channel; + int _syst; + + bool _dataPathIsSet; + bool _isInitialized; + //bool _protection; + + bool _debug; + std::string _dataPath; + + MatrixUtils *_mmUtil; + + MMEffSet *_EffSet[4]; // real, fake, real2, fake2 + + int _period; + std::string _trig1_el; + std::string _trig2_el; + std::string _trig3_el; + std::string _trig1_mu; + std::string _trig2_mu; + std::string _trig3_mu; + float _ps1_el; + float _ps2_el; + float _ps3_el; + float _ps1_mu; + float _ps2_mu; + float _ps3_mu; + float _ptTres_el; + float _ptTres_mu; +}; + +#endif + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEffSet.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEffSet.h new file mode 100644 index 0000000000000000000000000000000000000000..1cbbbbf701352c763cd8054bbaa518b228eaa29d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEffSet.h @@ -0,0 +1,181 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + ** authors: + ** Michele Pinamonti <michele.pinamonti@cern.ch> +*/ + +#ifndef MMEFFSET_h +#define MMEFFSET_h + +#include <string> +#include <vector> +#include <map> + +class TFile; +class TH1F; +class TH2F; +class TH3F; +class MMEfficiency; +class MatrixUtils; + + +//---- +class MMLepton{ +public: + float pt; + float eta; + float cleta; + float dR; // min dR(jet-lepton) + float dRpt; // pT/dR (lepton-closest jet) + float dPhi; // dPhi(MET-lepton) + float d0sig; // d0 significance + int trigger; // trigger matching the lepton +}; + +class MMEvent{ +public: + float jetpt; // pT of the leading jet + float sumet; // met_sumet + float hthad; // sum of pT's of jets + float met; // met_et in the event + int njets; // number of jets + int ntag; // number of b-tagged jets (MV1 70%) +}; +//---- + + + +class MMEffSet{ + +public: + + enum{ + TRIGGER_MASK =1, + NJETSSHORT_MASK=2, + NJETS_MASK =4, + NBTAG_MASK =8 + }; + + // "period" + enum Period { + Year2012, // 0 + Year2015, + Year2016 + }; + + MMEffSet(bool isEle,bool isReal,bool debug=false); + ~MMEffSet(); + + void SetDataPath(std::string path="data"); + + void SetupEff(std::string aEff); + + void AddCustomSplit(std::string config); // config = "condition1:condition2:condition3_..." -> value = 0,1,2,... + void AddNumBtagSplit(); + void AddNumJetsSplit(); + void AddNumJetsShortSplit(); + void AddTriggerSplit(); + void AddNumBtagAndTriggerSplit(); + void AddNumBtagAndNumJetsSplit(); + void AddNumBtagAndNumJetsShortSplit(); + void AddNumJetsAndTriggerSplit(); + void AddNumJetsShortAndTriggerSplit(); + void AddNumBtagAndNumJetsAndTriggerSplit(); + void AddNumBtagAndNumJetsShortAndTriggerSplit(); + void ReadEfficiencies(); // to call after having set up and added splittings + + void AddCorrection(); + + void SetLepton(float v0,float v1=0,float v2=0,float v3=0,float v4=0,float v5=0,float v6=0,float v7=0,float v8=0,float v9=0); + + void SetCustom(int value); + void SetNumBtag(int nbtag); + void SetNumJets(int njets); + void SetNumJetsShort(int njets); + void SetTrigger(int trigger,float pt); // pT in GeV + + void SetNumBtagAndNumJets(int ntag,int njets); + void SetNumBtagAndNumJetsShort(int ntag,int njets); + void SetNumBtagAndTrigger(int nbtag,int trigger,float pt); + void SetNumJetsAndTrigger(int njets,int trigger,float pt); + void SetNumJetsShortAndTrigger(int njets,int trigger,float pt); + void SetNumBtagAndNumJetsAndTrigger(int nbtag,int njets,int trigger,float pt); + void SetNumBtagAndNumJetsShortAndTrigger(int nbtag,int njets,int trigger,float pt); + + void SetPtThres(int thres); // set the pT-threshold for trigger splitting (in GeV); set it to -1 to ignore it + void SetTriggerNames(std::string trig1,std::string trig2,std::string trig3); + + int TriggerValue(int trigger,float pt); + + int NumJetsValue(int njets); + int NumJetsShortValue(int njets); + int NumBtagValue(int nbtag); + + void SetLepton(MMEvent event,MMLepton lepton); + float GetEff(bool isAverage=false); + + void SetPeriod(int period); + void SetTriggerPrescales(float ps1,float ps2,float ps3); + void SetTriggerThreshold(float thres); + + float GetPrescale(); + +private: + void ReadEfficiency(MMEfficiency *eff,std::string aEff,std::string condition="",bool isCorrection=false); + void ParseOptions(std::string s,std::map<std::string,std::string> *m); + + MMEvent _event; + MMLepton _lepton; + + std::string _Estimate; + + std::string _dataPath; + + std::map<std::string,std::string> _optMap; + + int _numCond; + + int _splitIdx; + + int _splitBitMask; // nbtag-njet-njetshort-trigger (eg. 1000, 1010, 0011..) + + float _ptTres; + + std::vector<std::string> _condVec; + + // separate class for efficiencies + MMEfficiency *_Eff[10]; + MMEfficiency *_EffCorr[10]; + + bool _useCorr; + + bool _effIsRead; + + //int _estimate; + //int _syst; + + bool _isEle; + bool _isReal; + bool _debug; + + int _period; + std::string _trig1; + std::string _trig2; + std::string _trig3; + float _ps1; + float _ps2; + float _ps3; + int _trigger; + + // Internal methods / functions + int CountInString(std::string s,char c); + std::vector<std::string> Tokenize(std::string s, std::string c); + std::vector<std::string> Combine(std::vector<std::string> v1,std::vector<std::string> v2); +}; + +#endif + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEfficiency.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEfficiency.h new file mode 100644 index 0000000000000000000000000000000000000000..053c147d35c5ba70ba2c9841d0e63fbcc2a2d2a4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MMEfficiency.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + ** author: Michele Pinamonti <michele.pinamonti@cern.ch> + ** version: v1 - 23aug2013 +*/ + +#ifndef MMEfficiency_H_ +#define MMEfficiency_H_ + +#include "TFile.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TH3F.h" +#include "TF1.h" +#include "TF2.h" +#include "TF3.h" + +#include <string> +#include <iostream> + + +const int MAXvar = 10; + + +class MMEfficiency{ + public: + MMEfficiency(); + ~MMEfficiency(); + + bool AddHisto(TH1F *h); + bool AddHisto(TH2F *h); + bool AddHisto(TH3F *h); + bool AddHisto(TFile *f, std::string histoName, int ndim=1); + bool AddHisto(std::string fileName, std::string histoName, int ndim=1); + + void SetAverage(float value); + void SetAverageHist(TFile* f, std::string histoName); // this should be a 1-D & 1-bin histogram + void SetAverageHist(std::string fileName, std::string histoName); // this should be a 1-D & 1-bin histogram + float SetAverageFromHist(TH1F *h); + float SetAverageFromHist(TH2F *h); + float SetAverageFromHist(TH3F *h); + float SetAverageFromHist(TFile *f, std::string histoName,int ndim=1); + float SetAverageFromHist(std::string fileName, std::string histoName,int ndim=1); + + float GetEfficiency(); + float GetAverageEfficiency(); + float GetEfficiency(float v0,float v1=0,float v2=0,float v3=0,float v4=0,float v5=0,float v6=0,float v7=0,float v8=0,float v9=0); + void SetParVar(int idx,float value); + void SetParVars(float v0,float v1=0,float v2=0,float v3=0,float v4=0,float v5=0,float v6=0,float v7=0,float v8=0,float v9=0); + + // control methods + int GetNvars(); + + private: + TH1F* fHist[MAXvar]; + TH2F* fHist2D[MAXvar]; + TH3F* fHist3D[MAXvar]; + float fAverage; + float fVars[MAXvar]; + int fNvar; + int fDim[MAXvar]; +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MatrixUtils.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MatrixUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..ad5721f03818fe1929385a7b15f87b017e66680f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/MatrixUtils.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// Generic matrix methods fake lepton estimates for lepton and dilepton. +// +// Given loose/tight lepton ID, real efficiency r, +// and fake efficiency f builds the fake estimate event weight +// +// Authors: +// Karl Gellerstedt (kargel@fysik.su.se) +// Jorgen Sjolin (sjolin@fysik.su.se) +// + +#ifndef MATRIX_UTILS_H +#define MATRIX_UTILS_H + +#include "TMatrixD.h" + +class MatrixUtils { + + public: + MatrixUtils(); + + double lepton_weight(bool loose, double r, double f, + double &nf, double &nr); + + void fill_matrix(double r, double f); + void fill_matrix(double r, double f, double t); + + double lepton_tight_weight(bool loose); + double lepton_loose_weight(bool loose); + double lepton_tight_top_corr_weight(bool loose); + double lepton_loose_top_corr_weight(bool loose); + + double dilepton_weight(bool l1, double r1, double f1, + bool l2, double r2, double f2, + double &nrf, double &nfr, double &nff); + + void fill_matrix(double r1, double f1, double r2, double f2); + void fill_matrix(double r1, double f1, double t1, double r2, double f2, double t2); + + double dilepton_TT_weight(bool l1, bool l2); + double dilepton_TL_weight(bool l1, bool l2); + double dilepton_LT_weight(bool l1, bool l2); + double dilepton_LL_weight(bool l1, bool l2); + double dilepton_TT_top_corr_weight(bool l1, bool l2); + double dilepton_TL_top_corr_weight(bool l1, bool l2); + double dilepton_LT_top_corr_weight(bool l1, bool l2); + double dilepton_LL_top_corr_weight(bool l1, bool l2); + + void fill_lll_matrix(double r1, double f1, double r2, double f2, double r3, double f3); + double trilepton_weight(bool l1, bool l2, bool l3); + + private: + + TMatrixD ljets_matrix; + TMatrixD ljets_matrix_top_corr; + TMatrixD ll_matrix; + TMatrixD ll_matrix_top_corr; + TMatrixD lll_matrix; + + TMatrixD i_ljets_matrix; + TMatrixD i_ljets_matrix_top_corr; + TMatrixD i_ll_matrix; + TMatrixD i_ll_matrix_top_corr; + TMatrixD i_lll_matrix; +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesMMWeightCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesMMWeightCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..6bef6366541a7ca396beccf0bb9b1fc7e1a65558 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesMMWeightCalculator.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopFakesMMWeightCalculator.h 762053 2016-07-15 04:39:49Z tpelzer $ +#ifndef TOPFAKESMMWEIGHTCALCULATOR_H +#define TOPFAKESMMWEIGHTCALCULATOR_H + +/** + * @author Timothée Theveneaux-Pelzer <tpelzer@cern.ch> + * + * @brief TopFakesMMWeightCalculator + * Calculate Matrix-Method Weights for fake prompt lepton background estimates + **/ + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// For Object containers +#include "TopEvent/Event.h" + +#include <map> + +// Classes from fakesWeight framework +class FakesWeights; +class MMLepton; +class MMEvent; + +// Forward declaration(s): +namespace top{ + class TopConfig; + class Event; + namespace fakes { + enum class LeptonDefinitions; + } +} + +namespace top{ + + class TopFakesMMWeightCalculator final : public asg::AsgTool { + public: + explicit TopFakesMMWeightCalculator( const std::string& name = "MMWeightCalculator" ); + virtual ~TopFakesMMWeightCalculator(); + + // Delete Standard constructors + TopFakesMMWeightCalculator(const TopFakesMMWeightCalculator& rhs) = delete; + TopFakesMMWeightCalculator(TopFakesMMWeightCalculator&& rhs) = delete; + TopFakesMMWeightCalculator& operator=(const TopFakesMMWeightCalculator& rhs) = delete; + + StatusCode initialize(); + StatusCode setSelectionConfigs(std::string selection, std::vector<std::string> configs); + StatusCode execute(top::Event* topEvent); + + std::vector<std::string> GetFakesMMConfigNames(std::string selection) const; + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::string m_dir; + + bool m_debug; + + // unordered_map of FakesWeight objects + // m_fakesWeightTools[selection][configuration] + std::unordered_map<std::string,std::unordered_map<std::string,std::shared_ptr<FakesWeights>>> m_fakesWeightTools; + + float getMMweightE(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info); + float getMMweightM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info); + float getMMweightEE(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info); + float getMMweightMM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info); + float getMMweightEM(std::shared_ptr<FakesWeights> weighter, const xAOD::MissingET& met, const xAOD::ElectronContainer& els, const xAOD::MuonContainer& mus, const xAOD::JetContainer jets, const xAOD::EventInfo* event_info); + + MMLepton* getLeptonMMInfo(const xAOD::Electron& el, const xAOD::JetContainer& jets, const xAOD::MissingET& met, const xAOD::EventInfo* event_info); + MMLepton* getLeptonMMInfo(const xAOD::Muon& mu, const xAOD::JetContainer& jets, const xAOD::MissingET& met, const xAOD::EventInfo* event_info); + MMEvent* getEventMMInfo( const xAOD::JetContainer& jets, const xAOD::MissingET& met); + + int getPeriod ( const std::string& period_string ); + +// fakes::LeptonDefinitions m_leptonDefs; +// void CheckConfiguration(); + + ///-- Tell RootCore to build a dictionary (we need this) --/// + ClassDef(top::TopFakesMMWeightCalculator, 0); + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesxAODUtils.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesxAODUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..c975f6a9a703f8c66228b717f917ce81454c5abb --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/TopFakes/TopFakesxAODUtils.h @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPFAKESXAODUTILS_H +#define TOPFAKESXAODUTILS_H + +#include "TopEvent/Event.h" + +#include <vector> + +namespace top { + /** @namespace fakes + * @brief namespace containing usefull functions for matrix-method fakes estimates + **/ + namespace fakes { + /** @brief calculates the jet-environment-related quantities for a given electron + * quantities are calculated with and without taking into account the forward jets + * default values are -999. - it can occur in 0-jet cases + * @param el the selected electron (const) + * @param jets the whole jet container (const) + * @param dRClosetJet reference to the deltaR(electron, closest jet), including forward jets (i.e. jets can have |eta|>2.5) + * @param PtClosetJet reference to the pT of the closest Jet, including forward jets (i.e. jets can have |eta|>2.5) + * @param dRClosetCentralJet reference to the deltaR(electron, closest jet), excluding forward jets (i.e. considering only jets with |eta|<2.5) + * @param PtClosetCentralJet reference to the pT of the closest Jet, excluding forward jets (i.e. considering only jets with |eta|<2.5) + **/ + void GetClosestJet (const xAOD::Electron& el, + const xAOD::JetContainer& jets, + float& dRClosetJet, + float& PtClosetJet, + float& dROverPtClosetJet, + float& dRClosetCentralJet, + float& PtClosetCentralJet, + float& dROverPtClosetCentralJet); + + /** @brief calculates the jet-enrivronment-related quantities for a given muon + * quantities are calculated with and without taking into account the forward jets + * default values are -999. - it can occur in 0-jet cases + * @param mu the selected muon (const) + * @param jets the whole jet container (const) + * @param dRClosetJet reference to the deltaR(muon, closest jet), including forward jets (i.e. jets can have |eta|>2.5) + * @param PtClosetJet reference to the pT of the closest Jet, including forward jets (i.e. jets can have |eta|>2.5) + * @param dRClosetCentralJet reference to the deltaR(muon, closest jet), excluding forward jets (i.e. considering only jets with |eta|<2.5) + * @param PtClosetCentralJet reference to the pT of the closest Jet, excluding forward jets (i.e. considering only jets with |eta|<2.5) + **/ + void GetClosestJet (const xAOD::Muon& mu, const xAOD::JetContainer& jets, + float& dRClosetJet, + float& PtClosetJet, + float& dROverPtClosetJet, + float& dRClosetCentralJet, + float& PtClosetCentralJet, + float& dROverPtClosetCentralJet); + + /** @brief calculates the deltaPhi between an electron and the MET + * @param el reference to the selected electron (const) + * @param met reference to the MET (const) + * @param dPhi reference to the deltaPhi + **/ + void GetdPhiLepMET (const xAOD::Electron& el, + const xAOD::MissingET& met, float& dPhi); + + /** @brief calculates the deltaPhi between a muon and the MET + * @param mu reference to the selected muon (const) + * @param met reference to the MET (const) + * @param dPhi reference to the deltaPhi + **/ + void GetdPhiLepMET (const xAOD::Muon& mu, + const xAOD::MissingET& met, float& dPhi); + + /** @brief calculates the trigger-matching variable of an electron + * FIXME convention could be updated with new trigger recommendations + * @param runNumber allows to distinguish 2015 and 2016 data for triggers - default is 2015 + **/ + void GetTrigMatchVariable(const xAOD::Electron& el, int& trigmatch, const unsigned int runNumber=276262); + + /** @brief calculates the trigger-matching variable of a muon + * FIXME convention could be updated with new trigger recommendations + * @param runNumber allows to distinguish 2015 and 2016 data for triggers - default is 2015 + **/ + void GetTrigMatchVariable(const xAOD::Muon& mu, int& trigmatch, const unsigned int runNumber=276262); + + /** @brief get the indexes of the good high pT electrons + * FIXME may not be needed + **/ + std::vector<unsigned int> GetGoodHighPtLeptons(const xAOD::ElectronContainer& els); + + /** @brief get the indexes of the good high pT muons + * FIXME may not be needed + **/ + std::vector<unsigned int> GetGoodHighPtLeptons(const xAOD::MuonContainer& mus); + + + /** @brief get the channel of the event, based on the good high pT electrons and muons + * FIXME may not be needed + **/ + int GetChannel(const xAOD::ElectronContainer& els, const xAOD::MuonContainer& mus); + + /** @brief enum class listing the possible lepton definitions supported by the TopFakes package + * FIXME need to add more definitions (e.g. SSDilepton, TTbarResonance) + **/ + enum class LeptonDefinitions { Standard, Other }; + } +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..f8d26606d7eb4219b937f1bf9abd5d85523b1294 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopFakes + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = TopEvent TopConfiguration + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.Standalone b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.Standalone new file mode 100644 index 0000000000000000000000000000000000000000..b6a05f39b3aa6c0237cdcb8ed7a0d2269692c21c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/cmt/Makefile.Standalone @@ -0,0 +1,129 @@ +# This make file is for building a standalone version of the +# FakesMacros package. +# (The make file is a modified version of the GoodRunsLists Makefile.) +# + +# --- External configuration ---------------------------------- +#include $(ROOTSYS)/test/Makefile.arch +include $(ROOTSYS)/etc/Makefile.arch + +# ------------------------------------------------------------- +# General flags +# ------------------------------------------------------------- +PACKAGE = TopFakes +OUTPUTDIR = ../lib + +MFLAGS = -MM -Wall -W -Woverloaded-virtual -DSTANDALONE +INCLUDES += -I$(shell root-config --incdir) -I.. + +# For debugging +CXXFLAGS += -g -DSTANDALONE + +# Need these to avoid loading dependent libraries when ROOT starts +LINKLIBS = -L$(shell root-config --libdir) -lHist + +# Library list for applications +#EXELIBS = -L../lib -l$(PACKAGE) +#EXELIBS += $(shell root-config --libs) -lTreePlayer -lHistPainter + +# ------------------------------------------------------------- +# ROOT CINT files +# ------------------------------------------------------------- +LDEFFILE = ../Root/LinkDef.h +CINTFILE = ../Root/$(PACKAGE)Dict.cxx +CINTFILEH = ../Root/$(PACKAGE)Dict.h +CINTOBJ = ../Root/$(PACKAGE)Dict.o + +# ------------------------------------------------------------- +# C++ source and header files +# ------------------------------------------------------------- +CCXAOD = ../Root/TopFakesMMWeightCalculator.cxx ../Root/TopFakesxAODUtils.cxx +HHXAOD = ../$(PACKAGE)/TopFakesMMWeightCalculator.h ../$(PACKAGE)/TopFakesxAODUtils.h + +CCLIST = $(patsubst ../Root/%cxx, %cxx, $(filter-out $(CINTFILE) $(CCXAOD), $(wildcard ../Root/*.cxx))) +CCLISTC = $(addprefix ../Root/,$(CCLIST)) $(CINTFILE) +HHEXCLUDE = $(CINTFILEH) $(LDEFFILE) +HHLIST = $(patsubst ../$(PACKAGE)/%h, %h, $(filter-out $(HHEXCLUDE) $(HHXAOD), $(wildcard ../$(PACKAGE)/*.h))) +HHLISTC = $(addprefix ../$(PACKAGE)/,$(HHLIST)) +OLISTC = $(patsubst %.cxx,%.o,$(CCLISTC)) + +#APPCCLIST = $(patsubst ../src/apps/%cxx, %cxx, $(wildcard ../src/apps/*.cxx)) +#APPCCLISTC = $(addprefix ../src/apps/,$(APPCCLIST)) +#APPOLISTC = $(patsubst %.cxx,%.o,$(APPCCLISTC)) +#APPEXELIST = $(addprefix ../bin/, $(patsubst %cxx, %exe, $(APPCCLIST))) + +# ------------------------------------------------------------- +# Libraries +# ------------------------------------------------------------- +SHLIBFILE = $(OUTPUTDIR)/lib$(PACKAGE).so + +ifeq ($(PLATFORM),macosx) +EXTRALDFLAGS = -install_name @rpath/$(SHLIBFILE) +endif + +# get libraries of ROOT +define ldlinksuffixROOT + $(addsuffix $(LDLINKSUFFIX),$(Lib)) $(shell if [ "$(findstring -Ldlink2,$(OPTIONS))" ]; then echo $(addsuffix _pkgid_$(ROOTVER),$(Lib)); fi) +endef + +# ------------------------------------------------------------- +# Compilation +# ------------------------------------------------------------- + +#all: shlib apps +all: shlib + +# Implicit rule making all dependency Makefiles included at the end of this makefile +%.d: %.cxx $(HLIST) + @echo "Making $@" + @set -e; $(CC) $(MFLAGS) $(CXXFLAGS) $< \ + | awk '{ sub("^$(notdir $*).o:","$*.o $@:") ; print }' > $@ ;\ + [ -s $@ ] || rm -f $@ + +# Implicit rule to compile all classes +%.o : %.cxx + @echo "Compiling $<" + @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $*.o + +# Rule to make ROOTCINT output file +$(CINTOBJ) : $(HHLISTC) $(LDEFFILE) + @echo "Running rootcint" + @$(ROOTSYS)/bin/rootcint -f $(CINTFILE) -c -p $(CXXFLAGS) $(INCLUDES) $(HHLISTC) $(LDEFFILE) + @echo "Compiling $(CINTFILE)" + @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(CINTFILE) -o $@ + +rootcint : $(HHLISTC) $(LDEFFILE) + @echo "Running rootcint" + $(ROOTSYS)/bin/rootcint -f $(CINTFILE) -c -p $(CXXFLAGS) $(INCLUDES) $(HHLISTC) $(LDEFFILE) + +# Rule to combine objects into a shared library +$(SHLIBFILE): $(OLISTC) + @echo "Linking $(SHLIBFILE)" + @mkdir -p $(OUTPUTDIR) + @rm -f $(SHLIBFILE) + @$(LD) $(CXXFLAGS) $(SOFLAGS) $(LINKLIBS) $(EXTRALDFLAGS) $(OLISTC) -o $(SHLIBFILE) + +# Rule to build test applications +#../bin/test.exe : ../src/apps/test.o +# @echo "Building $@" +# @$(LD) $(CXXFLAGS) $(EXELIBS) $< -o ../bin/test.exe +# +#../bin: +# @mkdir -p ../bin + +-include $(DLIST) + +cint: $(CINTOBJ) +shlib: $(SHLIBFILE) + +#apps: shlib ../bin $(APPEXELIST) + +clean: + @rm -f ../*/*~ + @rm -f ../*/*.o ../*/*.d ../*/*.pcm + @rm -f ../*/*/*.o ../*/*/*.d ../*/*/*.pcm + +veryclean: clean + @rm -f ../Root/$(CINTFILE) ../Root/$(CINTFILEH) + @rm -rf $(OUTPUTDIR) + @rm -rf ../bin diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default.root new file mode 100644 index 0000000000000000000000000000000000000000..aa8ed4a17e833e3220ba22092c1ba743d72df808 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_CRfake.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_CRfake.root new file mode 100644 index 0000000000000000000000000000000000000000..1d60d363b5fc6e32cf74a03379b1591da5e9e639 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_CRfake.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCdown.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCdown.root new file mode 100644 index 0000000000000000000000000000000000000000..01e8465945b5e98542abfc97ac6220a1f8f33f6f Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCdown.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCup.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCup.root new file mode 100644 index 0000000000000000000000000000000000000000..0b7eb759f7aebba9f4ca4dade7c25e20cc7cd945 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_MCup.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZMG.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZMG.root new file mode 100644 index 0000000000000000000000000000000000000000..d9b5b80792e91bbdaeee6f2e28a50dfd23199c85 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZMG.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZPowheg.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZPowheg.root new file mode 100644 index 0000000000000000000000000000000000000000..e25cd6801cfb9e7cfaf2005ddd5837e993f87371 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/F_el_Default_WZPowheg.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default.root new file mode 100644 index 0000000000000000000000000000000000000000..13d678bcf9379067e93e2d11599447a868483f6c Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_CRreal.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_CRreal.root new file mode 100644 index 0000000000000000000000000000000000000000..5956a4bcfe93baccee5f9b13370b1cdbbb15c913 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_CRreal.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_TPNoCorr.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_TPNoCorr.root new file mode 100644 index 0000000000000000000000000000000000000000..fbb0666ccab0d1575911f0d96f5ecb28c63fe07b Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_el_Default_TPNoCorr.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_mu_Default.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_mu_Default.root new file mode 100644 index 0000000000000000000000000000000000000000..6293996d65b9c69138439f10b1b474934d008340 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p1/Standard/R_mu_Default.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_el_2015Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_el_2015Test.root new file mode 100644 index 0000000000000000000000000000000000000000..164ccf1d6e63b8abc81a7c7b051f34a33ea145b9 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_el_2015Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_mu_2015Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_mu_2015Test.root new file mode 100644 index 0000000000000000000000000000000000000000..b25724ea4275f9aaf90c9ac7a916acfd068ec7be Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/F_mu_2015Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_el_2015Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_el_2015Test.root new file mode 100644 index 0000000000000000000000000000000000000000..55401f2409f20cc8aac184cf6d9db3dcb8f1b8d7 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_el_2015Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_mu_2015Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_mu_2015Test.root new file mode 100644 index 0000000000000000000000000000000000000000..3c023c3d648e9e6f2772471069b775c0fc030c64 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2015/R_mu_2015Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_el_2016Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_el_2016Test.root new file mode 100644 index 0000000000000000000000000000000000000000..f3f764b0fc7282c2b7f18aa1a538b3d039a1ff8b Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_el_2016Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_mu_2016Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_mu_2016Test.root new file mode 100644 index 0000000000000000000000000000000000000000..326ae1414b3df298631d6eeefe926d6c163462c2 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/F_mu_2016Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_el_2016Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_el_2016Test.root new file mode 100644 index 0000000000000000000000000000000000000000..189d69454d21fc9d32919add4e4f10d27448b03e Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_el_2016Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_mu_2016Test.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_mu_2016Test.root new file mode 100644 index 0000000000000000000000000000000000000000..04fa25d8ff939f317ee22d0201f110fc8d8facac Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/2016/R_mu_2016Test.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_el_2016PSTest.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_el_2016PSTest.root new file mode 100644 index 0000000000000000000000000000000000000000..2ff43ce2794a4dac8e752cd6953b1fd90727e7fe Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_el_2016PSTest.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_mu_2016PSTest.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_mu_2016PSTest.root new file mode 100644 index 0000000000000000000000000000000000000000..81877818132326e2197fa44389f97333dd7d3095 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/F_mu_2016PSTest.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_el_2016PSTest.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_el_2016PSTest.root new file mode 100644 index 0000000000000000000000000000000000000000..c8b4c2d06ec3a1e058f31ec25a7b38825f2081e0 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_el_2016PSTest.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_mu_2016PSTest.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_mu_2016PSTest.root new file mode 100644 index 0000000000000000000000000000000000000000..5b4e78f8883daca4fd389a13fb86698367b36369 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/PS2016/R_mu_2016PSTest.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/F_el_Nedaa2015_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/F_el_Nedaa2015_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..527c19f9d75176777f9af8b58de6c4c5533d70fb Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/F_el_Nedaa2015_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2015_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2015_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..8f388f06d0681f0d18725035abdf31362f0dbd18 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2015_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2016_2412-fakesStdNoTTVA.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2016_2412-fakesStdNoTTVA.root new file mode 100644 index 0000000000000000000000000000000000000000..a7aaf9bf85baa5af8a1fb977ebdfe8e668854724 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Fred2016_2412-fakesStdNoTTVA.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2015_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2015_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..fccf00697a3d328f6c6a6963a3678bf2a4637b1c Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2015_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2016_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2016_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..929bb91cd5284ba72f82d1f0ebfd40cfca8adeff Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_el_Nedaa2016_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2015_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2015_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..f7bf09faefc98ca4b3a4d191152821b04c9fea90 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2015_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2016_2412-fakesStdNoTTVA.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2016_2412-fakesStdNoTTVA.root new file mode 100644 index 0000000000000000000000000000000000000000..b2413e4757ac6c9fac75ad277264fbffe78885ae Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Fred2016_2412-fakesStdNoTTVA.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2015_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2015_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..11feb6886c3a3c76a6014a999e8cb9a9c8962856 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2015_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2016_2412-fakesStd.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2016_2412-fakesStd.root new file mode 100644 index 0000000000000000000000000000000000000000..f10330bd5929e2bea797b8b0f4367f5e37b3583a Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/Standard/R_mu_Nedaa2016_2412-fakesStd.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/F_el_Fred2015_AT2414-fakesOldOR_MCup.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/F_el_Fred2015_AT2414-fakesOldOR_MCup.root new file mode 100644 index 0000000000000000000000000000000000000000..03a440673f48896299180195c64affb3c28ba262 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/F_el_Fred2015_AT2414-fakesOldOR_MCup.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2015_AT2414-fakesOldOR.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2015_AT2414-fakesOldOR.root new file mode 100644 index 0000000000000000000000000000000000000000..93606bf4c6c8cd8bc786ecdf015e6cbbad1d8bc6 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2015_AT2414-fakesOldOR.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2016_AT2414-fakesOldOR.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2016_AT2414-fakesOldOR.root new file mode 100644 index 0000000000000000000000000000000000000000..aa809097468c25ca29eb789b04933bf7012e6179 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_el_Fred2016_AT2414-fakesOldOR.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2015_AT2414-fakesOldOR.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2015_AT2414-fakesOldOR.root new file mode 100644 index 0000000000000000000000000000000000000000..b48cd20f553fb785a48cfab536af68cc745200c2 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2015_AT2414-fakesOldOR.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2016_AT2414-fakesOldOR.root b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2016_AT2414-fakesOldOR.root new file mode 100644 index 0000000000000000000000000000000000000000..89c14708da9ccda819f2edf4b041d96bece1fe05 Binary files /dev/null and b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/20p7/StandardOldOR/R_mu_Fred2016_AT2414-fakesOldOR.root differ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..5cac0dedaff785292f3478c7365c451b9b631c89 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/data/mainpage.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @page tfpage TopFakes + * + * @section intro Introduction + * + * Description of the purpose of this code and how to use it. + * + * Example for usage + * @code + * executable [options] + * @endcode + * + * + * @section addinfo Additional information + * + * Some useful code is: + * - top::TopFakesMMWeightCalculator + * + * + * + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasExample.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasExample.C new file mode 100644 index 0000000000000000000000000000000000000000..24870d823628effdd99ae99a7e11824e445b89e8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasExample.C @@ -0,0 +1,224 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <cmath> + +#include "Rtypes.h" + +#include "AtlasUtils.h" +// #ifndef __CINT__ +#include "AtlasStyle.C" +#include "AtlasLabels.C" +// #endif + +#include "TCanvas.h" +#include "TFile.h" +#include "TROOT.h" +#include "TH1F.h" +#include "TRandom.h" +#include "TGraphErrors.h" + +using namespace std; + +const Int_t GMAX=864; + +const int nren=3; +static const double mur[nren] = {1.0,0.25,4.0}; +static const double muf[nren] = {1.0,0.25,4.0}; +const unsigned int NUMPDF=41; + +TGraphErrors* GetGraph(Int_t ir, Int_t ifs,Int_t icut, Int_t ipdf); + + +void AtlasExample() +{ + +#ifdef __CINT__ + gROOT->LoadMacro("AtlasUtils.C"); +#endif + + SetAtlasStyle(); + + Int_t icol1=5; + Int_t icol2=5; + + TCanvas* c1 = new TCanvas("c1","single inclusive jets",50,50,600,600); + // TCanvas* c1 = new TCanvas("c1","single inclusive jets"); + TPad* thePad = (TPad*)c1->cd(); + thePad->SetLogy(); + + Double_t ymin=1.e-3; Double_t ymax=2e7; + Double_t xmin=60.00; Double_t xmax=3500.; + TH1F *h1 = thePad->DrawFrame(xmin,ymin,xmax,ymax); + h1->SetYTitle("d#sigma_{jet}/dE_{T,jet} [fb/GeV]"); + h1->SetXTitle("E_{T,jet} [GeV]"); + h1->GetYaxis()->SetTitleOffset(1.4); + h1->GetXaxis()->SetTitleOffset(1.4); + //h1->GetXaxis()->SetNdivisions(5); + h1->Draw(); + + const Int_t ncut=1; + TGraphErrors *data[ncut]; + + for (Int_t icut=0; icut<ncut; icut++) { // loop over cuts + + TGraphErrors *g1[nren][ncut]; + for (Int_t ir=0; ir<nren; ir++) { // loop over ren scale + g1[ir][icut]= GetGraph(ir,ir,icut,0); + if (g1[ir][icut]) + cout << g1[ir][icut]->GetTitle() << " found " << g1[ir][icut]->GetName() << endl; + else { + cout << " g1 not found " << endl; + return; + } + g1[ir][icut]->SetLineColor(1); + g1[ir][icut]->SetMarkerStyle(0); + //g1[ir][icut]->Draw("C"); + } + + char daname[100]; + sprintf(daname,"data_%d",icut); + data[icut]=(TGraphErrors*)g1[0][icut]->Clone(daname); + data[icut]->SetMarkerStyle(20); + data[icut]->SetMarkerColor(1); + + // just invent some data + for (Int_t i=0; i< data[icut]->GetN(); i++) { + Double_t x1,y1,e,dx1=0.; + data[icut]->GetPoint(i,x1,y1); + Double_t r1 = 0.4*(gRandom->Rndm(1)+2); + Double_t r2 = 0.4*(gRandom->Rndm(1)+2); + //cout << " i= " << i << " x1= " << x1 << " y1= " << y1 << " r= " << r << endl; + Double_t y; + if (icut==0) y=r1*y1+r1*r2*r2*x1/50000.; + else y=r1*y1; + e=sqrt(y*1000)/200; + data[icut]->SetPoint(i, x1,y); + data[icut]->SetPointError(i,dx1,e); + } + //data[icut]->Print(); + + TGraphAsymmErrors* scale[ncut]; + TGraphAsymmErrors* scalepdf[ncut]; + + scale[icut]= myMakeBand(g1[0][icut],g1[1][icut],g1[2][icut]); + //printf(" band1: \n"); + //scale->Print(); + + scalepdf[icut]=(TGraphAsymmErrors* ) scale[icut]->Clone("scalepdf"); + + TGraphErrors *gpdf[NUMPDF][ncut]; + for (Int_t ipdf=0; ipdf<NUMPDF; ipdf++) { + gpdf[ipdf][icut]= GetGraph(0,0,icut,ipdf); + if (gpdf[ipdf][icut]) + cout << gpdf[ipdf][icut]->GetTitle() << " found " << gpdf[ipdf][icut]->GetName() << endl; + else { + cout << " gpdf not found " << endl; + return; + } + gpdf[ipdf][icut]->SetLineColor(2); + gpdf[ipdf][icut]->SetLineStyle(1); + gpdf[ipdf][icut]->SetMarkerStyle(0); + myAddtoBand(gpdf[ipdf][icut],scalepdf[icut]); + } + + scalepdf[icut]->SetFillColor(icol2); + scalepdf[icut]->Draw("zE2"); + scale[icut]->SetFillColor(icol1); + scale[icut]->Draw("zE2"); + g1[0][icut]->SetLineWidth(3); + g1[0][icut]->Draw("z"); + data[icut]->Draw("P"); + + } + + myText( 0.3,0.85,1,"#sqrt{s}= 14 TeV"); + myText( 0.57,0.85,1,"|#eta_{jet}|<0.5"); + myMarkerText(0.55,0.75,1,20,"Data 2009",1.3); + myBoxText( 0.55,0.67,0.05,icol1,"NLO QCD"); + + //ATLAS_LABEL(0.2,0.2); myText( 0.37,0.2,1,"Preliminary"); + + // new method for ATLAS labels. Use this! + //ATLASLabel(0.2,0.2); + ATLASLabel(0.2,0.2,"Preliminary"); + //ATLASLabel(0.2,0.2,"Work in progress"); + + c1->Print("AtlasExample.eps"); + c1->Print("AtlasExample.png"); + c1->Print("AtlasExample.pdf"); + +} + +TGraphErrors* GetGraph(Int_t ir, Int_t ifs,Int_t icut, Int_t ipdf) +{ + + const bool debug=0; + + char *cuts[5] = + {"0.0 <= |eta| < 0.5", + "0.5 <= |eta| < 1.0", + "1.0 <= |eta| < 1.5", + "1.5 <= |eta| < 2.0", + "2.0 <= |eta| < 3.0"}; + + const double mur[] = {1.0,0.25,4.0}; + const double muf[] = {1.0,0.25,4.0}; + + TFile *f1 = TFile::Open("nlofiles.root"); + if (f1&&debug) cout << " file opened " << endl; + + char gname[100]; + char tname[100]; + + if (debug) cout << " mur= " << mur[ir] << " muf= " << muf[ifs] + << " iut= " << icut << " ipdf= " << ipdf << endl; + + if (ipdf>=0) + sprintf(tname," E_T (mu_r=%g, mu_f=%g);%s Pdf: %d",mur[ir],muf[ifs],cuts[icut],ipdf); + else + sprintf(tname," E_T %s Ms= %d",cuts[icut],-ipdf); + + if (debug) cout << "**GetGraph: Look for: " << tname << endl; + + TGraphErrors* g1 = 0; + + for (int i=1; i<=GMAX; i++){ + sprintf(gname,"full_%d",i); + // sprintf(gname,"born_%d",i); + sprintf(gname,"full_%d",i); + g1=(TGraphErrors*) f1->Get(gname); + if (!g1) { cout << gname << " not found " << endl; return g1=0; } + + const char *title=g1->GetTitle(); + + if (debug){ + cout << " Title= " << title << endl; + cout << " tname= " << tname << endl; + cout << " strcmp: " << strcmp(title,tname) << endl; + } + + if (strcmp(title,tname)==0) break; + g1=0; + } + + if (!g1) return 0; + if (debug) cout << " found: " << g1->GetTitle() << endl; + + return g1; +} + + + +#ifndef __CINT__ + +int main() { + + AtlasExample(); + + return 0; +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.C new file mode 100644 index 0000000000000000000000000000000000000000..eb382c7759ed912038880a5626ac8213f147a597 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.C @@ -0,0 +1,129 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "AtlasLabels.h" + +#include "TLatex.h" +#include "TLine.h" +#include "TPave.h" +#include "TMarker.h" + + +void ATLASLabel(Double_t x,Double_t y,char* text,Color_t color) +{ + TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + + //double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw()); + double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw()); + + //l.DrawLatex(x,y,"ATLAS Internal"); + l.DrawLatex(x,y,"ATLAS"); + if (text) { + TLatex p; + p.SetNDC(); + p.SetTextFont(42); + p.SetTextColor(color); + //p.DrawLatex(x+delx,y,text); + //p.DrawLatex(x+delx,y,text); + p.DrawLatex(x+0.16,y,text); + } +} + + +void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary,Color_t color) +{ + TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + l.DrawLatex(x,y,"ATLAS"); + if (Preliminary) { + TLatex p; + p.SetNDC(); + p.SetTextFont(42); + p.SetTextColor(color); + p.DrawLatex(x+0.115,y,"Preliminary"); + } +} + + + +void ATLASVersion(char* version,Double_t x,Double_t y,Color_t color) +{ + + if (version) { + char versionString[100]; + sprintf(versionString,"Version %s",version); + TLatex l; + l.SetTextAlign(22); + l.SetTextSize(0.04); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + l.DrawLatex(x,y,versionString); + } +} + + + +void myText(Double_t x,Double_t y,Color_t color,char *text,float size) +{ + Double_t tsize=size; + TLatex l; //l.SetTextAlign(12); + l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextColor(color); + l.DrawLatex(x,y,text); +} + +void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text) +{ + Double_t tsize=0.06; + + TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); + l.SetNDC(); + l.DrawLatex(x,y,text); + + Double_t y1=y-0.25*tsize; + Double_t y2=y+0.25*tsize; + Double_t x2=x-0.3*tsize; + Double_t x1=x2-boxsize; + + printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2); + + TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC"); + + mbox->SetFillColor(mcolor); + mbox->SetFillStyle(1001); + mbox->Draw(); + + TLine mline; + mline.SetLineWidth(4); + mline.SetLineColor(1); + mline.SetLineStyle(1); + Double_t y_new=(y1+y2)/2.; + mline.DrawLineNDC(x1,y_new,x2,y_new); + +} + +void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text) + // Float_t msize=2.,Float_t mytsize=0.05) +{ + // printf("**myMarker: text= %s\ m ",text); + + Double_t tsize=0.06; + TMarker *marker = new TMarker(x-(0.4*tsize),y,8); + marker->SetMarkerColor(color); marker->SetNDC(); + marker->SetMarkerStyle(mstyle); + marker->SetMarkerSize(2.0); + marker->Draw(); + + TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); + l.SetNDC(); + l.DrawLatex(x,y,text); +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.h new file mode 100644 index 0000000000000000000000000000000000000000..8ad0f8dd394fb30285a1db195a3c70e0c7451806 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasLabels.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// @file AtlasLabels.h +// +// @author M.Sutton +// +// Copyright (C) 2010 Atlas Collaboration +// +// $Id: AtlasLabels.h 726730 2016-02-29 08:41:06Z derue $ + + +#ifndef __ATLASLABELS_H +#define __ATLASLABELS_H + +#include "Rtypes.h" + +void ATLASLabel(Double_t x,Double_t y,char* text=NULL,Color_t color=1); + +void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary=false,Color_t color=1); + +void ATLASVersion(char* version=NULL,Double_t x=0.88,Double_t y=0.975,Color_t color=1); + +void myText(Double_t x,Double_t y,Color_t color,char *text,float size=0.045); + +void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text); + +void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text); +// Float_t msize=2.,Float_t mytsize=0.05); + +#endif // __ATLASLABELS_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.C new file mode 100644 index 0000000000000000000000000000000000000000..99515ac6c3650a0affe86d153c61d68e7c14305b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.C @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// ATLAS Style, based on a style file from BaBar +// + +#include <iostream> + +#include "AtlasStyle.h" + +#include "TROOT.h" + +void SetAtlasStyle () +{ + static TStyle* atlasStyle = 0; + std::cout << "\nApplying ATLAS style settings...\n" << std::endl ; + if ( atlasStyle==0 ) atlasStyle = AtlasStyle(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); +} + +TStyle* AtlasStyle() +{ + TStyle *atlasStyle = new TStyle("ATLAS","Atlas style"); + + // use plain black on white colors + Int_t icol=0; // WHITE + atlasStyle->SetFrameBorderMode(icol); + atlasStyle->SetFrameFillColor(icol); + atlasStyle->SetCanvasBorderMode(icol); + atlasStyle->SetCanvasColor(icol); + atlasStyle->SetPadBorderMode(icol); + atlasStyle->SetPadColor(icol); + atlasStyle->SetStatColor(icol); + //atlasStyle->SetFillColor(icol); // don't use: white fill color for *all* objects + + // set the paper & margin sizes + atlasStyle->SetPaperSize(20,26); + + // set margin sizes + atlasStyle->SetPadTopMargin(0.05); + atlasStyle->SetPadRightMargin(0.05); + atlasStyle->SetPadBottomMargin(0.16); + atlasStyle->SetPadLeftMargin(0.16); + + // set title offsets (for axis label) + atlasStyle->SetTitleXOffset(1.4); + atlasStyle->SetTitleYOffset(1.4); + + // use large fonts + //Int_t font=72; // Helvetica italics + Int_t font=42; // Helvetica + Double_t tsize=0.045; + atlasStyle->SetTextFont(font); + + atlasStyle->SetTextSize(tsize); + atlasStyle->SetLabelFont(font,"x"); + atlasStyle->SetTitleFont(font,"x"); + atlasStyle->SetLabelFont(font,"y"); + atlasStyle->SetTitleFont(font,"y"); + atlasStyle->SetLabelFont(font,"z"); + atlasStyle->SetTitleFont(font,"z"); + + atlasStyle->SetLabelSize(tsize,"x"); + atlasStyle->SetTitleSize(tsize,"x"); + atlasStyle->SetLabelSize(tsize,"y"); + atlasStyle->SetTitleSize(tsize,"y"); + atlasStyle->SetLabelSize(tsize,"z"); + atlasStyle->SetTitleSize(tsize,"z"); + + // use bold lines and markers + atlasStyle->SetMarkerStyle(20); + atlasStyle->SetMarkerSize(1.); + atlasStyle->SetHistLineWidth(1.5); + atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes + + // get rid of X error bars + //atlasStyle->SetErrorX(0.001); + // get rid of error bar caps + atlasStyle->SetEndErrorSize(0.); + + // do not display any of the standard histogram decorations + atlasStyle->SetOptTitle(0); + atlasStyle->SetOptStat("emr"); + //atlasStyle->SetOptStat(0); + //atlasStyle->SetOptFit(1111); + atlasStyle->SetOptFit(0); + + // put tick marks on top and RHS of plots + atlasStyle->SetPadTickX(1); + atlasStyle->SetPadTickY(1); + + return atlasStyle; + +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.h new file mode 100644 index 0000000000000000000000000000000000000000..de616b5f1a37e70c2cd8af6d0b04f4635674ee44 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// @file AtlasStyle.h +// +// ATLAS Style, based on a style file from BaBar +// +// +// @author M.Sutton +// +// Copyright (C) 2010 Atlas Collaboration +// +// $Id: AtlasStyle.h 726730 2016-02-29 08:41:06Z derue $ + +#ifndef __ATLASSTYLE_H +#define __ATLASSTYLE_H + +#include "TStyle.h" + +void SetAtlasStyle(); + +TStyle* AtlasStyle(); + +#endif // __ATLASSTYLE_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.py b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.py new file mode 100644 index 0000000000000000000000000000000000000000..1113db98a72cff04732c4d3c5523b53c3094c4ed --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasStyle.py @@ -0,0 +1,5 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from ROOT import * +ROOT.gROOT.LoadMacro("AtlasStyle.C") +#SetAtlasStyle() diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.C new file mode 100644 index 0000000000000000000000000000000000000000..e2e336e2ae5edcbc8d9af049ce8b8bfb36c8edef --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.C @@ -0,0 +1,330 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +#include <iostream> +#include <cmath> + +#include "AtlasUtils.h" + +#include "TLine.h" +#include "TLatex.h" +#include "TMarker.h" +#include "TPave.h" +#include "TH1.h" + +void ATLAS_LABEL(Double_t x,Double_t y,Color_t color) +{ + TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + l.DrawLatex(x,y,"ATLAS"); +} + +TGraphErrors* myTGraphErrorsDivide(TGraphErrors* g1,TGraphErrors* g2) { + + const Int_t debug=0; + + if (!g1) printf("**myTGraphErrorsDivide: g1 does not exist ! \n"); + if (!g2) printf("**myTGraphErrorsDivide: g2 does not exist ! \n"); + + + Int_t n1=g1->GetN(); + Int_t n2=g2->GetN(); + + if (n1!=n2) { + printf("**myTGraphErrorsDivide: vector do not have same number of entries ! \n"); + } + + TGraphErrors* g3= new TGraphErrors(); + + Double_t x1=0., y1=0., x2=0., y2=0.; + Double_t dx1=0.,dy1=0., dy2=0.; + + Int_t iv=0; + for (Int_t i1=0; i1<n1; i1++) { + for (Int_t i2=0; i2<n2; i2++) { + //if (debug) printf("**myTGraphErrorsDivide: %d %d ! \n",i1,i2); + + g1->GetPoint(i1,x1,y1); + g2->GetPoint(i2,x2,y2); + if (x1!=x2) { + //printf("**myTGraphErrorsDivide: %d x1!=x2 %f %f ! \n",iv,x1,x2); + }else{ + //if (debug) printf("**myTGraphErrorsDivide: %d x1=x2 %f %f ! \n",iv,x1,x2); + dx1 = g1->GetErrorX(i1); + if (y1!=0) dy1 = g1->GetErrorY(i1)/y1; + if (y2!=0) dy2 = g2->GetErrorY(i2)/y2; + + if (debug) + printf("**myTGraphErrorsDivide: %d x1=%f x2=%f y1=%f y2=%f \n",iv,x1,x2,y1,y2); + + if (y2!=0.) g3->SetPoint(iv, x1,y1/y2); + else g3->SetPoint(iv, x1,y2); + + Double_t e=0.; + if (y1!=0 && y2!=0) e=std::sqrt(dy1*dy1+dy2*dy2)*(y1/y2); + g3->SetPointError(iv,dx1,e); + + + if (debug) { + //Double_t g3y, g3x,g3e; + //g3->GetPoint(iv, g3y,g3x); + //g3e=g3->GetErrorY(iv); + //printf("%d g3y= %f g3e=%f \n",iv,g3y,g3e); + } + iv++; + } + // printf("**myTGraphErrorsDivide: ...next \n"); + } + } + return g3; + +} + + +TGraphAsymmErrors* myTGraphErrorsDivide(TGraphAsymmErrors* g1,TGraphAsymmErrors* g2) { + + const Int_t debug=0; + + TGraphAsymmErrors* g3= new TGraphAsymmErrors(); + Int_t n1=g1->GetN(); + Int_t n2=g2->GetN(); + + if (n1!=n2) { + printf(" vectors do not have same number of entries ! \n"); + return g3; + } + + Double_t x1=0., y1=0., x2=0., y2=0.; + Double_t dx1h=0., dx1l=0.; + Double_t dy1h=0., dy1l=0.; + Double_t dy2h=0., dy2l=0.; + + Double_t* X1 = g1->GetX(); + Double_t* Y1 = g1->GetY(); + Double_t* EXhigh1 = g1->GetEXhigh(); + Double_t* EXlow1 = g1->GetEXlow(); + Double_t* EYhigh1 = g1->GetEYhigh(); + Double_t* EYlow1 = g1->GetEYlow(); + + Double_t* X2 = g2->GetX(); + Double_t* Y2 = g2->GetY(); + Double_t* EXhigh2 = g2->GetEXhigh(); + Double_t* EXlow2 = g2->GetEXlow(); + Double_t* EYhigh2 = g2->GetEYhigh(); + Double_t* EYlow2 = g2->GetEYlow(); + + for (Int_t i=0; i<g1->GetN(); i++) { + g1->GetPoint(i,x1,y1); + g2->GetPoint(i,x2,y2); + dx1h = EXhigh1[i]; + dx1l = EXlow1[i]; + if (y1!=0.) dy1h = EYhigh1[i]/y1; + else dy1h = 0.; + if (y2!=0.) dy2h = EYhigh2[i]/y2; + else dy2h = 0.; + if (y1!=0.) dy1l = EYlow1 [i]/y1; + else dy1l = 0.; + if (y2!=0.) dy2l = EYlow2 [i]/y2; + else dy2l = 0.; + + //if (debug) + //printf("%d x1=%f x2=%f y1=%f y2=%f \n",i,x1,x2,y1,y2); + if (debug) + printf("%d dy1=%f %f dy2=%f %f sqrt= %f %f \n",i,dy1l,dy1h,dy2l,dy2h, + std::sqrt(dy1l*dy1l+dy2l*dy2l), std::sqrt(dy1h*dy1h+dy2h*dy2h)); + + if (y2!=0.) g3->SetPoint(i, x1,y1/y2); + else g3->SetPoint(i, x1,y2); + Double_t el=0.; Double_t eh=0.; + + if (y1!=0. && y2!=0.) el=std::sqrt(dy1l*dy1l+dy2l*dy2l)*(y1/y2); + if (y1!=0. && y2!=0.) eh=std::sqrt(dy1h*dy1h+dy2h*dy2h)*(y1/y2); + + if (debug) printf("dx1h=%f dx1l=%f el=%f eh=%f \n",dx1h,dx1l,el,eh); + g3->SetPointError(i,dx1h,dx1l,el,eh); + + } + return g3; + +} + + + +TGraphAsymmErrors* myMakeBand(TGraphErrors* g0, TGraphErrors* g1,TGraphErrors* g2) { + // default is g0 + //const Int_t debug=0; + + TGraphAsymmErrors* g3= new TGraphAsymmErrors(); + + Double_t x1=0., y1=0., x2=0., y2=0., y0=0, x3=0.; + //Double_t dx1=0.; + Double_t dum; + for (Int_t i=0; i<g1->GetN(); i++) { + g0->GetPoint(i, x1,y0); + g1->GetPoint(i, x1,y1); + g2->GetPoint(i, x1,y2); + + // if (y1==0) y1=1; + //if (y2==0) y2=1; + + if (i==g1->GetN()-1) x2=x1; + else g2->GetPoint(i+1,x2,dum); + + if (i==0) x3=x1; + else g2->GetPoint(i-1,x3,dum); + + Double_t tmp=y2; + if (y1<y2) {y2=y1; y1=tmp;} + //Double_t y3=1.; + Double_t y3=y0; + g3->SetPoint(i,x1,y3); + + Double_t binwl=(x1-x3)/2.; + Double_t binwh=(x2-x1)/2.; + if (binwl==0.) binwl= binwh; + if (binwh==0.) binwh= binwl; + g3->SetPointError(i,binwl,binwh,(y3-y2),(y1-y3)); + + } + return g3; + +} + +void myAddtoBand(TGraphErrors* g1, TGraphAsymmErrors* g2) { + + Double_t x1=0., y1=0., y2=0., y0=0; + //Double_t dx1=0.; + //Double_t dum; + + if (g1->GetN()!=g2->GetN()) + std::cout << " graphs have not the same # of elements " << std::endl; + + Double_t* EYhigh = g2-> GetEYhigh(); + Double_t* EYlow = g2-> GetEYlow(); + + for (Int_t i=0; i<g1->GetN(); i++) { + g1->GetPoint(i, x1,y1); + g2->GetPoint(i, x1,y2); + + if (y1==0) y1=1; + if (y2==0) y2=1; + + // if (i==g1->GetN()-1) x2=x1; + // else g2->GetPoint(i+1,x2,dum); + // if (i==0) x3=x1; + // else g2->GetPoint(i-1,x3,dum); + + Double_t eyh=0., eyl=0.; + //if (y1<y2) {y2=y1; y1=tmp;} + //Double_t y3=1.; + + //printf("%d: y1=%f y2=%f Eyhigh= %f Eylow= %f \n",i,y1,y2,EYhigh[i],EYlow[i]); + + y0=y1-y2; + if (y0!=0) { + if (y0>0){ + eyh=EYhigh[i]; + eyh=std::sqrt(eyh*eyh+y0*y0); + //printf("high: %d: y0=%f eyh=%f \n",i,y0,eyh); + g2->SetPointEYhigh(i,eyh); + } else { + eyl=EYlow[i]; + eyl=std::sqrt(eyl*eyl+y0*y0); + // printf("low: %d: y0=%f eyl=%f \n",i,y0,eyl); + g2->SetPointEYlow (i,eyl); + } + } + } + return; + +} + +TGraphErrors* TH1TOTGraph(TH1 *h1){ + + + if (!h1) std::cout << "TH1TOTGraph: histogram not found !" << std::endl; + + TGraphErrors* g1= new TGraphErrors(); + + Double_t x, y, ex, ey; + for (Int_t i=0; i<h1->GetNbinsX(); i++) { + y=h1->GetBinContent(i); + ey=h1->GetBinError(i); + x=h1->GetBinCenter(i); + ex=h1->GetBinWidth(i); + + // cout << " x,y = " << x << " " << y << " ex,ey = " << ex << " " << ey << endl; + + g1->SetPoint(i,x,y); + g1->SetPointError(i,ex,ey); + + } + + //g1->Print(); + + return g1; +} + +void myText(Double_t x,Double_t y,Color_t color,char *text,float size) { + + Double_t tsize=size; + TLatex l; //l.SetTextAlign(12); + l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextColor(color); + l.DrawLatex(x,y,text); +} + + +void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text,Float_t mytsize) +{ + + Double_t tsize=0.06; + + TLatex l; l.SetTextAlign(12); l.SetTextSize(mytsize); + l.SetNDC(); + l.DrawLatex(x,y,text); + + Double_t y1=y-0.25*tsize; + Double_t y2=y+0.25*tsize; + Double_t x2=x-0.3*tsize; + Double_t x1=x2-boxsize; + + printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2); + + TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC"); + + mbox->SetFillColor(mcolor); + mbox->SetFillStyle(1001); + mbox->Draw(); + + TLine mline; + mline.SetLineWidth(4); + mline.SetLineColor(1); + mline.SetLineStyle(1); + Double_t y_new=(y1+y2)/2.; + mline.DrawLineNDC(x1,y_new,x2,y_new); + +} + + +void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text, + Float_t msize,Float_t mytsize) +{ + Double_t tsize=0.06; + TMarker *marker = new TMarker(x-(0.4*tsize),y,8); + marker->SetMarkerColor(color); marker->SetNDC(); + marker->SetMarkerStyle(mstyle); + marker->SetMarkerSize(msize); + marker->Draw(); + + TLatex l; l.SetTextAlign(12); + l.SetTextSize(mytsize); + l.SetNDC(); + l.DrawLatex(x,y,text); +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.h b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..d66c59a9937e5033663d54aac7f24eb0ef73dbec --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// @file AtlasUtils.h +// +// +// @author M.Sutton +// +// Copyright (C) 2010 Atlas Collaboration +// +// $Id: AtlasUtils.h 726730 2016-02-29 08:41:06Z derue $ + + +#ifndef __ATLASUTILS_H +#define __ATLASUTILS_H + +#include "TGraphErrors.h" +#include "TGraphAsymmErrors.h" + +void ATLAS_LABEL(Double_t x,Double_t y,Color_t color=1); + +TGraphErrors* myTGraphErrorsDivide(TGraphErrors* g1,TGraphErrors* g2); + +TGraphAsymmErrors* myTGraphErrorsDivide(TGraphAsymmErrors* g1,TGraphAsymmErrors* g2); + +TGraphAsymmErrors* myMakeBand(TGraphErrors* g0, TGraphErrors* g1,TGraphErrors* g2); + +void myAddtoBand(TGraphErrors* g1, TGraphAsymmErrors* g2); + +TGraphErrors* TH1TOTGraph(TH1 *h1); + +void myText(Double_t x,Double_t y,Color_t color,char *text,float size=0.1); + +void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text, + Float_t mytsize=0.05); + +void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text,Float_t msize=2., + Float_t mytsize=0.05); + +#endif // __ATLASUTILS_H + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.py b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..d19a7dc5b4454cc2b9dad94ddc4a323488add485 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/AtlasUtils.py @@ -0,0 +1,5 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from ROOT import * +ROOT.gROOT.LoadMacro("AtlasUtils.C") + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/EffSummary.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/EffSummary.C new file mode 100644 index 0000000000000000000000000000000000000000..c72f3edbe5d443d59dc8743f698f8519a09ad4ae --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/EffSummary.C @@ -0,0 +1,595 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TH1.h" +#include "TFile.h" +#include "TCanvas.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" + +#include <string> +#include <map> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Michele Pinamonti (Univ. Udine), Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot a summary of all efficiencies +// vs different variables +// It reads as input the default efficiencies of TopFakes package +// void EffSummary() is the core of this macro +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +class MMEffComparison { +public: + MMEffComparison(){ + // _c = new TCanvas("c","c",600,600); + _totH = 0; + _label = ""; + _dummyHist = 0; + _noYlabels = false; + }; + ~MMEffComparison(){}; + + + void SetIsReal(int isReal=0){ + _isReal = isReal; + }; + + void SetXaxis(float min=0,float max=1,string title,int njetbins=0){ + _dummyHist = new TH1F("h","h",1,min,max); + _dummyHist->GetXaxis()->SetTitle(title.c_str()); + if(njetbins>0){ + _dummyHist->GetXaxis()->SetNdivisions(njetbins); + _dummyHist->GetXaxis()->CenterLabels(); + } + }; + + void SetYaxis(float min=0,float max=1){ + _dummyHist = new TH1F("h","h",1,min,max); + //_dummyHist->GetYaxis()->SetTitle(title.c_str()); + /*if(njetbins>0){ + _dummyHist->GetYaxis()->SetNdivisions(njetbins); + _dummyHist->GetYaxis()->CenterLabels(); + }*/ + }; + + void Add(string filename,string histoname,string label,int color,int style,int color2=-1,int style2=-1){ + TFile *f = new TFile(filename.c_str()); + std::cout << " filename = " << filename << std::endl; + std::cout << " histoname = " << histoname << std::endl; + _h[_totH] = (TH1*)f->Get(histoname.c_str())->Clone(); + + // cout << "Adding " << filename << ", " << histoname << endl; + // cout << _h[_totH]->GetBinContent(1) << endl; + + if(!_dummyHist){ + _dummyHist = (TH1F*)_h[_totH]->Clone("h_dummy"); + for(int i_bin=1;i_bin<=_dummyHist->GetNbinsX();i_bin++){ + _dummyHist->SetBinContent(i_bin,0); + _dummyHist->SetBinError(i_bin,0); + } + } + + _h[_totH]->SetName(label.c_str()); + _h[_totH]->SetTitle(label.c_str()); + _h[_totH]->SetLineColor(color); + _h[_totH]->SetLineWidth(1); + // _h[_totH]->SetLineStyle(style); + + // _h[_totH]->SetMarkerSize(0); + _h[_totH]->SetMarkerSize(1.5); + _h[_totH]->SetMarkerStyle(style); + _h[_totH]->SetMarkerColor(color); + + // _h_syst_up[_totH] = (TH1*)_h[_totH]->Clone(Form("%s_syst_up",histoname.c_str())); + // _h_syst_down[_totH] = (TH1*)_h[_totH]->Clone(Form("%s_syst_down",histoname.c_str())); + + _h_syst[_totH] = new TGraphAsymmErrors(_h[_totH]->GetNbinsX()); + for(int i_bin=1;i_bin<=_h[_totH]->GetNbinsX();i_bin++){ + _h_syst[_totH]->SetPoint(i_bin-1,_h[_totH]->GetXaxis()->GetBinCenter(i_bin), _h[_totH]->GetBinContent(i_bin) ); + _h_syst[_totH]->SetPointEYhigh( i_bin-1, _h[_totH]->GetBinError(i_bin) ); + _h_syst[_totH]->SetPointEYlow( i_bin-1, _h[_totH]->GetBinError(i_bin) ); + _h_syst[_totH]->SetPointEXhigh( i_bin-1, _h[_totH]->GetXaxis()->GetBinWidth(i_bin)/2. ); + _h_syst[_totH]->SetPointEXlow( i_bin-1, _h[_totH]->GetXaxis()->GetBinWidth(i_bin)/2. ); + } + + _h_syst[_totH]->SetMarkerSize(0); + _h_syst[_totH]->SetLineColor(color); + _h_syst[_totH]->SetLineStyle(style); + + if(color2>=0) _h_syst[_totH]->SetFillColor(color2); + else _h_syst[_totH]->SetFillColor(color); + if(style2>=0) _h_syst[_totH]->SetFillStyle(style2);//3454); + else _h_syst[_totH]->SetFillStyle(3454); + // _h_syst[_totH]->SetLineWidth(2); + + _index[label] = _totH; + _totH ++; + }; + + void AddSyst(string filename,string histoname,string label){ + TFile *f = new TFile(filename.c_str()); + // cout << "Adding syst to " << filename << ", " << histoname << " -> " << _index[label] << endl; + AddSystToHist( (TH1*)f->Get(histoname.c_str()), _h_syst[_index[label]] ); + }; + + void SetLabel(string label){ + _label = label; + }; + + void Draw(){ + bool xaxisSet = false; + if(_dummyHist!=0) _dummyHist->Draw(); + for(int i=0;i<_totH;i++){ + // if(i==0 && _dummyHist==0) _h_syst[i]->Draw("E2 same"); + // else + _h_syst[i]->Draw("E2 same"); + // if(i==0 && _dummyHist==0) + // _h[i]->Draw("E same"); + // else + _h[i]->Draw("E same"); + // if(i>0 && !xaxisSet) _h[0]->GetXaxis()->SetTitle( _h[i]->GetXaxis()->GetTitle() ); + string s = _h[i]->GetXaxis()->GetTitle(); + if( s != "" ) xaxisSet = true; + } + + if(_noYlabels){ + _dummyHist->GetYaxis()->SetTitle(""); + _dummyHist->GetYaxis()->SetLabelSize(0); + } + else{ + if(_isReal==0) _dummyHist->GetYaxis()->SetTitle("#epsilon_{fake}"); + if(_isReal==1) _dummyHist->GetYaxis()->SetTitle("#epsilon_{real}"); + if(_isReal==2) _dummyHist->GetYaxis()->SetTitle("Efficiency"); + } + + // if(_isReal) _dummyHist->SetMaximum(1.65); + if(_isReal) _dummyHist->SetMaximum(1.3); + else _dummyHist->SetMaximum(1.00); + _dummyHist->SetMinimum(0); + + // fix empty bins and error bars... + for(int i=0;i<_totH;i++){ + for(int i_bin=1;i_bin<=_h[i]->GetNbinsX();i_bin++){ + // _h[i]->SetBinError(i_bin,0.0001); + if( _h[i]->GetBinContent(i_bin)<=0 ) _h_syst[i]->SetPointEYhigh(i_bin-1,0); + if( _h[i]->GetBinContent(i_bin)<=0 ) _h_syst[i]->SetPointEYlow(i_bin-1,0); + // if( _h[i]->GetTitle() ) + } + } + + gPad->RedrawAxis(); + }; + + void DrawLegend(float x0=0.2, float y0=0.7, float x1=0.9, float y1=0.9){ + TLegend *l; + if(_isReal==2) l = new TLegend(x0,y0,x1,y1); + if(_isReal==2) l->SetNColumns(3); + l->SetFillStyle(0); + l->SetBorderSize(0); + l->SetTextSize(0.06); + for(int i=0;i<_totH;i++){ + // l->AddEntry(_h_syst[i],_h[i]->GetTitle(),"lf"); + _h_forLegend[i] = (TH1F*)_h[i]->Clone(Form("histForLegend[%d]",i)); + _h_forLegend[i]->SetFillColor(_h_syst[i]->GetFillColor()); + _h_forLegend[i]->SetFillStyle(_h_syst[i]->GetFillStyle()); + l->AddEntry(_h_forLegend[i],_h[i]->GetTitle(),"lpf"); + } + l->Draw(); + } + + TH1* GetHist(int idx){ + return _h[idx]; + }; + + TH1F* GetDummyHist(){ + return _dummyHist; + }; + + bool _noYlabels; + +private: + TH1* _h[100]; + TH1* _h_forLegend[100]; + // TH1* _h_syst[100]; + TGraphAsymmErrors* _h_syst[100]; + // TH1* _h_syst_up[100]; + // TH1* _h_syst_down[100]; + int _totH; + string _label; + int _isReal; + TH1F* _dummyHist; + map<string,int> _index; +}; + +// -------------------------------------------------- + +class MMEffComparisonSet { +public: + MMEffComparisonSet(int w=600,int h=600){ + _c = new TCanvas("c","c",w,h); + _N = 0; + _idx = 0; + _ec[0] = new MMEffComparison(); + Cd(0); + }; + ~MMEffComparisonSet(){}; + + void Divide(int a=2, int b=1){ + _c->Divide(a,b, 0,0 ); + _N=a*b; + for(int i=0;i<_N;i++){ + _ec[i] = new MMEffComparison(); + if(i>0) _ec[i]->_noYlabels = true; + } + Cd(0); + }; + + void Cd(int i){ + _c->cd(i+1); + _idx = i; + }; + + void SaveAs(string name){ + _c->SaveAs(name.c_str()); + }; + + + // methods from MMEffComparison: + void SetIsReal(int isReal=0){ + _ec[_idx]->SetIsReal(isReal); + }; + + void SetXaxis(float min=0,float max=1,string title,int njetbins=0){ + _ec[_idx]->SetXaxis(min,max,title,njetbins); + }; + + void SetYaxis(float min=0,float max=1){ + _ec[_idx]->SetYaxis(min,max); + }; + + void Add(string filename,string histoname,string label,int color,int style,int color2=-1,int style2=-1){ + _ec[_idx]->Add(filename,histoname,label,color,style,color2,style2); + }; + + void AddSyst(string filename,string histoname,string label){ + _ec[_idx]->AddSyst(filename,histoname,label); + }; + + void SetLabel(string label){ + _ec[_idx]->SetLabel(label); + }; + + void Draw(){ + _ec[_idx]->Draw(); + }; + + void DrawLegend(float x0=0.2, float y0=0.7, float x1=0.9, float y1=0.9){ + _ec[_idx]->DrawLegend(x0,y0,x1,y1); + } + + TH1* GetHist(int idx){ + return _ec[_idx]->GetHist(idx); + }; + + TCanvas* GetCanvas(){ + return _c; + }; + + TH1F* GetDummyHist(){ + return _ec[_idx]->GetDummyHist(); + }; + +private: + TCanvas *_c; + + MMEffComparison *_ec[10]; + int _N; + int _idx; + +}; + +// -------------------------------------------------- + +void AddSystToHist(TH1* h, TGraphAsymmErrors* h_syst){ + float x; + int j; + float diff; + for(int i=0;i<h_syst->GetN();i++){ + x = h_syst->GetX()[i]; + j = h->GetXaxis()->FindBin(x); + diff = h->GetBinContent(j) - h_syst->GetY()[i]; + // syst cutoff ;) + //if(diff>0.2) diff = 0.2; + //if(diff<-0.2) diff = -0.2; + // +// if(x<h_syst->GetXaxis()->GetXmax() && j<=h_syst->GetN() && h_syst->GetY[j]>0 ){ + if(diff>0) h_syst->SetPointEYhigh( i, SqSum( h_syst->GetErrorYhigh(i), diff ) ); + if(diff<0) h_syst->SetPointEYlow( i, SqSum( h_syst->GetErrorYlow(i), diff ) ); +// } + } +}; + +float SqSum(float a,float b){ + return sqrt( pow(a,2) + pow(b,2) ); +}; + +// -------------------------------------------------- + + +void EffSummary(string ch="el",string var="all_1", + string jet="",string bjet="_ge1b",int isReal=2) +{ + // ch : "el" for electrons, "mu" for muons + // var: "all_1" for eta,pt,dR + // "all_2" for ptjet,njet,nbtag and dphi + // jet: jet bin + // bjet: b-jet bin + // isReal = 2 means both fake and real + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + + MMEffComparisonSet *c = new MMEffComparisonSet(1800,600*1800/1400); + + if(ch=="el"){ + string trig[] = {""}; // no trigger splitting + } + else{ + string trig[] = {"mu20i","mu50","mu20"} + } + + // define the variables + if(ch=="el"){ + if(var=="all_1"){ + // e channel + int Nvar = 3; + string vari[] = {"eta", "pt", "dR"}; + string label[] = {"|#eta(elec)| ","p_{T}(elec) [GeV] ","#DeltaR(elec,jet) "}; + float xmin[] = {0, 21, 0.}; + float xmax[] = {2.6, 149, 5.9}; + } + if(var=="all_2"){ + int Nvar = 4; + string vari[] = {"jetpt", "njet", "nbtag", "dPhi"}; + string label[] = {"p_{T}(leading jet) [GeV] ", "n_{jet} ", "n_{b-jet} ", "#Delta#phi(e,E_{T}^{miss}) " }; + float xmin[] = {0, 0.9, -0.1, -0.1}; + float xmax[] = {530, 6.1, 3.1, 3.3}; + } + } + + if(ch=="mu"){ + // mu channel + if(var=="all_1"){ + int Nvar = 3; + string vari[] = {"eta", "pt", "dR"}; + string label[] = {"|#eta(#mu)| ","p_{T}(#mu) [GeV] ","#DeltaR(#mu,jet) "}; + float xmin[] = {0, 21, 0.}; + float xmax[] = {2.6, 149, 5.9}; + } + if(var=="all_2"){ + int Nvar = 4; + string vari[] = {"jetpt", "njet", "nbtag", "dPhi"}; + string label[] = {"p_{T}(leading jet) [GeV] ", "n_{jet} ", "n_{b-jet} ", "#Delta#phi(#mu,E_{T}^{miss}) " }; + float xmin[] = {0, 0.9, -0.1, -0.1}; + float xmax[] = {530, 6.1, 3.1, 3.3}; + } + } + + + // ---- + + c->Divide(Nvar); + // c->GetCanvas()->GetPad(1)->SetRightMargin(0.3); + // c->GetCanvas()->GetPad(2)->SetRightMargin(0.5); + if(Nvar==4){ + c->GetCanvas()->GetPad(1)->SetPad(0, 0, 0.367672, 0.942544); + c->GetCanvas()->GetPad(2)->SetPad(0.367672,0, 0.57,0.942544); // w = 0.57 - 0.367672; origw = 0.983166 - 0.675419 + c->GetCanvas()->GetPad(3)->SetPad(0.57,0, 0.675419,0.942544); // w = 0.675419 - 0.57; origw = 0.983166 - 0.675419 + c->GetCanvas()->GetPad(4)->SetPad(0.675419, 0, 0.983166, 0.942544); + // 0.367672, 0, 0.675419, 0.942544 + } + else{ + cout << c->GetCanvas()->GetPad(1)->GetXlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(1)->GetYlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(1)->GetXlowNDC()+c->GetCanvas()->GetPad(1)->GetAbsWNDC() << ", "; + cout << c->GetCanvas()->GetPad(1)->GetYlowNDC()+c->GetCanvas()->GetPad(1)->GetAbsHNDC(); + cout << endl; + + cout << c->GetCanvas()->GetPad(2)->GetXlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(2)->GetYlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(2)->GetXlowNDC()+c->GetCanvas()->GetPad(2)->GetAbsWNDC() << ", "; + cout << c->GetCanvas()->GetPad(2)->GetYlowNDC()+c->GetCanvas()->GetPad(2)->GetAbsHNDC(); + cout << endl; + + cout << c->GetCanvas()->GetPad(3)->GetXlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(3)->GetYlowNDC() << ", "; + cout << c->GetCanvas()->GetPad(3)->GetXlowNDC()+c->GetCanvas()->GetPad(3)->GetAbsWNDC() << ", "; + cout << c->GetCanvas()->GetPad(3)->GetYlowNDC()+c->GetCanvas()->GetPad(3)->GetAbsHNDC(); + cout << endl; + } + + for(int i=0;i<Nvar;i++){ + c->Cd(i); + c->SetYaxis(0.,1.5); + c->SetXaxis(xmin[i],xmax[i],label[i]); + if(vari[i]=="nbtag") c->SetXaxis(xmin[i],xmax[i],label[i],5); + if(vari[i]=="njet") c->SetXaxis(xmin[i],xmax[i],label[i],7); + + c->SetIsReal(isReal); + + // ================================================== + // case for electrons + if(ch=="el") { + //std::cout << " add real efficiencies " << std::endl; + // real efficiencies + c->Add("../data/R_"+ch+"_Default.root","eff_"+vari[i]+jet,"#varepsilon_{r} ",kBlack,kOpenTriangleUp,kBlack,3445); + // add systematics (CRreal) + //std::cout << " add CRreal " << std::endl; + c->AddSyst("../data/R_"+ch+"_Default_CRreal.root","eff_"+vari[i]+bjet+jet,"#varepsilon_{r} "); + + //std::cout << " add fake efficiencies " << std::endl; + // fake efficiencies + c->Add("../data/F_"+ch+"_Default.root","eff_"+vari[i]+bjet+jet,"#varepsilon_{f} ",kBlack,kFullTriangleUp,kBlack,3445); + // add systematics MCup + //std::cout << " add MCup " << std::endl; + c->AddSyst("../data/F_"+ch+"_Default_MCup.root","eff_"+vari[i]+bjet+jet,"#varepsilon_{f} "); + // add systematics MCdown + //std::cout << " add MCdown " << std::endl; + c->AddSyst("../data/F_"+ch+"_Default_MCdown.root","eff_"+vari[i]+bjet+jet,"#varepsilon_{f} "); + //std::cout << " add CRfake " << std::endl; + // add systematics CRfake + c->AddSyst("../data/F_"+ch+"_Default_CRfake.root","eff_"+vari[i]+bjet+jet,"#varepsilon_{f} "); + } + // ================================================== + // case for muons + if(ch=="mu") { + //std::cout << " add real efficiencies T&P" << std::endl; + // real efficiencies + c->Add("../data/R_"+ch+"_Default.root","eff_"+vari[i]+jet+"_"+trig[0],"#varepsilon_{r} "+trig[0],kRed,kOpenSquare,kRed-10,1001); + c->Add("../data/R_"+ch+"_Default.root","eff_"+vari[i]+jet+"_"+trig[1],"#varepsilon_{r} "+trig[1],kBlack,kOpenTriangleUp,kBlack,3445); + c->Add("../data/R_"+ch+"_Default.root","eff_"+vari[i]+jet+"_"+trig[2],"#varepsilon_{r} "+trig[2],kBlue,kOpenCircle,kBlue-7);//kAzure); + // add systematics (CRreal) + //std::cout << " add real efficiencies high MTW" << std::endl; + //std::cout << " file = " << "../data/R_"+ch+"_Default_CRreal.root" << std::endl; + c->AddSyst("../data/R_"+ch+"_Default_CRreal.root","eff_"+vari[i]+bjet+jet+"_"+trig[0],"#varepsilon_{r} "+trig[0]); + c->AddSyst("../data/R_"+ch+"_Default_CRreal.root","eff_"+vari[i]+bjet+jet+"_"+trig[1],"#varepsilon_{r} "+trig[1]); + c->AddSyst("../data/R_"+ch+"_Default_CRreal.root","eff_"+vari[i]+bjet+jet+"_"+trig[2],"#varepsilon_{r} "+trig[2]); + + //std::cout << " add fake efficiencies " << std::endl; + // fake efficiencies + c->Add("../data/F_"+ch+"_Default.root","eff_"+vari[i]+bjet+jet+"_"+trig[0],"#varepsilon_{f} "+trig[0],kRed,kFullSquare,kRed-10,1001); + c->Add("../data/F_"+ch+"_Default.root","eff_"+vari[i]+bjet+jet+"_"+trig[1],"#varepsilon_{f} "+trig[1],kBlack,kFullTriangleUp,kBlack,3445); + c->Add("../data/F_"+ch+"_Default.root","eff_"+vari[i]+bjet+jet+"_"+trig[2],"#varepsilon_{f} "+trig[2],kBlue,kFullCircle,kBlue-7); + + // add systematics MCup + c->AddSyst("../data/F_"+ch+"_Default_MCup.root","eff_"+vari[i]+bjet+jet+"_"+trig[0],"#varepsilon_{f} "+trig[0]); + c->AddSyst("../data/F_"+ch+"_Default_MCup.root","eff_"+vari[i]+bjet+jet+"_"+trig[1],"#varepsilon_{f} "+trig[1]); + c->AddSyst("../data/F_"+ch+"_Default_MCup.root","eff_"+vari[i]+bjet+jet+"_"+trig[2],"#varepsilon_{f} "+trig[2]); + + // add systematics MCdown + c->AddSyst("../data/F_"+ch+"_Default_MCdown.root","eff_"+vari[i]+bjet+jet+"_"+trig[0],"#varepsilon_{f} "+trig[0]); + c->AddSyst("../data/F_"+ch+"_Default_MCdown.root","eff_"+vari[i]+bjet+jet+"_"+trig[1],"#varepsilon_{f} "+trig[1]); + c->AddSyst("../data/F_"+ch+"_Default_MCdown.root","eff_"+vari[i]+bjet+jet+"_"+trig[2],"#varepsilon_{f} "+trig[2]); + + // add systematics CRfake + c->AddSyst("../data/F_"+ch+"_Default_CRfake.root","eff_"+vari[i]+bjet+jet+"_"+trig[0],"#varepsilon_{f} "+trig[0]); + c->AddSyst("../data/F_"+ch+"_Default_CRfake.root","eff_"+vari[i]+bjet+jet+"_"+trig[1],"#varepsilon_{f} "+trig[1]); + c->AddSyst("../data/F_"+ch+"_Default_CRfake.root","eff_"+vari[i]+bjet+jet+"_"+trig[2],"#varepsilon_{f} "+trig[2]); + } + c->Draw(); + + if(i==Nvar-1){ + if(ch=="el") c->DrawLegend(0.05,0.8, 0.95,0.95); + if(ch=="mu") c->DrawLegend(0.05,0.8, 0.95,0.95); + } + } + + // ------ + + if(Nvar==4){ + c->Cd(0); + c->GetDummyHist()->GetXaxis()->SetNdivisions(506); + // w = 0.57 - 0.367672; origw = 0.942544 - 0.367672 + c->Cd(1); + c->GetDummyHist()->GetXaxis()->SetLabelSize( ((0.983166 - 0.675419)/(0.57 - 0.367672)) * c->GetDummyHist()->GetXaxis()->GetLabelSize() ); + c->GetDummyHist()->GetXaxis()->SetTitleSize( ((0.983166 - 0.675419)/(0.57 - 0.367672)) * c->GetDummyHist()->GetXaxis()->GetTitleSize() ); + c->GetDummyHist()->GetXaxis()->SetLabelOffset(-0.015); + c->GetDummyHist()->GetXaxis()->SetTitleOffset(0.9); + // + c->Cd(2); + c->GetDummyHist()->GetXaxis()->SetLabelSize( ((0.983166 - 0.675419)/(0.675419 - 0.57)) * c->GetDummyHist()->GetXaxis()->GetLabelSize() ); + c->GetDummyHist()->GetXaxis()->SetTitleSize( ((0.983166 - 0.675419)/(0.675419 - 0.57)) * c->GetDummyHist()->GetXaxis()->GetTitleSize() ); + c->GetDummyHist()->GetXaxis()->SetLabelOffset(-0.065); + c->GetDummyHist()->GetXaxis()->SetTitleOffset(0.46); + } + + + // increase x-axis size + c->Cd(0); + c->GetDummyHist()->GetXaxis()->SetLabelSize( 0.85 * c->GetDummyHist()->GetXaxis()->GetLabelSize() ); + c->GetDummyHist()->GetXaxis()->SetTitleSize( 0.85 * c->GetDummyHist()->GetXaxis()->GetTitleSize() ); + c->GetDummyHist()->GetXaxis()->SetLabelOffset(0.012); + c->GetDummyHist()->GetXaxis()->SetTitleOffset(1.6); + for(int i=0;i<Nvar;i++){ + c->Cd(i); + c->GetDummyHist()->GetXaxis()->SetLabelSize( 1.2 * c->GetDummyHist()->GetXaxis()->GetLabelSize() ); + c->GetDummyHist()->GetXaxis()->SetTitleSize( 1.2 * c->GetDummyHist()->GetXaxis()->GetTitleSize() ); + } + + + c->Cd(0); + if(ch=="el"){ + ATLASLabel(0.25,0.93,"Work in progress"); + myText(0.25,0.87,1,"#sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + } + if(ch=="mu"){ + ATLASLabel(0.25,0.93,"Work in progress"); + myText(0.25,0.87,1,"#sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + } + + // adapt to your case + // for electrons + if (ch=="el") { + if (jet=="_1j") { + if (bjet=="_0b") + myText(0.65,0.87,1,"e+1 jet, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"e+1 jet, #geq1 b-jet",0.045); + } + if (jet=="") { + if (bjet=="_0b") + myText(0.65,0.87,1,"e+#geq 1 jet, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"e+#geq 1 jet, #geq1 b-jet",0.045); + } + if (jet=="_ge2j") { + if (bjet=="_0b") + myText(0.65,0.87,1,"e+#geq 2 jets, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"e+#geq 2 jets, #geq1 b-jet",0.045); + } + } + // for muons + if (ch=="mu") { + if (jet=="_1j") { + if (bjet=="_0b") + myText(0.65,0.87,1,"#mu+1 jet, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"#mu+1 jet, #geq1 b-jet",0.045); + } + if (jet=="") { + if (bjet=="_0b") + myText(0.65,0.87,1,"#mu+#geq 1 jet, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"#mu+#geq 1 jet, #geq1 b-jet",0.045); + } + if (jet=="_ge2j") { + if (bjet=="_0b") + myText(0.65,0.87,1,"#mu+#geq 2 jets, 0 b-jet",0.045); + if (bjet=="_ge1b") + myText(0.65,0.87,1,"#mu+#geq 2 jets, #geq1 b-jet",0.045); + } + } + + string name; + if(isReal==0) name = "FakeEffComp_"+ch+"_"+var+bjet+jet; + if(isReal==1) name = "RealEffComp_"+ch+"_"+var+bjet+jet; + if(isReal==2) name = "EffComp_"+ch+"_"+var+bjet+jet; + c->SaveAs(("fig/"+name+".png").c_str()); + c->SaveAs(("fig/"+name+".eps").c_str()); + c->SaveAs(("fig/"+name+".pdf").c_str()); + + TFile *fNew = new TFile("Test.root","RECREATE"); + gPad->Write("",TObject::kOverwrite); + +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffElec.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffElec.C new file mode 100644 index 0000000000000000000000000000000000000000..522561dcea07b335ef7dbfe3060a204451a3d39d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffElec.C @@ -0,0 +1,501 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot fake efficiencies vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void FakeEffElec() +{ + // choice the option you want - in which control region + //int choice = 0; // CR1 + //int choice = 1; // CR1 vs CR2 0 b-tag + //int choice = 2; // CR1 vs CR2 b-tag + //int choice = 3; // CR1 MCup/down 0 b-tag + //int choice = 4; // CR1 MCup/down b-tag + //int choice = 5; // CR1 MC WZ 0 b-tag + //int choice = 6; // CR1 MC WZ b-tag + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice==0;choice<=6;choice++) + for (int var==0;var<=8;var++) + my.execute(var,choice); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var, int choice) + { + TGraph* plot0; + TH1F* plot[10][10]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f[10]; + + // read input files + // CR1 + myname = "..//data/F_el_Default.root"; + f[0] = TFile::Open(myname,"old"); + // CR2 + myname = "../data/F_el_Default_CRfake.root"; + f[1] = TFile::Open(myname,"old"); + // CR1 MCup + myname = "../data/F_el_Default_MCup.root"; + f[2] = TFile::Open(myname,"old"); + // CR1 MCdown + myname = "../data/F_el_Default_MCdown.root"; + f[3] = TFile::Open(myname,"old"); + // CR1 Powheg + myname = "../data/F_el_Default_WZPowheg.root"; + f[4] = TFile::Open(myname,"old"); + // CR1 MadGraph + myname = "../data/F_el_Default_WZMG.root"; + f[5] = TFile::Open(myname,"old"); + + // loop on each files + for (int ifile=0;ifile<=5;ifile++) { + // loop on jet bins + for (int ijet=0;ijet<=3;ijet++) { + // check which variable to be used + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mtw"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (var!=7) { + if (ijet==0) mynamehist += "_0b_1j"; + if (ijet==1) mynamehist += "_0b_ge2j"; + if (ijet==2) mynamehist += "_ge1b_1j"; + if (ijet==3) mynamehist += "_ge1b_ge2j"; + } else { + if (ijet==0) mynamehist += "_0b"; + if (ijet==1) mynamehist += "_0b_ge2j"; + if (ijet==2) mynamehist += "_ge1b"; + if (ijet==3) mynamehist += "_ge1b_ge2j"; + } + + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ifile][ijet] = (TH1F*)f[ifile]->Get(mynamehist); + //std::cout << " plot = " << plot[ifile][ijet] << std::endl; + } + } + + // =============================================== + // set the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.; + m_eff[1] = 0.8; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,TGraph* plot0,TH1F* plot[10][10]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // plot the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("E_{T}(elec) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(elec)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (elec, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (elec,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(elec,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // plot the TGraph + if (choice==0) { // CR1 + myplot(plot[0][0],1,20); + if (var!=7) myplot(plot[0][1],2,21); // case for njet + myplot(plot[0][2],3,24); + if (var!=7) myplot(plot[0][3],4,25); // case for njet + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[0][0],1,20); + myplot(plot[0][1],3,24); + myplot(plot[0][2],1,20); + myplot(plot[0][3],3,24); + } + } + if (choice==1) { // CR1 vs CR2 0 btag + myplot(plot[0][0],1,20); // 1j 0b + myplot(plot[1][0],1,24); + myplot(plot[0][1],2,21); // ge2j 0b + myplot(plot[1][1],2,25); + } + if (choice==2) { //CR1 vs CR2 btag + myplot(plot[0][2],1,20); // 1j ge1b + myplot(plot[1][2],1,24); + myplot(plot[0][3],2,21); // ge2j ge1b + myplot(plot[1][3],2,25); + } + if (choice==3) { // CR1 MCup/down 0 btag + myplot(plot[0][0],1,20); // 1j 0b + myplot(plot[2][0],1,21); + myplot(plot[3][0],1,22); + + myplot(plot[0][1],2,24); // ge2j 0b + myplot(plot[2][1],2,25); + myplot(plot[3][1],2,26); + } + if (choice==4) { // CR1 MCup/down btag + myplot(plot[0][2],1,20); // 1j b + myplot(plot[2][2],1,21); + myplot(plot[3][2],1,22); + + myplot(plot[0][3],2,24); // ge2j b + myplot(plot[2][3],2,25); + myplot(plot[3][3],2,26); + } + if (choice==5) { // CR1 MC WZ 0 btag + myplot(plot[0][0],1,20); // 1j 0b + myplot(plot[4][0],1,21); + myplot(plot[5][0],1,22); + + myplot(plot[0][1],2,24); // ge2j 0b + myplot(plot[4][1],2,25); + myplot(plot[5][1],2,26); + } + if (choice==6) { // CR1 MC WZ btag + myplot(plot[0][2],1,20); // 1j b + myplot(plot[4][2],1,21); + myplot(plot[5][2],1,22); + + myplot(plot[0][3],2,24); // ge2j b + myplot(plot[4][3],2,25); + myplot(plot[5][3],2,26); + } + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,plot); + c1->RedrawAxis(); + + // plot the output names + TString suffix = ""; + if (var==0) suffix = "_vsEt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + + if (choice==0) // CR1 + c1->SaveAs("fig/efffake_elec"+suffix+format); + if (choice==1) // CR1 vs CR2 0 btag + c1->SaveAs("fig/efffake_elec_CR12_0btag"+suffix+format); + if (choice==2) // CR1 vs CR2 ge1 btag + c1->SaveAs("fig/efffake_elec_CR12_btag"+suffix+format); + if (choice==3) // CR1 MCup/down 0 btag + c1->SaveAs("fig/efffake_elec_CR1_MCUpDown_0btag"+suffix+format); + if (choice==4) // CR1 MCup/down ge1 btag + c1->SaveAs("fig/efffake_elec_CR1_MCUpDown_btag"+suffix+format); + if (choice==5) // CR1 MC WZ 0 btag + c1->SaveAs("fig/efffake_elec_CR1_MCWZ_0btag"+suffix+format); + if (choice==6) // CR1 MC WZ ge1 btag + c1->SaveAs("fig/efffake_elec_CR1_MCWZ_btag"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,TH1F* plot[10][10]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.1,ylabel-0.06,1,"e+jets, #sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + // ============================================================ + // set the TLegend (adapt to your own team) + if (choice==0) { + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var!=7 && var!=8) { + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[0][1],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg->AddEntry(plot[0][2],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[0][3],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + } else if (var==7) { // case for njet + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1} 0 btag","ep"); + leg->AddEntry(plot[0][2],"#epsilon_{f} CR_{1} #geq1 btag","ep"); + } else if (var==8) { // case for nbjet + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1}, 1 jet","ep"); + leg->AddEntry(plot[0][1],"#epsilon_{f} CR_{1}, #geq2 jets","ep"); + } + leg->Draw(); + } + + // ============================= + if (choice==1) { // for comparison CR1 CR2 + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[1][0],"#epsilon_{f} CR_{2}, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.5,ymin2,0.6,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.04); + leg2->AddEntry(plot[0][1],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[1][1],"#epsilon_{f} CR_{2}, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==2) { // for comparison CR1 CR2 + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + leg->AddEntry(plot[0][2],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[1][2],"#epsilon_{f} CR_{2}, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.5,ymin2,0.6,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.04); + leg2->AddEntry(plot[0][3],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[1][3],"#epsilon_{f} CR_{2}, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + // ============================= + if (choice==3) { // for comparison CR1 MCup/down 0 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.035); + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[2][0],"#epsilon_{f} CR_{1} MCup, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[3][0],"#epsilon_{f} CR_{1} MCdown, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.035); + leg2->AddEntry(plot[0][1],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[2][1],"#epsilon_{f} CR_{1} MCup, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[3][1],"#epsilon_{f} CR_{1} down, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==4) { // for comparison CR1 MCup/down >=1 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.035); + leg->AddEntry(plot[0][2],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[2][2],"#epsilon_{f} CR_{1} MCup, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[3][2],"#epsilon_{f} CR_{1} MCdown, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.035); + leg2->AddEntry(plot[0][3],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[2][3],"#epsilon_{f} CR_{1} MCup, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[3][3],"#epsilon_{f} CR_{1} down, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + // ============================= + if (choice==5) { // for comparison CR1 MC WZ 0 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.03); + leg->AddEntry(plot[0][0],"#epsilon_{f} CR_{1} Sherpa, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[4][0],"#epsilon_{f} CR_{1} Powheg, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[5][0],"#epsilon_{f} CR_{1} MadGraph, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.03); + leg2->AddEntry(plot[0][1],"#epsilon_{f} CR_{1} Sherpa, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[4][1],"#epsilon_{f} CR_{1} Powheg, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[5][1],"#epsilon_{f} CR_{1} MadGraph, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==6) { // for comparison CR1 MC WZ >=1 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.03); + leg->AddEntry(plot[0][2],"#epsilon_{f} CR_{1} Sherpa, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[4][2],"#epsilon_{f} CR_{1} Powheg, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[5][2],"#epsilon_{f} CR_{1} MadGraph, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.03); + leg2->AddEntry(plot[0][3],"#epsilon_{f} CR_{1} Sherpa, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[4][3],"#epsilon_{f} CR_{1} Powheg, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[5][3],"#epsilon_{f} CR_{1} MadGraph, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffMuon.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffMuon.C new file mode 100644 index 0000000000000000000000000000000000000000..eb279ab2ad206873a78212f9def641050e429bb0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/FakeEffMuon.C @@ -0,0 +1,564 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot fake efficiencies vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void FakeEffMuon() +{ + // use these options to choose the control region + //int choice = 0; // CR1 + //int choice = 1; // CR1 vs CR2 0 b-tag + //int choice = 2; // CR1 vs CR2 b-tag + //int choice = 3; // CR1 MCup/down 0 b-tag + //int choice = 4; // CR1 MCup/down b-tag + //int choice = 5; // CR1 MC WZ 0 b-tag + //int choice = 6; // CR1 MC WZ b-tag + + // choose the trigger + //int trigger = 0; // mu20i + //int trigger = 1; // mu20 + //int trigger = 2; // mu50 + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice=0;choice<=1;choice++) + for (int trigger=0;trigger<=2;trigger++) + for (int var=0;var<=8;var++) + my.execute(var,choice,trigger); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var, int choice, int trigger) + { + TGraph* plot0; + TH1F* plot[10][20]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f[10]; + + // read the input files + // CR1 + myname = "../data/F_mu_Default.root"; + f[0] = TFile::Open(myname,"old"); + // CR2 + myname = "../data/F_mu_Default_CRfake.root"; + f[1] = TFile::Open(myname,"old"); + // CR1 MCup + myname = "../data/F_mu_Default_MCup.root"; + f[2] = TFile::Open(myname,"old"); + // CR1 MCdown + myname = "../data/F_mu_Default_MCdown.root"; + f[3] = TFile::Open(myname,"old"); + // CR1 Powheg + myname = "../data/F_mu_Default_WZPowheg.root"; + f[4] = TFile::Open(myname,"old"); + // CR1 MadGraph + myname = "../data/F_mu_Default_WZMG.root"; + f[5] = TFile::Open(myname,"old"); + + // loop on each files + for (int ifile=0;ifile<=5;ifile++) { + // loop on all jet possibilities + for (int ijet=0;ijet<=11;ijet++) { + // check which variable to use + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mtw"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (var<7) { + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } else if (var==7) { // njet + // mu20i + if (ijet==0) mynamehist += "_0b_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } else if (var==8) { // nbjet + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } + + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ifile][ijet] = (TH1F*)f[ifile]->Get(mynamehist); + //std::cout << " plot = " << plot[ifile][ijet] << std::endl; + } + } + + // =============================================== + // set the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.; + m_eff[1] = 1.4; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,trigger,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,int trigger, + TGraph* plot0,TH1F* plot[10][20]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // plot the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("p_{T}(#mu) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(#mu)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (#mu, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (#mu,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(#mu,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // choose the trigger + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + if (choice==0) { // CR1 + myplot(plot[0][it1],1,20); + if (var!=7) myplot(plot[0][it2],2,21); // case for njet + myplot(plot[0][it3],3,24); + if (var!=7) myplot(plot[0][it4],4,25); // case for njet + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[0][it1],1,20); + myplot(plot[0][it2],3,24); + myplot(plot[0][it3],1,20); + myplot(plot[0][it4],3,24); + } + } + if (choice==1) { // CR1 vs CR2 0 btag + myplot(plot[0][it1],1,20); // 1j 0b + myplot(plot[1][it1],1,24); + myplot(plot[0][it2],2,21); // ge2j 0b + myplot(plot[1][it2],2,25); + } + if (choice==2) { //CR1 vs CR2 btag + myplot(plot[0][it3],1,20); // 1j ge1b + myplot(plot[1][it3],1,24); + myplot(plot[0][it4],2,21); // ge2j ge1b + myplot(plot[1][it4],2,25); + } + if (choice==3) { // CR1 MCup/down 0 btag + myplot(plot[0][it1],1,20); // 1j 0b + myplot(plot[2][it1],1,21); + myplot(plot[3][it1],1,22); + + myplot(plot[0][it2],2,24); // ge2j 0b + myplot(plot[2][it2],2,25); + myplot(plot[3][it2],2,26); + } + if (choice==4) { // CR1 MCup/down btag + myplot(plot[0][it3],1,20); // 1j b + myplot(plot[2][it3],1,21); + myplot(plot[3][it3],1,22); + + myplot(plot[0][it4],2,24); // ge2j b + myplot(plot[2][it4],2,25); + myplot(plot[3][it4],2,26); + } + if (choice==5) { // CR1 MC WZ 0 btag + myplot(plot[0][it1],1,20); // 1j 0b + myplot(plot[4][it1],1,21); + myplot(plot[5][it1],1,22); + + myplot(plot[0][it2],2,24); // ge2j 0b + myplot(plot[4][it2],2,25); + myplot(plot[5][it2],2,26); + } + if (choice==6) { // CR1 MC WZ btag + myplot(plot[0][it3],1,20); // 1j b + myplot(plot[4][it3],1,21); + myplot(plot[5][it3],1,22); + + myplot(plot[0][it4],2,24); // ge2j b + myplot(plot[4][it4],2,25); + myplot(plot[5][it4],2,26); + } + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,trigger,plot); + c1->RedrawAxis(); + + // set the output names + TString suffix = ""; + if (var==0) suffix = "_vsPt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString st = ""; + if (trigger==0) st = "_mu20i"; + if (trigger==1) st = "_mu20"; + if (trigger==2) st = "_mu50"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + + if (choice==0) // CR1 + c1->SaveAs("fig/efffake_muon"+st+suffix+format); + if (choice==1) // CR1 vs CR2 0 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR12_0btag"+suffix+format); + if (choice==2) // CR1 vs CR2 ge1 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR12_btag"+suffix+format); + if (choice==3) // CR1 MCup/down 0 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR1_MCUpDown_0btag"+suffix+format); + if (choice==4) // CR1 MCup/down ge1 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR1_MCUpDown_btag"+suffix+format); + if (choice==5) // CR1 MC WZ 0 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR1_MCWZ_0btag"+suffix+format); + if (choice==6) // CR1 MC WZ ge1 btag + c1->SaveAs("fig/efffake_muon"+st+"_CR1_MCWZ_btag"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,int trigger,TH1F* plot[10][20]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.2,ylabel-0.06,1,"#sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + if (trigger==0) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20i",0.04); + if (trigger==1) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20",0.04); + if (trigger==2) myText(xlabel,ylabel-0.06,1,"#mu+jets mu50",0.04); + + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + // ============================================================ + // set the TLegend (adapt to your own team) + if (choice==0) { + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var!=7 && var!=8) { + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[0][it2],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg->AddEntry(plot[0][it3],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[0][it4],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + } else if (var==7) { // case for njet + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1} 0 btag","ep"); + leg->AddEntry(plot[0][it3],"#epsilon_{f} CR_{1} #geq1 btag","ep"); + } else if (var==8) { // case for nbjet + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1}, 1 jet","ep"); + leg->AddEntry(plot[0][it2],"#epsilon_{f} CR_{1}, #geq2 jets","ep"); + } + leg->Draw(); + } + + // ============================= + if (choice==1) { // for comparison CR1 CR2 + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[1][it1],"#epsilon_{f} CR_{2}, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.5,ymin2,0.6,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.04); + leg2->AddEntry(plot[0][it2],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[1][it2],"#epsilon_{f} CR_{2}, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==2) { // for comparison CR1 CR2 + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + leg->AddEntry(plot[0][it3],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[1][it3],"#epsilon_{f} CR_{2}, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.5,ymin2,0.6,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.04); + leg2->AddEntry(plot[0][it4],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[1][it4],"#epsilon_{f} CR_{2}, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + // ============================= + if (choice==3) { // for comparison CR1 MCup/down 0 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.035); + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[2][it1],"#epsilon_{f} CR_{1} MCup, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[3][it1],"#epsilon_{f} CR_{1} MCdown, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.035); + leg2->AddEntry(plot[0][it2],"#epsilon_{f} CR_{1}, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[2][it2],"#epsilon_{f} CR_{1} MCup, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[3][it2],"#epsilon_{f} CR_{1} down, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==4) { // for comparison CR1 MCup/down >=1 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.035); + leg->AddEntry(plot[0][it3],"#epsilon_{f} CR_{1}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[2][it3],"#epsilon_{f} CR_{1} MCup, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[3][it3],"#epsilon_{f} CR_{1} MCdown, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.035); + leg2->AddEntry(plot[0][it4],"#epsilon_{f} CR_{1}, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[2][it4],"#epsilon_{f} CR_{1} MCup, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[3][it4],"#epsilon_{f} CR_{1} down, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + // ============================= + if (choice==5) { // for comparison CR1 MC WZ 0 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.03); + leg->AddEntry(plot[0][it1],"#epsilon_{f} CR_{1} Sherpa, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[4][it1],"#epsilon_{f} CR_{1} Powheg, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[5][it1],"#epsilon_{f} CR_{1} MadGraph, 1 jet, 0 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.03); + leg2->AddEntry(plot[0][it2],"#epsilon_{f} CR_{1} Sherpa, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[4][it2],"#epsilon_{f} CR_{1} Powheg, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[5][it2],"#epsilon_{f} CR_{1} MadGraph, #geq2 jets, 0 btag","ep"); + leg2->Draw(); + } + + // ============================= + if (choice==6) { // for comparison CR1 MC WZ >=1 btag + float ymin = 0.65; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.03); + leg->AddEntry(plot[0][it3],"#epsilon_{f} CR_{1} Sherpa, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[4][it3],"#epsilon_{f} CR_{1} Powheg, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[5][it3],"#epsilon_{f} CR_{1} MadGraph, 1 jet, #geq1 btag","ep"); + leg->Draw(); + + float ymin2 = 0.65; + float ymax2 = 0.8; + leg2 = new TLegend(0.58,ymin2,0.68,ymax2); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.03); + leg2->AddEntry(plot[0][it4],"#epsilon_{f} CR_{1} Sherpa, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[4][it4],"#epsilon_{f} CR_{1} Powheg, #geq2 jets, #geq1 btag","ep"); + leg2->AddEntry(plot[5][it4],"#epsilon_{f} CR_{1} MadGraph, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecHighEtmiss.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecHighEtmiss.C new file mode 100644 index 0000000000000000000000000000000000000000..068c1710385063917d254986f8f572b404711e3f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecHighEtmiss.C @@ -0,0 +1,281 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained from high-MET/MTW +// method vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void RealEffElecHighEtmiss() +{ + // use this option to see results with different njet bins + //int choice = 0; + // use this option to see results with njet>=1 only + //int choice = 1; + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice=0;choice<=1;choice++) + for (int var=0;var<=8;var++) + my.execute(var,choice); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var, int choice) + { + TGraph* plot0; + TH1F* plot[10]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f; + + // loop on input files + myname = "../data/R_el_Default_CRreal.root"; + std::cout << " myname = " << myname << std::endl; + f = TFile::Open(myname,"old"); + + // loop on jet bins + for (int ijet=0;ijet<=3;ijet++) { + // check which variable is read + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mtw"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (choice==0) { // with details on njet + if (var!=7) { // for all variables except njet + if (ijet==0) mynamehist += "_0b_1j"; + if (ijet==1) mynamehist += "_0b_ge2j"; + if (ijet==2) mynamehist += "_ge1b_1j"; + if (ijet==3) mynamehist += "_ge1b_ge2j"; + } else { // for njet + if (ijet==0) mynamehist += "_0b"; + if (ijet==1) mynamehist += "_0b_ge2j"; + if (ijet==2) mynamehist += "_ge1b"; + if (ijet==3) mynamehist += "_ge1b_ge2j"; + } + } else { // with ony njet>=1 + if (var!=7) { // for all variables except njet + if (ijet==0) mynamehist += ""; + if (ijet==1) mynamehist += ""; + if (ijet==2) mynamehist += ""; + if (ijet==3) mynamehist += ""; + } else { // for njet + if (ijet==0) mynamehist += ""; + if (ijet==1) mynamehist += ""; + if (ijet==2) mynamehist += ""; + if (ijet==3) mynamehist += ""; + } + } + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ijet] = (TH1F*)f->Get(mynamehist); + //std::cout << " plot = " << plot[ijet] << std::endl; + } + + // =============================================== + // define TAxis ranges + m_nlines = 2; + m_eff[0] = 0.75; + m_eff[1] = 1.1; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,TGraph* plot0,TH1F* plot[10]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // plot the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("E_{T}(elec) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(elec)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (elec, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (elec,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(elec,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // plot the TGraph + if (choice==0) { // with details on njet + myplot(plot[0],1,20); + if (var!=7) myplot(plot[1],2,21); // case for njet + myplot(plot[2],3,24); + if (var!=7) myplot(plot[3],4,25); // case for njet + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[0],1,20); + myplot(plot[1],3,24); + myplot(plot[2],1,20); + myplot(plot[3],3,24); + } + } else { // only njet>=1 + myplot(plot[0],1,20); + } + + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,plot); + c1->RedrawAxis(); + + // define the output name + TString suffix = ""; + if (var==0) suffix = "_vsEt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + if (choice==0) + c1->SaveAs("fig/effrealHighMET_elec"+suffix+format); + else + c1->SaveAs("fig/effrealHighMET_elec_ge1j"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,TH1F* plot[10]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.1,ylabel-0.06,1,"e+jets, #sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (choice==0) { // case with details on njet + if (var!=7 && var!=8) { + leg->AddEntry(plot[0],"#epsilon_{r} high E_{T}^{miss}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[1],"#epsilon_{r} high E_{T}^{miss}, #geq2 jets, 0 btag","ep"); + leg->AddEntry(plot[2],"#epsilon_{r} high E_{T}^{miss}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[3],"#epsilon_{r} high E_{T}^{miss}, #geq2 jets, #geq1 btag","ep"); + } else if (var==7) { // case for njet + leg->AddEntry(plot[0],"#epsilon_{r} high E_{T}^{miss}, 0 btag","ep"); + leg->AddEntry(plot[2],"#epsilon_{r} high E_{T}^{miss}, #geq1 btag","ep"); + } else if (var==8) { // case for nbjet + leg->AddEntry(plot[0],"#epsilon_{r} high E_{T}^{miss}, 1 jet","ep"); + leg->AddEntry(plot[1],"#epsilon_{r} high E_{T}^{miss}, #geq2 jets","ep"); + } + } else { + leg->AddEntry(plot[0],"#epsilon_{r} high E_{T}^{miss}, #geq1 jet","ep"); + } + leg->Draw(); + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTP.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTP.C new file mode 100644 index 0000000000000000000000000000000000000000..d4c3cad81daed13ea3357a30b1b91e97c71b06df --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTP.C @@ -0,0 +1,246 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained from tag-and-probe +// method vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + + +void RealEffElecTP() +{ + // use this option to read tag-and-probe results on Z data + //int choice = 0; + // use this option to read tag-and-probe results on Z data + MC correction + //int choice = 1; + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice=0;choice<=1;choice++) + for (int var=0;var<=8;var++) + my.execute(var,choice); + + return; +} + +class MyEff { + +public: + + MyEff(int choice){} + + // ======================================== + void execute(int var, int choice) + { + TGraph* plot0; + TH1F* plot[10]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f; + + // read input files + if (choice==0) + myname = "../data/R_el_Default_TPNoCorr.root"; + if (choice==1) + myname = "../data/R_el_Default.root"; + std::cout << " myname = " << myname << std::endl; + f = TFile::Open(myname,"old"); + + // loop on jet bins + for (int ijet=0;ijet<=1;ijet++) { + // check which variable is read + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mtw"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (var!=7) { // for all variables except njet + if (ijet==0) mynamehist += "_1j"; + if (ijet==1) mynamehist += "_ge2j"; + } else { // for njet + if (ijet==0) mynamehist += ""; + if (ijet==1) mynamehist += ""; + } + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ijet] = (TH1F*)f->Get(mynamehist); + //std::cout << " plot = " << plot[ijet] << std::endl; + } + + // =============================================== + // setup the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.75; + m_eff[1] = 1.1; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,TGraph* plot0,TH1F* plot[10]) + { + // define the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // set the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("E_{T}(elec) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(elec)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (elec, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (elec,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(elec,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // plot the TGraph + myplot(plot[0],1,20); // 1 jet + if (var!=7) { // for all variables except njet + myplot(plot[1],2,21); // >=2 jet + } + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,plot); + c1->RedrawAxis(); + + // define the name of the output + TString suffix = ""; + if (var==0) suffix = "_vsEt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + if (choice==0) c1->SaveAs("fig/effrealTPNoCorr_elec"+suffix+format); + if (choice==1) c1->SaveAs("fig/effrealTP_elec"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,TH1F* plot[10]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel,ylabel-0.06,1,"e+jets, #sqrt{s}=13 TeV, 3.2 fb^{-1}",0.04); + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (choice==0) { + leg->AddEntry(plot[0],"#epsilon_{r} tag-and-probe (no MC Corr) 1 jet","ep"); + leg->AddEntry(plot[1],"#epsilon_{r} tag-and-probe (no MC corr) #geq2 jets","ep"); + } + if (choice==1) { + leg->AddEntry(plot[0],"#epsilon_{r} tag-and-probe 1 jet","ep"); + leg->AddEntry(plot[1],"#epsilon_{r} tag-and-probe #geq2 jets","ep"); + } + if (var!=7) leg->Draw(); + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTPHighETmiss.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTPHighETmiss.C new file mode 100644 index 0000000000000000000000000000000000000000..34c8ded333f1bdf22dd5b95d24a9b393bad99c72 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffElecTPHighETmiss.C @@ -0,0 +1,243 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained both from +// tag-and-probe and high-MET/MTW methods vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void RealEffElecTPHighETmiss() +{ + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int var=0;var<=8;var++) + my.execute(var); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var) + { + TGraph* plot0; + TH1F* plot[2][10]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f[2]; + + // read the input files + // T&P + myname = "../data/R_el_Default.root"; + f[0] = TFile::Open(myname,"old"); + // High ETmiss + myname = "../data/R_el_Default_CRreal.root"; + f[1] = TFile::Open(myname,"old"); + + // loop on files + for (int ifile=0;ifile<=1;ifile++) { + // loop on jet bins + for (int ijet=0;ijet<=1;ijet++) { + // check which variables to use + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mtw"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (var!=7) { + if (ijet==0) mynamehist += "_1j"; + if (ifile==0) + if (ijet==1) mynamehist += "_ge2j"; + if (ifile==1) + if (ijet==1) mynamehist += ""; + } else { + if (ijet==0) mynamehist += ""; + if (ijet==1) mynamehist += ""; + } + + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ifile][ijet] = (TH1F*)f[ifile]->Get(mynamehist); + std::cout << " ifile = " << ifile << " ijet = " << ijet + << " plot = " << plot[ifile][ijet] << std::endl; + } + } + + // =============================================== + // set the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.75; + m_eff[1] = 1.1; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,plot0,plot); + } + + // ============================================== + void plotGraph(int var,TGraph* plot0,TH1F* plot[2][10]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // set the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("E_{T}(elec) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(elec)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (elec, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (elec,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(elec,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // plot the TGraph + myplot(plot[0][0],1,20); + if (var!=7) { + myplot(plot[0][1],2,21); + } + myplot(plot[1][0],3,24); + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,plot); + c1->RedrawAxis(); + + // set the output names + TString suffix = ""; + if (var==0) suffix = "_vsEt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + + c1->SaveAs("fig/effrealTPHighETmiss_elec"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,TH1F* plot[2][10]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.1,ylabel-0.06,1,"e+jets, #sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + leg->AddEntry(plot[0][0],"#epsilon_{r} tag-and-probe 1 jet","ep"); + leg->AddEntry(plot[0][1],"#epsilon_{r} tag-and-probe #geq2 jets","ep"); + leg->AddEntry(plot[1][0],"#epsilon_{r} #epsilon_{r} high E_{T}^{miss} #geq1 jet","ep"); + if (var!=7) leg->Draw(); + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonHighMTW.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonHighMTW.C new file mode 100644 index 0000000000000000000000000000000000000000..7c566e79a88ffea1542d74b53faf1c8f4afa20de --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonHighMTW.C @@ -0,0 +1,386 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained from high-MET/MTW +// method vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void RealEffMuonHighMTW() +{ + // use this option to see results with different njet bins + //int choice = 0; + // use this option to see results with njet>=1 only + //int choice = 1; + + // choose the trigger + //int trigger = 0; // mu20i + //int trigger = 1; // mu20 + //int trigger = 2; // mu50 + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice=0;choice<=1;choice++) + for (int trigger=0;trigger<=2;trigger++) + for (int var=0;var<=8;var++) + my.execute(var,choice,trigger); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var, int choice,int trigger) + { + TGraph* plot0; + TH1F* plot[20]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f; + + // read input files + myname = "../data/R_mu_Default_CRreal.root"; + std::cout << " myname = " << myname << std::endl; + f = TFile::Open(myname,"old"); + + // loop on jet bins + for (int ijet=0;ijet<=11;ijet++) { + // check which variables to use + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mwt"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (choice==0) { // with details on njet + if (var<7) { + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } else if (var==7) { // njet + // mu20i + if (ijet==0) mynamehist += "_0b_mu20i"; + if (ijet==1) mynamehist += "_0b_mu20i"; + if (ijet==2) mynamehist += "_ge1b_mu20i"; + if (ijet==3) mynamehist += "_ge1b_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_mu20"; + if (ijet==5) mynamehist += "_0b_mu20"; + if (ijet==6) mynamehist += "_ge1b_mu20"; + if (ijet==7) mynamehist += "_ge1b_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_mu50"; + if (ijet==9) mynamehist += "_0b_mu50"; + if (ijet==10) mynamehist += "_ge1b_mu50"; + if (ijet==11) mynamehist += "_ge1b_mu50"; + } else if (var==8) { // nbjet + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } + } + // case for njet>=1 + if (choice==1) { // with details on njet + // mu20i + if (ijet==0) mynamehist += "_0b_mu20i"; + if (ijet==1) mynamehist += "_0b_mu20i"; + if (ijet==2) mynamehist += "_ge1b_mu20i"; + if (ijet==3) mynamehist += "_ge1b_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_mu20"; + if (ijet==5) mynamehist += "_0b_mu20"; + if (ijet==6) mynamehist += "_ge1b_mu20"; + if (ijet==7) mynamehist += "_ge1b_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_mu50"; + if (ijet==9) mynamehist += "_0b_mu50"; + if (ijet==10) mynamehist += "_ge1b_mu50"; + if (ijet==11) mynamehist += "_ge1b_mu50"; + } + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ijet] = (TH1F*)f->Get(mynamehist); + std::cout << " ijet = " << ijet + << " plot = " << plot[ijet] << std::endl; + } + + // =============================================== + // set the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.75; + m_eff[1] = 1.3; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,trigger,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,int trigger,TGraph* plot0,TH1F* plot[20]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // plot the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("p_{T}(#mu) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(#mu)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (#mu, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (#mu,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(#mu,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // choose the trigger + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + // plot the TGraph + if (choice==0) { // for different jet + myplot(plot[it1],1,20); + if (var!=7) myplot(plot[it2],2,21); // case for njet + myplot(plot[it3],3,24); + if (var!=7) myplot(plot[it4],4,25); // case for njet + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[it1],1,20); + myplot(plot[it2],3,24); + myplot(plot[it3],1,20); + myplot(plot[it4],3,24); + } + } + if (choice==1) { // for njet>=1 + myplot(plot[it1],1,20); + myplot(plot[it3],3,24); + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[it1],1,20); + myplot(plot[it3],1,20); + } + } + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,trigger,plot); + c1->RedrawAxis(); + + // set the output names + TString suffix = ""; + if (var==0) suffix = "_vsPt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString st = ""; + if (trigger==0) st = "_mu20i"; + if (trigger==1) st = "_mu20"; + if (trigger==2) st = "_mu50"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + + if (choice==0) + c1->SaveAs("fig/effrealHighMTW_muon"+st+suffix+format); + if (choice==1) + c1->SaveAs("fig/effrealHighMTW_muon_ge1j"+st+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,int trigger,TH1F* plot[20]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.2,ylabel-0.06,1,"#sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + if (trigger==0) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20i",0.04); + if (trigger==1) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20",0.04); + if (trigger==2) myText(xlabel,ylabel-0.06,1,"#mu+jets mu50",0.04); + + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.55; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + // ============================================================ + // set the TLegend (adapt to your own team) + + if (choice==0) { // with details on njet + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var!=7 && var!=8) { + leg->AddEntry(plot[it1],"#epsilon_{r} High m_{T}^{W}, 1 jet, 0 btag","ep"); + leg->AddEntry(plot[it2],"#epsilon_{r} High m_{T}^{W}, #geq2 jets, 0 btag","ep"); + leg->AddEntry(plot[it3],"#epsilon_{r} High m_{T}^{W}, 1 jet, #geq1 btag","ep"); + leg->AddEntry(plot[it4],"#epsilon_{r} High m_{T}^{W}, #geq2 jets, #geq1 btag","ep"); + } else if (var==7) { // case for njet + leg->AddEntry(plot[it1],"#epsilon_{r} High m_{T}^{W}, 0 btag","ep"); + leg->AddEntry(plot[it3],"#epsilon_{r} High m_{T}^{W}, #geq1 btag","ep"); + } else if (var==8) { // case for nbjet + leg->AddEntry(plot[it1],"#epsilon_{r} High m_{T}^{W}, 1 jet","ep"); + leg->AddEntry(plot[it2],"#epsilon_{r} High m_{T}^{W}, #geq2 jets","ep"); + } + leg->Draw(); + } + + if (choice==1) { // with njet>=1 + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var!=8) { + leg->AddEntry(plot[it1],"#epsilon_{r} High m_{T}^{W}, #geq 1 jet, 0 btag","ep"); + leg->AddEntry(plot[it3],"#epsilon_{r} High m_{T}^{W}, #geq 1 jet, #geq1 btag","ep"); + } + if (var==8) // for nbjet + leg->AddEntry(plot[it1],"#epsilon_{r} High m_{T}^{W}, #geq 1 jet","ep"); + leg->Draw(); + } + + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTP.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTP.C new file mode 100644 index 0000000000000000000000000000000000000000..0f0a4a6e0c61c09a00a001c4e7bb82e49b252959 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTP.C @@ -0,0 +1,272 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained from tag-and-probe +// method vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void RealEffMuonTP() +{ + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int var=0;var<=8;var++) + my.execute(var); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var) + { + TGraph* plot0; + TH1F* plot[10]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f; + + // read input files + myname = "../data/R_mu_Default.root"; + std::cout << " myname = " << myname << std::endl; + f = TFile::Open(myname,"old"); + + // loop on all jet possibilities + for (int ijet=0;ijet<=5;ijet++) { + // check which variable is read + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mwt"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + if (var<7) { // for all variables except njet and nbjet + if (ijet==0) mynamehist += "_1j_mu20i"; + if (ijet==1) mynamehist += "_ge2j_mu20i"; + if (ijet==2) mynamehist += "_1j_mu20"; + if (ijet==3) mynamehist += "_ge2j_mu20"; + if (ijet==4) mynamehist += "_1j_mu50"; + if (ijet==5) mynamehist += "_ge2j_mu50"; + } else if (var==7) { // njet + if (ijet==0) mynamehist += "_mu20i"; + if (ijet==1) mynamehist += "_ge2j_mu20i"; + if (ijet==2) mynamehist += "_mu20"; + if (ijet==3) mynamehist += "_ge2j_mu20"; + if (ijet==4) mynamehist += "_mu50"; + if (ijet==5) mynamehist += "_ge2j_mu50"; + } else if (var==8) { // nbjet + if (ijet==0) mynamehist += "_mu20i"; + if (ijet==1) mynamehist += "_mu20i"; + if (ijet==2) mynamehist += "_mu20"; + if (ijet==3) mynamehist += "_mu20"; + if (ijet==4) mynamehist += "_mu50"; + if (ijet==5) mynamehist += "_mu50"; + } + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ijet] = (TH1F*)f->Get(mynamehist); + //std::cout << " plot = " << plot[ijet] << std::endl; + } + // =============================================== + // setup the TAxis ranges + m_nlines = 2; + m_eff[0] = 0.85; + m_eff[1] = 1.2; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,plot0,plot); + } + + // ============================================== + void plotGraph(int var,TGraph* plot0,TH1F* plot[10]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // plot the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("p_{T}(#mu) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(#mu)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (#mu, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (#mu,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(#mu,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // plot the TGraph + myplot(plot[0],1,20); + if (var<7) { // for all variables except njet and nbjet + myplot(plot[0],1,20); // mu20i 1 jet + myplot(plot[1],1,24); // >=2 jet + myplot(plot[2],2,21); // mu20 1 jet + myplot(plot[3],2,25); // >=2 jet + myplot(plot[4],4,22); // mu50 1 jet + myplot(plot[5],4,26); // >=2 jet + } + if (var==7) { // njet + myplot(plot[0],1,20); + myplot(plot[2],2,24); + myplot(plot[4],3,25); + } + if (var==8) { // nbjet + myplot(plot[0],1,20); + myplot(plot[2],2,24); + myplot(plot[4],3,25); + } + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + + // plot the TLegend + plotLegend(var,plot); + c1->RedrawAxis(); + + // define the output name + TString suffix = ""; + if (var==0) suffix = "_vsPt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + c1->SaveAs("fig/effrealTP_muon"+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,TH1F* plot[10]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.1,ylabel-0.06,1,"#mu+jets, #sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.55; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var<7) { + leg->AddEntry(plot[0],"#epsilon_{r} tag-and-probe 1 jet mu20i","ep"); + leg->AddEntry(plot[1],"#epsilon_{r} tag-and-probe #geq2 jets mu20i","ep"); + leg->AddEntry(plot[2],"#epsilon_{r} tag-and-probe 1 jet mu20","ep"); + leg->AddEntry(plot[3],"#epsilon_{r} tag-and-probe #geq2 jets mu20","ep"); + leg->AddEntry(plot[4],"#epsilon_{r} tag-and-probe 1 jet mu50","ep"); + leg->AddEntry(plot[5],"#epsilon_{r} tag-and-probe #geq2 jets mu50","ep"); + } else if (var==7) { // njet + leg->AddEntry(plot[0],"#epsilon_{r} tag-and-probe mu20i","ep"); + leg->AddEntry(plot[2],"#epsilon_{r} tag-and-probe mu20","ep"); + leg->AddEntry(plot[4],"#epsilon_{r} tag-and-probe mu50","ep"); + } else if (var==8) { // njet + leg->AddEntry(plot[0],"#epsilon_{r} tag-and-probe mu20i","ep"); + leg->AddEntry(plot[2],"#epsilon_{r} tag-and-probe mu20","ep"); + leg->AddEntry(plot[4],"#epsilon_{r} tag-and-probe mu50","ep"); + } + leg->Draw(); + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTPHighMTW.C b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTPHighMTW.C new file mode 100644 index 0000000000000000000000000000000000000000..a3afcdbb8a601cb46d32a22388281f99e131faf5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/macros/RealEffMuonTPHighMTW.C @@ -0,0 +1,506 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TGraph.h" +#include "TString.h" +#include "AtlasUtils.C" +#include "AtlasStyle.C" +#include "AtlasLabels.C" +#include <vector> +#include <string> +#include <cmath> + +///////////////////////////////////////////////////////////////////// +// CREATED : 01/02/2016 +// AUTHOR : Frederic Derue (LPNHE Paris) +// PURPOSE : ROOT macro to plot real efficiencies obtained both from +// tag-and-probe and high-MET/MTW methods vs different variables +// It reads as input the default efficiencies of TopFakes package +// MODIFICATION : +// +///////////////////////////////////////////////////////////////////// + +void RealEffMuonTPHighMTW() +{ + // use this option to see results with different njet bins + //int choice = 0; + // use this.q + // option to see results with njet>=1 only + //int choice = 1; + + // choose the trigger + //int trigger = 0; // mu20i + //int trigger = 1; // mu20 + //int trigger = 2; // mu50 + + // set the variable one want to compare + //int var = 0; // pt + //int var = 1; // eta + //int var = 2; // dR + //int var = 3; // jetpt + //int var = 4; // dphi + //int var = 5; // met + //int var = 6; // mtw + //int var = 7; // njet + //int var = 8; // nbjet + + SetAtlasStyle(); + gROOT->Reset(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptTitle(0); + + // define the class + MyEff my(1); + // uncomment if you want to do all plots in one go + for (int choice=0;choice<=1;choice++) + for (int trigger=0;trigger<=2;trigger++) + for (int var=0;var<=8;var++) + my.execute(var,choice,trigger); + + return; +} + +class MyEff { + +public: + + MyEff(int choice) {} + + // ======================================== + void execute(int var,int choice,int trigger) + { + TGraph* plot0; + TH1F* plot[2][20]; + TString myname=""; + TString name[100]; + TString mynamehist = ""; + TFile *f[2]; + + // read input files + // T&P + myname = "../data/R_mu_Default.root"; + f[0] = TFile::Open(myname,"old"); + // High ETmiss + myname = "../data/R_mu_Default_CRreal.root"; + f[1] = TFile::Open(myname,"old"); + + // loop on all files + for (int ifile=0;ifile<=1;ifile++) { + // loop on jet bins + for (int ijet=0;ijet<=11;ijet++) { + // check which variable to be used + if (var==0) mynamehist = "eff_pt"; + if (var==1) mynamehist = "eff_eta"; + if (var==2) mynamehist = "eff_dR"; + if (var==3) mynamehist = "eff_jetpt"; + if (var==4) mynamehist = "eff_dPhi"; + if (var==5) mynamehist = "eff_met"; + if (var==6) mynamehist = "eff_mwt"; + if (var==7) mynamehist = "eff_njet"; + if (var==8) mynamehist = "eff_nbtag"; + + // case for the tag-and-probe + if (ifile==0) { + if (choice==0) { // with details on njet + if (var<7) { + // mu20i + if (ijet==0) mynamehist += "_1j_mu20i"; + if (ijet==1) mynamehist += "_ge2j_mu20i"; + if (ijet==2) mynamehist += "_1j_mu20i"; + if (ijet==3) mynamehist += "_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_1j_mu20"; + if (ijet==5) mynamehist += "_ge2j_mu20"; + if (ijet==6) mynamehist += "_1j_mu20"; + if (ijet==7) mynamehist += "_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_1j_mu50"; + if (ijet==9) mynamehist += "_ge2j_mu50"; + if (ijet==10) mynamehist += "_1j_mu50"; + if (ijet==11) mynamehist += "_ge2j_mu50"; + } else if (var==7) { // njet + // mu20i + if (ijet==0) mynamehist += "_mu20i"; + if (ijet==1) mynamehist += "_mu20i"; + if (ijet==2) mynamehist += "_mu20i"; + if (ijet==3) mynamehist += "_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_mu20"; + if (ijet==5) mynamehist += "_mu20"; + if (ijet==6) mynamehist += "_mu20"; + if (ijet==7) mynamehist += "_mu20"; + // mu50 + if (ijet==8) mynamehist += "_mu50"; + if (ijet==9) mynamehist += "_mu50"; + if (ijet==10) mynamehist += "_mu50"; + if (ijet==11) mynamehist += "_mu50"; + } else if (var==8) { // nbjet + // mu20i + if (ijet==0) mynamehist += "_1j_mu20i"; + if (ijet==1) mynamehist += "_ge2j_mu20i"; + if (ijet==2) mynamehist += "_1j_mu20i"; + if (ijet==3) mynamehist += "_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_1j_mu20"; + if (ijet==5) mynamehist += "_ge2j_mu20"; + if (ijet==6) mynamehist += "_1j_mu20"; + if (ijet==7) mynamehist += "_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_1j_mu50"; + if (ijet==9) mynamehist += "_ge2j_mu50"; + if (ijet==10) mynamehist += "_1j_mu50"; + if (ijet==11) mynamehist += "_ge2j_mu50"; + } + } + // case for njet>=1 + if (choice==1) { // with details on njet + // mu20i + if (ijet==0) mynamehist += "_mu20i"; + if (ijet==1) mynamehist += "_mu20i"; + if (ijet==2) mynamehist += "_mu20i"; + if (ijet==3) mynamehist += "_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_mu20"; + if (ijet==5) mynamehist += "_mu20"; + if (ijet==6) mynamehist += "_mu20"; + if (ijet==7) mynamehist += "_mu20"; + // mu50 + if (ijet==8) mynamehist += "_mu50"; + if (ijet==9) mynamehist += "_mu50"; + if (ijet==10) mynamehist += "_mu50"; + if (ijet==11) mynamehist += "_mu50"; + } + } + + // case for the HighMTW + if (ifile==1) { + if (choice==0) { // with details on njet + if (var<7) { + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } else if (var==7) { // njet + // mu20i + if (ijet==0) mynamehist += "_0b_mu20i"; + if (ijet==1) mynamehist += "_0b_mu20i"; + if (ijet==2) mynamehist += "_ge1b_mu20i"; + if (ijet==3) mynamehist += "_ge1b_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_mu20"; + if (ijet==5) mynamehist += "_0b_mu20"; + if (ijet==6) mynamehist += "_ge1b_mu20"; + if (ijet==7) mynamehist += "_ge1b_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_mu50"; + if (ijet==9) mynamehist += "_0b_mu50"; + if (ijet==10) mynamehist += "_ge1b_mu50"; + if (ijet==11) mynamehist += "_ge1b_mu50"; + } else if (var==8) { // nbjet + // mu20i + if (ijet==0) mynamehist += "_0b_1j_mu20i"; + if (ijet==1) mynamehist += "_0b_ge2j_mu20i"; + if (ijet==2) mynamehist += "_ge1b_1j_mu20i"; + if (ijet==3) mynamehist += "_ge1b_ge2j_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_0b_1j_mu20"; + if (ijet==5) mynamehist += "_0b_ge2j_mu20"; + if (ijet==6) mynamehist += "_ge1b_1j_mu20"; + if (ijet==7) mynamehist += "_ge1b_ge2j_mu20"; + // mu50 + if (ijet==8) mynamehist += "_0b_1j_mu50"; + if (ijet==9) mynamehist += "_0b_ge2j_mu50"; + if (ijet==10) mynamehist += "_ge1b_1j_mu50"; + if (ijet==11) mynamehist += "_ge1b_ge2j_mu50"; + } + } + // case for njet>=1 + if (choice==1) { // with details on njet + // mu20i + if (ijet==0) mynamehist += "_mu20i"; + if (ijet==1) mynamehist += "_mu20i"; + if (ijet==2) mynamehist += "_mu20i"; + if (ijet==3) mynamehist += "_mu20i"; + // mu20 + if (ijet==4) mynamehist += "_mu20"; + if (ijet==5) mynamehist += "_mu20"; + if (ijet==6) mynamehist += "_mu20"; + if (ijet==7) mynamehist += "_mu20"; + // mu50 + if (ijet==8) mynamehist += "_mu50"; + if (ijet==9) mynamehist += "_mu50"; + if (ijet==10) mynamehist += "_mu50"; + if (ijet==11) mynamehist += "_mu50"; + } + } + + std::cout << " ijet = " << ijet + << " namehist = " << mynamehist << std::endl; + plot[ifile][ijet] = (TH1F*)f[ifile]->Get(mynamehist); + std::cout << " ijet = " << ijet + << " plot = " << plot[ifile][ijet] << std::endl; + } + } + + // =============================================== + // set the TAxis range + m_nlines = 2; + m_eff[0] = 0.85; + m_eff[1] = 1.2; + if (var==0) {m_var[0] = 25.; m_var[1] = 150.;} // pt + if (var==1) {m_var[0] = 0.; m_var[1] = 2.3;} // eta + if (var==2) {m_var[0] = 0.; m_var[1] = 6.;} // dR + if (var==3) {m_var[0] = 25.; m_var[1] = 500.;} // jetpt + if (var==4) {m_var[0] = 0.; m_var[1] = 3.2;} // dphi + if (var==5) {m_var[0] = 0.; m_var[1] = 1000.;} // met + if (var==6) {m_var[0] = 0.; m_var[1] = 1000.;} // mtw + if (var==7) {m_var[0] = 0.; m_var[1] = 6.;} // njet + if (var==8) {m_var[0] = 0.; m_var[1] = 3.;} // nbjet + plot0 = new TGraph(m_nlines,m_var,m_eff); + + // plot the TGraph + plotGraph(var,choice,trigger,plot0,plot); + } + + // ============================================== + void plotGraph(int var,int choice,int trigger, + TGraph* plot0,TH1F* plot[2][20]) + { + // set the TCanvas + c1 = new TCanvas("c1"," ",0.,0.,800,600); + c1->SetFillColor(42); + c1->SetFillColor(10); + + // set the TAxis + plot0->SetFillColor(19); + plot0->SetLineColor(0); + plot0->SetLineWidth(4); + plot0->SetMarkerColor(0); + plot0->SetMarkerStyle(20); + //plot0->GetXaxis()->CenterLabels(true); + if (var==0) plot0->GetXaxis()->SetTitle("p_{T}(#mu) [GeV]"); + if (var==1) plot0->GetXaxis()->SetTitle("|#eta(#mu)|"); + if (var==2) plot0->GetXaxis()->SetTitle("#DeltaR (#mu, nearest jet)"); + if (var==3) plot0->GetXaxis()->SetTitle("p_{T}(leading jet) [GeV]"); + if (var==4) plot0->GetXaxis()->SetTitle("#Delta#phi (#mu,E_{T}^{miss})"); + if (var==5) plot0->GetXaxis()->SetTitle("E_{T}^{miss} [GeV]"); + if (var==6) plot0->GetXaxis()->SetTitle("m_{T}(#mu,E_{T}^{miss}) [GeV]"); + if (var==7) plot0->GetXaxis()->SetTitle("n_{jet}"); + if (var==8) plot0->GetXaxis()->SetTitle("n_{b-jet}"); + plot0->GetYaxis()->SetTitle("Efficiency"); + plot0->Draw("AP"); + + // ================================================================ + // choose the trigger + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + // plot the TGraph + if (choice==0) { // for different jet + // T&P + myplot(plot[0][it1],1,20); + myplot(plot[0][it2],1,24); + // High MTWW + myplot(plot[1][it1],1,21); + if (var!=7) myplot(plot[1][it2],2,22); // case for njet + myplot(plot[1][it3],3,23); + if (var!=7) myplot(plot[1][it4],4,29); // case for njet + + if (var==8) { // case for nbjet (use same colors) + myplot(plot[0][it1],1,20); + myplot(plot[0][it2],1,24); + + myplot(plot[1][it1],1,21); + myplot(plot[1][it2],3,22); + myplot(plot[1][it3],1,23); + myplot(plot[1][it4],3,29); + } + } + if (choice==1) { // for njet>=1 + if (var!=8) { + myplot(plot[0][it1],1,20); // T&P + myplot(plot[1][it1],2,21); // high MTW + } + if (var==8) { // case for nbjet (use same colors) + myplot(plot[0][it1],1,20); + myplot(plot[1][it1],2,21); + } + } + + c1->Update(); + c1->GetFrame()->SetFillColor(0); + c1->GetFrame()->SetBorderSize(0); + c1->Modified(); + // plot the TLegend + plotLegend(var,choice,trigger,plot); + c1->RedrawAxis(); + + // set the output filename + TString suffix = ""; + if (var==0) suffix = "_vsPt"; + if (var==1) suffix = "_vsEta"; + if (var==2) suffix = "_vsdR"; + if (var==3) suffix = "_vsPtLeadingJet"; + if (var==4) suffix = "_vsdPhi"; + if (var==5) suffix = "_vsMET"; + if (var==6) suffix = "_vsMTW"; + if (var==7) suffix = "_vsnjet"; + if (var==8) suffix = "_vsnbjet"; + + TString st = ""; + if (trigger==0) st = "_mu20i"; + if (trigger==1) st = "_mu20"; + if (trigger==2) st = "_mu50"; + + TString format = ""; + for (int i=0;i<3;i++) { + if (i==0) format = ".eps"; + if (i==1) format = ".pdf"; + if (i==2) format = ".png"; + + if (choice==0) + c1->SaveAs("fig/effrealTPHighMTW_muon"+st+suffix+format); + if (choice==1) + c1->SaveAs("fig/effrealTPHighMTW_muon_ge1j"+st+suffix+format); + } + } + + // ============================================== + void myplot(TH1F* plot,int mkcolor, int mktype, float size=1.5) + { + plot->SetFillColor(19); + plot->SetLineColor(1); + plot->SetLineWidth(1.5); + plot->SetMarkerColor(mkcolor); + plot->SetMarkerStyle(mktype); + //plot->SetTitle("rel 16"); + plot->SetMarkerSize(size); + plot->Draw("P sames"); + } + + // ============================================== + void plotLegend(int var,int choice,int trigger,TH1F* plot[2][20]) + { + float xlabel = 0.2; + float ylabel = 0.88; + // set the ATLAS label + ATLASLabel(xlabel,ylabel,"Work in Progress"); + // set energy and luminosity (adapt to your own case) + myText(xlabel+0.2,ylabel-0.06,1,"#sqrt{s}=13 TeV, 3.2 fb^{-1}",0.045); + + if (choice==0) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20i",0.04); + if (choice==1) myText(xlabel,ylabel-0.06,1,"#mu+jets mu20",0.04); + if (choice==2) myText(xlabel,ylabel-0.06,1,"#mu+jets mu50",0.04); + + int it1 = -1; int it2 = -1; int it3 = -1; int it4 = -1; + if (trigger==0) {it1 = 0; it2 = 1; it3 = 2; it4 = 3;} // mu20i + if (trigger==1) {it1 = 4; it2 = 5; it3 = 6; it4 = 7;} // mu20 + if (trigger==2) {it1 = 8; it2 = 9; it3 = 10; it4 = 11;} // mu50 + + // ============================= + if (choice==0) { // with details on njet + if (var<7) { + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.035); + leg->AddEntry(plot[0][it1],"#epsilon_{r} tag-and-probe, 1 jet","ep"); + leg->AddEntry(plot[0][it2],"#epsilon_{r} tag-and-probe, #geq2 jets","ep"); + leg->Draw(); + + leg2 = new TLegend(0.5,ymin,0.8,ymax); + leg2->SetFillColor(0); + leg2->SetFillStyle(0); + leg2->SetBorderSize(0); + leg2->SetTextSize(0.035); + leg2->AddEntry(plot[1][it1],"#epsilon_{r} High m_{T}^{W}, 1 jet, 0 btag","ep"); + leg2->AddEntry(plot[1][it2],"#epsilon_{r} High m_{T}^{W}, #geq2 jets, 0 btag","ep"); + leg2->AddEntry(plot[1][it3],"#epsilon_{r} High m_{T}^{W}, 1 jet, #geq1 btag","ep"); + leg2->AddEntry(plot[1][it4],"#epsilon_{r} High m_{T}^{W}, #geq2 jets, #geq1 btag","ep"); + leg2->Draw(); + } + } + + // ============================================================ + // set the TLegend (adapt to your own team) + float ymin = 0.55; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + // ============================================================ + // set the TLegend (adapt to your own team) + + if (choice==0) { // with details on njet + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var==7) { // case for njet + leg->AddEntry(plot[0][it1],"#epsilon_{r} tag-and-probe","ep"); + leg->AddEntry(plot[1][it1],"#epsilon_{r} High m_{T}^{W}, 0 btag","ep"); + leg->AddEntry(plot[1][it3],"#epsilon_{r} High m_{T}^{W}, #geq1 btag","ep"); + } else if (var==8) { // case for nbjet + leg->AddEntry(plot[0][it1],"#epsilon_{r} tag-and-probe, 1 jet","ep"); + leg->AddEntry(plot[0][it2],"#epsilon_{r} tag-and-probe, #geq2 jets","ep"); + leg->AddEntry(plot[1][it1],"#epsilon_{r} High m_{T}^{W}, 1 jet","ep"); + leg->AddEntry(plot[1][it2],"#epsilon_{r} High m_{T}^{W}, #geq2 jets","ep"); + } + leg->Draw(); + } + + if (choice==1) { // with njet>=1 + float ymin = 0.6; + float ymax = 0.8; + leg = new TLegend(0.2,ymin,0.3,ymax); + leg->SetFillColor(0); + leg->SetFillStyle(0); + leg->SetBorderSize(0); + leg->SetTextSize(0.04); + if (var!=8) { + leg->AddEntry(plot[0][it1],"#epsilon_{r} tag-and-probe, #geq 1 jet","ep"); + leg->AddEntry(plot[1][it1],"#epsilon_{r} High m_{T}^{W}, #geq 1 jet","ep"); + } + if (var==8) { // for nbjet + leg->AddEntry(plot[0][it1],"#epsilon_{r} tag-and-probe, #geq 1 jet","ep"); + leg->AddEntry(plot[1][it1],"#epsilon_{r} High m_{T}^{W}, #geq 1 jet","ep"); + } + leg->Draw(); + } + + } + +private: + + Float_t m_var[300]; + Float_t m_errvar[300]; + Float_t m_eff[300]; + Float_t m_erreff[300]; + + Int_t m_nlines; +}; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c3b0ad7cc72ced4707696435bf6ca2a4339d1a2 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/CMakeLists.txt @@ -0,0 +1,38 @@ +# Auto-generated on: 2017-03-08 14:47:37.415174 + +# Declare the name of this package: +atlas_subdir( TopHLUpgrade None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + TopConfiguration + TopEvent + xAODTruth + xAODJet + xAODMissingET + TopParticleLevel + UpgradePerformanceFunctions ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopHLUpgrade _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopHLUpgrade Root/*.cxx Root/*.h Root/*.icc + TopHLUpgrade/*.h TopHLUpgrade/*.icc TopHLUpgrade/*/*.h + TopHLUpgrade/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopHLUpgrade + LINK_LIBRARIES TopConfiguration + TopEvent + xAODTruth + xAODJet + xAODMissingET + TopParticleLevel + UpgradePerformanceFunctions + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..f9fa452558b6689ef1035f603096f64ab7ab8510 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/LinkDef.h @@ -0,0 +1,12 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeLeptonObjectSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeLeptonObjectSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3775b5e013f9c5fa62b062ea603425d64b3bee3b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeLeptonObjectSelector.cxx @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: UpgradeLeptonObjectSelector.cxx +// Description: +// Author: Mark Owen +// Created: Sun Feb 22 15:18:45 2015 + +#include "TopHLUpgrade/UpgradeLeptonObjectSelector.h" + +using namespace top; + +UpgradeLeptonObjectSelector::UpgradeLeptonObjectSelector( Options opt /* = Options() */ ) + : m_opt( opt ){ /* Deliberately Empty */ } + +/* virtual */ bool +UpgradeLeptonObjectSelector::apply( const xAOD::TruthParticle & truthParticle ) { + + // -------------------------------------------------- + // Always require 'reco' to pass + if( truthParticle.auxdata<int>("passReco") !=1 ) { return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the (smeared) pT: + // must exceed 25 GeV + if ( truthParticle.pt() < m_opt.pt_min ){ return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the eta: + // must be less than or equal to 2.5 + if ( std::abs( truthParticle.eta() ) > m_opt.eta_max ){ return false; } + + + // -------------------------------------------------- + // Everything that reaches this point has passed the selection + return true; + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1e5caa1de8d40d1397a03d9413faacdab8f5f87b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx @@ -0,0 +1,295 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopHLUpgrade/UpgradeObjectLoader.h" + +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" +#include "TopHLUpgrade/UpgradeLeptonObjectSelector.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODCore/ShallowCopy.h" + +#include <algorithm> + +using namespace top; + +bool ptSort(const xAOD::IParticle* p1, const xAOD::IParticle* p2) { + return p1->pt() > p2->pt(); +} + +UpgradeObjectLoader::UpgradeObjectLoader( const std::shared_ptr<top::TopConfig> & cfg ) : + asg::AsgTool( "UpgradeObjectLoader" ), + m_config(cfg), + m_upgrade(), + // tool is active depending on config settings + m_active(m_config->isMC() && m_config->HLLHC()), + // object selection tools setup below + m_objectSelector_Electron( nullptr ), + m_objectSelector_Muon( nullptr ) + { + + if ( m_active ){ + std::cout << "Upgrade level reconstruction is enabled; telling you how I am configured:" << '\n'; + m_upgrade.reset(new UpgradePerformanceFunctionsxAOD(UpgradePerformanceFunctions::gold, 200.0)); //layout & mu hard coded for now + m_upgrade->setElectronWorkingPoint(UpgradePerformanceFunctions::looseElectron); + m_upgrade->setElectronRandomSeed(171); + m_upgrade->setMuonWorkingPoint(UpgradePerformanceFunctions::tightMuon); + m_upgrade->setMETRandomSeed(986); + m_upgrade->loadMETHistograms("UpgradePerformanceFunctions/sumetPU_mu200_ttbar_gold.root"); + m_upgrade->setPileupRandomSeed(121); + m_upgrade->setPileupRandomSeed(771); + m_upgrade->setPileupJetPtThresholdMeV(30000.); + m_upgrade->setPileupEfficiencyScheme(UpgradePerformanceFunctions::PileupEff::HS); + m_upgrade->setPileupEff(0.9); + m_upgrade->setPileupTemplatesPath("/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/UpgradePerformanceFunctions/"); + m_upgrade->setFlavourTaggingCalibrationFilename("UpgradePerformanceFunctions/flavor_tags_v1.1.root"); + + // configure muon selector + auto optMu = UpgradeLeptonObjectSelector::Options{ + m_config->truth_muon_PtCut(), + m_config->truth_muon_EtaCut() + }; + + m_objectSelector_Muon.reset( new UpgradeLeptonObjectSelector( optMu ) ); + + // configure electron selector + auto optEl = UpgradeLeptonObjectSelector::Options{ + m_config->truth_electron_PtCut(), + m_config->truth_electron_EtaCut() + }; + + m_objectSelector_Electron.reset( new UpgradeLeptonObjectSelector( optEl ) ); + } + +}//UpgradeObjectLoader constructor + +UpgradeObjectLoader::~UpgradeObjectLoader( ) { + +} + +/*! + * The main function to do the heavy lifting - get the truth objects, smear them + * and apply efficiency corrections. + * @return ParticleLevelEvent object + */ +ParticleLevelEvent UpgradeObjectLoader::load() { + + // Create the ParticleLevelEvent object + ParticleLevelEvent particleEvent; + + // Load event info object directly into the particleEvent + top::check( evtStore()->retrieve( particleEvent.m_info, m_config->sgKeyEventInfo() ), + "xAOD::TEvent::retrieve failed for EventInfo" ); + + /* ------------------------------ Muons -----------------------------------------------------------*/ + // Get muons + const xAOD::TruthParticleContainer * origmuons(0); + top::check( evtStore()->retrieve( origmuons, m_config->sgKeyTruthMuons() ), + "xAOD::TEvent::retrieve failed for Truth Muons" ); + + // Shallow copy + std::pair< xAOD::TruthParticleContainer*, xAOD::ShallowAuxContainer* > muons_shallowCopy = xAOD::shallowCopyContainer( *origmuons ); + xAOD::TruthParticleContainer* muons = muons_shallowCopy.first; + + // container to put the selected muons in - use view container to avoid deep copies + m_selectedMuons.reset( new xAOD::TruthParticleContainer(SG::VIEW_ELEMENTS)); + + // Smear & efficiency correct muons + for(auto muon : *muons) { + // efficiency (assume pass unsmeared pT here) + const double eff = m_upgrade->getMuonEfficiency( muon->pt(), muon->eta()); + //std::cout << "Muon with pT " << muon->pt() << " has efficiency = " << eff << std::endl; + + // smear + m_upgrade->smearMuon( *muon ); + //std::cout << "\t smeared pT " << muon->pt() << std::endl; + + // store efficiency correction + if(m_upgrade->getRandom3()->Uniform() < eff) { + muon->auxdata<int>("passReco") = 1; + } + else muon->auxdata<int>("passReco") = 0; + + // apply all cuts + if( m_objectSelector_Muon->apply( *muon ) ) m_selectedMuons->push_back( muon ); + + } + + // sort the muons by pT + std::sort(m_selectedMuons->begin(), m_selectedMuons->end(), ptSort); + + // keep hold of the pointers in our private variables (also clears last event) + m_muons.reset(muons); + m_muonsShallowAux.reset(muons_shallowCopy.second); + + // pass the muons to the ParticleLevelEvent object + particleEvent.m_muons = m_selectedMuons.get(); + + /* ------------------------------ Electrons -----------------------------------------------------------*/ + // Get electrons + const xAOD::TruthParticleContainer * origelectrons(0); + top::check( evtStore()->retrieve( origelectrons, m_config->sgKeyTruthElectrons() ), + "xAOD::TEvent::retrieve failed for Truth Electrons" ); + + // Shallow copy + std::pair< xAOD::TruthParticleContainer*, xAOD::ShallowAuxContainer* > electrons_shallowCopy = xAOD::shallowCopyContainer( *origelectrons ); + xAOD::TruthParticleContainer* electrons = electrons_shallowCopy.first; + + // container to put the selected electrons in - use view container to avoid deep copies + m_selectedElectrons.reset( new xAOD::TruthParticleContainer(SG::VIEW_ELEMENTS)); + + // Smear & efficiency correct electrons + for(auto electron : *electrons) { + // efficiency (assume pass unsmeared pT here) + const double eff = m_upgrade->getElectronEfficiency( electron->pt(), electron->eta()); + //std::cout << "Electron with pT " << electron->pt() << " has efficiency = " << eff << std::endl; + + // smear + m_upgrade->smearElectron( *electron ); + //std::cout << "\t smeared pT " << electron->pt() << std::endl; + + // store efficiency result + if(m_upgrade->getRandom3()->Uniform() < eff) { + electron->auxdata<int>("passReco") = 1; + } + else electron->auxdata<int>("passReco") = 0; + + // apply all cuts + if( m_objectSelector_Electron->apply( *electron ) ) m_selectedElectrons->push_back( electron ); + } + + // sort the electrons by pT + std::sort(m_selectedElectrons->begin(), m_selectedElectrons->end(), ptSort); + + // keep hold of the pointers in our private variables (also clears last event) + m_electrons.reset(electrons); + m_electronsShallowAux.reset(electrons_shallowCopy.second); + + // pass the electrons to the ParticleLevelEvent object + particleEvent.m_electrons = m_selectedElectrons.get(); + + + /* ------------------------------ Jets-----------------------------------------------------------*/ + // Get jets + const xAOD::JetContainer * origjets(0); + top::check( evtStore()->retrieve( origjets, m_config->sgKeyTruthJets() ), + "xAOD::TEvent::retrieve failed for Truth Jets" ); + + // Shallow copy + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > jets_shallowCopy = xAOD::shallowCopyContainer( *origjets ); + xAOD::JetContainer* jets = jets_shallowCopy.first; + + // we are going to put selected 'good' jets in to a xAOD::JetContainer + xAOD::JetContainer* selectedJets = new xAOD::JetContainer(); + xAOD::JetAuxContainer* auxJetCont = new xAOD::JetAuxContainer(); + selectedJets->setStore(auxJetCont); // connect container & store + + // Smear & efficiency correct jets + for(auto jet : *jets) { + // smear + m_upgrade->smearJet( *jet ); + + // jets must be above minimum threshold + if ( jet->pt() < m_upgrade->getPileupJetPtThresholdMeV()) continue; + + jet->auxdata<int>("pileUp") = 0; // so we know this jet is not pileup later on + + const float trackEff = m_upgrade->getTrackJetConfirmEff(jet->pt(),jet->eta(), "HS"); + + if(m_upgrade->getRandom3()->Uniform() < trackEff) { + // mark that jet passed track confirmation + jet->auxdata<int>("passTrackConf") = 1; + + // store b-tagging efficiency + + // first work out jet flavour + char type = 'L'; + if(jet->auxdata<int>("GhostBQuarksFinalCount") > 0) type = 'B'; + else if(jet->auxdata<int>("GhostCQuarksFinalCount") > 0) type = 'C'; + + // now get b-tagging efficiency + const double MV1tagEff = m_upgrade->getFlavourTagEfficiency(jet->pt(), jet->eta(), type, "mv1", 70, m_upgrade->getPileupTrackConfSetting()); + jet->auxdata<float>("mv1TagEff") = MV1tagEff; + + // put jet in to selectedJets container, have to deep copy the jet + xAOD::Jet* newjet = new xAOD::Jet(*jet); + selectedJets->push_back( newjet ); + + } + else jet->auxdata<int>("passTrackConf") = 0; + + + //std::cout << "\t smeared pT " << jet->pt() << std::endl; + } + + // now get the pileup jets + std::vector<TLorentzVector> puJets = m_upgrade->getPileupJets(); + // loop over pileup jets + for(auto puJet : puJets) { + + const float trackEff = m_upgrade->getTrackJetConfirmEff(puJet.Pt(),puJet.Eta(),"PU"); + + if(m_upgrade->getRandom3()->Uniform() > trackEff) continue; // ignore jets failing track confirmation + + // jet 4 momentum stored as PtEtaPhiM (see xAODJet/JetTypes.h) + xAOD::JetFourMom_t mom( puJet.Pt(), puJet.Eta(), puJet.Phi(), puJet.M() ); + xAOD::Jet* jet = new xAOD::Jet(); + selectedJets->push_back( jet ); + selectedJets->back()->setJetP4( mom ); + selectedJets->back()->auxdata<int>("pileUp") = 1; // so we know this jet is pileup later on + // now get b-tagging efficiency + const double MV1tagEff = m_upgrade->getFlavourTagEfficiency(jet->pt(), jet->eta(), 'P', "mv1", 70, m_upgrade->getPileupTrackConfSetting()); + selectedJets->back()->auxdata<float>("mv1TagEff") = MV1tagEff; + + }// pileup jet loop + + // sort jets by pT + std::sort(selectedJets->begin(), selectedJets->end(), ptSort); + + // keep hold of the pointers in our private variables (also clears last event) + m_jets.reset(selectedJets); + m_jetsAux.reset(auxJetCont); + + // pass the jets to the ParticleLevelEvent object + particleEvent.m_jets = selectedJets; + + // clean up memory from the shallow copy of jets that is finished with now + delete jets; + delete jets_shallowCopy.second; + + + /* ----------------------------- MET ------------------------------------------*/ + const xAOD::MissingETContainer * origmetcont(0); + top::check( evtStore()->retrieve( origmetcont, m_config->sgKeyTruthMET() ), + "xAOD::TEvent::retrieve failed for Truth MET" ); + + ATH_MSG_DEBUG("N(MET) = " << origmetcont->size()); + + // Maybe we shouldn't hard code this, but probably it will not change.... + const xAOD::MissingET* origmet = (*origmetcont)["NonInt"]; + + // the MET type is just std::pair<double,double>, representing the smeared METx and METy + UpgradePerformanceFunctions::MET smearedMET = m_upgrade->getMETSmeared(origmet->sumet(), origmet->mpx(), origmet->mpy()); + + // Shallow copy + std::pair< xAOD::MissingETContainer*, xAOD::ShallowAuxContainer* > metcont_shallowCopy = xAOD::shallowCopyContainer( *origmetcont ); + xAOD::MissingETContainer* metcont = metcont_shallowCopy.first; + xAOD::MissingET* met = (*metcont)["NonInt"]; + met->setMpx(smearedMET.first); + met->setMpx(smearedMET.second); + + // keep hold of the pointers in our private variables (also clears last event) + m_metCont.reset(metcont); + m_metShallowAux.reset(metcont_shallowCopy.second); + + // pass the MET pointer to the ParticleLevelEvent object + particleEvent.m_met = met; + + return particleEvent; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradePerformanceFunctionsxAOD.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradePerformanceFunctionsxAOD.cxx new file mode 100644 index 0000000000000000000000000000000000000000..63fe0423de0d8a65c825231ad8cf472c5415cb6a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradePerformanceFunctionsxAOD.cxx @@ -0,0 +1,83 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopHLUpgrade/UpgradePerformanceFunctionsxAOD.h" + +UpgradePerformanceFunctionsxAOD::UpgradePerformanceFunctionsxAOD() : + UpgradePerformanceFunctions(), + m_randgen(811) //fix random seed +{ + +} + +UpgradePerformanceFunctionsxAOD::UpgradePerformanceFunctionsxAOD(UpgradeLayout layout, double avgMu) : + UpgradePerformanceFunctions(layout, avgMu), + m_randgen(811) // fix random seed +{ + +} + +/** + * Get smeared electron energy from the UpgradePerformanceFunctions and then + * modify the input electron energy accordingly. + */ +void UpgradePerformanceFunctionsxAOD::smearElectron(xAOD::TruthParticle& electron) { + const double newE = getElectronSmearedEnergy( electron.e(), electron.eta() ); + const double newE2 = newE*newE; + const double m2 = electron.m() * electron.m(); + const double p2 = newE2 > m2 ? newE2 - m2 : 0.; + TLorentzVector newvec; + newvec.SetPtEtaPhiE( sqrt(p2) / cosh(electron.eta()), electron.eta(), electron.phi(), newE ); + + // no p4 setter in truth particle, have to set one-by-one + electron.setPx( newvec.Px() ); + electron.setPy( newvec.Py() ); + electron.setPz( newvec.Pz() ); + electron.setE( newvec.E() ); + electron.setM( newvec.M() ); +} + +/** + * Get smeared muon momentum from the UpgradePerformanceFunctions and then + * modify the input muon accordingly. Note, the PdgId will be changed + * if the muon smearing results in a charge flip (since the + * TruthParticle->charge() function uses the PdgId). + */ +void UpgradePerformanceFunctionsxAOD::smearMuon(xAOD::TruthParticle& muon) { + double qoverpt = muon.charge()/muon.pt(); + const double sigma_qoverpt = this->getMuonQOverPtResolution(muon.pt(), muon.eta()); + qoverpt += m_randgen.Gaus(0,sigma_qoverpt); + const double pt_smeared = fabs(1.0/qoverpt); + const double q_smeared = (qoverpt > 0) ? 1.0 : -1.0; + TLorentzVector newvec; + newvec.SetPtEtaPhiM( pt_smeared, muon.eta(), muon.phi(), muon.m() ); + + // no p4 setter in truth particle, have to set one-by-one + muon.setPx( newvec.Px() ); + muon.setPy( newvec.Py() ); + muon.setPz( newvec.Pz() ); + muon.setE( newvec.E() ); + muon.setM( newvec.M() ); + // set pdg id (which is used to get charge) + muon.setPdgId( -1.0 * q_smeared * muon.absPdgId()); +} + +/** + * Get smeared jet pT from the UpgradePerformanceFunctions and then + * modify the input jet accordingly. + */ +void UpgradePerformanceFunctionsxAOD::smearJet(xAOD::Jet& jet) { + // can only smear jets with 10 < pT < 1500 GeV (would be good not to hard code this....) + if(jet.pt() < 10.0*1000.0 or jet.pt() > 1500.0*1000.0) return; + + // function might be called 'SmearedEnergy', but apparently it gives smeared pT (https://twiki.cern.ch/twiki/bin/view/AtlasProtected/UpgradePerformanceFunctions) + const double smearedjetpt = this->getJetSmearedEnergy(jet.pt(), jet.eta(), true); + const double smearedjetE = jet.e() * smearedjetpt/jet.pt(); + // lazy way to calculate the mass after pT smearing + TLorentzVector newjet; + newjet.SetPtEtaPhiE( smearedjetpt, jet.eta(), jet.phi(), smearedjetE ); + // jet 4 momentum stored as PtEtaPhiM (see xAODJet/JetTypes.h) + xAOD::JetFourMom_t mom( smearedjetpt, jet.eta(), jet.phi(), newjet.M() ); + jet.setJetP4( mom ); +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeLeptonObjectSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeLeptonObjectSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..547c51402c2e8a01f3e000e19ad673017508ebed --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeLeptonObjectSelector.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: UpgradeLeptonObjectSelector.h +// Description: +// Author: Mark Owen +// Created: 19 Jan 2017 + +#ifndef _TOP_UPGRADE_LEPTONOBJECTSELECTOR_H_ +#define _TOP_UPGRADE_LEPTONOBJECTSELECTOR_H_ + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODTruth/TruthParticleContainer.h" + +namespace top { + + class UpgradeLeptonObjectSelector + : public ObjectSelectorBase<xAOD::TruthParticle> { + public: + // Struct used to store the cut values used by the object selector. It + // is important that the object has a sensible default config because it + // will be default constructed for the trivial constructor of the object + // selector. + struct Options { + Options( double ptMin = 25.e3, + double etaMax = 2.5 ) : + pt_min( ptMin ), + eta_max( etaMax ) {} + double pt_min; + double eta_max; + + }; + public: + UpgradeLeptonObjectSelector( Options opt = Options() ); + virtual bool apply( const xAOD::TruthParticle & truthParticle ); + private: + Options m_opt; + }; + +} + +#endif /* _TOP_UPGRADE_LEPTONOBJECTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeObjectLoader.h b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeObjectLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..49fa5a1efccfacd94919a2323467f59fe3865a30 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradeObjectLoader.h @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TOP_UPGRADEOBJECTLOADER_H_ +#define _TOP_UPGRADEOBJECTLOADER_H_ + +#include "AsgTools/AsgTool.h" + +#include "TopHLUpgrade/UpgradePerformanceFunctionsxAOD.h" +#include "TopParticleLevel/ParticleLevelEvent.h" +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODEgamma/Electron.h" +#include "xAODCore/ShallowCopy.h" + +// Forward Declarations +namespace top { + class TopConfig; +} + +namespace top { + + class UpgradeObjectLoader : public asg::AsgTool { + + public: + + /*! + * @brief Constructor of loader tool. + */ + UpgradeObjectLoader( const std::shared_ptr<top::TopConfig> & cfg ); + + /*! + * @brief Destructor of loader tool. + */ + ~UpgradeObjectLoader( ); + + /*! + * @brief Loading function. Does the actual work. This function will + * load the truth information from the #xaodEvent and return this data + * transformed into a smeared level event. The data stored in the + * SmearedLevel is owned by the truth event loader. + * @param xaodEvent The input data event object. + * @return ParticleLevelEvent object. + */ + ParticleLevelEvent load(); + + /*! + * @brief Function that can be used to test whether the UpgradeObjectLoader + * is active. The loader is set to inactive if the names of the truth + * collections are unavailable. This is determined at construction. + */ + bool active() const { return m_active; } + + private: + + // The global config object + const std::shared_ptr<top::TopConfig> & m_config; + + // pointer to smearing function object + std::unique_ptr<UpgradePerformanceFunctionsxAOD> m_upgrade; + + // Flag denoting whether the loader tool is active. Will be set by the + // constructor and remains unchanged afterwards. + const bool m_active; + + // muons + std::unique_ptr<xAOD::TruthParticleContainer> m_muons; + std::unique_ptr<xAOD::ShallowAuxContainer> m_muonsShallowAux; + std::unique_ptr<xAOD::TruthParticleContainer> m_selectedMuons; + + // electrons + std::unique_ptr<xAOD::TruthParticleContainer> m_electrons; + std::unique_ptr<xAOD::ShallowAuxContainer> m_electronsShallowAux; + std::unique_ptr<xAOD::TruthParticleContainer> m_selectedElectrons; + + // jets + std::unique_ptr<xAOD::JetContainer> m_jets; + std::unique_ptr<xAOD::JetAuxContainer> m_jetsAux; + + // MET + std::unique_ptr<xAOD::MissingETContainer> m_metCont; + std::unique_ptr<xAOD::ShallowAuxContainer> m_metShallowAux; + + // Electron selector tool + std::unique_ptr<ObjectSelectorBase<xAOD::TruthParticle> > m_objectSelector_Electron; + + // Muon selector tool + std::unique_ptr<ObjectSelectorBase<xAOD::TruthParticle> > m_objectSelector_Muon; + + };//class UpgradeObjectLoader + +}//namespace top + +#endif //_TOP_UPGRADEOBJECTLOADER_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradePerformanceFunctionsxAOD.h b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradePerformanceFunctionsxAOD.h new file mode 100644 index 0000000000000000000000000000000000000000..158af7891d6a26f9301e6f0851b2461fb68fc36e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/TopHLUpgrade/UpgradePerformanceFunctionsxAOD.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef UPGRADEPERFORMANCEFUNCTIONSXAOD_H +#define UPGRADEPERFORMANCEFUNCTIONSXAOD_H + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +#include "TRandom3.h" + +#include "xAODTruth/TruthParticle.h" +#include "xAODJet/Jet.h" + +/*! + * @brief Class to use the upgrade performance functions to smear xAOD objects. + * + * The class inherits from UpgradePerformanceFunctions and provides a few functions + * to smear electrons, muons and jets. + * + * @author Mark Owen <markowen@cern.ch> + */ +class UpgradePerformanceFunctionsxAOD : public UpgradePerformanceFunctions { + + public: + + /// Default constructor + UpgradePerformanceFunctionsxAOD(); + + /// Constructor specifing layout & mu + UpgradePerformanceFunctionsxAOD(UpgradeLayout layout, double avgMu); + + /// Destructor + ~UpgradePerformanceFunctionsxAOD() {}; + + /// Smear an Electron + void smearElectron(xAOD::TruthParticle& electron); + + /// Smear a Muon + void smearMuon(xAOD::TruthParticle& muon); + + /// Smear a Jet + void smearJet(xAOD::Jet& jet); + + /// Access to random number generator + inline TRandom3* getRandom3() {return &m_randgen;} + + private: + + TRandom3 m_randgen; + +};//class UpgradePerformanceFunctionsxAOD + +#endif //UPGRADEPERFORMANCEFUNCTIONSXAOD_H diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..85a53e6660af14bff77a0f9a2dc68e6e35da6702 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/cmt/Makefile.RootCore @@ -0,0 +1,60 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopHLUpgrade + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = UpgradePerformanceFunctions TopConfiguration TopEvent xAODTruth xAODJet xAODMissingET TopParticleLevel + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + +# the list of all unit tests that should be called in recursive testing, +# i.e. in unit tests that call other unit tests +# for that unit tests need to pass on all machines, and run very fast +PACKAGE_RECURSIVE_UT = + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..2dd9663462385280cbdeba3553c80534d4e345ab --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt @@ -0,0 +1,54 @@ +# Auto-generated on: 2017-03-08 14:47:37.639679 + +# Declare the name of this package: +atlas_subdir( TopJetSubstructure None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODPrimitives + xAODBase + GeoPrimitives + xAODCaloEvent + xAODJet + xAODBTagging + EventPrimitives + xAODTracking + CaloGeoHelpers + xAODEgamma) + + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# This package uses FastJet: +find_package( FastJet ) +find_package( FastJetContrib ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Build a library that other components can link against: +atlas_add_library( TopJetSubstructure Root/*.cxx Root/*.h Root/*.icc + TopJetSubstructure/*.h TopJetSubstructure/*.icc TopJetSubstructure/*/*.h + TopJetSubstructure/*/*.icc + PUBLIC_HEADERS TopJetSubstructure + LINK_LIBRARIES xAODPrimitives + xAODBase + GeoPrimitives + xAODCaloEvent + xAODJet + xAODBTagging + EventPrimitives + xAODTracking + CaloGeoHelpers + xAODEgamma + ${ROOT_LIBRARIES} + ${FASTJET_LIBRARIES} + ${FASTJETCONTRIB_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + ${FASTJET_INCLUDE_DIRS} + ${FASTJETCONTRIB_INCLUDE_DIRS}) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/ElectronInJetSubtractionAlgorithm.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/ElectronInJetSubtractionAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ef63f2d9adce4cd9cc11655a1338c44d1e52c670 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/ElectronInJetSubtractionAlgorithm.cxx @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronInJetSubtractionAlgorithm.cxx 654856 2015-03-17 19:00:30Z dferreir $ +#include "TopJetSubstructure/ElectronInJetSubtractionAlgorithm.h" + +#include <iostream> + +namespace top{ + + ElectronInJetSubtractionAlgorithm::ElectronInJetSubtractionAlgorithm() : + m_doLooseCuts(false), + m_passPreORSelection("passPreORSelection"), + m_passPreORSelectionLoose("passPreORSelectionLoose") + { + + } + + void ElectronInJetSubtractionAlgorithm::apply( xAOD::ElectronContainer* electrons , xAOD::JetContainer* jets , const bool useLooseElectrons ) + { + std::string leptonDef; + if (!useLooseElectrons){ + leptonDef = m_passPreORSelection; + } + if (useLooseElectrons) { + leptonDef = m_passPreORSelectionLoose; + } + + unsigned int passedElectronsBefore(0); + for (auto e : *electrons) { + if (e->auxdataConst<char>(leptonDef) == 1) { + ++passedElectronsBefore; + } + } + + m_o.Load(jets, electrons, leptonDef); + m_o.AnalyzeEvent(leptonDef); + + unsigned int passedElectrons(0); + for (auto e : *electrons) { + if (e->auxdataConst<char>(leptonDef) == 1) { + ++passedElectrons; + } + } + + bool debug(false); + if (debug) { + std::cout<<"Total number of electrons = "<<electrons->size()<<" that pass cuts = "<<passedElectrons<<"/" << passedElectronsBefore << " :: Total number of jets = "<<jets->size()<<std::endl; + } + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/LargeJetTrimmer.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/LargeJetTrimmer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9ef40ba675d33667fb9a004f742233eb54062823 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/LargeJetTrimmer.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopJetSubstructure/LargeJetTrimmer.h" + +#include "xAODJet/Jet.h" + +#include <fastjet/PseudoJet.hh> +#include <fastjet/ClusterSequence.hh> +#include <fastjet/ClusterSequenceArea.hh> +#include <fastjet/AreaDefinition.hh> +#include <fastjet/contrib/Nsubjettiness.hh> +#include <fastjet/contrib/Njettiness.hh> +#include <fastjet/contrib/NjettinessPlugin.hh> +#include <fastjet/tools/Filter.hh> + +using namespace xAOD; +using namespace fastjet; +using namespace fastjet::contrib; + +top::LargeJetTrimmer::LargeJetTrimmer() { +} + +top::LargeJetTrimmer::~LargeJetTrimmer() { +} + +void top::LargeJetTrimmer::correctJet(xAOD::Jet& jet) { + JetConstituentVector vec = jet.getConstituents(); + std::vector<fastjet::PseudoJet> p_c; + + xAOD::JetConstituentVector::iterator it = vec.begin(); + xAOD::JetConstituentVector::iterator itE = vec.end(); + for( ; it != itE; it++){ + PseudoJet p(0,0,0,0); + float pt = (*it)->pt(); + float y = (*it)->rapidity(); + float phi = (*it)->phi(); + float m = (*it)->m(); + p.reset_PtYPhiM(pt, y, phi, m); + p_c.push_back(p); + } + + JetDefinition jet_def_large = JetDefinition(antikt_algorithm, 1.0, fastjet::E_scheme, fastjet::Best); + ClusterSequence cs_large(p_c, jet_def_large); + std::vector<PseudoJet> ljets = sorted_by_pt(cs_large.inclusive_jets(50e3)); + Filter trimmer(0.3, SelectorPtFractionMin(0.05)); + if (ljets.size() == 0) { + return; + } + PseudoJet tjet = trimmer(ljets[0]); + jet.setJetP4(xAOD::JetFourMom_t(tjet.pt(), tjet.eta(), tjet.phi(), tjet.m())); +} + +void top::LargeJetTrimmer::print(std::ostream& o) const { + o << "LargeJetTrimmer" << std::endl; +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/SubjetMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/SubjetMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..67745de04259fec2f5a2cc3264c919f3e23cf521 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/SubjetMaker.cxx @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopJetSubstructure/SubjetMaker.h" + +#include "xAODJet/Jet.h" + +#include <fastjet/PseudoJet.hh> +#include <fastjet/ClusterSequence.hh> +#include <fastjet/ClusterSequenceArea.hh> +#include <fastjet/AreaDefinition.hh> +#include <fastjet/contrib/Nsubjettiness.hh> +#include <fastjet/contrib/Njettiness.hh> +#include <fastjet/contrib/NjettinessPlugin.hh> +#include <fastjet/tools/Filter.hh> + +using namespace fastjet; +using namespace fastjet::contrib; + +top::SubjetMaker::SubjetMaker() { +} + +top::SubjetMaker::~SubjetMaker() { +} + +void top::SubjetMaker::correctJet(xAOD::Jet& jet) { + //std::cout << "Making Subjets" << std::endl; + xAOD::JetConstituentVector vec = jet.getConstituents(); + std::vector<fastjet::PseudoJet> p_c; + + for(auto it : vec){ + PseudoJet p(0,0,0,0); + float pt = (*it)->pt(); + float y = (*it)->rapidity(); + float phi = (*it)->phi(); + float m = (*it)->m(); + if (y != y) { + continue; + } + else { + p.reset_PtYPhiM(pt, y, phi, m); + p_c.push_back(p); + } + + } + + JetDefinition jet_def_small = JetDefinition(cambridge_algorithm, 0.2, fastjet::E_scheme, fastjet::Best); + ClusterSequence cs_small(p_c, jet_def_small); + std::vector<PseudoJet> ljets = sorted_by_pt(cs_small.inclusive_jets(20e3)); + if (ljets.size() == 0) { + return; + } + std::vector<float> sje,sjpx,sjpy,sjpz; + for (size_t z = 0; z < ljets.size(); ++z) { + sje.push_back(ljets[z].e()); + sjpx.push_back(ljets[z].px()); + sjpy.push_back(ljets[z].py()); + sjpz.push_back(ljets[z].pz()); + } + jet.auxdata<std::vector<float> >("Subjet_E") = sje; + jet.auxdata<std::vector<float> >("Subjet_Px") = sjpx; + jet.auxdata<std::vector<float> >("Subjet_Py") = sjpy; + jet.auxdata<std::vector<float> >("Subjet_Pz") = sjpz; + +} + +void top::SubjetMaker::print(std::ostream& o) const { + o << "SubjetMaker" << std::endl; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TTBarElectronJetOverlap.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TTBarElectronJetOverlap.cxx new file mode 100644 index 0000000000000000000000000000000000000000..99421df6c3fc3615abc284030e72dd7cd09e76ca --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TTBarElectronJetOverlap.cxx @@ -0,0 +1,348 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopJetSubstructure/TTBarElectronJetOverlap.h" + +#include <iostream> +#include <cmath> + +#include "xAODJet/JetContainer.h" +#include "xAODEgamma/ElectronContainer.h" + + +using namespace std; + +void TTBarElectronJetOverlap::Load(xAOD::JetContainer *jets, xAOD::ElectronContainer *electrons, const std::string &leptonDef) { + m_jets = jets; + m_electrons = electrons; + fDebug = false; + + size_t se = m_electrons->size(); + fElClTLVs.resize(se); + fElTLVs.resize(se); + fElGood.resize(se); + + size_t sj = m_jets->size(); + fJetTLVs.resize(sj); + fOrigJetTLVs.resize(sj); + fJetJVFs.resize(sj); + fJetD3PDTrkPtSums.resize(sj); + fJetD3PDTrkPtPVSums.resize(sj); + + for (size_t i = 0; i < sj; i++) { + fJetTLVs[i].SetPtEtaPhiE(m_jets->at(i)->pt(), m_jets->at(i)->eta(), m_jets->at(i)->phi(), m_jets->at(i)->e()); + fOrigJetTLVs[i].SetPtEtaPhiE(m_jets->at(i)->pt(), m_jets->at(i)->eta(), m_jets->at(i)->phi(), m_jets->at(i)->e()); + + //std::vector<float> JVF = m_jets->at(i)->getAttribute<std::vector<float> >("JVF"); + //fJetJVFs[i] = JVF.size() > 0 ? JVF[0] : -1; // (TODO) NOTA BENE: Assumes PV is the first vertex + //std::vector<float> trkPtSumVec = m_jets->at(i)->getAttribute<std::vector<float> >("SumPtTrkPt500"); + //float trkPtSum = trkPtSumVec.size() > 0 ? trkPtSumVec[0] : 0; // (TODO) NOTA BENE: Assumes PV is the first vertex + //fJetD3PDTrkPtSums[i] = fJetJVFs[i] ? trkPtSum/JVF[0] : -1; + //fJetD3PDTrkPtPVSums[i] = trkPtSum; + if (fDebug) { + cout << " - (pre-OR) Jet # " << i << + " Pt Eta Phi: " << + fJetTLVs[i].Pt() << " " << + fJetTLVs[i].Eta() << " " << + fJetTLVs[i].Phi() << endl; + } + } + + for (size_t i = 0; i < se; i++) { + fElGood[i] = m_electrons->at(i)->auxdataConst<char>(leptonDef.c_str()); + + if (m_electrons->at(i)->caloCluster()) { + fElClTLVs[i].SetPtEtaPhiM(m_electrons->at(i)->caloCluster()->e()/std::cosh(m_electrons->at(i)->caloCluster()->eta()), + m_electrons->at(i)->caloCluster()->eta(), m_electrons->at(i)->caloCluster()->phi(), 0.511); + } else { + fElClTLVs[i] = m_electrons->at(i)->p4(); + } + + if (m_electrons->at(i)->trackParticle() && m_electrons->at(i)->caloCluster()) { + fElTLVs[i].SetPtEtaPhiM(m_electrons->at(i)->caloCluster()->e()/std::cosh(m_electrons->at(i)->trackParticle()->eta()), + m_electrons->at(i)->trackParticle()->eta(), m_electrons->at(i)->trackParticle()->phi(), 0.511); + } else { + fElTLVs[i] = m_electrons->at(i)->p4(); + } + if (fDebug) { + cout << " - (pre-OR) El # " << i << + " Pt Eta Phi: " << + fElTLVs[i].Pt() << " " << + fElTLVs[i].Eta() << " " << + fElTLVs[i].Phi() << endl; + } + } +} + +void TTBarElectronJetOverlap::FindAssocEls() { + size_t nJets = m_jets->size(); + fJetAssocElCls = vector<set<int> >(nJets); + size_t nEls = m_electrons->size(); + fElClAssocJet = vector<int>(nEls, -1); + + // find the associated electron clusters in each jet + double drmin, dr; + TLorentzVector elcl, jet; + for (size_t z = 0 ; z < nEls; ++z) { + if (!fElGood[z]) continue; + elcl = fElClTLVs[z]; + drmin = 0.4; + int drmin_idx = -1; + for (size_t y = 0 ; y < nJets; ++y) { + jet = fJetTLVs[y]; + dr = elcl.DeltaR(jet); + // attempt to match the jet to the electron. + if (dr < drmin) { + drmin = dr; + drmin_idx = y; + } + } + if (drmin_idx == -1) + continue; + fJetAssocElCls[drmin_idx].insert(z); + fElClAssocJet[z] = drmin_idx; + } +} + +void TTBarElectronJetOverlap::SubtractEls() { + size_t nJets = m_jets->size(); + size_t nEls = m_electrons->size(); + int ElIdx; + + fSubJets.resize(nJets); + for (int k=0; k<nJets; ++k) { + fSubJets[k] = 0; + } + + for (size_t iJet = 0; iJet < nJets; iJet++) { + TLorentzVector originalJet = fOrigJetTLVs[iJet]; + for (set<int>::iterator iEl = fJetAssocElCls[iJet].begin(); iEl != fJetAssocElCls[iJet].end(); iEl++) { + ElIdx = *iEl; + TLorentzVector elcorr = fElTLVs[ElIdx]; + fJetTLVs[iJet] -= elcorr; + fSubJets[iJet] = 1; + } + } +} + +void TTBarElectronJetOverlap::FindGoodObjects() { + size_t nEls = m_electrons->size(); + fGoodEls = vector<bool>(nEls, true); + + size_t nJets = fJetTLVs.size(); + vector<TLorentzVector> TmpJetTLVs = fJetTLVs; + vector<TLorentzVector> TmpOrigJetTLVs = fOrigJetTLVs; + TLorentzVector el, jet, jetOrig; + + for (size_t iEl = 0; iEl < nEls; iEl++) { + if (!fElGood[iEl]) continue; + + el = fElTLVs[iEl]; + + if (fDebug) { + cout << " - (good) El # " << iEl << + " Pt Eta Phi: " << + el.Pt() << " " << + el.Eta() << " " << + el.Phi() << endl; + } + + for (size_t iJet = 0; iJet < nJets; iJet++) { + jet = fJetTLVs[iJet]; + jetOrig = fOrigJetTLVs[iJet]; + if (fDebug) { + cout << " - (good) Jet # " << iJet << + " Pt Eta Phi M: " << + jet.Pt() << " " << + jet.Eta() << " " << + jet.Phi() << " " << + jet.M() << endl; + } + + //if (jet.Pt() < 25e3) + //continue; + + // New overlap removal procedure: + // subtracted ets failing the pT cut are assumed to be a result of electron energy deposits. Continue to the next jet. + + if ((jetOrig.Pt() >= 30e3 && jetOrig.Pt() < 50e3) && jet.Pt() < 20e3) { + continue; + } else if (( jetOrig.Pt() >= 50e3 && jetOrig.Pt() < 100e3) && jet.Pt() <30e3) { + continue; + } else if ((jetOrig.Pt() >= 100e3 && jetOrig.Pt() < 400e3) && jet.Pt() <90e3) { + continue; + } else if ((jetOrig.Pt() >= 400e3 && jetOrig.Pt() < 800e3) && jet.Pt() <130e3) { + continue; + } else if ((jetOrig.Pt() >= 800e3 && jetOrig.Pt() <1200e3) && jet.Pt() <230e3) { + continue; + } else if ((jetOrig.Pt() >=1200e3 && jetOrig.Pt() <1600e3) && jet.Pt() <700e3) { + continue; + } else if ((jetOrig.Pt() >=1600e3 && jetOrig.Pt() <2000e3) && jet.Pt() < 1250e3) { + continue; + } else if ((jetOrig.Pt() >=2000e3 && jetOrig.Pt()<2200e3) && jet.Pt() < 1300e3) { + continue; + } else if (jetOrig.Pt()>2200e3 && jet.Pt()<1350e3) { + continue; + } + + // if the electron is too close to a subtracted jet... + if (jet.DeltaR(el) < 0.2) { + + if (fDebug) + cout << " El too close to jet. Removing." << endl; + + // remove from good electrons list. + fGoodEls[iEl] = false; + + if (fElClAssocJet[iEl] >= 0) { + // add electron 4-vector back to jet. + TmpJetTLVs[fElClAssocJet[iEl]] += el; + //remove from subtracted jets list + fSubJets[iJet] = 0; + // remove this electron from the association. + fJetAssocElCls[iJet].erase(iEl); + } + } + } + } + + fJetTLVs = TmpJetTLVs; + fOrigJetTLVs = TmpOrigJetTLVs; + fGoodJets = vector<bool>(nJets,true); + + for (size_t iJet = 0; iJet < nJets; iJet++) { + jetOrig = fOrigJetTLVs[iJet]; + + if (jetOrig.Pt() >= 30e3 && jetOrig.Pt() < 50e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 20e3; + } else if (jetOrig.Pt() >= 50e3 && jetOrig.Pt() < 100e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 30e3; + } else if (jetOrig.Pt() >= 100e3 && jetOrig.Pt() < 400e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 90e3; + } else if (jetOrig.Pt() >= 400e3 && jetOrig.Pt() < 800e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 130e3; + } else if (jetOrig.Pt() >= 800e3 && jetOrig.Pt() < 1200e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 230e3; + } else if (jetOrig.Pt() >= 1200e3 && jetOrig.Pt() < 1600e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 700e3; + } else if (jetOrig.Pt() >= 1600e3 && jetOrig.Pt() < 2000e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 1250e3; + } else if (jetOrig.Pt() >= 2000e3 && jetOrig.Pt() < 2200e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 1300e3; + } else if (jetOrig.Pt() > 2200e3) { + fGoodJets[iJet] = fJetTLVs[iJet].Pt() > 1350e3; + } + } +} + +void TTBarElectronJetOverlap::RecalcJVF() { + + size_t nJets = m_jets->size(); + int ElIdx; + //int TrkIdx; + TLorentzVector trk; + + for (size_t iJet = 0; iJet < nJets; iJet++) { + + // if jvf == 0 or -1, no need to recalulate... + if (!fJetJVFs[iJet] || + fJetJVFs[iJet] < 0) + continue; + + for (set<int>::iterator iEl = fJetAssocElCls[iJet].begin(); + iEl != fJetAssocElCls[iJet].end(); iEl++) { + + ElIdx = *iEl; + + trk.SetPtEtaPhiE(m_electrons->at(ElIdx)->trackParticle()->pt(), + m_electrons->at(ElIdx)->trackParticle()->eta(), m_electrons->at(ElIdx)->trackParticle()->phi(), m_electrons->at(ElIdx)->trackParticle()->e()); + + // not in the associated tracks. + bool foundMatch = false; + std::vector<const xAOD::TrackParticle*> jetTracks; + //bool haveJetTracks = m_jets->at(iJet)->getAssociatedObjects(xAOD::JetAttribute::GhostTrack, jetTracks); + for (size_t t = 0; t < jetTracks.size(); ++t) { + TLorentzVector jet_trk; + jet_trk.SetPtEtaPhiE(jetTracks[t]->pt(), jetTracks[t]->eta(), jetTracks[t]->phi(), jetTracks[t]->e()); + if (jet_trk.DeltaR(trk) < 0.01) { + foundMatch = true; + } + } + + if (!foundMatch) + continue; + + // recompute JVF. + fJetD3PDTrkPtSums[iJet] -= trk.Pt(); + + if (std::fabs(std::sin(m_electrons->at(ElIdx)->trackParticle()->theta())*m_electrons->at(ElIdx)->trackParticle()->z0()) < 1.0 && + std::fabs(m_electrons->at(ElIdx)->trackParticle()->d0()) < 1.0) + fJetD3PDTrkPtPVSums[iJet] -= trk.Pt(); + } + + // we subtracted too much for some reason? + if (fJetD3PDTrkPtSums[iJet] < 0 || + fJetD3PDTrkPtPVSums[iJet] < 0) + fJetJVFs[iJet] = 0; + // no tracks associated with the jet. + else if (fJetD3PDTrkPtSums[iJet] == 0) + fJetJVFs[iJet] = -1; + // all good. recalculate JVF. + else + fJetJVFs[iJet] = fJetD3PDTrkPtPVSums[iJet]/fJetD3PDTrkPtSums[iJet]; + } +} + +void TTBarElectronJetOverlap::AnalyzeEvent(const std::string &leptonDef) { + FindAssocEls(); + SubtractEls(); + FindGoodObjects(); + //RecalcJVF(); + + // put the results back in place + size_t se = m_electrons->size(); + size_t sj = m_jets->size(); + for (size_t i = 0; i < sj; i++) { + m_jets->at(i)->setJetP4(xAOD::JetFourMom_t(fJetTLVs[i].Perp(), fJetTLVs[i].Eta(), fJetTLVs[i].Phi(), fJetTLVs[i].M())); + + if (fGoodJets[i]) m_jets->at(i)->auxdata<char>("passesFancyOR") = 1; // Subtracted jets that pass the OR test and are kept. + else m_jets->at(i)->auxdata<char>("passesFancyOR") = 0; + + if (fSubJets[i]==1) m_jets->at(i)->auxdata<char>("subtractedJet") = 1; // Jets close to electrons that undergo the OR test. + else m_jets->at(i)->auxdata<char>("subtractedJet") = 0; + + + //std::vector<float> newJVF; + //newJVF.push_back(fJetJVFs[i]); + //m_jets->at(i)->setAttribute<std::vector<float> >("JVF", newJVF); + if (fDebug) { + cout << " - (final) Jet # " << i << + " Pt Eta Phi M: " << + m_jets->at(i)->pt() << " " << + m_jets->at(i)->eta() << " " << + m_jets->at(i)->phi() << " " << + m_jets->at(i)->m() << " good " << (int) m_jets->at(i)->auxdata<char>(leptonDef.c_str())<< endl; + } + } + + + for (size_t j = 0; j < se; j++) { + if (!fGoodEls[j] || !fElGood[j]) { + m_electrons->at(j)->auxdata<char>(leptonDef.c_str()) = 0; + } else { + m_electrons->at(j)->auxdata<char>(leptonDef.c_str()) = 1; + } + + if (fDebug) { + cout << " - (final) El # " << j << + " Pt Eta Phi M: " << + m_electrons->at(j)->pt() << " " << + m_electrons->at(j)->eta() << " " << + m_electrons->at(j)->phi() << " " << + m_electrons->at(j)->m() << " good " << (int) m_electrons->at(j)->auxdata<char>(leptonDef.c_str()) << endl; + } + } +} + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TopJetSubstructure.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TopJetSubstructure.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d0ab71ef6c220fe734ec1ea134498c175cfc5dbc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/Root/TopJetSubstructure.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopJetSubstructure/TopJetSubstructure.h" + +#include "xAODJet/Jet.h" + +using namespace xAOD; + +top::TopJetSubstructure::TopJetSubstructure() { +} + +top::TopJetSubstructure::~TopJetSubstructure() { +} + +void top::TopJetSubstructure::print(std::ostream& o) const { + o << "TopJetSubstructure empty calss" << std::endl; +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/ElectronInJetSubtractionAlgorithm.h b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/ElectronInJetSubtractionAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..86161df3042d64c7cfea2265de29c9efc387fd85 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/ElectronInJetSubtractionAlgorithm.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronInJetSubtractionAlgorithm.h 654856 2015-03-17 19:00:30Z dferreir $ +#ifndef ANALYSISTOP_TOPJETSUBSTRUCTURE_ELECTRONINJETSUBTRACTIONALGORITHM_H +#define ANALYSISTOP_TOPJETSUBSTRUCTURE_ELECTRONINJETSUBTRACTIONALGORITHM_H + +#include "xAODEgamma/ElectronContainer.h" +#include "xAODJet/JetContainer.h" +#include "TopJetSubstructure/TTBarElectronJetOverlap.h" + +namespace top{ + class ElectronInJetSubtractionAlgorithm final { + public: + ElectronInJetSubtractionAlgorithm(); + virtual ~ElectronInJetSubtractionAlgorithm(){} + + ElectronInJetSubtractionAlgorithm(const ElectronInJetSubtractionAlgorithm& rhs) = delete; + ElectronInJetSubtractionAlgorithm(ElectronInJetSubtractionAlgorithm&& rhs) = delete; + ElectronInJetSubtractionAlgorithm& operator=(const ElectronInJetSubtractionAlgorithm& rhs) = delete; + + void apply( xAOD::ElectronContainer* electrons , xAOD::JetContainer* jets , const bool useLooseElectrons=false ); + + private: + bool m_doLooseCuts; + // Pass selection strings + const std::string m_passPreORSelection; + const std::string m_passPreORSelectionLoose; + + TTBarElectronJetOverlap m_o; + }; +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/LargeJetTrimmer.h b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/LargeJetTrimmer.h new file mode 100644 index 0000000000000000000000000000000000000000..a2e72fea55b66bc89351fcdf642ce196e4eafec5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/LargeJetTrimmer.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARGEJETTRIMMER_H +#define LARGEJETTRIMMER_H + +#include "xAODJet/JetContainer.h" +#include "TopJetSubstructure/TopJetSubstructure.h" + +namespace top { + +/** + * @brief JetCorrection-derived class that trims large-R jets while derivations are not ready. + */ + +class LargeJetTrimmer : public TopJetSubstructure { +public: + LargeJetTrimmer(); + ~LargeJetTrimmer(); + + void correctJet(xAOD::Jet& /*jet*/); + + ///Useful messages on the screen. + void print(std::ostream&) const; + +private: +}; + +} + +#endif + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/SubjetMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/SubjetMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..9bf729325d3664e97a7fd780bca69779d69a8a10 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/SubjetMaker.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SUBJETMAKER_H +#define SUBJETMAKER_H + +#include "xAODJet/JetContainer.h" +#include "TopJetSubstructure/TopJetSubstructure.h" + +namespace top { + +/** + * @brief Derived class that constructs subjets while derivations are not ready. + */ + +class SubjetMaker : public TopJetSubstructure { +public: + SubjetMaker(); + ~SubjetMaker(); + + void correctJet(xAOD::Jet& /*jet*/); + + ///Useful messages on the screen. + void print(std::ostream&) const; + +private: +}; + +} + +#endif + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TTBarElectronJetOverlap.h b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TTBarElectronJetOverlap.h new file mode 100644 index 0000000000000000000000000000000000000000..d3a2c02772b33bee03c0eab0eb11b095a0fbfe69 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TTBarElectronJetOverlap.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef __TTBARELECTRONJETOVERLAP_H__ +#define __TTBARELECTRONJETOVERLAP_H__ + +#include <vector> +#include <set> +#include <utility> +#include "TLorentzVector.h" + +#include "xAODJet/JetContainer.h" +#include "xAODEgamma/ElectronContainer.h" + +class TTBarElectronJetOverlap { + private: + std::vector<TLorentzVector> fJetTLVs; + std::vector<float> fJetJVFs; + std::vector<float> fJetD3PDTrkPtPVSums; + std::vector<float> fJetD3PDTrkPtSums; + + std::vector<bool> fGoodJets; + std::vector<int> fSubJets; + std::vector<std::set<int> > fJetAssocElCls; + + std::vector<TLorentzVector> fElTLVs; + std::vector<TLorentzVector> fOrigJetTLVs; + std::vector<TLorentzVector> fElClTLVs; + std::vector<bool> fElGood; // this registers if the electron passed the object definition + + std::vector<bool> fGoodEls; + std::vector<int> fElClAssocJet; + + bool fDebug; + + void FindAssocEls(); + void SubtractEls(); + void FindGoodObjects(); + void RecalcJVF(); + + + xAOD::JetContainer *m_jets; //! + xAOD::ElectronContainer *m_electrons; //! + + public: + TTBarElectronJetOverlap() : fDebug(false), m_jets(nullptr), m_electrons(nullptr) { + } + + ~TTBarElectronJetOverlap() { } + + void AnalyzeEvent(const std::string &leptonDef); + + // sets the debug level (info will print if set true). + void SetDebug(bool db) { + fDebug = db; + } + + bool GetDebug() { + return fDebug; + } + + // load all anti-kt 0.4 LCTopo jets in the event. + // these variables should correspond to the *corrected* jet + // quantities. Every jet in the D3PD should be passed. + // load selected electrons. + // these variables should only be filled for /selected/ + // electrons (i.e. pass ID and isolation cuts). + void Load(xAOD::JetContainer *jets, xAOD::ElectronContainer *electrons, const std::string &leptonDef); + +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TopJetSubstructure.h b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TopJetSubstructure.h new file mode 100644 index 0000000000000000000000000000000000000000..c9a916c747c536054df12f49f3f0cce9d0a8fe61 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/TopJetSubstructure/TopJetSubstructure.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPJETSUBSTRUCTURE_H +#define TOPJETSUBSTRUCTURE_H + +#include "xAODJet/JetContainer.h" + +namespace top { + +/** + * @brief JetCorrection-derived class that applies a jet substructure action on the object + */ + +class TopJetSubstructure { +public: + TopJetSubstructure(); + ~TopJetSubstructure(); + + virtual void correctJet(xAOD::Jet& /*jet*/) = 0; + + ///Useful messages on the screen. + void print(std::ostream&) const; + +private: +}; + +} + +#endif + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..665426197fd5ac0aa1cc8f81c9cbdd57c0d4454f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/cmt/Makefile.RootCore @@ -0,0 +1,24 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + +PACKAGE = TopJetSubstructure +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = -g +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = -lNsubjettiness +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = xAODPrimitives xAODBase GeoPrimitives xAODCaloEvent xAODJet xAODBTagging EventPrimitives xAODTracking CaloGeoHelpers xAODEgamma Asg_FastJet +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_NOGRID = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 +PACKAGE_REFLEX = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..444d0abb932443cb6c8485273f1de870b40fe275 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt @@ -0,0 +1,74 @@ +# Auto-generated on: 2017-03-08 14:47:37.990954 + +# Declare the name of this package: +atlas_subdir( TopObjectSelectionTools None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODBase + xAODPrimitives + xAODEventInfo + xAODEgamma + xAODMuon + xAODTau + xAODTracking + ElectronPhotonSelectorTools + MuonSelectorTools + TopEvent + TopSystematicObjectMaker + AssociationUtils + TrigConfInterfaces + TrigDecisionTool + TriggerMatchingTool + TrigTauMatching + GoodRunsLists + JetJvtEfficiency + xAODBTaggingEfficiency + JetSubStructureMomentTools + JetSubStructureUtils + JetReclustering ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopObjectSelectionTools _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopObjectSelectionTools Root/*.cxx Root/*.h Root/*.icc + TopObjectSelectionTools/*.h TopObjectSelectionTools/*.icc TopObjectSelectionTools/*/*.h + TopObjectSelectionTools/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopObjectSelectionTools + LINK_LIBRARIES xAODBase + xAODPrimitives + xAODEventInfo + xAODEgamma + xAODMuon + xAODTau + xAODTracking + ElectronPhotonSelectorToolsLib + MuonSelectorToolsLib + TopEvent + TopSystematicObjectMaker + AssociationUtilsLib + TrigConfInterfaces + TrigDecisionToolLib + TriggerMatchingToolLib + TrigTauMatchingLib + GoodRunsListsLib + JetJvtEfficiencyLib + xAODBTaggingEfficiencyLib + JetSubStructureMomentToolsLib + JetSubStructureUtils + JetReclusteringLib + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/AntiMuonMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/AntiMuonMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aee050b03609b73aa818bcf0263f8457ec3420df --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/AntiMuonMC15.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/AntiMuonMC15.h" + +#include "TopEvent/EventTools.h" + +namespace top { + +AntiMuonMC15::AntiMuonMC15(const double ptcut, IsolationBase* /* isolation */) : + m_ptcut(ptcut), + m_muonSelectionTool("CP::MuonSelectionTool") + //m_muonSelectionToolLoose("CP::MuonSelectionToolLoose"), + //m_isolation(isolation) +{ + top::check( m_muonSelectionTool.retrieve() , "Failed to retrieve muonSelectionTool" ); +// top::check( m_muonSelectionToolLoose.retrieve() , "Failed to retrieve muonSelectionToolLoose" ); +} + +bool AntiMuonMC15::passSelection(const xAOD::Muon& mu) const +{ + if (mu.pt() < m_ptcut) + return false; + + ///-- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MCPAnalysisGuidelinesMC15 --/// + if (!m_muonSelectionTool->accept(mu)) + return false; + + + if (mu.energyLossType()!=xAOD::Muon::NotIsolated) return false; + float eloss=0; + bool ok=mu.parameter(eloss,xAOD::Muon::EnergyLoss); + if (ok && eloss>6000) return false; + float etcone20=0,ptvarcone40=0; + ok=mu.isolation(etcone20,xAOD::Iso::etcone20); + if (ok && etcone20/mu.pt()<0.03) return false; + //if (mu.auxdataConst<float>("miniIso")/mu.pt() > .1) return false; + ok=mu.isolation(ptvarcone40,xAOD::Iso::ptvarcone40); + if (ok && ptvarcone40/mu.pt()>0.1) return false; + + return true; +} + +bool AntiMuonMC15::passSelectionLoose(const xAOD::Muon& /*mu*/) const +{ + + // code does not compile without this function + + return true; +} + + void AntiMuonMC15::print(std::ostream& os) const { + os << "AntiMuonMC15\n" + << " * pT > " << m_ptcut << "\n" +// << " * |eta| < " << m_etamax << "\n" +// << " * quality=" << m_quality << " (tight=0, medium=1, loose=2, v.loose=3)\n" + << " * Everything else from muon tool - fill this in?\n"; + +// if (!m_isolation) +// os << " * No isolation requirement\n"; +// else +// m_isolation->print(os); + } + + + +} + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronCutBasedMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronCutBasedMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ce47f1b7edb7e893f3450d303182e9203c4ae397 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronCutBasedMC15.cxx @@ -0,0 +1,80 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/ElectronCutBasedMC15.h" + +namespace top { + +ElectronCutBasedMC15::ElectronCutBasedMC15(double ptcut, bool vetoCrack, const std::string& quality, const std::string& qualityLoose, IsolationBase* isolation) : + m_ptcut(ptcut), + m_vetoCrack(vetoCrack), + m_quality(quality), + m_qualityLoose(qualityLoose), + m_isolation(isolation) +{ +} + +bool ElectronCutBasedMC15::passSelection(const xAOD::Electron& el) const { + + if (!passSelectionNoIsolation(el, m_quality)) + return false; + + if (m_isolation && !m_isolation->passSelection(el)) + return false; + + return true; +} + +bool ElectronCutBasedMC15::passSelectionLoose(const xAOD::Electron& el) const { + + if (!passSelectionNoIsolation(el, m_qualityLoose)) + return false; + + if (m_isolation && !m_isolation->passSelectionLoose(el)) + return false; + + return true; +} + +bool ElectronCutBasedMC15::passSelectionNoIsolation(const xAOD::Electron& el, const std::string& quality) const { + // if (el.author() != xAOD::EgammaParameters::AuthorElectron && el.author() != xAOD::EgammaParameters::AuthorSofte) + // return false; + + if (el.pt() < m_ptcut) + return false; + + // This will be replaced with the proper AsgElectronIsEMSelector + // Once the calib files are on afs (cvmfs?) - not there yet..... + if (!el.passSelection(quality)) + return false; + + //WARNING: Not all electrons keep clusters in the derivation + //i.e. bad electrons (which is why we moved the check on the quality + //before the check on the calo cluster) + //Good electrons should always have a cluster, if not then crash to warn us + //Better than checking and silently doing nothing... + //This stops a crash + if (std::fabs(el.caloCluster()->etaBE(2)) > 2.47) + return false; + + if (m_vetoCrack && std::fabs(el.caloCluster()->etaBE(2)) > 1.37 && std::fabs(el.caloCluster()->etaBE(2)) < 1.52) + return false; + + return true; +} + +void ElectronCutBasedMC15::print(std::ostream& os) const { + os << "ElectronCutBasedMC15\n"; + os << " * pT > " << m_ptcut << "\n"; + os << " * Currently disabled --- |cluster_eta| < 2.47 \n"; + os << " * Veto 1.37 < |cluster_eta| < 1.52? " << std::boolalpha << m_vetoCrack << "\n"; + os << " * Quality " << m_quality << "\n"; + + if (!m_isolation) + os << " * No isolation requirement\n"; + else + m_isolation->print(os); +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b8bf1093b8eda3c2cf170977ef89792c2c370a6e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx @@ -0,0 +1,210 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/ElectronLikelihoodMC15.h" +#include "TopEvent/EventTools.h" +#include "ElectronPhotonSelectorTools/AsgElectronChargeIDSelectorTool.h" +#include <iostream> + +namespace top { + + ElectronLikelihoodMC15::ElectronLikelihoodMC15(const double ptcut, const bool vetoCrack, const std::string& operatingPoint, + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut) : + m_ptcut(ptcut), + m_vetoCrack(vetoCrack), + m_operatingPoint("SetMe"), + m_operatingPointLoose("SetMe"), + m_operatingPoint_DF("SetMe"), + m_operatingPointLoose_DF("SetMe"), + m_isolation(isolation), + m_applyTTVACut(applyTTVACut), + m_applyChargeIDCut(false) + { + /** Egamma use different naming styles for the likelihood in: + * Trigger = HLT_e24_lhmedium_iloose_L1EM20VH HLT_e60_lhmedium + * Derivation Framework = DFCommonElectronsLHMedium + * ElectronPhotonSelectionTools (the LLH tools) = ElectronLikelihoodMediumOfflineConfig2015.conf + * Trigger SF = efficiencySF.e24vhi_medium1_e60_medium1.MediumLLH.2015.13TeV.rel20p0.v02.root + * Trigger SF = efficiencySF.AnyElectronTrigger.MediumLH.2015.13TeV.rel20p0.v01.root + * ID SF = efficiencySF.offline.MediumLH.2015.13TeV.rel20p0.v01.root + * + * It's a bit of a mess + */ + + std::string egammaNamesAreNotConsistantAnywhere("LikelihoodNotSetProperly"); + std::string egammaNamesAreNotConsistantAnywhereLoose("LikelihoodNotSetProperly"); + + if (operatingPoint == "LooseLH") {egammaNamesAreNotConsistantAnywhere = "DFCommonElectronsLHLoose";} + if (operatingPoint == "LooseAndBLayerLH") {egammaNamesAreNotConsistantAnywhere = "DFCommonElectronsLHLoose";} + if (operatingPoint == "MediumLH") {egammaNamesAreNotConsistantAnywhere = "DFCommonElectronsLHMedium";} + if (operatingPoint == "TightLH") {egammaNamesAreNotConsistantAnywhere = "DFCommonElectronsLHTight";} + + if (operatingPointLoose == "LooseLH") {egammaNamesAreNotConsistantAnywhereLoose = "DFCommonElectronsLHLoose";} + if (operatingPointLoose == "LooseAndBLayerLH") {egammaNamesAreNotConsistantAnywhereLoose = "DFCommonElectronsLHLoose";} + if (operatingPointLoose == "MediumLH") {egammaNamesAreNotConsistantAnywhereLoose = "DFCommonElectronsLHMedium";} + if (operatingPointLoose == "TightLH") {egammaNamesAreNotConsistantAnywhereLoose = "DFCommonElectronsLHTight";} + + m_operatingPoint_DF = egammaNamesAreNotConsistantAnywhere; + m_operatingPointLoose_DF = egammaNamesAreNotConsistantAnywhereLoose; + m_operatingPoint = operatingPoint; + m_operatingPointLoose = operatingPointLoose; + + // currently implemented only for this working point + if (m_operatingPoint == "MediumLH" && m_isolation->tightLeptonIsolation() == "FixedCutTight") + m_applyChargeIDCut = true; + } + + ElectronLikelihoodMC15::ElectronLikelihoodMC15(const bool, + const double ptcut, const bool vetoCrack, const std::string& operatingPoint, + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut) : + ElectronLikelihoodMC15::ElectronLikelihoodMC15(ptcut, vetoCrack, operatingPoint, + operatingPointLoose, isolation, applyTTVACut) {} + + bool ElectronLikelihoodMC15::passSelection(const xAOD::Electron& el) const { + if (!passSelectionNoIsolation(el, m_operatingPoint_DF, m_operatingPoint)) + return false; + + if (m_isolation && !m_isolation->passSelection(el)) + return false; + + return true; + } + + bool ElectronLikelihoodMC15::passSelectionLoose(const xAOD::Electron& el) const { + if (!passSelectionNoIsolation(el, m_operatingPointLoose_DF, m_operatingPointLoose)) + return false; + + if (m_isolation && !m_isolation->passSelectionLoose(el)) + return false; + + return true; + } + + bool ElectronLikelihoodMC15::passSelectionNoIsolation(const xAOD::Electron& el, const std::string& operatingPoint_DF, const std::string& operatingPoint) const { + + if (el.pt() < m_ptcut) + return false; + + // removing bad electron cluser - see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EGammaIdentificationRun2#Bad_Electron_Photon_Cluster + if( !el.isGoodOQ(xAOD::EgammaParameters::BADCLUSELECTRON) ) return false; + + try { + if (el.auxdataConst<int>(operatingPoint_DF) != 1) + return false; + } catch(std::exception& e) { + if (el.auxdataConst<char>(operatingPoint_DF) != 1) + return false; + } + + + if(operatingPoint == "LooseAndBLayerLH"){ + + if(!passBLayerCuts(el)) + return false; + + } + + //WARNING: Not all electrons keep clusters in the derivation + //i.e. bad electrons (which is why we moved the check on the likelihood + //before the check on the calo cluster) + //This stops a crash + //Good electrons should always have a cluster, if not then crash to warn us + //Better than checking and silently doing nothing... + if (std::fabs(el.caloCluster()->etaBE(2)) > 2.47) + return false; + + if (m_vetoCrack && std::fabs(el.caloCluster()->etaBE(2)) > 1.37 && std::fabs(el.caloCluster()->etaBE(2)) < 1.52) + return false; + + // Track-to-vertex association + if (m_applyTTVACut){ + if (!passTTVACuts(el)) + return false; + } + + // Electron Charge ID Selector Tool + // apply decoration only + if (m_applyChargeIDCut && !passChargeIDCut(el)) + el.auxdecor<char>("passChargeID") = 0; + else + el.auxdecor<char>("passChargeID") = 1; + + return true; + } + +bool ElectronLikelihoodMC15::passBLayerCuts(const xAOD::Electron& el) const +{ + + // this is taken from ElectronPhotonSelectorTools/Root/AsgElectronLikelihoodTool.cxx + const xAOD::TrackParticle* t = el.trackParticle(); + + if (!t) return false; + + uint8_t expectBlayer(true); + uint8_t nBlayerHits(0); + uint8_t nBlayerOutliers(0); + + t -> summaryValue(expectBlayer, xAOD::expectBLayerHit); + t -> summaryValue(nBlayerHits, xAOD::numberOfBLayerHits); + t -> summaryValue(nBlayerOutliers, xAOD::numberOfBLayerOutliers); + + if(expectBlayer && (nBlayerHits+nBlayerOutliers) < 1) return false; + else return true; + +} + +bool ElectronLikelihoodMC15::passTTVACuts(const xAOD::Electron& el) const +{ + + // TTVA: + // see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TrackingCPEOYE2015#Track_to_Vertex_Association + if( !el.isAvailable<float>("d0sig") ){ + std::cout << "d0 significance not found for electron. " + << "Maybe no primary vertex? Won't accept." << std::endl; + return false; + } + + float d0sig = el.auxdataConst<float>("d0sig"); + if( std::abs(d0sig) >= 5 ) + return false; + + if( !el.isAvailable<float>("delta_z0_sintheta") ){ + std::cout << "delta z0*sin(theta) not found for electron. " + << "Maybe no primary vertex? Won't accept." << std::endl; + return false; + } + + float delta_z0_sintheta = el.auxdataConst<float>("delta_z0_sintheta"); + if( std::abs(delta_z0_sintheta) >= 0.5 ) + return false; + + return true; + +} + +bool ElectronLikelihoodMC15::passChargeIDCut(const xAOD::Electron& el) const +{ + + // Electron Charge ID Selector Tool + // see https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ElectronChargeFlipTaggerTool + if ( asg::ToolStore::contains<AsgElectronChargeIDSelectorTool> ("ECIDS_medium") ) { + AsgElectronChargeIDSelectorTool* electronChargeIDSelectorTool = asg::ToolStore::get<AsgElectronChargeIDSelectorTool> ("ECIDS_medium"); + if (!electronChargeIDSelectorTool->accept(el)) return false; + } + return true; +} + + void ElectronLikelihoodMC15::print(std::ostream& os) const { + os << "ElectronLikelihoodMC15\n"; + os << " * pT > " << m_ptcut << "\n"; + os << " * Currently disabled --- |cluster_eta| < 2.47 \n"; + os << " * Veto 1.37 < |cluster_eta| < 1.52? " << std::boolalpha << m_vetoCrack << "\n"; + if (!m_isolation) { + os << " * No isolation requirement\n"; + } else { + m_isolation->print(os); + } + os << " * LH Tool Operating Point: " << m_operatingPoint_DF << " \t\t LH Tool Loose Operating Point: " <<m_operatingPointLoose_DF << " \n"; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a4aed6c324cf7fb44911ddef60a0138d630632f0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronSelectionBase.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/ElectronSelectionBase.h" + +#include <iostream> + +namespace top { + +ElectronSelectionBase::ElectronSelectionBase() { +} + +ElectronSelectionBase::~ElectronSelectionBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::ElectronSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/EventCleaningSelection.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/EventCleaningSelection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f5c228878c0ee0f8b063b8edcfca9924b00ab81a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/EventCleaningSelection.cxx @@ -0,0 +1,478 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: EventCleaningSelection.cxx 802748 2017-04-11 20:29:03Z iconnell $ +#include "TopObjectSelectionTools/EventCleaningSelection.h" +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODTracking/VertexContainer.h" + + +#include <sstream> +#include <list> + +namespace top { + + EventCleaningSelection::EventCleaningSelection( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_grlTool("GoodRunsListSelectionTool"), + + m_trigConfTool("TrigConf::xAODConfigTool"), + m_trigDecisionTool("Trig::TrigDecisionTool"), + m_trigMatchTool("Trig::MatchingTool"), + m_trigMatchTauTool("Trig::TrigTauMatchingTool"), + + m_vetoEventsTrigger(false), + m_vetoEventsGRL(false), + m_vetoEventsGoodCalo(false), + m_vetoEventsPriVtx(false) { + declareProperty( "config" , m_config ); + + declareProperty( "GRLTool" , m_grlTool ); + + declareProperty( "TrigConfigTool", m_trigConfTool ); + declareProperty( "TrigDecisionTool", m_trigDecisionTool ); + declareProperty( "TrigMatchTool", m_trigMatchTool ); + declareProperty( "TrigMatchTauTool" , m_trigMatchTauTool ); + } + + StatusCode EventCleaningSelection::initilize() + { + // If running on a Truth DxAOD we don't need anything so + // just return successfully... + if (m_config->isTruthDxAOD()) return StatusCode::SUCCESS; + + top::check( m_trigConfTool.retrieve() , "Failed to retrieve TrigConfTool" ); + top::check( m_trigDecisionTool.retrieve() , "Failed to retrieve TrigDecisionTool" ); + top::check( m_trigMatchTool.retrieve(), + "Failed to retrieve trigger matching tool"); + if (m_config->useTaus()) + top::check(m_trigMatchTauTool.retrieve(), + "Failed to retrieve TrigMatchTauTool" ); + + if (!m_config->isMC()) { + top::check( m_grlTool.retrieve() , "Failed to retrieve TrigDecisionTool" ); + } + + return StatusCode::SUCCESS; + } + + void EventCleaningSelection::setEventSelections( const std::vector<top::SelectionConfigurationData>& selections ) + { + std::list<std::string> tmpAllTriggers; + + m_allTriggers.clear(); + m_electronTriggers.clear(); + m_muonTriggers.clear(); + m_tauTriggers.clear(); + + // Trigger maps for TopConfig - to be used by individual selectors + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> allTriggers_perSelector + ( new std::unordered_map<std::string,std::vector<std::string>> ); + + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> electronTriggers_perSelector + ( new std::unordered_map<std::string,std::vector<std::string>> ); + + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> muonTriggers_perSelector + ( new std::unordered_map<std::string,std::vector<std::string>> ); + + std::shared_ptr<std::unordered_map<std::string,std::vector<std::string>>> tauTriggers_perSelector + ( new std::unordered_map<std::string,std::vector<std::string>> ); + + + // Loop over all selections + m_vetoEventsTrigger = true; + m_vetoEventsGRL = true; + m_vetoEventsGoodCalo = true; + m_vetoEventsPriVtx = true; + + for (auto sel : selections) { + + std::list<std::string> listAllTriggers_thisSelector; + std::vector<std::string> allTriggers_thisSelector; + std::vector<std::string> electronTriggers_thisSelector; + std::vector<std::string> muonTriggers_thisSelector; + std::vector<std::string> tauTriggers_thisSelector; + + // Loop over cut names and look for TRIGDEC, GRL, GOODCALO, PRIVTX + bool selectionHasTriggerCut(false),selectionHasGRLCut(false); + bool selectionHasGOODCALOCut(false),selectionHasPRIVTXCut(false); + for (auto cut : sel.m_cutnames) { + + if (cut.find("GRL") != std::string::npos) { + selectionHasGRLCut = true; + } + + if (cut.find("GOODCALO") != std::string::npos) { + selectionHasGOODCALOCut = true; + } + + if (cut.find("PRIVTX") != std::string::npos) { + selectionHasPRIVTXCut = true; + } + + if (cut.find("TRIGDEC") != std::string::npos) { + selectionHasTriggerCut = true; + ATH_MSG_INFO("Triggers for Selection \t"<<sel.m_name<<"\tare "<<cut); + + //split the trigger string at spaces + std::stringstream ss(cut); + std::string item; + char delim = ' '; + while (std::getline(ss, item, delim)) { + if (item.size() > 0 && item.find("TRIGDEC") == std::string::npos) { + tmpAllTriggers.push_back(item); + listAllTriggers_thisSelector.push_back(item); + } + } + tmpAllTriggers.sort(); + tmpAllTriggers.unique(); + listAllTriggers_thisSelector.sort(); + listAllTriggers_thisSelector.unique(); + + // Turn list into vector + for (auto trigger : listAllTriggers_thisSelector) { + allTriggers_thisSelector.push_back( trigger ); + } + // Split triggers into electron, muon and tau + for (const auto& trigger : allTriggers_thisSelector) { + if ( (trigger.find("HLT_e") != std::string::npos) || (trigger.find("HLT_2e") != std::string::npos) ) { + electronTriggers_thisSelector.push_back(trigger); + } + if ( (trigger.find("HLT_mu") != std::string::npos) || (trigger.find("HLT_2mu") != std::string::npos) || (trigger.find("_mu") != std::string::npos) ) { + muonTriggers_thisSelector.push_back(trigger); + } + if ( (trigger.find("_tau") != std::string::npos) ) { + tauTriggers_thisSelector.push_back(trigger); + } + } + + allTriggers_perSelector->insert( std::make_pair( sel.m_name , allTriggers_thisSelector ) ); + electronTriggers_perSelector->insert( std::make_pair( sel.m_name , electronTriggers_thisSelector ) ); + muonTriggers_perSelector->insert( std::make_pair( sel.m_name , muonTriggers_thisSelector ) ); + tauTriggers_perSelector->insert( std::make_pair( sel.m_name , tauTriggers_thisSelector ) ); + + } // Cut requested is TRIGDEC + } // Loop over all cuts + + if (!selectionHasGRLCut) { + m_vetoEventsGRL = false; + } + + if (!selectionHasGOODCALOCut) { + m_vetoEventsGoodCalo = false; + } + + if (!selectionHasPRIVTXCut) { + m_vetoEventsPriVtx = false; + } + + if (!selectionHasTriggerCut) { + m_vetoEventsTrigger = false; + ATH_MSG_INFO("Selection "<<sel.m_name<<" Does not request a trigger. No event veto will be applied"); + } + } // Loop over all selections + + // Turn list into vector + for (auto trigger : tmpAllTriggers) { + m_allTriggers.push_back( trigger ); + } + + ATH_MSG_INFO("All requested triggers are:"); + for (const auto& trigger : m_allTriggers) { + ATH_MSG_INFO(" "<<trigger); + } + + std::string outputInfoString("True"); + if (!m_vetoEventsTrigger) { + outputInfoString = "False"; + } + ATH_MSG_INFO("Apply event veto on trigger decision = "<<outputInfoString); + + // Split triggers into electron, muon and tau + for (const auto& trigger : m_allTriggers) { + if ( (trigger.find("HLT_e") != std::string::npos) || (trigger.find("HLT_2e") != std::string::npos) ) { + m_electronTriggers.push_back(trigger); + } + if ( (trigger.find("HLT_mu") != std::string::npos) || (trigger.find("HLT_2mu") != std::string::npos) || (trigger.find("_mu") != std::string::npos) ) { + m_muonTriggers.push_back(trigger); + } + if ( (trigger.find("_tau") != std::string::npos) ) { + m_tauTriggers.push_back(trigger); + } + } + + // Tell TopConfig about the triggers + m_config->allTriggers( allTriggers_perSelector ); + m_config->electronTriggers( electronTriggers_perSelector ); + m_config->muonTriggers( muonTriggers_perSelector ); + m_config->tauTriggers( tauTriggers_perSelector ); + + // If the user has requested that all events are saved, then we'd better turn off the vetos + if (!m_config->saveOnlySelectedEvents()) { + m_vetoEventsGRL = false; + m_vetoEventsGoodCalo = false; + m_vetoEventsTrigger = false; + } + + } + + bool EventCleaningSelection::applyGRL() const + { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + ///-- Apply GRL to data --/// + char passGRL(1); + if (!m_config->isMC() && asg::ToolStore::contains<IGoodRunsListSelectionTool> ("GoodRunsListSelectionTool")) { + if (!m_grlTool->passRunLB( *eventInfo )) { + passGRL = 0; + } + } + eventInfo->auxdecor<char>("AnalysisTop_GRL") = passGRL; + + // Do we veto events? Only if ALL selectors request GRL and GRL fails + if (m_vetoEventsGRL) { + if (passGRL == 1) { + return true; + } + if (passGRL == 0) { + return false; + } + } + + // otherwise, we don't veto the event + return true; + } + + bool EventCleaningSelection::applyGoodCalo() const + { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + ///-- Apply GoodCalo tests to data --/// + ///-- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PhysicsAnalysisWorkBookRel20CPRec --/// + char passGoodCalo(1); + if (!m_config->isMC()) { + bool badTile(false), badLAr(false), badSCT(false), incompleteEvent(false); + + ///-- Remove bad events due to problems in TileCal --/// + if (eventInfo->errorState(xAOD::EventInfo::Tile)==xAOD::EventInfo::Error) { + badTile = true; + } + + ///-- Remove bad events due to problems in LAr --/// + if (eventInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error) { + badLAr = true; + } + + // <tom.neep@cern.ch> Technically not the Calo, but this is easier :) + if (eventInfo->errorState(xAOD::EventInfo::SCT) == xAOD::EventInfo::Error) { + badSCT = true; + } + + // <tom.neep@cern.ch> Technically not the Calo (volume 2), but this is easier :) + if (eventInfo->isEventFlagBitSet(xAOD::EventInfo::Core, 18)) { + incompleteEvent = true; + } + + if (badTile || badLAr || badSCT || incompleteEvent) { + passGoodCalo = 0; + } + } + eventInfo->auxdecor<char>("AnalysisTop_GOODCALO") = passGoodCalo; + + // Do we veto events? Only if ALL selectors request GOODCALO and GOODCALO fails + if (m_vetoEventsGoodCalo) { + if (passGoodCalo == 1) { + return true; + } + if (passGoodCalo == 0) { + return false; + } + } + + // otherwise, we don't veto the event + return true; + } + + bool EventCleaningSelection::applyPrimaryVertex() const + { + ///-- https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/InDetTrackingPerformanceGuidelines#Vertexing --/// + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + const xAOD::VertexContainer* vertices(nullptr); + top::check(evtStore()->retrieve(vertices,m_config->sgKeyPrimaryVertices()), "Failed to retrieve Primary Vertices"); + + char passPriVtx(0); + float pri_vtx_z(0); + + for (auto vtx : *vertices) { + if (vtx->vertexType() == xAOD::VxType::PriVtx) { + passPriVtx = 1; + pri_vtx_z = vtx->z(); + break; // No need to loop over all vertices, we only need one + } + } + eventInfo->auxdecor<char>("AnalysisTop_PRIVTX") = passPriVtx; + if( passPriVtx == 1 ) + eventInfo->auxdecor<float>("AnalysisTop_PRIVTX_z_position") = pri_vtx_z; + + // Do we veto events? Only if ALL selectors request PRIVTX and PRIVTX fails + if (m_vetoEventsPriVtx) { + if (passPriVtx == 1) { + return true; + } + if (passPriVtx == 0) { + return false; + } + } + + // otherwise, we don't veto the event + return true; + } + + bool EventCleaningSelection::applyTrigger() + { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + + bool orOfAllTriggers(false); + for (const auto& trigger : m_allTriggers) { + //decorating event with trigger decision + bool passThisTrigger = m_trigDecisionTool->isPassed(trigger); + char decoration = passThisTrigger ? 1 : 0; + eventInfo->auxdecor<char>( "TRIGDEC_" + trigger ) = decoration; + orOfAllTriggers |= passThisTrigger; + + //decorating event with trigger prescale (on Data) + if (!m_config->isMC()) { + auto cg = m_trigDecisionTool->getChainGroup(trigger); + float prescale = cg->getPrescale(); + eventInfo->auxdecor<float>( "TRIGPS_" + trigger ) = prescale; + } + } + + // match offline objects to trigger + if (m_config->useElectrons()) matchElectrons(); + if (m_config->useMuons()) matchMuons(); + if (m_config->useTaus()) matchTaus(); + + // Do we veto events? Only if ALL selectors request TRIGDEC and no trigger passes + if (m_vetoEventsTrigger) { + return orOfAllTriggers; + } + + // otherwise, we don't veto the event + return true; + } + + void EventCleaningSelection::matchElectrons() + { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + // Take muons from input file. Decorate these before doing any calibration/shallow copies + const xAOD::ElectronContainer* electrons(nullptr); + top::check(evtStore()->retrieve(electrons,m_config->sgKeyElectrons()),"Failed to retrieve electrons"); + + // Loop over muons + for (const auto* el : *electrons) { + // Loop over muon triggers + for (const auto& trigger : m_electronTriggers) { + bool match(false); + // Match even if event fails trigger decistion - it's important in case of pre-scaled menus + if (el->isAvailable<char>(m_config->getDerivationStream() + "_" + trigger)) { + match = el->auxdataConst<char>( m_config->getDerivationStream() + "_" + trigger); + } else { + match = m_trigMatchTool->match(*el, trigger); + } + char decoration = match ? 1 : 0; + el->auxdecor<char>("TRIGMATCH_" + trigger ) = decoration; + } + } + } + + void EventCleaningSelection::matchMuons() + { + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()),"Failed to retrieve EventInfo"); + + // Take muons from input file. Decorate these before doing any calibration/shallow copies + const xAOD::MuonContainer* muons(nullptr); + top::check(evtStore()->retrieve(muons,m_config->sgKeyMuons()),"Failed to retrieve muons"); + + // Loop over muons + for (const auto* mu : *muons) { + // Loop over muon triggers + for (const auto& trigger : m_muonTriggers) { + bool match(false); + // Match even if event fails trigger decistion - it's important in case of pre-scaled menus + if (mu->isAvailable<char>(m_config->getDerivationStream() + "_" + trigger)) { + match = mu->auxdataConst<char>(m_config->getDerivationStream() + "_" + trigger); + } else { + match = m_trigMatchTool->match(*mu, trigger); + } + char decoration = match ? 1 : 0; + mu->auxdecor<char>("TRIGMATCH_" + trigger ) = decoration; + } + } + } + + void EventCleaningSelection::matchTaus() + { + + const xAOD::EventInfo* eventInfo(nullptr); + top::check(evtStore()->retrieve(eventInfo,m_config->sgKeyEventInfo()), + "Failed to retrieve EventInfo"); + + // Take taus from input file. + // Decorate these before doing any calibration/shallow copies + const xAOD::TauJetContainer* taus(nullptr); + top::check(evtStore()->retrieve(taus,m_config->sgKeyTaus()), + "Failed to retrieve taus"); + + // Loop over taus + for (const auto* tau : *taus) { + // Loop over tau triggers + for (const auto& trigger : m_tauTriggers) { + bool match(false); + // Match even if event fails trigger decistion - it's important in case of pre-scaled menus + match = m_trigMatchTauTool->match(tau, trigger); + if (tau->isAvailable<char>(m_config->getDerivationStream() + "_" + trigger)) { + match = tau->auxdataConst<char>(m_config->getDerivationStream() + "_" + trigger); + } else { + match = m_trigMatchTool->match(*tau, trigger); + } + char decoration = match ? 1 : 0; + tau->auxdecor<char>("TRIGMATCH_" + trigger ) = decoration; + } + } + } + + void EventCleaningSelection::addExtraBranches( std::vector<std::string>& extraBranchList) { + + for (const auto& trigger : m_allTriggers) + extraBranchList.push_back( "TRIGDEC_" + trigger ); + + } + + void EventCleaningSelection::printTriggers() const + { + // printout all HLT chains + // Debug only - this is very verbose + m_trigConfTool->chainList()->print("",10); + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/IsolationTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/IsolationTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..43345d31a4a4ba47ccd407220c29563d915fb14a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/IsolationTools.cxx @@ -0,0 +1,181 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/IsolationTools.h" + +#include "TopEvent/EventTools.h" +#include "xAODEgamma/Photon.h" +#include "xAODEgamma/Electron.h" +#include "xAODMuon/Muon.h" + +namespace top { + +IsolationBase::IsolationBase() { +} + +IsolationBase::~IsolationBase() { +} + + +AbsoluteIsolationDC14::AbsoluteIsolationDC14(const xAOD::Iso::IsolationType type, double cutvalue) : + m_type(type), + m_cutvalue(cutvalue) { +} + +bool AbsoluteIsolationDC14::passSelection(const xAOD::IParticle& p) const { + //electrons + if (p.type() == xAOD::Type::Electron) { + float iso = 0.; + const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(&p); + bool exists = el->isolationValue(iso, m_type); + return exists && iso > m_cutvalue; + } + + //muons + if (p.type() == xAOD::Type::Muon) { + float iso = 0.; + const xAOD::Muon* mu = dynamic_cast<const xAOD::Muon*>(&p); + bool exists = mu->isolation(iso, m_type); + return exists && iso > m_cutvalue; + } + + std::cout << "IsolationDC14::Not an electron or muon" << std::endl; + exit(1); + + //should never happen (famous last words for a comment, no?) + return false; +} + +///Implement me! +bool AbsoluteIsolationDC14::passSelectionLoose(const xAOD::IParticle& /*p*/) const { + return true; +} + +void AbsoluteIsolationDC14::print(std::ostream& os) const { + os << " * AbsoluteIsolationDC14\n"; + os << " * " << m_type << " > " << m_cutvalue << " MeV\n"; + //missing in xaodprimities-00-00-02 os << " * " << xAOD::Iso::toString(m_type) << " > " << m_cutvalue << " MeV\n"; +} + + + +RelativePTVarCone::RelativePTVarCone(unsigned int size, double fraction, unsigned int sizeLoose, double fractionLoose) : + m_fraction(fraction), + m_fractionLoose(fractionLoose) { + + if (size != 20 && size != 30 && size != 40) { + std::cout << "ptvarcone only supports cone sizes of 20, 30, 40" << std::endl; + std::cout << "and you asked for " << size << ". why?" << std::endl; + exit(1); + } + + std::stringstream ss; + ss << "ptvarcone" << size; + m_size = ss.str(); + + ss.str(""); + ss << "ptvarcone" << sizeLoose; + m_sizeLoose = ss.str(); +} + +bool RelativePTVarCone::passSelection(const xAOD::IParticle& p) const { + return (p.auxdataConst<float>(m_size) / p.pt() < m_fraction); +} + +bool RelativePTVarCone::passSelectionLoose(const xAOD::IParticle& p) const { + return (p.auxdataConst<float>(m_sizeLoose) / p.pt() < m_fractionLoose); +} + +void RelativePTVarCone::print(std::ostream& os) const { + os << " * RelativePTVarCone\n"; + os << " * " << m_size << " /pT > " << m_fraction << "\n"; +} + + +ApproxPTVarCone::ApproxPTVarCone(double fraction, double fractionLoose) : + m_fraction(fraction), + m_fractionLoose(fractionLoose) { +} + +bool ApproxPTVarCone::passSelection(const xAOD::IParticle& p) const { + return (p.auxdataConst<float>("miniIso") / p.pt() < m_fraction); +} + +bool ApproxPTVarCone::passSelectionLoose(const xAOD::IParticle& p) const { + return (p.auxdataConst<float>("miniIso") / p.pt() < m_fractionLoose); +} + +void ApproxPTVarCone::print(std::ostream& os) const { + os << " * Approximate Mini Isolation\n"; + os << " * iso/pT > " << m_fraction << "\n"; +} + + + +StandardIsolation::StandardIsolation(const std::string& tightLeptonIsolation,const std::string& looseLeptonIsolation) : + m_tightLeptonDecoration("AnalysisTop_Isol_"+tightLeptonIsolation), + m_looseLeptonDecoration("AnalysisTop_Isol_"+looseLeptonIsolation), + m_doTightIsolation(true), + m_doLooseIsolation(true) +{ + if (tightLeptonIsolation == "None") + m_doTightIsolation = false; + + if (looseLeptonIsolation == "None") + m_doLooseIsolation = false; +} + +bool StandardIsolation::passSelection(const xAOD::IParticle& p) const +{ + // Are we doing isolation? + if (!m_doTightIsolation) + return true; + + // If we get this far then we are doing isolation + if ( p.type() == xAOD::Type::Photon || + p.type() == xAOD::Type::Electron || + p.type() == xAOD::Type::Muon ) + { + if (p.isAvailable<char>(m_tightLeptonDecoration)) { + if (p.auxdataConst<char>(m_tightLeptonDecoration) == 1) { + return true; + } + } + } + + // Not a photon, electron or muon? + // Didn't pass isolation? + return false; +} + +bool StandardIsolation::passSelectionLoose(const xAOD::IParticle& p) const +{ + // Are we doing isolation? + if (!m_doLooseIsolation) + return true; + + // If we get this far then we are doing isolation + if ( p.type() == xAOD::Type::Photon || + p.type() == xAOD::Type::Electron || + p.type() == xAOD::Type::Muon ) + { + if (p.isAvailable<char>(m_looseLeptonDecoration)) { + if (p.auxdataConst<char>(m_looseLeptonDecoration) == 1) { + return true; + } + } + } + + // Not a photon, electron or muon? + // Didn't pass isolation? + return false; +} + +void StandardIsolation::print(std::ostream& os) const { + os << " * Standard Isolation\n"; + os << " * Tight lepton isolation = "<<m_tightLeptonDecoration<< "\n"; + os << " * Loose lepton isolation = "<<m_looseLeptonDecoration<< "\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0121920e039c3dcba83dc943c3616ceaaebce7e3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetMC15.cxx @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/JetMC15.h" + +#include <cmath> + +#include "TopEvent/EventTools.h" + +namespace top { + + JetMC15::JetMC15(const double ptcut, + const double etamax, + const bool doJVTCut, + const std::string fwdJetSel) : + m_ptcut(ptcut), + m_etamax(etamax), + m_applyJVTCut(doJVTCut), + m_fwdJetSel(fwdJetSel), + m_jvt_tool("JetJvtEfficiencyTool") { + top::check(m_jvt_tool.retrieve(), + "Failed to retrieve JVT tool"); + } + + // This version of the constructor always perform JVT cut + JetMC15::JetMC15(const double ptcut, + const double etamax, + const std::string fwdJetSel) : JetMC15::JetMC15(ptcut, etamax, true, fwdJetSel) {} + + // DEPRECATED - only kept for backward compatibility + JetMC15::JetMC15(const double ptcut, + const double etamax, + const double) : JetMC15::JetMC15(ptcut, etamax) {} + + bool JetMC15::passSelection(const xAOD::Jet& jet) { + if (jet.pt() < m_ptcut) + return false; + + if (std::fabs(jet.eta()) > m_etamax) + return false; + + if (m_applyJVTCut) { + if (!m_jvt_tool->passesJvtCut(jet)) { + jet.auxdecor<char>("passJVT") = 0; + } + else { + jet.auxdecor<char>("passJVT") = 1; + } + } + + if (m_fwdJetSel == "fJVT") { + if (!jet.getAttribute<char>("passFJVT")) + return false; + } + else if (m_fwdJetSel == "Tight") { + if (std::fabs(jet.eta()) > 2.5 && jet.pt() < 30e3) + return false; + } + + jet.auxdecor<char>("good") = 1; + jet.auxdecor<char>("closeToLepton") = 0; + + return true; + } + + void JetMC15::print(std::ostream& os) const { + os << "JetMC15\n" + << " * pT > " << m_ptcut << "\n" + << " * |eta| < " << m_etamax << "\n"; + } +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..475c55f4c93e7f6528fc9bd3914d785cc28ae42f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/JetSelectionBase.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/JetSelectionBase.h" + +namespace top { + +JetSelectionBase::JetSelectionBase() { +} + +JetSelectionBase::~JetSelectionBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::JetSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..12b00eda063d7c2c84deb7b002b9446bcf76046c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/LinkDef.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/RCJetMC15.h" + +#ifdef __CINT__ + +#pragma extra_include "TopObjectSelectionTools/RCJetMC15.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class RCJetMC15+; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0ded97d78d1e0cb4a9b5fc31d184e72c17a238ea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonMC15.cxx @@ -0,0 +1,111 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/MuonMC15.h" + +#include "TopEvent/EventTools.h" + +namespace top { + + MuonMC15::MuonMC15(const double ptcut, IsolationBase* isolation, const bool applyTTVACut) : + m_ptcut(ptcut), + m_muonSelectionTool("CP::MuonSelectionTool"), + m_muonSelectionToolLoose("CP::MuonSelectionToolLoose"), + m_isolation(isolation), + m_applyTTVACut(applyTTVACut) +{ + top::check( m_muonSelectionTool.retrieve() , "Failed to retrieve muonSelectionTool" ); + top::check( m_muonSelectionToolLoose.retrieve() , "Failed to retrieve muonSelectionToolLoose" ); + +} + +bool MuonMC15::passSelection(const xAOD::Muon& mu) const +{ + if (mu.pt() < m_ptcut) + return false; + + ///-- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MCPAnalysisGuidelinesMC15 --/// + if (!m_muonSelectionTool->accept(mu)) + return false; + + //isolation, if m_isolation != nullptr + if (m_isolation && !m_isolation->passSelection(mu)) + return false; + + // Track-to-vertex association + if (m_applyTTVACut){ + if (!passTTVACuts(mu)) + return false; + } + + return true; +} + +bool MuonMC15::passSelectionLoose(const xAOD::Muon& mu) const +{ + if (mu.pt() < m_ptcut) + return false; + + ///-- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MCPAnalysisGuidelinesMC15 --/// + if (!m_muonSelectionToolLoose->accept(mu)) + return false; + + //isolation, if m_isolation != nullptr + if (m_isolation && !m_isolation->passSelectionLoose(mu)) + return false; + + // Track-to-vertex association + if (m_applyTTVACut){ + if (!passTTVACuts(mu)) + return false; + } + + return true; +} + +bool MuonMC15::passTTVACuts(const xAOD::Muon& mu) const +{ + + // TTVA: + // see https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TrackingCPEOYE2015#Track_to_Vertex_Association + if( !mu.isAvailable<float>("d0sig") ){ + std::cout << "d0 significance not found for muon. " + << "Maybe no primary vertex? Won't accept." << std::endl; + return false; + } + + float d0sig = mu.auxdataConst<float>("d0sig"); + if( std::abs(d0sig) >= 3 ) + return false; + + if( !mu.isAvailable<float>("delta_z0_sintheta") ){ + std::cout << "delta z0*sin(theta) not found for muon. " + << "Maybe no primary vertex? Won't accept." << std::endl; + return false; + } + + float delta_z0_sintheta = mu.auxdataConst<float>("delta_z0_sintheta"); + if( std::abs(delta_z0_sintheta) >= 0.5 ) + return false; + + return true; + +} + + void MuonMC15::print(std::ostream& os) const { + os << "MuonMC15\n" + << " * pT > " << m_ptcut << "\n" +// << " * |eta| < " << m_etamax << "\n" +// << " * quality=" << m_quality << " (tight=0, medium=1, loose=2, v.loose=3)\n" + << " * Everything else from muon tool - fill this in?\n"; + + if (!m_isolation) + os << " * No isolation requirement\n"; + else + m_isolation->print(os); + } + + + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f6dbfdff46c972f74e511dc266da216a1e02a241 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/MuonSelectionBase.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/MuonSelectionBase.h" + +namespace top { + +MuonSelectionBase::MuonSelectionBase() { +} + +MuonSelectionBase::~MuonSelectionBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::MuonSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalASG.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalASG.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4d099c3457ba863e2b23cbf25bb505e2cb6adad5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalASG.cxx @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +#include "TopObjectSelectionTools/OverlapRemovalASG.h" +#include "TopEvent/EventTools.h" + +#include <list> + +namespace top { + + OverlapRemovalASG::OverlapRemovalASG(bool dolargeJet) : + m_overlapRemovalTool("OverlapRemovalTool"), + m_overlapRemovalToolLoose("OverlapRemovalToolLoose"), + m_passPreORSelection("passPreORSelection"), + m_passPreORSelectionLoose("passPreORSelectionLoose"), + m_overlaps("overlaps"), + m_doLargeJet(dolargeJet) + { + + top::check( m_overlapRemovalTool.retrieve() , "Failed to retrieve overlap removal tool" ); + top::check( m_overlapRemovalToolLoose.retrieve() , "Failed to retrieve (loose) overlap removal tool" ); + + } + + OverlapRemovalASG::~OverlapRemovalASG() + { + } + + void OverlapRemovalASG::overlapremoval(const xAOD::PhotonContainer* photon , + const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::TauJetContainer* tau , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& goodPhotons, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTaus, + std::vector<unsigned int>& goodJets, + std::vector<unsigned int>& goodLargeRJets, + const bool isLoose ) + { + std::string passTopCuts(""); + if (!isLoose) { + if (m_doLargeJet) + top::check( m_overlapRemovalTool->removeOverlaps( el, mu, jet, tau, photon, ljet ) , "Failed to remove overlaps" ); + else + top::check( m_overlapRemovalTool->removeOverlaps( el, mu, jet, tau, photon ) , "Failed to remove overlaps" ); + passTopCuts = m_passPreORSelection; + } + if (isLoose) { + if (m_doLargeJet) + top::check( m_overlapRemovalToolLoose->removeOverlaps( el, mu, jet, tau, photon, ljet ) , "Failed to remove overlaps" ); + else + top::check( m_overlapRemovalToolLoose->removeOverlaps( el, mu, jet, tau, photon ) , "Failed to remove overlaps" ); + passTopCuts = m_passPreORSelectionLoose; + } + + removeObjectOverlap( photon, goodPhotons, passTopCuts ); + removeObjectOverlap( el, goodElectrons, passTopCuts ); + removeObjectOverlap( mu, goodMuons, passTopCuts ); + removeObjectOverlap( tau, goodTaus, passTopCuts ); + removeObjectOverlap( jet, goodJets, passTopCuts ); + if (m_doLargeJet) + removeObjectOverlap( ljet, goodLargeRJets, passTopCuts ); + else + removeObject( ljet, goodLargeRJets, passTopCuts ); + + + } + + void OverlapRemovalASG::removeObjectOverlap( const xAOD::IParticleContainer* xaod, + std::vector<unsigned int>& OUT_vec, + const std::string passTopCuts) { + + OUT_vec.clear(); + + unsigned int index(0); + + if (xaod) { + for (auto x : *xaod) { + if (x->auxdataConst< char >(passTopCuts) == 1 && x->auxdataConst< char >(m_overlaps) == 0) { + OUT_vec.push_back(index); + } + ++index; + } + } + } + + void OverlapRemovalASG::removeObject( const xAOD::IParticleContainer* xaod, + std::vector<unsigned int>& OUT_vec, + const std::string passTopCuts) { + + OUT_vec.clear(); + + unsigned int index(0); + + if (xaod) { + for (auto x : *xaod) { + if (x->auxdataConst< char >(passTopCuts) == 1) { + OUT_vec.push_back(index); + } + ++index; + } + } + } + +void OverlapRemovalASG::print(std::ostream& os) const { + os << "OverlapRemovalASG\n"; + os << " (1) remove electron that sharing track with muon\n"; + os << " (2) remove single jet closest to an electron (within dR < 0.2)\n"; + os << " (3) remove electron with dR < 0.4 of jet\n"; + os << " (4) remove muon within dR < 0.4 of any jet\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..84b3c250edf0f5f4df9180ebf3112fc69e1c8888 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalBase.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/OverlapRemovalBase.h" + +namespace top { + +OverlapRemovalBase::OverlapRemovalBase() { +} + +OverlapRemovalBase::~OverlapRemovalBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::OverlapRemovalBase& overlapremoval) { + overlapremoval.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalIndices.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalIndices.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fa90456dfa5cfa26e145d5a1227e149eaf9d5809 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/OverlapRemovalIndices.cxx @@ -0,0 +1,157 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: OverlapRemovalIndices.cxx 661110 2015-04-17 00:03:39Z morrisj $ +#include "TopObjectSelectionTools/OverlapRemovalIndices.h" +#include "TopEvent/EventTools.h" + +#include <list> + +namespace top { + +OverlapRemovalIndices::OverlapRemovalIndices() { +} + +OverlapRemovalIndices::~OverlapRemovalIndices() { +} + +void OverlapRemovalIndices::overlapremoval(const xAOD::ElectronContainer* el, + const xAOD::MuonContainer* mu, + const xAOD::JetContainer* jet, + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& OUT_el, + std::vector<unsigned int>& OUT_mu, + std::vector<unsigned int>& OUT_jet, + std::vector<unsigned int>& OUT_ljet, + const bool isLoose ) +{ + std::string passTopCuts(""); + if (!isLoose) { + passTopCuts = "passPreORSelection"; + } + if (isLoose) { + passTopCuts = "passPreORSelectionLoose"; + } + + + // Work internally with std::list + // What passed the pre-overlap removal selection? + std::vector<unsigned int> IN_el,IN_mu,IN_jet,IN_ljet; + std::list<unsigned int> l_el,l_mu,l_jet,l_ljet; + unsigned int index_el(0),index_mu(0),index_jet(0),index_ljet(0); + + if (el) { + for( auto x : *el ){ + if( x->auxdataConst< char >(passTopCuts) == 1 ){ + IN_el.push_back(index_el); + l_el.push_back(index_el); + } + ++index_el; + } + } + + if (mu) { + for( auto x : *mu ){ + if( x->auxdataConst< char >(passTopCuts) == 1 ){ + IN_mu.push_back(index_mu); + l_mu.push_back(index_mu); + } + ++index_mu; + } + } + + if (jet) { + for( auto x : *jet ){ + if( x->auxdataConst< char >(passTopCuts) == 1 ){ + IN_jet.push_back(index_jet); + l_jet.push_back(index_jet); + } + ++index_jet; + } + } + + if (ljet) { + for( auto x : *ljet ){ + if( x->auxdataConst< char >(passTopCuts) == 1 ){ + IN_ljet.push_back(index_ljet); + l_ljet.push_back(index_ljet); + } + ++index_ljet; + } + } + + // Jets and Muons - remove muon with dR < 0.4 + for( auto j : IN_jet ){ + for( auto m : IN_mu ){ + if( top::deltaR( *(jet->at(j) ) , *(mu->at(m)) ) < 0.4 ){ + l_mu.remove( m ); + } + } + } + + // Jets and Electrons - remove single closest jet with dR < 0.2 + for (auto e : IN_el) { + double closestdr = 100.; + int closestJetIndex = -1; + for (auto j : IN_jet) { + const double ejetdr = top::deltaR(*(jet->at(j)) , *(el->at(e))); + + if (ejetdr < 0.2 && ejetdr < closestdr) { + closestdr = ejetdr; + closestJetIndex = j; + } + } + + if (closestJetIndex > -1) + l_jet.remove(closestJetIndex); + } + + // Electrons and Jets - remove electrons with dR < 0.4 + for( auto j : l_jet ){ + for( auto e : IN_el ){ + if( top::deltaR( *(el->at(e)) , *(jet->at(j)) ) < 0.4 ){ + l_el.remove( e ); + } + } + } + + // Save what's left of the std::lists into the OUT vectors; + OUT_el.clear(); + OUT_mu.clear(); + OUT_jet.clear(); + OUT_ljet.clear(); + + for( auto i : l_el ){OUT_el.push_back(i); } + for( auto i : l_mu ){OUT_mu.push_back(i); } + for( auto i : l_jet ){OUT_jet.push_back(i);} + for( auto i : l_ljet ){OUT_ljet.push_back(i);} +} + +void OverlapRemovalIndices::overlapremoval(const xAOD::PhotonContainer* /*photon*/ , + const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::TauJetContainer* /*tau*/ , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& /*goodPhotons*/, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& /*goodTaus*/, + std::vector<unsigned int>& goodJets, + std::vector<unsigned int>& goodLargeRJets, + const bool isLoose ) +{ + + overlapremoval(el, mu, jet, ljet, goodElectrons, goodMuons, goodJets, goodLargeRJets, isLoose ); + +} + +void OverlapRemovalIndices::print(std::ostream& os) const { + os << "OverlapRemovalIndices\n"; + os << " (1) remove muon within dR < 0.4 of any jet\n"; + os << " (2) remove single jet closest to an electron (within dR < 0.2)\n"; + os << " (3) remove electron with dR < 0.4 of jet\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ad4e620d5e7a6a22ca8dc170992be9935df6b75d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonMC15.cxx @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/PhotonMC15.h" + +// Include what you use! +#include <map> +#include <string> + +#include "TopEvent/EventTools.h" + +namespace top { + +PhotonMC15::PhotonMC15(double ptcut, double etamax, IsolationBase* isolation) : + m_ptcut(ptcut), + m_etamax(etamax), + m_photon_selection("DFCommonPhotonsIsEMTight"), + m_loose_photon_selection("DFCommonPhotonsIsEMLoose"), + m_isolation(isolation) { +} + +PhotonMC15::PhotonMC15(double ptcut, double etamax, + const std::string& tightID, + const std::string& looseID, + IsolationBase* isolation) : + m_ptcut(ptcut), + m_etamax(etamax), + m_photon_selection(tightID), + m_loose_photon_selection(looseID), + m_isolation(isolation) { + // Make a map of shortcuts e.g "Tight = DFCommonPhotonsIsEMTight" + std::map<std::string, std::string> id_map; + id_map["Tight"] = "DFCommonPhotonsIsEMTight"; + id_map["Loose"] = "DFCommonPhotonsIsEMLoose"; + id_map["None"] = "None"; + // If ID in map then set it to full name, else keep as is. + if (id_map.find(tightID) != id_map.end()) + m_photon_selection = id_map[tightID]; + if (id_map.find(looseID) != id_map.end()) + m_loose_photon_selection = id_map[looseID]; +} + +bool PhotonMC15::passSelection(const xAOD::Photon& ph) const { + if (!passSelectionNoIsolation(ph, m_photon_selection)) + return false; + + if (m_isolation && !m_isolation->passSelection(ph)) + return false; + + return true; +} + +bool PhotonMC15::passSelectionLoose(const xAOD::Photon& ph) const { + if (!passSelectionNoIsolation(ph, m_loose_photon_selection)) + return false; + + if (m_isolation && !m_isolation->passSelectionLoose(ph)) + return false; + + return true; +} + +bool PhotonMC15::passSelectionNoIsolation(const xAOD::Photon& ph, + const std::string& photon_selection) const { + // Photon author : AuthorPhoton/AuthorAmbiguous. + // Also, for special-case recovery of soft photons: + // xAOD::EgammaParameters::AuthorCaloTopo35. + if (ph.author() != xAOD::EgammaParameters::AuthorPhoton + && ph.author() != xAOD::EgammaParameters::AuthorAmbiguous) + return false; + + if (ph.pt() < m_ptcut) + return false; + + // removing bad photon cluser [http://cern.ch/go/kp8F] + if (!ph.isGoodOQ(xAOD::EgammaParameters::BADCLUSPHOTON)) + return false; + + // Photon selection using derivation decorations + if (photon_selection != "None") + if (!ph.auxdataConst<char>(photon_selection)) + return false; + + if (!ph.caloCluster()) return false; + float abs_eta = std::abs(ph.caloCluster()->etaBE(2)); + if (abs_eta > m_etamax) + return false; + + // Remove crack region + if (abs_eta > 1.37 && abs_eta < 1.52) + return false; + + // Photon cleaning [http://cern.ch/go/8RdK] + // <tom.neep@cern.ch>: This is madness!! I *think* this is the right way + // to do this but there should really be a helper function supplied by egamma! + if ((ph.OQ() & 134217728) != 0 + && + (ph.showerShapeValue(xAOD::EgammaParameters::Reta) > 0.98 + || ph.showerShapeValue(xAOD::EgammaParameters::Rphi) > 1.0 + || (ph.OQ() & 67108864) != 0)) + return false; + + return true; +} + +void PhotonMC15::print(std::ostream& os) const { + os << "PhotonMC15\n"; + os << " * pT > " << m_ptcut << "\n"; + os << " * |eta| < " << m_etamax << "\n"; + os << " * Photon PID: " << m_photon_selection << "\n"; + os << " * Loose Photon PID: " << m_loose_photon_selection << "\n"; + if (!m_isolation) + os << " * No isolation requirement\n"; + else + m_isolation->print(os); +} +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..20527343eeee379386f635b14b004db67690c75a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/PhotonSelectionBase.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/PhotonSelectionBase.h" + +#include <iostream> + +namespace top { + +PhotonSelectionBase::PhotonSelectionBase() { +} + +PhotonSelectionBase::~PhotonSelectionBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::PhotonSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/RCJetMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/RCJetMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d15dfe6b45f9c11b47663857c140d53b32578587 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/RCJetMC15.cxx @@ -0,0 +1,286 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/************************************************************** +// +// Created: 19 January 2016 +// Last Updated: 22 February 2016 +// +// Daniel Marley +// demarley@umich.edu +// University of Michigan, Ann Arbor, MI +// +// File for initializing and making re-clustered jets. +// +***************************************************************/ +#include "TopObjectSelectionTools/RCJetMC15.h" + +#include "TopConfiguration/TopConfig.h" +#include "AsgTools/AsgTool.h" +#include "AthContainers/ConstDataVector.h" + +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "PATInterfaces/SystematicsUtil.h" + + + +RCJetMC15::RCJetMC15( const std::string& name ) : + asg::AsgTool( name ), + m_name(name), + m_config(nullptr), + m_ptcut(0.), + m_etamax(0.), + m_trim(0.), + m_radius(0.), + m_minradius(0.), + m_massscale(0.), + m_egamma("EG_"), + m_jetsyst("JET_"), + m_muonsyst("MUONS_"), + m_InJetContainerBase( "AntiKt4EMTopoJets_RC"), + m_OutJetContainerBase("AntiKtRCJets"), + m_InputJetContainer( "AntiKt4EMTopoJets_RC"), + m_OutputJetContainer( "AntiKtRCJets"), + m_loose_hashValue(2), + m_unique_syst(false){ + declareProperty( "config" , m_config ); + declareProperty( "VarRCjets", m_VarRCjets=false); + declareProperty( "VarRCjets_rho", m_VarRCjets_rho=""); + declareProperty( "VarRCjets_mass_scale",m_VarRCjets_mass_scale=""); + } + + +RCJetMC15::~RCJetMC15() {} + + +StatusCode RCJetMC15::initialize(){ + /* Initialize the re-clustered jets */ + ATH_MSG_INFO(" Initializing Re-clustered jets "); + + // load the necessary parameters from the Dynamic Keys in the config file + top::ConfigurationSettings* configSettings = top::ConfigurationSettings::get(); + + m_name = m_VarRCjets_rho+m_VarRCjets_mass_scale; + if (m_VarRCjets){ + m_ptcut = std::stof(configSettings->value("VarRCJetPt")); // 100 GeV + m_etamax = std::stof(configSettings->value("VarRCJetEta")); // 2.5 + m_trim = std::stof(configSettings->value("VarRCJetTrim")); // 0.05 (5% jet pT) + m_radius = std::stof(configSettings->value("VarRCJetMaxRadius")); // 1.2 (min=0.4) + m_minradius = 0.4; // 0.4 default (until we have smaller jets!) + std::string original_rho(m_VarRCjets_rho); + std::replace( original_rho.begin(), original_rho.end(), '_', '.'); + float rho = std::stof(original_rho); + float m_scale = mass_scales.at(m_VarRCjets_mass_scale); + m_massscale = rho*m_scale*1e-3; // e.g., 2*m_top; in [GeV]! + } + else{ + m_ptcut = std::stof( configSettings->value("RCJetPt") ); // for initialize [GeV] & passSelection + m_etamax = std::stof( configSettings->value("RCJetEta") ); // for passSelection + m_trim = std::stof( configSettings->value("RCJetTrim") ); // for initialize + m_radius = std::stof( configSettings->value("RCJetRadius") ); // for initialize + m_minradius = -1.0; + m_massscale = -1.0; + } + + for (auto treeName : *m_config->systAllTTreeNames()) { + // only make a new tool if it is the nominal systematic or one that could affect small-r jets (el, mu, jet) + std::string hash_name(""); + + if ( isUniqueSyst(treeName.second) ){ + + if (treeName.second.compare("nominal")!=0) hash_name = treeName.second; // no extra strings for nominal (so all other non-unique systs have same name as nominal) + + m_InputJetContainer = m_InJetContainerBase+hash_name+m_name; + m_OutputJetContainer = m_OutJetContainerBase+hash_name+m_name; + + // build a jet re-clustering tool for each case + JetReclusteringTool* tool = new JetReclusteringTool(treeName.second+m_name); + top::check(tool->setProperty("InputJetContainer", m_InputJetContainer),"Failed inputjetcontainer initialize reclustering tool"); + top::check(tool->setProperty("OutputJetContainer", m_OutputJetContainer),"Failed outputjetcontainer initialize reclustering tool"); + top::check(tool->setProperty("ReclusterRadius", m_radius),"Failed re-clustering radius initialize reclustering tool"); + top::check(tool->setProperty("RCJetPtMin", m_ptcut*1e-3),"Failed ptmin [GeV] initialize reclustering tool"); + top::check(tool->setProperty("RCJetPtFrac", m_trim),"Failed pT fraction initialize reclustering tool"); + top::check(tool->setProperty("VariableRMinRadius", m_minradius),"Failed VarRC min radius initialize reclustering tool"); + top::check(tool->setProperty("VariableRMassScale", m_massscale),"Failed VarRC mass scale initialize reclustering tool"); + top::check(tool->initialize(),"Failed to initialize reclustering tool"); + + m_jetReclusteringTool.insert({treeName.first,tool}); // insert the re-clustering tool into map + // this stores a tool for each systematic based on hash value + + // map of container names to access in event saver + m_inputContainerNames.insert({treeName.first,m_InputJetContainer}); + m_outputContainerNames.insert({treeName.first,m_OutputJetContainer}); + + // make a re-clustering tool for 'loose' events, too. + if (m_config->doLooseEvents()){ + JetReclusteringTool* tool_loose = new JetReclusteringTool(treeName.second+m_name+"_Loose"); + top::check(tool_loose->setProperty("InputJetContainer", m_InputJetContainer+"_Loose"),"Failed inputjetcontainer reclustering tool"); + top::check(tool_loose->setProperty("OutputJetContainer", m_OutputJetContainer+"_Loose"),"Failed outputjetcontainer loose initialize reclustering tool"); + top::check(tool_loose->setProperty("ReclusterRadius", m_radius),"Failed re-clustering radius initialize reclustering tool"); + top::check(tool_loose->setProperty("RCJetPtMin", m_ptcut*1e-3),"Failed ptmin [GeV] reclustering tool"); + top::check(tool_loose->setProperty("RCJetPtFrac", m_trim),"Failed pT fraction initialize reclustering tool"); + top::check(tool_loose->setProperty("VariableRMinRadius", m_minradius),"Failed VarRC min radius initialize reclustering tool"); + top::check(tool_loose->setProperty("VariableRMassScale", m_massscale),"Failed VarRC mass scale initialize reclustering tool"); + top::check(tool_loose->initialize(),"Failed to initialize reclustering tool"); + + m_jetReclusteringTool.insert({m_loose_hashValue*treeName.first,tool_loose}); // making up a number as index for the loose event + // map of container names to access in event saver + m_inputContainerNames.insert({m_loose_hashValue*treeName.first,m_InputJetContainer+"_Loose"}); + m_outputContainerNames.insert({m_loose_hashValue*treeName.first,m_OutputJetContainer+"_Loose"}); + } // end if loose + } // end if unique syst + else{ + + + m_InputJetContainer = m_InJetContainerBase+m_name; + m_OutputJetContainer = m_OutJetContainerBase+m_name; + + // map of container names to access in event saver + if(m_config->doLooseEvents()){ + m_inputContainerNames.insert({m_loose_hashValue*treeName.first,m_InputJetContainer+"_Loose"}); + m_outputContainerNames.insert({m_loose_hashValue*treeName.first,m_OutputJetContainer+"_Loose"}); + } + else{ + m_inputContainerNames.insert({treeName.first,m_InputJetContainer}); + m_outputContainerNames.insert({treeName.first,m_OutputJetContainer}); + } + + } + } // end for loop over systematics + + ATH_MSG_INFO(" Re-clustered jets initialized "); + + return StatusCode::SUCCESS; +} // end initialize() + + + +StatusCode RCJetMC15::execute(const top::Event& event) { + /* + Make the jet container (if necessary) and execute the re-clustering tool + https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TopPhys/xAOD/TopEvent/trunk/Root/TopEventMaker.cxx#L31 + */ + m_InputJetContainer = inputContainerName( event.m_hashValue, event.m_isLoose ); + m_OutputJetContainer = rcjetContainerName( event.m_hashValue, event.m_isLoose ); + + + // -- Save the jet container to the TStore (only if it doesn't already exist!) + // -- Then, we can access it with the re-clustering tool further down + if (!evtStore()->contains<xAOD::JetContainer>(m_InputJetContainer)) { + // Save the nominal container once, and each jet systematic container once + // Make the new jet container (only do this if we have to!) + // 22 Feb 2016: + // Code significantly shortened to make this container + // thanks to email exchange between Davide Gerbaudo & Attila Krasznahorkay + + typedef ConstDataVector< xAOD::JetContainer > CJets; + std::unique_ptr< CJets > rcjets( new CJets( event.m_jets.begin(), event.m_jets.end(), SG::VIEW_ELEMENTS ) ); + top::check( evtStore()->tds()->record( std::move( rcjets ), m_InputJetContainer ), "Failed to put jets in TStore for re-clustering" ); + } // end if jet container exists + + + // --- EXECUTE --- // + // only execute if the jet container doesn't exist + // (do not re-make the 'nominal' jet container over & over again!) + if (!evtStore()->contains<xAOD::JetContainer>(m_OutputJetContainer)) { + int hash_factor = (event.m_isLoose) ? m_loose_hashValue : 1; + + // tools only exist for unique systematics & nominal (save time/space)! + m_tool_iterator tool_iter = m_jetReclusteringTool.find( hash_factor*event.m_hashValue ); + + // if this is a unique systematic or nominal, execute from the tool; else execute nominal + if (tool_iter!=m_jetReclusteringTool.end()) + tool_iter->second->execute(); + else + m_jetReclusteringTool.at(hash_factor*m_config->nominalHashValue())->execute(); + } + + return StatusCode::SUCCESS; +} // end execute() + + + +StatusCode RCJetMC15::finalize() { + /*Delete the re-clustering tool*/ + for ( auto& x: m_jetReclusteringTool ) + delete x.second; + m_jetReclusteringTool.clear(); + + return StatusCode::SUCCESS; +} + + +bool RCJetMC15::isUniqueSyst( const std::string syst_name ){ + /* + Check if the given systematic (besides nominal) needs a unique container + Keep this in one function so it easier to update than having multiple checks everywhere. + Only need jet containers for EGamma, Muon, Jet and Nominal systematics + */ + m_unique_syst = (syst_name.find(m_egamma) == 0 || + syst_name.find(m_muonsyst) == 0 || + syst_name.find(m_jetsyst) == 0 || + syst_name.compare("nominal")==0); + + return m_unique_syst; +} + + +std::string RCJetMC15::inputContainerName( std::size_t hash_value, bool isLooseEvent ){ + /* Return the name of the input container */ + std::string this_container_name(""); + if (isLooseEvent) + hash_value *= m_loose_hashValue; // loose events have a slightly different hash value to keep track of + + m_iterator iter = m_inputContainerNames.find( hash_value ); + + if (iter!=m_inputContainerNames.end()) + this_container_name = iter->second; + else + this_container_name = m_InJetContainerBase; + + return this_container_name; +} + + +std::string RCJetMC15::rcjetContainerName( std::size_t hash_value, bool isLooseEvent ){ + /* Return the name of the rcjet container for a given systematic */ + std::string this_container_name(""); + if (isLooseEvent) + hash_value *= m_loose_hashValue; // loose events have a slightly different hash value + + m_iterator iter = m_outputContainerNames.find( hash_value ); + + if (iter!=m_outputContainerNames.end()) + this_container_name = iter->second; + else + this_container_name = m_OutJetContainerBase; + + return this_container_name; +} + + +bool RCJetMC15::passSelection(const xAOD::Jet& jet) const { + /* + Check if the re-clustered jet passes selection. + Right now, this only does something for |eta| because + pT is taken care of in the re-clustering tool. When + small-r jet mass is available (calibrated+uncertainties), + we can cut on that. + */ + // [pT] calibrated to >~ 22 GeV (23 Jan 2016) + if (jet.pt() < m_ptcut) + return false; + + // [|eta|] calibrated < 2.5 + if (std::fabs(jet.eta()) > m_etamax) + return false; + + // small-r jet mass not calibrated and no uncertainties + + return true; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..df9cbe62f0e3322ebccc384ce43804aaa2056abd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauMC15.cxx @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TauMC15.h" +#include "TopEvent/EventTools.h" + +namespace top { + +TauMC15::TauMC15() : m_tauSelection("TauAnalysisTools::TauSelectionTool"), + m_tauSelectionLoose + ("TauAnalysisTools::TauSelectionToolLoose") { + top::check(m_tauSelection.retrieve(), + "Failed to retrieve tau selection tool"); + top::check(m_tauSelectionLoose.retrieve(), + "Failed to retrieve loose tau selection tool"); +} + +bool TauMC15::passSelection(const xAOD::TauJet& tau) const { + // Get the WP related decisions from TauSelectionTool + + // HIGG8D1 derivations (and possibly others) skim away + // tau tracks with pT<15 GeV. The tau selector tool + // returns an exception in this case. These taus should + // NOT be selected so return false if an exception is raised. + try { + return m_tauSelection->accept(tau); + } catch (std::runtime_error& e) { + // If an exception is raised (possibly due to no tau track) + // then return false + return false; + } +} + +bool TauMC15::passSelectionLoose(const xAOD::TauJet& tau) const { + // get the WP related decisions from TauSelectionTool + // For the reasoning behind try/catch see above... + try { + return m_tauSelectionLoose->accept(tau); + } catch (std::runtime_error& e) { + return false; + } +} + +void TauMC15::print(std::ostream& os) const { + os << "TauMC15\n"; + os << " * Taus are now selected using the TauSelectionTool"<< "\n"; + os << " * Either you have supplied a tau configuration file (expert)\n"; + os << " or set pT, JetIDWP and EleOLR options in your top-xaod\n"; + os << " configuration file."; +} + + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..99f9366c8bd450511eaa2c1582af8a0c3f62900a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TauSelectionBase.cxx @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TauSelectionBase.h" + +namespace top { + +TauSelectionBase::TauSelectionBase() { +} + +TauSelectionBase::~TauSelectionBase() { +} + +} + +std::ostream& operator<<(std::ostream& os, const top::TauSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2842e20c999a9c6f36309748d9259f17f9aecfb3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx @@ -0,0 +1,700 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TopObjectSelection.h" + +#include "TopConfiguration/TopConfig.h" + +#include "TopEvent/EventTools.h" +#include "TopEvent/SystematicEvent.h" + +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODMissingET/MissingETContainer.h" + +namespace top { + +TopObjectSelection::TopObjectSelection( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_electronSelection(nullptr), + m_muonSelection(nullptr), + m_tauSelection(nullptr), + m_jetSelection(nullptr), + m_photonSelection(nullptr), + m_largeJetSelection(nullptr), + m_trackJetSelection(nullptr), + + m_overlapRemovalToolPostSelection(nullptr), + + m_electronInJetSubtractor(nullptr), + + m_passPreORSelection("passPreORSelection"), + m_passPreORSelectionLoose("passPreORSelectionLoose"), + // the following two are used to give failing JVT jets a lower priority in the OR + m_ORToolDecoration("ORToolDecoration"), + m_ORToolDecorationLoose("ORToolDecorationLoose"), + + m_doLooseCuts(false) +{ + declareProperty( "config" , m_config ); +} + + StatusCode TopObjectSelection::initialize() + { + // If there are loose selection requirements, then we need additional computations + // Tight leptons are not constrained to be a sub-set of loose + // We will call the selections in the following order: + // (1) passSelection(); + // (2) passSelectionLoose(); + // + // If your tight is not a sub-set of your loose, then you have 2 different functions + // If your tight is a sub-set of your loose, then I suggest you set a loose flag + // when calling passSelection(), then have passSelectionLoose() return this flag + // + // Requests to process loose selections can come from: + // (1) Data event + // (2) User request overlap removal be done on loose objects + // - The top recommendation is that you do OR on tight objects + // (3) Determination of Fakes control regions in MC - expert fakes mode + // + + if (!m_config->isMC()) + m_doLooseCuts = true; + + if (m_config->doOverlapRemovalOnLooseLeptonDef()) + m_doLooseCuts = true; + + if (m_config->doLooseEvents()) + m_doLooseCuts = true; + + if (m_config->applyElectronInJetSubtraction()) { + m_electronInJetSubtractor = std::unique_ptr<top::ElectronInJetSubtractionCollectionMaker> + ( new top::ElectronInJetSubtractionCollectionMaker( "top::ElectronInJetSubtractionCollectionMaker" ) ); + top::check( m_electronInJetSubtractor->setProperty( "config" , m_config ) , "Failed to setProperty of top::ElectronInJetSubtractionCollectionMaker" ); + top::check( m_electronInJetSubtractor->initialize() , "Failed to initialize top::ElectronInJetSubtractionCollectionMaker" ); + } + + // b-tagging stuff + // for calo jets + std::vector<std::string> availableWPs = m_config->bTagWP_available(); + for (auto& WP : availableWPs) { + m_btagSelTools[WP] = "BTaggingSelectionTool_"+WP+"_"+m_config->sgKeyJets(); + top::check( m_btagSelTools[WP].retrieve(), "Failed to retrieve b-tagging Selection tool" ); + } + // for track jets + availableWPs = m_config->bTagWP_available_trkJet(); + for (auto& WP : availableWPs) { + m_trkjet_btagSelTools[WP] = "BTaggingSelectionTool_"+WP+"_"+m_config->sgKeyTrackJets(); + top::check( m_trkjet_btagSelTools[WP].retrieve(), "Failed to retrieve b-tagging Selection tool" ); + } + + return StatusCode::SUCCESS; +} + + + +void TopObjectSelection::electronSelection(ElectronSelectionBase* ptr) { + m_electronSelection.reset(ptr); +} + +void TopObjectSelection::muonSelection(MuonSelectionBase* ptr) { + m_muonSelection.reset(ptr); +} + +void TopObjectSelection::tauSelection(TauSelectionBase* ptr) { + m_tauSelection.reset(ptr); +} + +void TopObjectSelection::jetSelection(JetSelectionBase* ptr) { + m_jetSelection.reset(ptr); +} + +void TopObjectSelection::photonSelection(PhotonSelectionBase* ptr) { + m_photonSelection.reset(ptr); +} + +void TopObjectSelection::largeJetSelection(JetSelectionBase* ptr) { + m_largeJetSelection.reset(ptr); +} + +void TopObjectSelection::trackJetSelection(JetSelectionBase* ptr) { + m_trackJetSelection.reset(ptr); +} + +void TopObjectSelection::overlapRemovalPostSelection(OverlapRemovalBase* ptr) { + m_overlapRemovalToolPostSelection.reset(ptr); +} + +StatusCode TopObjectSelection::execute() +{ + applySelectionPreOverlapRemoval(); + top::check( applyOverlapRemoval() , "Failed to apply overlap removal" ); + return StatusCode::SUCCESS; +} + +void TopObjectSelection::applySelectionPreOverlapRemoval() +{ + + // If we are doing Electron in Jet subtraction, + // We need to: + // (1) Apply object selection to the electrons + // (2) Subtract the electron from the jet, which: + // - Changes the jet 4-momentum + // - Reject additional electrons + // (3) Apply object selection to the modified jets + + if( m_config->useElectrons() ){applySelectionPreOverlapRemovalElectrons() ;} + + if (m_config->applyElectronInJetSubtraction()) { + top::check( m_electronInJetSubtractor->execute() , "Failed to execute top::ElectronInJetSubtractionCollectionMaker" ); + } + + + if( m_config->usePhotons() && m_photonSelection != nullptr ){applySelectionPreOverlapRemovalPhotons() ;} + if( m_config->useMuons() && m_muonSelection != nullptr ){applySelectionPreOverlapRemovalMuons() ;} + if( m_config->useTaus() && m_tauSelection != nullptr ){applySelectionPreOverlapRemovalTaus() ;} + if( m_config->useJets() && m_jetSelection != nullptr ){applySelectionPreOverlapRemovalJets() ;} + if( m_config->useLargeRJets() && m_largeJetSelection != nullptr){applySelectionPreOverlapRemovalLargeRJets() ;} + if( m_config->useTrackJets() && m_trackJetSelection != nullptr){applySelectionPreOverlapRemovalTrackJets() ;} +} + +void TopObjectSelection::applySelectionPreOverlapRemovalPhotons() { + for (auto currentSystematic : *m_config->systSgKeyMapPhotons()) { + const xAOD::PhotonContainer* photons(nullptr); + top::check(evtStore()->retrieve(photons, currentSystematic.second), "TopObjectSelection::applySelectionPreOverlapRemovalPhotons() failed to retrieve photons"); + ATH_MSG_DEBUG(" Cut on Photons with key = "<<currentSystematic.second); + + for (auto photonPtr : *photons) { + photonPtr->auxdecor<char>( m_passPreORSelection ) = m_photonSelection->passSelection(*photonPtr); + photonPtr->auxdecor<char>( m_ORToolDecoration ) = photonPtr->auxdataConst<char>( m_passPreORSelection ) * 2; + if (m_doLooseCuts) { + photonPtr->auxdecor<char>( m_passPreORSelectionLoose ) = m_photonSelection->passSelectionLoose(*photonPtr); + photonPtr->auxdecor<char>( m_ORToolDecorationLoose ) = photonPtr->auxdataConst<char>( m_passPreORSelectionLoose ) * 2; + } + } + } +} + +/** + * @brief For each systematic load each of the electrons and test if they pass + * the object selection. + */ +void TopObjectSelection::applySelectionPreOverlapRemovalElectrons() +{ + for (auto currentSystematic : *m_config->systSgKeyMapElectrons()) { + const xAOD::ElectronContainer* electrons(nullptr); + top::check(evtStore()->retrieve(electrons, currentSystematic.second), "TopObjectSelection::applySelectionPreOverlapRemovalElectrons() failed to retrieve electrons"); + ATH_MSG_DEBUG(" Cut on Electrons with key = "<<currentSystematic.second); + + for (auto electronPtr : *electrons) { + electronPtr->auxdecor<char>( m_passPreORSelection ) = m_electronSelection->passSelection(*electronPtr); + electronPtr->auxdecor<char>( m_ORToolDecoration ) = electronPtr->auxdataConst<char>( m_passPreORSelection ) * 2; + if (m_doLooseCuts) { + electronPtr->auxdecor<char>( m_passPreORSelectionLoose ) = m_electronSelection->passSelectionLoose(*electronPtr); + electronPtr->auxdecor<char>( m_ORToolDecorationLoose ) = electronPtr->auxdataConst<char>( m_passPreORSelectionLoose ) * 2; + } + } + } +} + +void TopObjectSelection::applySelectionPreOverlapRemovalMuons() +{ + for (auto currentSystematic : *m_config->systSgKeyMapMuons()) { + const xAOD::MuonContainer* muons(nullptr); + top::check(evtStore()->retrieve(muons, currentSystematic.second) , "TopObjectSelection::applySelectionPreOverlapRemovalMuons() failed to retrieve muons" ); + + for (auto muonPtr : *muons) { + muonPtr->auxdecor<char>( m_passPreORSelection ) = m_muonSelection->passSelection(*muonPtr); + muonPtr->auxdecor<char>( m_ORToolDecoration ) = muonPtr->auxdataConst<char>( m_passPreORSelection ) * 2; + if (m_doLooseCuts) { + muonPtr->auxdecor<char>( m_passPreORSelectionLoose ) = m_muonSelection->passSelectionLoose(*muonPtr); + muonPtr->auxdecor<char>( m_ORToolDecorationLoose ) = muonPtr->auxdataConst<char>( m_passPreORSelectionLoose ) * 2; + } + } + } +} + +void TopObjectSelection::applySelectionPreOverlapRemovalTaus() +{ + for (auto currentSystematic : *m_config->systSgKeyMapTaus()) { + const xAOD::TauJetContainer* taus(nullptr); + top::check(evtStore()->retrieve(taus, currentSystematic.second) , "TopObjectSelection::applySelectionPreOverlapRemovalTaus() failed to retrieve taus" ); + + for (auto tauPtr : *taus) { + tauPtr->auxdecor<char>( m_passPreORSelection ) = m_tauSelection->passSelection(*tauPtr); + tauPtr->auxdecor<char>( m_ORToolDecoration ) = tauPtr->auxdataConst<char>( m_passPreORSelection ) * 2; + if (m_doLooseCuts) { + tauPtr->auxdecor<char>( m_passPreORSelectionLoose ) = m_tauSelection->passSelectionLoose(*tauPtr); + tauPtr->auxdecor<char>( m_ORToolDecorationLoose ) = tauPtr->auxdataConst<char>( m_passPreORSelectionLoose ) * 2; + } + } + } +} + +void TopObjectSelection::applySelectionPreOverlapRemovalJets() +{ + + // Boosted analysis subtract electrons from jets + // If we use Loose electrons we end up with loose jet collections + + bool isLooseJets(false); + + for (auto currentSystematic : *m_config->systSgKeyMapJets(isLooseJets)) { + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, currentSystematic.second) , "TopObjectSelection::applySelectionPreOverlapRemovalJets() failed to retrieve jets" ); + ATH_MSG_DEBUG(" Cut on Jets with key = "<<currentSystematic.second); + + for (auto jetPtr : *jets) { + ATH_MSG_DEBUG(" Jet pt = "<<(jetPtr)->pt()); + char decoration = m_jetSelection->passSelection(*jetPtr); + jetPtr->auxdecor<char>( m_passPreORSelection ) = decoration; + // if JVT cut enabled: jets that pass JVT get a 2, otherwise the same as passPreORSelection + // if not, passPreORSelection * 2 + if (jetPtr->isAvailable<char>("passJVT")) { + jetPtr->auxdecor<char>( m_ORToolDecoration ) = decoration + jetPtr->auxdataConst<char>( "passJVT" ); + } else { + jetPtr->auxdecor<char>( m_ORToolDecoration ) = decoration * 2; + } + if (m_doLooseCuts) { + jetPtr->auxdecor<char>( m_passPreORSelectionLoose ) = decoration; + if (jetPtr->isAvailable<char>("passJVT")) { + jetPtr->auxdecor<char>( m_ORToolDecorationLoose ) = decoration + jetPtr->auxdataConst<char>( "passJVT" ); + } else { + jetPtr->auxdecor<char>( m_ORToolDecorationLoose ) = decoration * 2; + } + } + //decorate with b-tagging flags + std::vector<std::string> availableWPs = m_config->bTagWP_available(); + for (auto& WP : availableWPs) { + if (WP!= "Continuous") { + bool isTagged = false; + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_btagSelTools[WP]; + isTagged = btagsel->accept(*jetPtr); + } + jetPtr->auxdecor<char>("isbtagged_"+WP) = isTagged; + } + else { + int tagWeightBin = -2; // AT default + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_btagSelTools[WP]; + tagWeightBin = btagsel->getQuantile(*jetPtr); + } + jetPtr->auxdecor<int>("tagWeightBin") = tagWeightBin; + } + } + } + } + + // Are we using the ElectronInJetSubtraction and running with loose lepton definitons + if (m_doLooseCuts && m_config->applyElectronInJetSubtraction()) { + for (auto currentSystematic : *m_config->systSgKeyMapJets(m_doLooseCuts)) { + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, currentSystematic.second) , "TopObjectSelection::applySelectionPreOverlapRemovalJets() failed to retrieve jets" ); + ATH_MSG_DEBUG(" Cut on Jets with key = "<<currentSystematic.second); + + for (auto jetPtr : *jets) { + char decoration = m_jetSelection->passSelection(*jetPtr); + jetPtr->auxdecor<char>( m_passPreORSelection ) = decoration; + // if JVT cut enabled: jets that pass JVT get a 2, otherwise the same as passPreORSelection + // if not, passPreORSelection * 2 + if (jetPtr->isAvailable<char>("passJVT")) { + jetPtr->auxdecor<char>( m_ORToolDecoration ) = decoration + jetPtr->auxdataConst<char>( "passJVT" ); + } else { + jetPtr->auxdecor<char>( m_ORToolDecoration ) = decoration * 2; + } + if (m_doLooseCuts) { + jetPtr->auxdecor<char>( m_passPreORSelectionLoose ) = decoration; + if (jetPtr->isAvailable<char>("passJVT")) { + jetPtr->auxdecor<char>( m_ORToolDecorationLoose ) = decoration + jetPtr->auxdataConst<char>( "passJVT" ); + } else { + jetPtr->auxdecor<char>( m_ORToolDecorationLoose ) = decoration * 2; + } + } + //decorate with b-tagging flags + std::vector<std::string> availableWPs = m_config->bTagWP_available(); + for (auto& WP : availableWPs) { + if (WP!= "Continuous") { + bool isTagged = false; + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_btagSelTools[WP]; + isTagged = btagsel->accept(*jetPtr); + } + jetPtr->auxdecor<char>("isbtagged_"+WP) = isTagged; + } + else { + int tagWeightBin = -2; // AT default + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_btagSelTools[WP]; + tagWeightBin = btagsel->getQuantile(*jetPtr); + } + jetPtr->auxdecor<int>("tagWeightBin") = tagWeightBin; + } + } + } + } + } + +} + +void TopObjectSelection::applySelectionPreOverlapRemovalLargeRJets() +{ + for (auto currentSystematic : *m_config->systSgKeyMapLargeRJets()) { + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, currentSystematic.second) , "TopObjectSelection::applySelectionPreOverlapRemovalLargeRJets() failed to retrieve large R jets" ); + + for (auto jetPtr : *jets) { + char decoration = m_largeJetSelection->passSelection(*jetPtr); + jetPtr->auxdecor<char>( m_passPreORSelection ) = decoration; + jetPtr->auxdecor<char>( m_ORToolDecoration ) = decoration * 2; + if (m_doLooseCuts) { + jetPtr->auxdecor<char>( m_passPreORSelectionLoose ) = decoration; + jetPtr->auxdecor<char>( m_ORToolDecorationLoose ) = decoration * 2; + } + } + } +} + +void TopObjectSelection::applySelectionPreOverlapRemovalTrackJets() +{ + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, m_config->sgKeyTrackJets()) , "TopObjectSelection::applySelectionPreOverlapRemovalTrackJets() failed to retrieve track jets" ); + for (auto jetPtr : *jets) { + char decoration = m_trackJetSelection->passSelection(*jetPtr); + jetPtr->auxdecor<char>( m_passPreORSelection ) = decoration; + if (m_doLooseCuts) { + jetPtr->auxdecor<char>( m_passPreORSelectionLoose ) = decoration; + } + std::vector<std::string> availableWPs = m_config->bTagWP_available_trkJet(); + for (auto& WP : availableWPs) { + if (WP!= "Continuous") { + bool isTagged = false; + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_trkjet_btagSelTools[WP]; + isTagged = btagsel->accept(*jetPtr); + } + jetPtr->auxdecor<char>("isbtagged_"+WP) = isTagged; + } + else { + int tagWeightBin = -2; // AT default + if (std::fabs(jetPtr->eta()) < 2.5 ) { + ToolHandle<IBTaggingSelectionTool>& btagsel = m_btagSelTools[WP]; + tagWeightBin = btagsel->getQuantile(*jetPtr); + } + jetPtr->auxdecor<int>("tagWeightBin") = tagWeightBin; + } + } + } +} + +StatusCode TopObjectSelection::applyOverlapRemoval() +{ + bool aLooseEvent(true),aTightEvent(false); + if (!m_config->doLooseTreeOnly()) { + top::check( applyOverlapRemoval(aTightEvent,m_config->sgKeyTopSystematicEvents()) , "Failed to apply overlap removal" ); + } + if (m_config->doLooseEvents()) { + top::check( applyOverlapRemoval(aLooseEvent,m_config->sgKeyTopSystematicEventsLoose()) , "Failed to apply overlap removal" ); + } + return StatusCode::SUCCESS; +} + +StatusCode TopObjectSelection::applyOverlapRemoval(const bool isLoose,const std::string& sgKey) +{ + // create the xAOD::SystematicEventContainer + xAOD::SystematicEventAuxContainer* systEventAuxCont = new xAOD::SystematicEventAuxContainer{}; + xAOD::SystematicEventContainer* systEventCont = new xAOD::SystematicEventContainer{}; + systEventCont->setStore( systEventAuxCont ); + + for (auto systematicNumber : *m_config->systHashAll()) { + xAOD::SystematicEvent* systEvent = new xAOD::SystematicEvent{}; + systEventCont->push_back( systEvent ); + systEvent->setHashValue( systematicNumber ); + systEvent->setIsLooseEvent( isLoose ); + if (!isLoose) {systEvent->setTtreeIndex( m_config->ttreeIndex( systematicNumber ) );} + if (isLoose) {systEvent->setTtreeIndex( m_config->ttreeIndexLoose( systematicNumber ) );} + systEvent->auxdecor<char> (m_config->passEventSelectionDecoration()) = 0; + + top::check( applyOverlapRemoval( systEvent ) , "Failed to apply overlap removal" ); + } + + // Save to StoreGate / TStore + std::string outputSGKeyAux = sgKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( systEventCont ,sgKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( systEventAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + + +StatusCode TopObjectSelection::applyOverlapRemoval(xAOD::SystematicEvent* currentSystematic) { + + // Which lepton definition are we using for the overlap removal? + // Default for top analysis is "Tight" + // + // Use "Loose" for Fakes estimates + // + // Other physics groups choose to do overlap removal on "Loose" lepton definitions + // As such, this mode is fully supported, simply set: + // OverlapRemovalLeptonDef Loose + // In your configuration file + + bool looseLeptonOR(false); // default behaviour for top analysis - use the "Tight" definitions + if (currentSystematic->isLooseEvent()) { + looseLeptonOR = true; + } + if (m_config->doOverlapRemovalOnLooseLeptonDef()) { + looseLeptonOR = true; + } + + std::size_t hash = currentSystematic->hashValue(); + + // Retrieve the relevant shallow copies + const xAOD::PhotonContainer* xaod_photon(nullptr); + if (m_config->usePhotons()) + top::check(evtStore()->retrieve(xaod_photon, m_config->sgKeyPhotons(hash)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve photons"); + + const xAOD::ElectronContainer* xaod_el(nullptr); + if (m_config->useElectrons()) + top::check(evtStore()->retrieve(xaod_el, m_config->sgKeyElectrons(hash)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve electrons" ); + + const xAOD::MuonContainer* xaod_mu(nullptr); + if (m_config->useMuons()) + top::check(evtStore()->retrieve(xaod_mu, m_config->sgKeyMuons(hash)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve muons" ); + + const xAOD::TauJetContainer* xaod_tau(nullptr); + if (m_config->useTaus()) + top::check(evtStore()->retrieve(xaod_tau, m_config->sgKeyTaus(hash)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve taus"); + + const xAOD::JetContainer* xaod_jet(nullptr); + if (m_config->useJets()) + top::check(evtStore()->retrieve(xaod_jet, m_config->sgKeyJets(hash,looseLeptonOR)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve jets" ); + + const xAOD::JetContainer* xaod_ljet(nullptr); + if (m_config->useLargeRJets()) + top::check(evtStore()->retrieve(xaod_ljet, m_config->sgKeyLargeRJets(hash)) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve large-R jets"); + + const xAOD::JetContainer* xaod_tjet(nullptr); + if (m_config->useTrackJets()) + top::check(evtStore()->retrieve(xaod_tjet, m_config->sgKeyTrackJets()) , "TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve track jets"); + + // vectors to store the indices of objects passing selection and overlap removal + std::vector<unsigned int> goodPhotons,goodElectrons,goodMuons,goodTaus,goodJets,goodLargeRJets,goodTrackJets; + + // Apply overlap removal + m_overlapRemovalToolPostSelection->overlapremoval(xaod_photon,xaod_el,xaod_mu,xaod_tau, + xaod_jet,xaod_ljet, + goodPhotons,goodElectrons,goodMuons,goodTaus, + goodJets,goodLargeRJets,looseLeptonOR); + + // Additonal lepton information + std::vector<unsigned int> overlapsEl,overlapsMu; + if (m_overlapRemovalToolPostSelection->overlapsEl(overlapsEl) ) { + currentSystematic->auxdecor< std::vector<unsigned int> >("overlapsEl") = overlapsEl; + } + if (m_overlapRemovalToolPostSelection->overlapsMu(overlapsMu) ) { + currentSystematic->auxdecor< std::vector<unsigned int> >("overlapsMu") = overlapsMu; + } + + + + // If we did use overlap removal on "Loose" lepton definitions + // We take the remaining leptons and only keep those passing the "Tight" cuts + if (!currentSystematic->isLooseEvent() && m_config->doOverlapRemovalOnLooseLeptonDef()) { + applyTightSelectionPostOverlapRemoval( xaod_photon , goodPhotons ); + applyTightSelectionPostOverlapRemoval( xaod_el , goodElectrons ); + applyTightSelectionPostOverlapRemoval( xaod_mu , goodMuons ); + applyTightSelectionPostOverlapRemoval( xaod_tau , goodTaus ); + applyTightSelectionPostOverlapRemoval( xaod_jet , goodJets ); + applyTightSelectionPostOverlapRemoval( xaod_ljet , goodLargeRJets ); + } + + if (m_config->useTrackJets()){ + for (unsigned int i=0; i<xaod_tjet->size(); ++i) goodTrackJets.push_back(i); + trackJetOverlapRemoval(xaod_el, xaod_mu, xaod_tjet, goodElectrons, goodMuons, goodTrackJets); + applyTightSelectionPostOverlapRemoval( xaod_tjet , goodTrackJets ); + } + + // set the indices in the xAOD::SystematicEvent + currentSystematic->setGoodPhotons( goodPhotons ); + currentSystematic->setGoodElectrons( goodElectrons ); + currentSystematic->setGoodMuons( goodMuons ); + currentSystematic->setGoodTaus( goodTaus ); + currentSystematic->setGoodJets( goodJets ); + currentSystematic->setGoodLargeRJets( goodLargeRJets ); + currentSystematic->setGoodTrackJets( goodTrackJets ); + + return StatusCode::SUCCESS; +} + +void TopObjectSelection::applyTightSelectionPostOverlapRemoval( const xAOD::IParticleContainer* xaod , std::vector<unsigned int>& indices ) +{ + // Copy the original indices of the xAOD objects in + // the collection that pass the overlap removal + std::vector<unsigned int> tmpCopy; + for (auto i : indices) { + tmpCopy.push_back( i ); + } + + // Clear the original indices + indices.clear(); + + // Only save indices that are in tmpCopy && passPreORSelection + // This will keep the objects that pass the "Loose" overlap selection + // and pass the "Tight" cuts + for (auto i : tmpCopy) { + if (xaod->at(i)->isAvailable< char> ( m_passPreORSelection )) { + if (xaod->at(i)->auxdataConst< char >( m_passPreORSelection ) == 1) { + indices.push_back( i ); + } + } + } +} + +void TopObjectSelection::trackJetOverlapRemoval(const xAOD::IParticleContainer* xaod_el, + const xAOD::IParticleContainer* xaod_mu, + const xAOD::IParticleContainer* xaod_tjet, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTrackJets) +{ + + // Copy the original indices of the xAOD objects in + // the collection that pass the overlap removal + std::vector<unsigned int> tmpGoodTrackJets; + for (auto i : goodTrackJets) { + tmpGoodTrackJets.push_back( i ); + } + + // Clear the original indices + goodTrackJets.clear(); + + int counterTrk = 0; + for (auto jet : *xaod_tjet){ + bool matchEl(false); + int counterEl = 0; + for (auto el : *xaod_el){ + if ((std::find(goodElectrons.begin(), goodElectrons.end(), counterEl) != goodElectrons.end())){ + if ( el->p4().DeltaR(jet->p4())<0.2){ + matchEl = true; + break; + } + } + counterEl++; + } + + bool matchMu(false); + int counterMu = 0; + for (auto mu : *xaod_mu){ + if ((std::find(goodMuons.begin(), goodMuons.end(), counterMu) != goodMuons.end())){ + if ( mu->p4().DeltaR(jet->p4())<0.2){ + matchMu = true; + break; + } + } + counterMu++; + } + + if (!(matchEl || matchMu)) goodTrackJets.push_back(counterTrk); + counterTrk++; + } +} + +void TopObjectSelection::print() const +{ + asg::AsgTool::print(); +} + +void TopObjectSelection::print(std::ostream& os) const { + os << "TopObjectSelection configuration\n"; + + os << "\n"; + os << "Electrons\n"; + os << " ContainerName: " << m_config->sgKeyElectrons() << "\n"; + if (m_config->useElectrons()) { + os << " Selection: "; + if (!m_electronSelection) + os << "All"; + else + os << *m_electronSelection; + } + + os << "\n"; + os << "Photons\n"; + os << " ContainerName: " << m_config->sgKeyPhotons() << "\n"; + if (m_config->usePhotons()) { + os << " Selection: "; + if (!m_photonSelection) + os << "All"; + else + os << *m_photonSelection; + } + + os << "\n"; + os << "Muons\n"; + os << " ContainerName: " << m_config->sgKeyMuons() << "\n"; + if (m_config->useMuons()) { + os << " Selection: "; + if (!m_muonSelection) + os << "All"; + else + os << *m_muonSelection; + } +// +// os << "\n"; +// os << "Taus\n"; +// os << " ContainerName: " << containerNames().tauCollectionName << "\n"; +// if (containerNames().tauCollectionName != "None") { +// os << " Selection: "; +// if (!m_tauSelection) +// os << "All"; +// else +// os << *m_tauSelection; +// } + + os << "\n"; + os << "Jets\n"; + os << " ContainerName: " << m_config->sgKeyJets() << "\n"; + if (m_config->useJets()) { + os << " Selection: "; + if (!m_jetSelection) + os << "All"; + else + os << *m_jetSelection; + } + + os << "\n"; + os << "LargeJets\n"; + os << " ContainerName: " << m_config->sgKeyLargeRJets() << "\n"; + if (m_config->useLargeRJets()) { + os << " Selection: "; + if (!m_largeJetSelection) + os << "All"; + else + os << *m_largeJetSelection; + } + + os << "\n"; + os << "MET\n"; + os << " ContainerName: " << m_config->sgKeyMissingEt() << "\n"; + + os << "\n\n"; + os << "OverlapRemoval after object selection: "; + if (!m_overlapRemovalToolPostSelection) + os << "None"; + else + os << *m_overlapRemovalToolPostSelection; + + os << "\n\n"; +} + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TrackJetMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TrackJetMC15.cxx new file mode 100644 index 0000000000000000000000000000000000000000..daad4eeaee7eb2333904ea66af2da73fea86f869 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TrackJetMC15.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TrackJetMC15.h" + +namespace top{ + + TrackJetMC15::TrackJetMC15(const double ptcut,const double etamax) : + m_ptcut(ptcut), + m_etamax(etamax) { + } + + TrackJetMC15::~TrackJetMC15() { + } + + bool TrackJetMC15::passSelection(const xAOD::Jet& jet) { + + if (jet.pt() < m_ptcut) + return false; + + if (std::fabs(jet.eta()) > m_etamax) + return false; + + // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TrackJetSelectionRecAndGuide + if (jet.numConstituents() < 2) + return false; + + return true; + } + + void TrackJetMC15::print(std::ostream& os) const { + os << "Track jet\n" + << " * pT > " << m_ptcut << "\n" + << " * |eta| < " << m_etamax << "\n" + << " * >= 2 tracks \n"; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionBase.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a1e93857ccb9a7ea0607c46573bc212884b2e110 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionBase.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TruthSelectionBase.h" + +#include "TopEvent/EventTools.h" + +#include <cmath> +#include <iostream> + +namespace top { + + TruthSelectionBase::TruthSelectionBase() { + } + + bool TruthSelectionBase::isBhadron(int pid) const { + pid = (int) std::fabs(pid); + if ( (pid >= 511 && pid <= 545) || (pid >= 10511 && pid <= 10545) || (pid >= 20511 && pid <= 20545) || (pid >= 5112 && pid <= 5554)) { // check if it's a B-hadron + return true; + } + return false; + } + + bool TruthSelectionBase::isChadron(int pid) const { + pid = (int) std::fabs(pid); + if ( (pid >= 400 && pid < 500 && pid != 443) || (pid >= 4000 && pid < 5000) || (pid >= 10411 && pid <= 10455) || (pid >= 20411 && pid <= 20445)) { // check if it's a C-hadron + return true; + } + return false; + } + +} + +std::ostream& operator<<(std::ostream& os, const top::TruthSelectionBase& selection) { + selection.print(os); + return os; +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionTtres.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionTtres.cxx new file mode 100644 index 0000000000000000000000000000000000000000..94c94d7357ca217a5ed946b55903900d4579963f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TruthSelectionTtres.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopObjectSelectionTools/TruthSelectionTtres.h" +#include "TopEvent/EventTools.h" + +namespace top { + + TruthSelectionTtres::TruthSelectionTtres() + { + } + + bool TruthSelectionTtres::passSelection(const xAOD::TruthParticle& mc) const + { + int p = (int) std::fabs(mc.pdgId()); + int s = mc.status(); + int b = mc.barcode(); + + if (b > 100000) return false; + if (p == 11 || p == 13) { + if (s != 1) // only final electrons and muons for e-in-jet and isolation performance eval. + return false; + return true; + } + + if (p == 6) { + if (s != 3) // tops after radiation for mtt reconstruction + return false; + return true; + } + + if (isBhadron(p) || isChadron(p)) { + if (s != 3) // b and c hadrons with status 3 to match with jets + return false; + return true; + } + + if (p == 12 || p == 14 || p == 16) { + if (s != 1) // only final neutrinos for m_tt reconstruction + return false; + return true; + } + + // veto everything else + return false; + } + + void TruthSelectionTtres::print(std::ostream& os) const { + os << "TruthSelectionTtres\n" + << " * keep final electrons and muons\n" + << " * keep top quarks after radiation\n" + << " * keep b and c hadrons\n" + << " * keep final neutrinos\n" + ; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/AntiMuonMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/AntiMuonMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..c675f80eb7e932001e0b875feeef9e8e3bf12d81 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/AntiMuonMC15.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANTIMUONMC15_H_ +#define ANTIMUONMC15_H_ + +#include "TopObjectSelectionTools/MuonSelectionBase.h" +#include "TopObjectSelectionTools/IsolationTools.h" + +#include "AsgTools/ToolHandle.h" +#include "MuonSelectorTools/IMuonSelectionTool.h" + +namespace top { + +/** + * @brief Select muons based on some early MC15 suggestions. + */ +class AntiMuonMC15 : public MuonSelectionBase { +public: + /** + * @brief Construct the tool to select good muons. + * + * @param ptcut The minimum pT cut for good muons. + * @param isolation The isolation the user wants to apply. Don't want any + * isolation to be applied? Then leave this as a nullptr. + */ + AntiMuonMC15(const double ptcut, IsolationBase* isolation); + + ///Does nothing. + virtual ~AntiMuonMC15(){} + + /** + * @brief Implements the logic to select good muons. + * + * @param mu The muon that we want to check. + * @return True if the muon is good, false otherwise. + */ + virtual bool passSelection(const xAOD::Muon& mu) const override; + + /** + * @brief The loose selection needed by some background estimates. + * + * @param mu + * @return + */ + virtual bool passSelectionLoose(const xAOD::Muon& mu) const override; + + ///Print the cuts to the ostream. + virtual void print(std::ostream& os) const override; + + +protected: + ///Lower pT threshold to apply to object selection. + double m_ptcut; + + ///Proper tool to select muons. + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; +// ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolLoose; + + ///Isolation tool, can be nullptr meaning "no isolation requirement" +// std::unique_ptr<top::IsolationBase> m_isolation; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronCutBasedMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronCutBasedMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..eb38ce5c10a3690f32f38eaed1416fcf65bd2bf0 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronCutBasedMC15.h @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ELECTRONCUTBASEDMC15_H_ +#define ELECTRONCUTBASEDMC15_H_ + +#include "TopObjectSelectionTools/ElectronSelectionBase.h" +#include "TopObjectSelectionTools/IsolationTools.h" + +#include <memory> + +namespace top { + +/** + * @brief Electron selection based on the cut-based thingy. + */ +class ElectronCutBasedMC15 : public top::ElectronSelectionBase { +public: + /** + * @brief Class to help select cut-based good electrons. + * + * @param ptcut The minimum pT cut to apply to the electrons. + * @param vetoCrack Do you want to veto 1.37 < |cluster_eta| < 1.52? + * @param quality The definition for good electrons, e.g. "Tight" + * @param qualityLoose The loose defeinition, for fake-lepton estimates with + * the matrix method? + * @param isolation nullptr for un-isolated, or a new "isolation object" to + * apply isolation cuts + */ + ElectronCutBasedMC15(double ptcut, bool vetoCrack, const std::string& quality, const std::string& qualityLoose, IsolationBase* isolation); + virtual ~ElectronCutBasedMC15(){} + /** + * @brief The cuts to select good electrons for your analysis should be + * implemented in here. + * + * @param el The electron to cut on (all electrons in the event are passed + * to the tool) + * @return True if this is a good electron, false otherwise. + */ + virtual bool passSelection(const xAOD::Electron& el) const override; + + /** + * @brief The loose selection needed by some background estimates. + * + * @param el + * @return + */ + virtual bool passSelectionLoose(const xAOD::Electron& el) const override; + + /** + * @brief Print some useful information about the electron selection. + * + * Usually this goes to the log file, so you know what you ran with. + * + * @param Where the print-out should go, e.g. cout. + */ + virtual void print(std::ostream&) const override; + +protected: + /** + * @brief Since both selections are fairly similar, we can perform + * the un-isolated part in one function. + * + * Do all the cuts except for the isolation. + * + * @param el The electron in question + * @param quality The string "Tight" or whatever to say which quality cuts + * should be applied. + * @return True if the electron passes + */ + bool passSelectionNoIsolation(const xAOD::Electron& el, const std::string& quality) const; + + ///minimum pT cut to apply + double m_ptcut; + + ///Should we veto the LAr crack region? + bool m_vetoCrack; + + ///Quality requirement for the tight (analysis) definition + std::string m_quality; + + ///Quality requirement for the loose (background estimate?) definition + std::string m_qualityLoose; + + ///The isolation tool, or nullptr if we don't want isolation + std::unique_ptr<top::IsolationBase> m_isolation; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..81833bcf8864dd6db9519bb40645c02f8cca1e1c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h @@ -0,0 +1,122 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ELECTRONLIKELIHOODMC15_H_ +#define ELECTRONLIKELIHOODMC15_H_ + +#include "TopObjectSelectionTools/ElectronSelectionBase.h" +#include "TopObjectSelectionTools/IsolationTools.h" + +#include <memory> + +namespace top { + + /** + * @brief To select electrons based on the "likelihood" definition. + */ + class ElectronLikelihoodMC15 : public top::ElectronSelectionBase { + public: + /** + * @brief Cut on likelihood electrons + * + * @param ptcut The minimum pT electrons should have + * @param vetoCrack Do you want to veto 1.37 < |cluster_eta| < 1.52? + * @param operatingPoint Likelihood operating point for the main object + * definition + * @param operatingPointLoose Likelihood operating point for the loose + * objects (fakes estimates?) + * @param isolation The isolation tool the user wants to use. If you don't + * want any isolation cuts to be applied then leave this as a nullptr. + */ + ElectronLikelihoodMC15(const double ptcut, const bool vetoCrack, const std::string& operatingPoint, + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true); + // this constructor is kept for backward compatibility - isPrimaryxAOD is not needed anymore + ElectronLikelihoodMC15(const bool, + const double ptcut, const bool vetoCrack, const std::string& operatingPoint, + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true); + virtual ~ElectronLikelihoodMC15(){} + /** + * @brief Selection for the main analysis (i.e. tight object definitions). + * + * @param el The electron in question + * @return True if it passes the selection, false otherwise. + */ + virtual bool passSelection(const xAOD::Electron& el) const override; + + /** + * @brief Selection for the loose object definitions (e.g. in fakes + * estimates). + * + * @param el The electron in question + * @return True if it passes the selection, false otherwise. + */ + virtual bool passSelectionLoose(const xAOD::Electron& el) const override; + + /** + * @brief The BLayer cuts for the loose lepton LH WP. + * + * @param el + * @return True if passes, false otherwise + */ + virtual bool passBLayerCuts(const xAOD::Electron& el) const; + + + /** + * @brief The track-to-vertex association (TTVA) cuts. + * + * @param el + * @return True if passes, false otherwise + */ + virtual bool passTTVACuts(const xAOD::Electron& el) const; + + /** + * @brief The charge flip selector cut + * + * @param el + * @return True if passes, false otherwise + */ + virtual bool passChargeIDCut(const xAOD::Electron& el) const; + + /** + * @brief Why would you not want to know what you're running? + * + * @param os Print details of the cuts to the output stream. + */ + virtual void print(std::ostream& os) const override; + + protected: + /** + * @brief The loose and tight selections are the same, except they have different + * use isolation and a different likelihood tool. + * + * @param el The electron in question. + * @param likelihoodTool The tool to use (m_likelihood, or m_likelihoodLoose) + * @return True if it's good, False if it's not + */ + bool passSelectionNoIsolation(const xAOD::Electron& el, const std::string& operatingPoint_DF, const std::string& operatingPoint) const; + + ///Minimum pT that electrons should have + double m_ptcut; + + ///Veto the crack region? + bool m_vetoCrack; + + std::string m_operatingPoint; + std::string m_operatingPointLoose; + std::string m_operatingPoint_DF; + std::string m_operatingPointLoose_DF; + + ///The isolation tool, or nullptr if we don't want isolation + std::unique_ptr<top::StandardIsolation> m_isolation; + + /// decide if TTVA cut should be applied at all + bool m_applyTTVACut; + + /// decide to apply the charge ID selector tool + bool m_applyChargeIDCut; + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..970a06b104a2f53666ce538b7700496cf861fe59 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronSelectionBase.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ELECTRONSELECTIONBASE_H_ +#define ELECTRONSELECTIONBASE_H_ + +#include "xAODEgamma/Electron.h" + +#include <memory> + +namespace top { + +/** + * @brief Base class for implementing an electron selection. + * + * If you want to build a new electron selection, you should inherit from this. + * Why didn't I use ASG tools as a base? I suspect it's a bit over-complicated + * for this simple task, and this way we can force people to implement + * passSelection for an Electron. I think it would be a less-clean solution if + * we were to use the 'proper' CP tool style. + */ +class ElectronSelectionBase { +public: + ElectronSelectionBase(); + virtual ~ElectronSelectionBase(); + + ///No copy construction + ElectronSelectionBase(const ElectronSelectionBase& rhs) = delete; + + ///No moving - really? Seems a bit strict. We'll see + ElectronSelectionBase(ElectronSelectionBase&& rhs) = delete; + + ///No assignment + ElectronSelectionBase& operator=(const ElectronSelectionBase& rhs) = delete; + + ///For the main analysis object selection + virtual bool passSelection(const xAOD::Electron&) const = 0; + + ///For the loose (e.g. fakes) object selection + virtual bool passSelectionLoose(const xAOD::Electron&) const = 0; + + ///Because everybody likes to know what object definitions they ran with + virtual void print(std::ostream&) const = 0; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::ElectronSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/EventCleaningSelection.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/EventCleaningSelection.h new file mode 100644 index 0000000000000000000000000000000000000000..9787fc024922ef04125124a4aeb57d37f54c551d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/EventCleaningSelection.h @@ -0,0 +1,107 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: EventCleaningSelection.h 797163 2017-02-14 16:31:05Z grancagn $ +#ifndef ANALYSISTOP_TOPOBJECTSELECTIONTOOLS_EVENTCLEANINGSELECTION_H +#define ANALYSISTOP_TOPOBJECTSELECTIONTOOLS_EVENTCLEANINGSELECTION_H + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// GRL include(s): +#include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h" + +// Trigger include(s): +#include "TrigConfInterfaces/ITrigConfigTool.h" +#include "TrigDecisionTool/TrigDecisionTool.h" +#include "TriggerMatchingTool/IMatchingTool.h" +#include "TrigTauMatching/ITrigTauMatching.h" + +// Top include(s): +#include "TopConfiguration/SelectionConfigurationData.h" + +namespace top{ + class TopConfig; + + class EventCleaningSelection final : public asg::AsgTool { + public: + explicit EventCleaningSelection( const std::string& name ); + virtual ~EventCleaningSelection(){} + + StatusCode initilize(); + + void setEventSelections( const std::vector<top::SelectionConfigurationData>& selections ); + bool applyGRL() const; + bool applyTrigger(); + bool applyGoodCalo() const; + bool applyPrimaryVertex() const; + + // Print trigger configuration - very verbose, but tells you which triggers are included for an event + void printTriggers() const; + + // helper to allow us to added trigger decisions to our output files + void addExtraBranches( std::vector<std::string>& extraBranchList ); + + // Delete Standard constructors + EventCleaningSelection(const EventCleaningSelection& rhs) = delete; + EventCleaningSelection(EventCleaningSelection&& rhs) = delete; + EventCleaningSelection& operator=(const EventCleaningSelection& rhs) = delete; + + private: + + ///Match offline electrons to the trigger + void matchElectrons(); + + ///Match offline muons to the trigger + void matchMuons(); + + ///Match offline taus to the trigger + void matchTaus(); + + /// Top config + std::shared_ptr<top::TopConfig> m_config; + + /// GoodRunsLists + ToolHandle<IGoodRunsListSelectionTool> m_grlTool; + + /// Trigger configuration tool + ToolHandle<TrigConf::ITrigConfigTool> m_trigConfTool; + + ///Trigger decision tool + ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; + + // Trigger matching tool + ToolHandle<Trig::IMatchingTool> m_trigMatchTool; + + //Tau trigger matching + ToolHandle<Trig::ITrigTauMatchingTool> m_trigMatchTauTool; + + ///List of triggers to 'or' together for each event. If any one passes, the event passes + std::vector<std::string> m_allTriggers; + std::vector<std::string> m_electronTriggers; + std::vector<std::string> m_muonTriggers; + std::vector<std::string> m_tauTriggers; + + /// Apply a logical OR cut to all supplied triggers + /// If ANY selection does not request the trigger, this will not be set + /// In this case, the apply method will always return true + /// + /// If ALL selections request a trigger, then we can veto events + /// and not run the systematics, pre-OR cuts and the overlap removal + bool m_vetoEventsTrigger; + + /// If ALL selections request GRL, then we can veto events + /// and not run the systematics, pre-OR cuts and the overlap removal + bool m_vetoEventsGRL; + + /// If ALL selections request GOODCALO, then we can veto events + /// Data only + bool m_vetoEventsGoodCalo; + + /// If ALL selections request PRIVTX, then we can veto events + bool m_vetoEventsPriVtx; + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/IsolationTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/IsolationTools.h new file mode 100644 index 0000000000000000000000000000000000000000..63dc09989ae1da1fe644f4bac3c3a8bec7cfbdd1 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/IsolationTools.h @@ -0,0 +1,246 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ISOLATIONTOOLS_H_ +#define ISOLATIONTOOLS_H_ + +#include "xAODBase/IParticle.h" +#include "xAODPrimitives/IsolationType.h" + +namespace top { + +/** + * @brief A common base for implementing isolation cuts. Probably these + * isolation tools should be in individual files? Time will tell. + */ +class IsolationBase { +public: + ///Create + IsolationBase(); + + ///Destroy! + virtual ~IsolationBase(); + + /** + * @brief For applying isolation cuts to the analysis (tight) lepton. + * + * Note that you must implement this otherwise it wont compile. Ha. + * + * @param p The lepton + * @return True if it passes the isolation cuts, false otherwise. + */ + virtual bool passSelection(const xAOD::IParticle& p) const = 0; + + /** + * @brief For applying loose isolation cuts to the loose lepton. + * + * Note that you must implement this otherwise it wont compile. Ha. + * + * @param p The lepton + * @return True if it passes the isolation cuts, false otherwise. + */ + virtual bool passSelectionLoose(const xAOD::IParticle& p) const = 0; + + /** + * @brief Because people like to know what isolation cuts they're applying. + * + * @param os Where to print things to, e.g. cout. + */ + virtual void print(std::ostream& os) const = 0; +}; + +/** + * @brief These should give you access to xAOD::Iso::topoetcone20, 30, 40 + * and ptcone20, 30, 40 + * + * They are only correct in the derivations, they will be wrong in the primary + * xAOD. + * + * It performs an absolute cut on the quantity you specify. If you need more + * fancy things, we should implement them. Don't you want to look at using + * RelativePTVarCone instead though? + */ +class AbsoluteIsolationDC14 : public IsolationBase { +public: + /** + * @brief Absolute cut on topoetcone or ptcone. + * + * Construct with something like: + * + * @code + * new IsolationDC14(xAOD::Iso::topoetcone20, 5000.) + * @endcode + * + * We didn't bother implementing the loose selection yet. I left that as + * an exercise for the reader. + * + * @param type I think xAOD::Iso::topoetcone20, 30, 40 and ptcone20, 30, 40 + * are allowed. + * @param value A number in MeV. + */ + AbsoluteIsolationDC14(const xAOD::Iso::IsolationType type, double value); + virtual bool passSelection(const xAOD::IParticle& p) const override; + virtual bool passSelectionLoose(const xAOD::IParticle& p) const override; + virtual void print(std::ostream& os) const override; + +protected: + ///What to cut on (topoetcone20, 30, 40 or ptcone20, 30, 40). + xAOD::Iso::IsolationType m_type; + + ///The value, in MeV, to cut. + double m_cutvalue; +}; + +/** + * @brief Yay DC14 now has isolation! This should allow you to cut on the + * isolation (ptvarcone) as a fraction of the pt of the lepton. + */ +class RelativePTVarCone : public IsolationBase { +public: + /** + * @brief Cut on the mini-isolation (aka ptvarcone) as a fraction of the + * pt of the lepton. + * + * @param size Cone size (*10). i.e. 20, 30, 40 for the analysis + * @param fraction For the tight (analysis) leptons + * @param sizeLoose Cone size for the loose lepton definition + * @param fractionLoose Fraction for the loose lepton definition + */ + RelativePTVarCone(unsigned int size, double fraction, unsigned int sizeLoose, double fractionLoose); + + /** + * @brief Does this particle pass the isolation cuts for the main analysis + * definitions? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelection(const xAOD::IParticle& p) const override; + + /** + * @brief Does this particle pass the isolation cuts for the loose analysis + * definitions (useful for background estimates)? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelectionLoose(const xAOD::IParticle& p) const override; + + ///Come on, you really need me to tell you what this does? + virtual void print(std::ostream& os) const override; + +protected: + ///The name of the variable to access, e.g. ptvarcone20 formed in the constructor. + std::string m_size; + + ///For the main analysis object selection + double m_fraction; + + ///Name of the variable to access for the loose object definition + std::string m_sizeLoose; + + ///For the objects used in the looser object selection (e.g. matrix method fakes) + double m_fractionLoose; +}; + +/** + * @brief Danilo's approximation of mini-isolation which has been calculated + * in AnalysisTop and applied as a decoration to the objects. + * + * This gave you something to work with before the DC14 derivations included + * isolation (which they should by the time you read this). Probably other + * options will be better, and almost certainly faster if we don't need to load + * all the tracks! + */ +class ApproxPTVarCone : public IsolationBase { +public: + /** + * @brief An approximation of mini-isolation. + * + * This applies some sort of fractional cut to mini-iso / particle pT. + * + * @param fraction For the tight (analysis) leptons + * @param fractionLoose For leptons that will be used in the background + * estimate. + */ + ApproxPTVarCone(double fraction, double fractionLoose); + + /** + * @brief Does this particle pass the isolation cuts for the main analysis + * definitions? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelection(const xAOD::IParticle& p) const override; + + /** + * @brief Does this particle pass the isolation cuts for the loose analysis + * definitions (useful for background estimates)? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelectionLoose(const xAOD::IParticle& p) const override; + + ///Come on, you really need me to tell you what this does? + virtual void print(std::ostream& os) const override; + +protected: + ///For the main analysis object selection + double m_fraction; + + ///For the objects used in the looser object selection (e.g. matrix method fakes) + double m_fractionLoose; +}; + +/** + * @brief Apply the cuts to etcone and ptcone like we used to in Run-I + */ +class StandardIsolation : public IsolationBase { +public: + /** + * @brief Applies the cuts to etcone and ptcone like we used to in Run-I + * + * This sets up the isolation tool and configures it with the cuts. + */ + StandardIsolation(const std::string& tightLeptonIsolation = "Gradient" , + const std::string& looseLeptonIsolation = "None" ); + + /** + * @brief Does this particle pass the isolation cuts for the main analysis + * definitions? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelection(const xAOD::IParticle& p) const override; + + /** + * @brief Does this particle pass the isolation cuts for the loose analysis + * definitions (useful for background estimates)? + * + * @param p Particle that we're worried about. + * @return True if it passes the isolation cuts. + */ + virtual bool passSelectionLoose(const xAOD::IParticle& p) const override; + + std::string tightLeptonIsolation() {return m_tightLeptonIsolation;}; + std::string looseLeptonIsolation() {return m_looseLeptonIsolation;}; + + ///Come on, you really need me to tell you what this does? + virtual void print(std::ostream& os) const override; + +protected: + std::string m_tightLeptonDecoration; + std::string m_looseLeptonDecoration; + std::string m_tightLeptonIsolation; + std::string m_looseLeptonIsolation; + bool m_doTightIsolation; + bool m_doLooseIsolation; +}; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..67c37327f20d97f076d0dc21413ef91713c661cc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetMC15.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETMC15_H_ +#define JETMC15_H_ + +#include "TopObjectSelectionTools/JetSelectionBase.h" +#include "JetJvtEfficiency/IJetJvtEfficiency.h" + +#include "AsgTools/ToolHandle.h" + +# include <string> + +namespace top { + +/** + * @brief A class that performs object cuts on Jets (of any size!). At the + * moment it includes a cut on pT, eta and JVT. + */ +class JetMC15 : public JetSelectionBase { + public: + /** + * @brief A tool to select some jets for MC15 based on the pT and eta cuts. + * + * @param ptcut The minimum pT to accept good jets. + * @param etamax The maximum eta cut. + * @param doJVTCut To perform JVT cut - should be false for small-R jets + * @param fwdJetSel Scenario for treating forward jets. + */ + JetMC15(const double ptcut, const double etamax, const bool doJVTCut, const std::string fwdJetSel="default"); + + /** + * @brief A tool to select some jets for MC15 based on the pT and eta cuts. + * + * This version of the constructor always perform JVT cut + * + * @param ptcut The minimum pT to accept good jets. + * @param etamax The maximum eta cut. + * @param fwdJetSel Scenario for treating forward jets. + */ + JetMC15(const double ptcut, const double etamax, const std::string fwdJetSel="default"); + + /** + * @brief A tool to select some jets for MC15 based on the pT and eta cuts. + * + * DEPRECATED - only kept for backward compatibility - no need to specify any jvt cut, please use the above function instead. + * + * @param ptcut The minimum pT to accept good jets. + * @param etamax The maximum eta cut. + * @param jvtmin The minimum cut on the jet vertex fraction (no longer used) + */ + JetMC15(const double ptcut, const double etamax, const double); + + // Does nothing. + virtual ~JetMC15() {} + + /** + * @brief Implements the logic to select jets based on pT and eta. + * + * It cuts on pt, eta, jvt. + * + * @param jet The jet to check. + * @return True if the jet passes the cuts, false otherwise. + */ + virtual bool passSelection(const xAOD::Jet& jet) override; + + // Print the cuts to the ostream. + virtual void print(std::ostream& os) const override; + + protected: + // The lower pT cut threshold to apply to the object. + double m_ptcut; + + // The upper eta cut. + double m_etamax; + + // Scenario for treating forward jets + std::string m_fwdJetSel; + + // To do JVT cut - should be false for large-R jets + bool m_applyJVTCut; + + ToolHandle<CP::IJetJvtEfficiency> m_jvt_tool; +}; +} // namespace top +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..eeb33f65c694645f98116e918d66959f79c505f5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/JetSelectionBase.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETSELECTIONBASE_H_ +#define JETSELECTIONBASE_H_ + +#include "xAODJet/Jet.h" + +namespace top { + +class JetSelectionBase { +public: + JetSelectionBase(); + + virtual ~JetSelectionBase(); + + virtual bool passSelection(const xAOD::Jet&) = 0; + + virtual void print(std::ostream&) const = 0; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::JetSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..49f0040a286df500953ed15bd30538dae0f77947 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonMC15.h @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONMC15_H_ +#define MUONMC15_H_ + +#include "TopObjectSelectionTools/MuonSelectionBase.h" +#include "TopObjectSelectionTools/IsolationTools.h" + +#include "AsgTools/ToolHandle.h" +#include "MuonSelectorTools/IMuonSelectionTool.h" + +namespace top { + +/** + * @brief Select muons based on some early MC15 suggestions. + */ +class MuonMC15 : public MuonSelectionBase { + public: + /** + * @brief Construct the tool to select good muons. + * + * @param ptcut The minimum pT cut for good muons. + * @param isolation The isolation the user wants to apply. Don't want any + * isolation to be applied? Then leave this as a nullptr. + */ + MuonMC15(const double ptcut, + IsolationBase* isolation, + const bool applyTTVACut = true); + + // Does nothing. + virtual ~MuonMC15() {} + + /** + * @brief Implements the logic to select good muons. + * + * @param mu The muon that we want to check. + * @return True if the muon is good, false otherwise. + */ + virtual bool passSelection(const xAOD::Muon& mu) const override; + + /** + * @brief The loose selection needed by some background estimates. + * + * @param mu + * @return + */ + virtual bool passSelectionLoose(const xAOD::Muon& mu) const override; + + /** + * @brief The track-to-vertex association (TTVA) cuts. + * + * @param mu + * @return True if passes, false otherwise + */ + virtual bool passTTVACuts(const xAOD::Muon& mu) const; + + // Print the cuts to the ostream. + virtual void print(std::ostream& os) const override; + + + protected: + // Lower pT threshold to apply to object selection. + double m_ptcut; + + // Proper tool to select muons. + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolLoose; + + // Isolation tool, can be nullptr meaning "no isolation requirement" + std::unique_ptr<top::IsolationBase> m_isolation; + + // decide if TTVA cut should be applied at all + bool m_applyTTVACut; +}; +} // namespace top + +#endif // MUONMC15_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..d0fe26fb0697fdc0edda55f91cc5e63e45cb1531 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/MuonSelectionBase.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONSELECTIONBASE_H_ +#define MUONSELECTIONBASE_H_ + +#include "xAODMuon/Muon.h" + +namespace top { + +class MuonSelectionBase { +public: + MuonSelectionBase(); + virtual ~MuonSelectionBase(); + + ///No copy construction + MuonSelectionBase(const MuonSelectionBase& rhs) = delete; + + ///No moving - really? Seems a bit strict. We'll see + MuonSelectionBase(MuonSelectionBase&& rhs) = delete; + + ///No assignment + MuonSelectionBase& operator=(const MuonSelectionBase& rhs) = delete; + + ///For the main analysis object selection + virtual bool passSelection(const xAOD::Muon&) const = 0; + + ///For the loose (e.g. fakes) object selection + virtual bool passSelectionLoose(const xAOD::Muon&) const = 0; + + ///Because everybody likes to know what object definitions they ran with + virtual void print(std::ostream&) const = 0; + +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::MuonSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalASG.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalASG.h new file mode 100644 index 0000000000000000000000000000000000000000..4806f7b19778ab4e64de1109ec5464de4d515136 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalASG.h @@ -0,0 +1,104 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: OverlapRemovalIndices.h 643484 2015-02-02 11:23:34Z simon $ +#ifndef ANALYSISTOP_TOPOBJECTSELECTONTOOLS_OVERLAPREMOVALASG_H +#define ANALYSISTOP_TOPOBJECTSELECTONTOOLS_OVERLAPREMOVALASG_H + +// system include(s): +#include <vector> + +// Framework includes: +#include "AsgTools/AnaToolHandle.h" + +#include "TopObjectSelectionTools/OverlapRemovalBase.h" +#include "AssociationUtils/IOverlapRemovalTool.h" + +namespace top { + +/** + * @brief The Harmonization Group recommended object overlap removal + */ + class OverlapRemovalASG : public top::OverlapRemovalBase { + public: + /** + * @brief Sets up ASG Overlap Removal Tool + * + * @param dolargeJet Enables OR also with large-R jets + * This is false by default becaause large-R jets are a bit special. + * + */ + OverlapRemovalASG(bool dolargeJet = false); + + ///does nothing + virtual ~OverlapRemovalASG(); + + /** + * @brief Perform the "ASG standard" overlap removal. + * + * This runs for every event. + * + * @param photon All the photons in the event + * @param el All the electrons (even bad ones). Good ones are decorated + * with passPreORSelection = 1. + * @param mu All the muons in the event + * @param tau All the taus in the event + * @param jet All the jets in the event + * @param ljet All the large-R jets in the event + * + * @param goodPhotons The indices of the photons to keep + * @param goodElectrons The indices of the electrons to keep (e.g. the 0th, 2nd) + * @param goodMuons The indices of the muons to keep + * @param goodTaus The indices of the taus to keep + * @param goodJets The indices of the jets to keep + * @param goodLargeRJets The indices of the large-R jets to keep + * + */ + virtual void overlapremoval(const xAOD::PhotonContainer* photon , + const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::TauJetContainer* tau , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& goodPhotons, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTaus, + std::vector<unsigned int>& goodJets, + std::vector<unsigned int>& goodLargeRJets, + const bool isLooseEvent ); + + ///Print something useful to the screen + virtual void print(std::ostream&) const; + + protected: + + /// For a generic container of type DataVector, fill a vector of + /// ints for objects we want to keep + virtual void removeObjectOverlap( const xAOD::IParticleContainer* xaod , + std::vector<unsigned int>& OUT_vec, + const std::string passTopCuts); + + + /// For a generic container of type DataVector, fill a vector of + /// ints for objects we want to keep + /// This doesn't check for overlap removal (Large R jets) + virtual void removeObject( const xAOD::IParticleContainer* xaod , + std::vector<unsigned int>& OUT_vec, + const std::string passTopCuts); + + // ASG overlap removal tool + asg::AnaToolHandle<ORUtils::IOverlapRemovalTool> m_overlapRemovalTool; + asg::AnaToolHandle<ORUtils::IOverlapRemovalTool> m_overlapRemovalToolLoose; + + const std::string m_passPreORSelection; + const std::string m_passPreORSelectionLoose; + const std::string m_overlaps; // true if object overlaps with another + + bool m_doLargeJet; + + }; + +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalBase.h new file mode 100644 index 0000000000000000000000000000000000000000..a88009b7d1dd2890f5427e4cbea5d313c8696234 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalBase.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef OVERLAPREMOVALBASE_H_ +#define OVERLAPREMOVALBASE_H_ + +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODTau/TauJetContainer.h" + +namespace top { + +class OverlapRemovalBase { +public: + OverlapRemovalBase(); + virtual ~OverlapRemovalBase(); + + OverlapRemovalBase(const OverlapRemovalBase& rhs) = delete; + OverlapRemovalBase(OverlapRemovalBase&& rhs) = delete; + OverlapRemovalBase& operator=(const OverlapRemovalBase& rhs) = delete; + + virtual void overlapremoval(const xAOD::PhotonContainer* photon , + const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::TauJetContainer* tau , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& goodPhotons, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTaus, + std::vector<unsigned int>& goodJets, + std::vector<unsigned int>& goodLargeRJets, + const bool isLooseEvent ) = 0; + + virtual bool overlapsEl(std::vector<unsigned int>&) {return false;} + virtual bool overlapsMu(std::vector<unsigned int>&) {return false;} + + virtual void print(std::ostream&) const = 0; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::OverlapRemovalBase& overlapremoval); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalIndices.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalIndices.h new file mode 100644 index 0000000000000000000000000000000000000000..ea92eab8ebc4c9514475b1008ebcfab29697ae1d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/OverlapRemovalIndices.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: OverlapRemovalIndices.h 661110 2015-04-17 00:03:39Z morrisj $ +#ifndef ANALYSISTOP_TOPOBJECTSELECTONTOOLS_OVERLAPREMOVALINDICES_H +#define ANALYSISTOP_TOPOBJECTSELECTONTOOLS_OVERLAPREMOVALINDICES_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief OverlapRemovalIndices + * Do overlap removal based on selected indices + * + * $Revision: 661110 $ + * $Date: 2015-04-17 02:03:39 +0200 (Fri, 17 Apr 2015) $ + * + **/ + +// system include(s): +#include <memory> +#include <vector> + +#include "TopObjectSelectionTools/OverlapRemovalBase.h" + +namespace top { + +/** + * @brief The "standard" overlap removal for the top group + */ + class OverlapRemovalIndices : public top::OverlapRemovalBase { + public: + ///Doesn't do anything + OverlapRemovalIndices(); + + ///Doesn't do anything + virtual ~OverlapRemovalIndices(); + + /** + * @brief Perform our "standard" overlap removal. + * + * This runs for every event. + * + * The overlap removal consists of: + * - (1) remove muon within dR < 0.4 of any jet + * - (2) remove single jet closest to an electron (within dR < 0.2) + * - (3) remove electron with dR < 0.4 of jet + * + * @param el All the electrons (even bad ones). Good ones are decorated + * with passPreORSelection = 1. + * @param mu All the muons in the event + * @param jet All the jets in the event + * @param ljet All the large-R jets in the event + * @param OUT_el The indices of the electrons to keep (e.g. the 0th, 2nd) + * @param OUT_mu The indices of the muons to keep + * @param OUT_jet The indices of the jets to keep + * @param OUT_ljet The indices of the large-R jets to keep + */ + virtual void overlapremoval(const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet , + std::vector<unsigned int>& OUT_el , + std::vector<unsigned int>& OUT_mu , + std::vector<unsigned int>& OUT_jet , + std::vector<unsigned int>& OUT_ljet , + const bool isLooseEvent ); + + virtual void overlapremoval(const xAOD::PhotonContainer* photon , + const xAOD::ElectronContainer* el , + const xAOD::MuonContainer* mu , + const xAOD::TauJetContainer* tau , + const xAOD::JetContainer* jet , + const xAOD::JetContainer* ljet, + std::vector<unsigned int>& goodPhotons, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTaus, + std::vector<unsigned int>& goodJets, + std::vector<unsigned int>& goodLargeRJets, + const bool isLooseEvent ); + + ///Print something useful to the screen + virtual void print(std::ostream&) const; + }; + +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..028629c64ea9a13689a785321f6b11257fe87760 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonMC15.h @@ -0,0 +1,107 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPOBJECTSELECTIONTOOLS_PHOTONMC15_H_ +#define TOPOBJECTSELECTIONTOOLS_PHOTONMC15_H_ + +#include <memory> +#include <string> + +#include "TopObjectSelectionTools/PhotonSelectionBase.h" +#include "TopObjectSelectionTools/IsolationTools.h" + +#include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h" + +namespace top { + +/** + * @brief Photon selection for top analyses. + */ + +class PhotonMC15 : public top::PhotonSelectionBase { + public: + /** + * @brief Class to help select good photons. + * + * @param ptcut The minimum pT cut to apply to the photons. + * @param etamax The maximum eta cut + * @param isolation nullptr for un-isolated, or a new "isolation object" to + * apply isolation cuts + */ + PhotonMC15(double ptcut, double etamax, IsolationBase* isolation); + + /** + * @brief Class to help select good photons. + * + * @param ptcut The minimum pT cut to apply to the photons. + * @param etamax The maximum eta cut + * @param tightID The ID level used to select tight photons. + * @param looseID The ID level used to select loose photons. + * @param isolation nullptr for un-isolated, or a new "isolation object" to + * apply isolation cuts + */ + PhotonMC15(double ptcut, double etamax, + const std::string& tightID, + const std::string& looseID, + IsolationBase* isolation); + + /** + * @brief The cuts to select good photons for your analysis should be + * implemented in here. + * + * @param ph The photon to cut on (all photons in the event are passed + * to the tool) + * @return True if this is a good photon, false otherwise. + */ + bool passSelection(const xAOD::Photon& ph) const override; + + /** + * @brief The loose selection. + * + * @param ph + * @return + */ + bool passSelectionLoose(const xAOD::Photon& ph) const override; + + /** + * @brief Print some useful information about the photon selection. + * + * Usually this goes to the log file, so you know what you ran with. + * + * @param Where the print-out should go, e.g. cout. + */ + void print(std::ostream&) const override; + + private: + /** + * @brief Do all the cuts except for the isolation. + * + * @param ph The photon in question + * @return True if the photon passes + */ + bool passSelectionNoIsolation(const xAOD::Photon& ph, + const std::string& photon_selection) const; + + std::string getConfigFile(int operatingPoint); + + // minimum pT cut to apply + double m_ptcut; + + // max eta cut + double m_etamax; + + std::string m_photon_selection; + std::string m_loose_photon_selection; + + // Proper tool to select photons. + // ToolHandle<AsgPhotonIsEMSelector> m_photonTightIsEMSelector; + // ToolHandle<AsgPhotonIsEMSelector> m_photonMediumIsEMSelector; + // ToolHandle<AsgPhotonIsEMSelector> m_photonLooseIsEMSelector; + + // The isolation tool, or nullptr if we don't want isolation + std::unique_ptr<top::IsolationBase> m_isolation; +}; + +} // namespace top +#endif // TOPOBJECTSELECTIONTOOLS_PHOTONMC15_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..bb1015d25c4455f667cd2dd03d9f8870c4fc8f95 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/PhotonSelectionBase.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PHOTONSELECTIONBASE_H_ +#define PHOTONSELECTIONBASE_H_ + +#include "xAODEgamma/Photon.h" + +#include <memory> + +namespace top { + +/** + * @brief Base class for implementing an Photon selection. + * + * If you want to build a new photon selection, you should inherit from this. + * + */ + +class PhotonSelectionBase { +public: + PhotonSelectionBase(); + virtual ~PhotonSelectionBase(); + + ///No copy construction + PhotonSelectionBase(const PhotonSelectionBase& rhs) = delete; + + ///No moving + PhotonSelectionBase(PhotonSelectionBase&& rhs) = delete; + + ///No assignment + PhotonSelectionBase& operator=(const PhotonSelectionBase& rhs) = delete; + + ///For the main analysis object selection + virtual bool passSelection(const xAOD::Photon&) const = 0; + + ///For the loose object selection + virtual bool passSelectionLoose(const xAOD::Photon&) const = 0; + + ///Because everybody likes to know what object definitions they ran with + virtual void print(std::ostream&) const = 0; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::PhotonSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/RCJetMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/RCJetMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..38a90b197e98787b7f088d132f9226f40bb667a7 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/RCJetMC15.h @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RCJETMC15_H_ +#define RCJETMC15_H_ + +#include "TopEvent/Event.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/TopEventMaker.h" +#include "TopEvent/SystematicEvent.h" +#include "TopConfiguration/ConfigurationSettings.h" + +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#include "xAODRootAccess/TActiveStore.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" + +#include "JetReclustering/JetReclusteringTool.h" +#include <unordered_map> +#include <unordered_set> +#include <memory> +#include <set> +#include <list> +#include <vector> + +// Forward declaration(s): +namespace xAOD{ + class SystematicEvent; +} + +namespace top{ + class TopConfig; + class Event; +} + +class RCJetMC15 final : public asg::AsgTool{ +public: + //Default - so root can load based on a name + explicit RCJetMC15(const std::string& name); + + //Default - so we can clean up + ~RCJetMC15(); + + // Delete Standard constructors + RCJetMC15(const RCJetMC15& rhs) = delete; + RCJetMC15(RCJetMC15&& rhs) = delete; + RCJetMC15& operator=(const RCJetMC15& rhs) = delete; + + //Run once at the start of the job + StatusCode initialize(); + + //Run for every event (in every systematic) that needs saving + StatusCode execute(const top::Event& event); + + //Clean-up remaining things + StatusCode finalize(); + + //Check if systematic needs a unique container + bool isUniqueSyst( std::string syst_name ); + + //Access all of the container names from the Event Saver + std::string inputContainerName( std::size_t hash_value, bool isLooseEvent ); + std::string rcjetContainerName( std::size_t hash_value, bool isLooseEvent ); + + bool passSelection(const xAOD::Jet& jet) const; + + +private: + + std::string m_name; + + std::shared_ptr<top::TopConfig> m_config; + bool m_VarRCjets; + std::string m_VarRCjets_rho; + std::string m_VarRCjets_mass_scale; + float m_ptcut; // in GeV + float m_etamax; + float m_trim; + float m_radius; + float m_minradius; + float m_massscale; + + std::string m_egamma; + std::string m_jetsyst; + std::string m_muonsyst; + + std::string m_InJetContainerBase; + std::string m_OutJetContainerBase; + std::string m_InputJetContainer; + std::string m_OutputJetContainer; + int m_loose_hashValue; + bool m_unique_syst; + + typedef std::map<std::size_t,std::string>::iterator m_iterator; + std::map<std::size_t,std::string> m_inputContainerNames; + std::map<std::size_t,std::string> m_outputContainerNames; + + std::map<std::string,float> mass_scales = { + {"m_t",172500.}, + {"m_w",80385.}, + {"m_z",91188.}, + {"m_h",125090.}}; + + //re-clustered jets + // -> need unordered map for systematics + std::unordered_map<std::size_t, JetReclusteringTool*> m_jetReclusteringTool; + typedef std::unordered_map<std::size_t, JetReclusteringTool*>::iterator m_tool_iterator; + + ClassDef(RCJetMC15, 0); +}; + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..aa343e8e5d1d7c450748511cd78bd422b1c395f4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauMC15.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TOPOBJECTSELECTIONTOOLS_TAUMC15_H_ +#define TOPOBJECTSELECTIONTOOLS_TAUMC15_H_ + +#include <memory> + +#include "TopObjectSelectionTools/TauSelectionBase.h" +#include "TauAnalysisTools/TauSelectionTool.h" +#include "TauAnalysisTools/Enums.h" +#include "TopEvent/EventTools.h" + +namespace top { + +/** + * @brief To select taus based on BoostedDecisionTree definition. + */ +class TauMC15 : public top::TauSelectionBase { + public: + TauMC15(); + + virtual ~TauMC15() {} + /** + * @brief Selection for the main analysis (i.e. tight object definitions). + * + * @param tauJet The tau in question + * @return True if it passes the selection, false otherwise. + */ + bool passSelection(const xAOD::TauJet& tau) const override; + + /** + * @brief Selection for the "loose" object definitions (e.g. in fakes + * estimates). + * + * @param tauJet The tau in question + * @return True if it passes the selection, false otherwise. + */ + bool passSelectionLoose(const xAOD::TauJet& tau) const override; + + /** + * @brief Why would you not want to know what you're running? + * + * @param os Print details of the cuts to the output stream. + */ + void print(std::ostream& os) const override; + + + protected: + // The selection tool to use for the tight (main) analysis. + ToolHandle<TauAnalysisTools::TauSelectionTool> m_tauSelection; + + // The selection tool to use for the loose (e.g. fakes) object selection. + ToolHandle<TauAnalysisTools::TauSelectionTool> m_tauSelectionLoose; +}; + +} // namespace top + +#endif // TOPOBJECTSELECTIONTOOLS_TAUMC15_H_ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..4a106f8b8280024798f71fad9d5f646235becf67 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TauSelectionBase.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TAUSELECTIONBASE_H_ +#define TAUSELECTIONBASE_H_ + +#include "xAODTau/TauJet.h" + +namespace top { + +class TauSelectionBase { +public: + TauSelectionBase(); + virtual ~TauSelectionBase(); + + ///No copy construction + TauSelectionBase(const TauSelectionBase& rhs) = delete; + + ///No moving - really? Seems a bit strict. We'll see + TauSelectionBase(TauSelectionBase&& rhs) = delete; + + ///No assignment + TauSelectionBase& operator=(const TauSelectionBase& rhs) = delete; + + ///For the main analysis object selection + virtual bool passSelection(const xAOD::TauJet&) const = 0; + + ///For the loose (e.g. fakes) object selection + virtual bool passSelectionLoose(const xAOD::TauJet&) const = 0; + + ///Because everybody likes to know what object definitions they ran with + virtual void print(std::ostream&) const = 0; +}; + +} + +std::ostream& operator<<(std::ostream& os, const top::TauSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TopObjectSelection.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TopObjectSelection.h new file mode 100644 index 0000000000000000000000000000000000000000..31b0b8d8af0ef46dfcae606ee75f5732c5b833a5 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TopObjectSelection.h @@ -0,0 +1,254 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TopObjectSelection.h 802995 2017-04-17 01:23:28Z tpelzer $ +#ifndef ANALYSISTOP_TOPOBJECTSELECTONTOOLS_TOPOBJECTSELECTION_H +#define ANALYSISTOP_TOPOBJECTSELECTONTOOLS_TOPOBJECTSELECTION_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TopObjectSelection + * Selects top objects according to the ObjectLoaderBase type + * + * $Revision: 802995 $ + * $Date: 2017-04-17 03:23:28 +0200 (Mon, 17 Apr 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <vector> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Top include(s): +#include "TopObjectSelectionTools/ElectronSelectionBase.h" +#include "TopObjectSelectionTools/MuonSelectionBase.h" +#include "TopObjectSelectionTools/JetSelectionBase.h" +#include "TopObjectSelectionTools/TauSelectionBase.h" +#include "TopObjectSelectionTools/PhotonSelectionBase.h" +#include "TopObjectSelectionTools/OverlapRemovalBase.h" + +#include "TopSystematicObjectMaker/ElectronInJetSubtractionCollectionMaker.h" +#include "xAODBTaggingEfficiency/BTaggingSelectionTool.h" + +#include "TopEvent/Event.h" + +// forward declare +namespace xAOD{ + class SystematicEvent; +} + +namespace top { +class TopConfig; + +/** + * @brief Configure the object selection used in the analysis. The user should + * be able to configure this, or if they really really want to, then overload it + * with a class based on TopObjectSelection and load that at run time. Crazy. + */ +class TopObjectSelection : public asg::AsgTool { +public: + /** + * @brief Setup the object selection at the start of the run. + * + * @param config We need the configuration object because it contains a lot + * of information about what the user wants (which containers to load for + * example). Note that it's not a smart pointer (yet) because of root5 + * restrictions on dynamic class loading. + * + */ + explicit TopObjectSelection( const std::string& name ); + virtual ~TopObjectSelection(){} + + // Delete Standard constructors + TopObjectSelection(const TopObjectSelection& rhs) = delete; + TopObjectSelection(TopObjectSelection&& rhs) = delete; + TopObjectSelection& operator=(const TopObjectSelection& rhs) = delete; + + StatusCode initialize(); + + /** + * @brief Code that runs for every event (note that it runs the selection + * on all the systematic variations too). + * + * @param topEvt The top event containing all the systematic variations. + */ + StatusCode execute(); + + /** + * @brief Set the code used to select electrons. + * + * Note that nullptr means that no selection will be applied (so all + * electrons will be accepted). + * + * @param ptr The code used to perform the electron selection (see + * TopObjectSelectionTools). + */ + void electronSelection(ElectronSelectionBase* ptr); + + /** + * @brief Set the code used to select muons. + * + * Note that nullptr means that no selection will be applied (so all + * muons will be accepted). + * + * @param ptr The code used to perform the muon selection (see + * TopObjectSelectionTools). + */ + void muonSelection(MuonSelectionBase* ptr); + + /** + * @brief Set the code used to select taus. + * + * Note that nullptr means that no selection will be applied (so all + * muons will be accepted). + * + * @param ptr The code used to perform the muon selection (see + * TopObjectSelectionTools). + */ + void tauSelection(TauSelectionBase* ptr); + + /** + * @brief Set the code used to select jets. + * + * Note that nullptr means that no selection will be applied (so all + * jets will be accepted). + * + * @param ptr The code used to perform the jets selection (see + * TopObjectSelectionTools). + */ + void jetSelection(JetSelectionBase* ptr); + + /** + * @brief Set the code used to select photons. + * + * Note that nullptr means that no selection will be applied (so all + * photons will be accepted). + * + * @param ptr The code used to perform the photon selection (see + * TopObjectSelectionTools). + */ + void photonSelection(PhotonSelectionBase* ptr); + + + /** + * @brief Set the code used to select large jets. + * + * Note that nullptr means that no selection will be applied (so all + * large jets will be accepted). + * + * @param ptr The code used to perform the large jets selection (see + * TopObjectSelectionTools). + */ + void largeJetSelection(JetSelectionBase* ptr); + + /** + * @brief Set the code used to select track jets. + * + * Note that nullptr means that no selection will be applied (so all + * track jets will be accepted). + * + * @param ptr The code used to perform the track jets selection (see + * TopObjectSelectionTools). + */ + void trackJetSelection(JetSelectionBase* ptr); + + /** + * @brief Set the code used to perform the overlap removal. At the moment + * the overlap removal is performed after all the electron, muon, jet etc + * selections are performed. + * + * @param ptr The overlap removal code to be used. + */ + void overlapRemovalPostSelection(OverlapRemovalBase* ptr); + void overlapRemovalPostSelectionTrackJets(OverlapRemovalBase* ptr); + + /** + * @brief Print details of this object selection to wherever the user asks + * for. Useful for checking cuts in the log files I hope! + * + * @param os Where you would like the output printing to, presumably std::cout? + */ + virtual void print(std::ostream& os) const; + + /** + * @brief or prehaps you'd like the AsgTool print function + */ + virtual void print() const; + +private: + void applySelectionPreOverlapRemoval(); + void applySelectionPreOverlapRemovalPhotons(); + void applySelectionPreOverlapRemovalElectrons(); + void applySelectionPreOverlapRemovalMuons(); + void applySelectionPreOverlapRemovalTaus(); + void applySelectionPreOverlapRemovalJets(); + void applySelectionPreOverlapRemovalLargeRJets(); + void applySelectionPreOverlapRemovalTrackJets(); + + virtual StatusCode applyOverlapRemoval(); + virtual StatusCode applyOverlapRemoval(const bool isLoose,const std::string& sgKey); + virtual StatusCode applyOverlapRemoval(xAOD::SystematicEvent* currentSystematic); + + void applyTightSelectionPostOverlapRemoval( const xAOD::IParticleContainer* xaod , std::vector<unsigned int>& indices ); + void trackJetOverlapRemoval(const xAOD::IParticleContainer* xaod_el, + const xAOD::IParticleContainer* xaod_mu, + const xAOD::IParticleContainer* xaod_tjet, + std::vector<unsigned int>& goodElectrons, + std::vector<unsigned int>& goodMuons, + std::vector<unsigned int>& goodTrackJets); + + /** + * @brief Pointer to the configuration object so we can check which objects + * were requested in the config file. + */ + std::shared_ptr<top::TopConfig> m_config; + + ///Electron selection code - can load user defined classes + std::unique_ptr<top::ElectronSelectionBase> m_electronSelection; + + ///Muon selection code - can load user defined classes + std::unique_ptr<top::MuonSelectionBase> m_muonSelection; + + ///Tau selection code - can load user defined classes + std::unique_ptr<top::TauSelectionBase> m_tauSelection; + + ///Jet selection code - can load user defined classes + std::unique_ptr<top::JetSelectionBase> m_jetSelection; + + ///Photon selection code - can load user defined classes + std::unique_ptr<top::PhotonSelectionBase> m_photonSelection; + + + ///Large-R jet selection code - can load user defined classes + std::unique_ptr<top::JetSelectionBase> m_largeJetSelection; + + ///Track jet selection code - can load user defined classes + std::unique_ptr<top::JetSelectionBase> m_trackJetSelection; + + ///Overlap removal that runs after all object selection + std::unique_ptr<top::OverlapRemovalBase> m_overlapRemovalToolPostSelection; + + //Electron In Jet Subtraction + std::unique_ptr<top::ElectronInJetSubtractionCollectionMaker> m_electronInJetSubtractor; + + // Pass selection strings + const std::string m_passPreORSelection; + const std::string m_passPreORSelectionLoose; + // the following two are used to give failing JVT jets a lower priority in the OR + const std::string m_ORToolDecoration; + const std::string m_ORToolDecorationLoose; + + // Do we need to request loose lepton selection + bool m_doLooseCuts; + + // do decorate the jets with the b-tagging flags + std::unordered_map<std::string, ToolHandle<IBTaggingSelectionTool>> m_btagSelTools; + std::unordered_map<std::string, ToolHandle<IBTaggingSelectionTool>> m_trkjet_btagSelTools; +}; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TrackJetMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TrackJetMC15.h new file mode 100644 index 0000000000000000000000000000000000000000..b36b72ba12c2bbd4a7b6bea23bc6dcab452f65a3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TrackJetMC15.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKJETMC15_H_ +#define TRACKJETMC15_H_ + +#include "TopObjectSelectionTools/JetSelectionBase.h" + +namespace top { + class TrackJetMC15 : public top::JetSelectionBase { + public: + TrackJetMC15(const double ptcut,const double etamax); + ~TrackJetMC15(); + virtual bool passSelection(const xAOD::Jet& jet) override; + virtual void print(std::ostream& os) const override; + private: + double m_ptcut; + double m_etamax; + + + }; +} +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..b875e44d189bd54ecd0bdafd03a6eb44c4acca53 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionBase.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRUTHSELECTIONBASE_H_ +#define TRUTHSELECTIONBASE_H_ + +#include "xAODTruth/TruthParticleContainer.h" + +#include <memory> + + /** + * @brief Base class for implementing a truth selection. + * + * If you want to build a new truth selection, you should inherit from this. + */ + +namespace top { + + class TruthSelectionBase { + public: + TruthSelectionBase(); + + virtual ~TruthSelectionBase(){} + + virtual bool passSelection(const xAOD::TruthParticle&) const = 0; + + virtual void print(std::ostream&) const = 0; + + protected: + bool isBhadron(int pid) const; + bool isChadron(int pid) const; + + TruthSelectionBase(const TruthSelectionBase& rhs); + TruthSelectionBase(const TruthSelectionBase&& rhs); + void operator=(const TruthSelectionBase& rhs); + }; +} + +std::ostream& operator<<(std::ostream& os, const top::TruthSelectionBase& selection); + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionTtres.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionTtres.h new file mode 100644 index 0000000000000000000000000000000000000000..462c0462bf6fb193a6ad824ea4256638abf9d41f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/TruthSelectionTtres.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRUTHSELECTIONTTRES_H_ +#define TRUTHSELECTIONTTRES_H_ + +#include "TopObjectSelectionTools/TruthSelectionBase.h" + + + /** + * @brief An example class implementing a truth selection for tt resonances. + * + */ + +namespace top { + + class TruthSelectionTtres : public top::TruthSelectionBase { + public: + + TruthSelectionTtres(); + /** + * @brief Doesn't do anything itself. + */ + virtual ~TruthSelectionTtres(){} + + /** + * @brief The cuts (per object) are implemented in here. + * + * Not that I've marked this as final, to stop people going crazy with + * inheritance. Why not just inherit from TruthSelectionBase instead? + * + * @param mc The particle to cut on. + * @return True if you want to keep this particle, false otherwise. + */ + bool passSelection(const xAOD::TruthParticle& mc) const override final; + + ///Print the cuts to the ostream. + void print(std::ostream& os) const override final; + + private: + TruthSelectionTtres(const TruthSelectionTtres& rhs); + TruthSelectionTtres(const TruthSelectionTtres&& rhs); + void operator=(const TruthSelectionTtres& rhs); + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..3d7c98f9184407886d93360d8a3c47446460a458 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopObjectSelectionTools + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = xAODBase xAODPrimitives xAODEventInfo xAODEgamma xAODMuon xAODTau xAODTracking ElectronPhotonSelectorTools MuonSelectorTools TopEvent TopSystematicObjectMaker AssociationUtils TrigConfInterfaces TrigDecisionTool TriggerMatchingTool TrigTauMatching GoodRunsLists JetJvtEfficiency xAODBTaggingEfficiency BoostedJetTaggers JetSubStructureMomentTools JetSubStructureUtils JetReclustering + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..f3f605a05bce195f7c1e0166e8f3d59e8239bafd --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/share/mainpage.h @@ -0,0 +1,56 @@ +/** + * @page tostpage TopObjectSelectionTools + * + * @section in Introduction + * + * The idea of this package is to have a few pre-defined object selections but + * also the ability to add and modify them until you're happy. + * + * The first stop to configure your selection would be to take a look at + * top::TopObjectSelection. Where you can see that you can supply it with + * various classes (even write your own) and options to change the object + * selection. + * + * An example of a selection might go something a bit like this: + * + * @code + * top::TopObjectSelection* objectSelection = new top::TopObjectSelection(topConfig->objectSelectionName()); + * top::check(objectSelection->setProperty( "config" , topConfig ) , "Failed to setProperty for top::TopObjectSelection" ); + * top::check(objectSelection->initialize() , "Failed to initialize top::TopObjectSelection" ); + * + * objectSelection->electronSelection(new top::ElectronLikelihoodMC15(25000., true, LikeEnum::Tight, LikeEnum::Medium, new top::ApproxPTVarCone(0.05, 0.))); + * objectSelection->muonSelection(new top::MuonMC15(25000., 2.5, new top::StandardIsolation())); //new top::ApproxPTVarCone(0.05, 0.))); + * objectSelection->jetSelection(new top::JetMC15(25000., 2.5, 0.941)); // new jet vertex tagger cut + * + * objectSelection->overlapRemovalPostSelection(new top::OverlapRemovalASG()); + * @endcode + * + * If you don't want isolation then just specify nullptr instead. + * + * For DC14 we currently have: + * - top::ElectronLikelihoodMC15: A cut on likelihood electrons + * - top::ElectronCutBasedMC15: A cut based electron selection + * - top::MuonMC15: Added the muon tool to select muons + * - top::JetMC15: Cut on the jet pT and eta. Configure those via constructor. + * - top::OverlapRemovalIndices: A first guess at something a bit like 'standard' top overlap removal used in Run-I + * - top::OverlapRemovalASG: Using the ASG overlap removal tool + * + * For isolation can you can your pick from + * - top::AbsoluteIsolationDC14: Only in DC14 derivations + * - top::RelativePTVarCone: For cutting on pTVarCone as a fraction of the charged lepton pT. Only in DC14 derivations. + * - top::ApproxPTVarCone: While we wait for the real thing in DC14 ptvarcone, Danilo implemented this. + * - top::StandardIsolation: Standard et-cone and pt-cone for electrons. Like run-I, using ElectronIsolationSelectionTool. + * + * If you want to modify the cuts you can edit one of those classes and make + * some changes, or you can create a new class following those as a template. + * You'll need to inherit from: + * - top::ElectronSelectionBase + * - top::MuonSelectionBase + * - top::JetSelectionBase + * - top::OverlapRemovalBase + * - top::IsolationBase + * + * That way the compiler can check that you're using the correct objects (i.e. + * that the electron tool really only takes electrons as an argument). Using + * the compiler to spot this kind of error is super useful, no? + */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cc50fae456db65c0064e534c32feba1b9e99f4f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt @@ -0,0 +1,40 @@ +# Auto-generated on: 2017-03-08 14:47:38.688787 + +# Declare the name of this package: +atlas_subdir( TopParticleLevel None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODTruth + xAODJet + xAODMissingET + xAODCore + xAODRootAccess + TopEvent + TopConfiguration + TruthUtils + MCTruthClassifier ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Build a library that other components can link against: +atlas_add_library( TopParticleLevel Root/*.cxx Root/*.h Root/*.icc + TopParticleLevel/*.h TopParticleLevel/*.icc TopParticleLevel/*/*.h + TopParticleLevel/*/*.icc + PUBLIC_HEADERS TopParticleLevel + LINK_LIBRARIES xAODTruth + xAODJet + xAODMissingET + xAODCore + xAODRootAccess + TopEvent + TopConfiguration + MCTruthClassifierLib + TruthUtils + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelElectronObjectSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelElectronObjectSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4c4f713403de88e7ed1c155dd25156827b0021cf --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelElectronObjectSelector.cxx @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelElectronObjectSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:18:45 2015 + +#include "TopParticleLevel/ParticleLevelElectronObjectSelector.h" + +#include "MCTruthClassifier/MCTruthClassifierDefs.h" +#include "TopParticleLevel/TruthTools.h" + +namespace top { + + ParticleLevelElectronObjectSelector::ParticleLevelElectronObjectSelector( Options opt /* = Options() */ ) + : m_opt( opt ){ /* Deliberately Empty */ } + + /* virtual */ bool + ParticleLevelElectronObjectSelector::apply( const xAOD::TruthParticle & truthParticle ) { + + // Obtain the particle type and particle origin from the decoration + // created by the MCTruthClassifier. For legacy reasons, try both + // decoration names. + unsigned int type; + if ( truthParticle.isAvailable<unsigned int>( "particleType" ) ){ + type = truthParticle.auxdata<unsigned int>( "particleType" ); + } else if ( truthParticle.isAvailable<unsigned int>( "classifierParticleType" ) ){ + type = truthParticle.auxdata<unsigned int>( "classifierParticleType" ); + } else { + std::cerr << "Could not obtain MCTruthClassifier result decoration." << std::endl; + std::exit( 1 ); + } + + // -------------------------------------------------- + // Accept electrons iff they do not come from a hadron + using namespace MCTruthPartClassifier; + if ( m_opt.not_from_hadron && + type != ParticleType::IsoElectron ){ + return false; + } + + // If it is requested that tauons are hadrons, perform a check of the + // ancestry: It shall not contain a single tauon. + if ( m_opt.tau_is_hadron ){ + auto truthProxy = truthParticle.auxdata<ElementLink<xAOD::TruthParticleContainer> >( "originalTruthParticle" ); + if ( not truthProxy.isValid() ){ + std::cerr << "Could not obtain 'originalTruthParticle' reference." << std::endl; + std::exit( 1 ); + } + if ( truth::isLeptonFromTau( * truthProxy ) ){ + return false; + } + } + + // -------------------------------------------------- + // Apply kinematic cut on the dressed pT: + // must exceed 25 GeV + if ( truthParticle.auxdata<float>( "pt_dressed" ) < m_opt.pt_min ){ return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the dressed eta: + // must be less than or equal to 2.5 + if ( std::abs( truthParticle.auxdata<float>( "eta_dressed" ) ) > m_opt.eta_max ){ return false; } + + + // -------------------------------------------------- + // Everything that reaches this point has passed the selection + return true; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelJetObjectSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelJetObjectSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a01bbfd9dfb8f03020e57742d683ca38d269e172 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelJetObjectSelector.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelJetObjectSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:51:27 2015 + +#include "TopParticleLevel/ParticleLevelJetObjectSelector.h" + +namespace top { + + ParticleLevelJetObjectSelector::ParticleLevelJetObjectSelector( Options opt /* = Options() */) + : m_opt( opt ){ /* Deliberately Empty */ } + + /* virtual */ bool + ParticleLevelJetObjectSelector::apply( const xAOD::Jet & jet ) { + // -------------------------------------------------- + // Apply kinematic cut on the pT: + // must exceed 25 GeV + if ( jet.pt() < m_opt.pt_min ){ return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the eta: + // must be less than or equal to 2.5 + if ( std::abs( jet.eta() ) > m_opt.eta_max ){ return false; } + + // -------------------------------------------------- + // Everything that reaches this point has passed the selection + return true; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelLoader.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelLoader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7b39d65f5dbf8d37a6c7c7ca11525fcea098d7a3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelLoader.cxx @@ -0,0 +1,563 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelLoader.cxx +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 13:24:02 2015 + +#include "TopParticleLevel/ParticleLevelLoader.h" + +#include <list> +#include <cassert> +#include <iomanip> + +#include "TopEvent/EventTools.h" + +#include "TopParticleLevel/ParticleLevelEvent.h" + +#include "TopParticleLevel/ParticleLevelElectronObjectSelector.h" +#include "TopParticleLevel/ParticleLevelMuonObjectSelector.h" +#include "TopParticleLevel/ParticleLevelPhotonObjectSelector.h" +#include "TopParticleLevel/ParticleLevelJetObjectSelector.h" + +#include "TopConfiguration/TopConfig.h" + +// #define TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL 1 + +namespace top { + + ParticleLevelLoader::ParticleLevelLoader( const std::shared_ptr<top::TopConfig> & cfg ) + : asg::AsgTool( "ParticleLevelLoader" ), + m_config( cfg ), + // Don't create them here because construction is a bit long-ish + m_objectSelector_Electron( nullptr ), + m_objectSelector_Muon( nullptr ), + m_objectSelector_Photon( nullptr ), + m_objectSelector_Jet( nullptr ), + m_objectSelector_LargeRJet( nullptr ), + // Tool is inactive on non-MC data and whenever particle level is not requested + m_active( m_config->doTopParticleLevel() && + m_config->isMC() && + ( m_config->useTruthElectrons() || + m_config->useTruthMuons() || + m_config->useTruthPhotons() || + m_config->useTruthJets() || + m_config->useTruthLargeRJets() || + m_config->useTruthMET() ) ) { + + // Configure and create electron object selector + auto optEl = ParticleLevelElectronObjectSelector::Options{ + m_config->truth_electron_PtCut(), + m_config->truth_electron_EtaCut(), + m_config->truth_electron_NotFromHadron(), + m_config->truth_electron_TauIsHadron() + }; + + m_objectSelector_Electron.reset( new ParticleLevelElectronObjectSelector( optEl ) ); + + // Configure and create muon object selector + auto optMu = ParticleLevelMuonObjectSelector::Options{ + m_config->truth_muon_PtCut(), + m_config->truth_muon_EtaCut(), + m_config->truth_muon_NotFromHadron(), + m_config->truth_muon_TauIsHadron() + }; + + m_objectSelector_Muon.reset( new ParticleLevelMuonObjectSelector( optMu ) ); + + // Configure and create photon object selector + auto optPhoton = ParticleLevelPhotonObjectSelector::Options{ + m_config->truth_photon_PtCut(), + m_config->truth_photon_EtaCut(), + m_config->truth_photon_Origin(), + m_config->truth_photon_Isolation() + }; + + m_objectSelector_Photon.reset( new ParticleLevelPhotonObjectSelector( optPhoton ) ); + + + // Configure and create jet object selector + auto optJet = ParticleLevelJetObjectSelector::Options{ + m_config->truth_jet_PtCut(), + m_config->truth_jet_EtaCut() + }; + + m_objectSelector_Jet.reset( new ParticleLevelJetObjectSelector( optJet ) ); + + // Configure and create jet object selector + auto optLargeRJet = ParticleLevelJetObjectSelector::Options{ + m_config->truth_jet_largeR_PtCut(), + m_config->truth_jet_largeR_EtaCut() + }; + + m_objectSelector_LargeRJet.reset( new ParticleLevelJetObjectSelector( optLargeRJet ) ); + + + if ( m_active ){ + std::cout << "Particle level reconstruction is enabled; telling you how I am configured:" << '\n'; + std::cout << " " << std::setw( 20 ) << "UseElectrons? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthElectrons(); + if ( m_config->useTruthElectrons() ){ + std::cout << " [" << m_config->sgKeyTruthElectrons() << "]" << '\n' + << " --- Pt > " << m_config->truth_electron_PtCut() << '\n' + << " --- |eta| < " << m_config->truth_electron_EtaCut() << '\n' + << " --- notFromHadron? " << std::boolalpha << m_config->truth_electron_NotFromHadron() << '\n' + << " --- tauIsHadron? " << std::boolalpha << m_config->truth_electron_TauIsHadron() << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "UseMuons? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthMuons(); + if ( m_config->useTruthMuons() ){ + std::cout << " [" << m_config->sgKeyTruthMuons() << "]" << '\n' + << " --- Pt > " << m_config->truth_muon_PtCut() << '\n' + << " --- |eta| < " << m_config->truth_muon_EtaCut() << '\n' + << " --- notFromHadron? " << std::boolalpha << m_config->truth_muon_NotFromHadron() << '\n' + << " --- tauIsHadron? " << std::boolalpha << m_config->truth_muon_TauIsHadron() << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "UsePhotons? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthPhotons(); + if ( m_config->useTruthPhotons() ){ + std::cout << " [" << m_config->sgKeyTruthPhotons() << "]" << '\n' + << " --- Pt > " << m_config->truth_photon_PtCut() << '\n' + << " --- |eta| < " << m_config->truth_photon_EtaCut() << '\n' + << " --- Origin = " << m_config->truth_photon_Origin() << '\n' + << " --- Isolation = " << m_config->truth_photon_Isolation() << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "UseJets? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthJets(); + if ( m_config->useTruthJets() ){ + std::cout << " [" << m_config->sgKeyTruthJets() << "]" << '\n' + << " --- Pt > " << m_config->truth_jet_PtCut() << '\n' + << " --- |eta| < " << m_config->truth_jet_EtaCut() << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "UseLargeRJets? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthLargeRJets(); + if ( m_config->useTruthJets() ){ + std::cout << " [" << m_config->sgKeyTruthLargeRJets() << "]" << '\n' + << " --- Pt > " << m_config->truth_jet_largeR_PtCut() << '\n' + << " --- |eta| < " << m_config->truth_jet_largeR_EtaCut() << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "UseMET? " << std::setw( 5 ) << std::boolalpha << m_config->useTruthMET(); + if ( m_config->useTruthMET() ){ + std::cout << " [" << m_config->sgKeyTruthMET() << "]" << '\n'; + } else { + std::cout << '\n'; + } + std::cout << " " << std::setw( 20 ) << "DoOverlapRemoval Mu-Jet? " << std::setw( 5 ) << std::boolalpha << m_config->doParticleLevelOverlapRemovalMuJet() << '\n'; + std::cout << " " << std::setw( 20 ) << "DoOverlapRemoval El-Jet? " << std::setw( 5 ) << std::boolalpha << m_config->doParticleLevelOverlapRemovalElJet() << '\n'; + std::cout << " " << std::setw( 20 ) << "DoOverlapRemoval Jet-Photon? " << std::setw( 5 ) << std::boolalpha << m_config->doParticleLevelOverlapRemovalJetPhoton() << '\n'; + + } else { + std::cout << "Particle level reconstruction is disabled." << '\n'; + } + } + + ParticleLevelLoader::~ParticleLevelLoader(){ /* Deliberately Empty */ } + + ParticleLevelEvent ParticleLevelLoader::load() { + + // If the ParticleLevelLoader is not active, return an empty object + if ( ! m_active ){ return {}; } + + // Create the result object. + ParticleLevelEvent plEvent; + + // Load event info object directly into the plEvent + top::check( evtStore()->retrieve( plEvent.m_info, m_config->sgKeyEventInfo() ), + "xAOD::TEvent::retrieve failed for EventInfo" ); + + // Load the info for electrons, muons, jets, and MET into local objects: + // They need to be selected / modified / etc + const xAOD::TruthParticleContainer * electrons{ nullptr }; + const xAOD::TruthParticleContainer * muons{ nullptr }; + const xAOD::TruthParticleContainer * photons{ nullptr }; + const xAOD::JetContainer * jets{ nullptr }; + const xAOD::JetContainer * largeRJets{ nullptr }; + const xAOD::MissingETContainer * mets{ nullptr }; + + if ( m_config->useTruthElectrons() ){ + top::check( evtStore()->retrieve( electrons, m_config->sgKeyTruthElectrons() ), + "xAOD::TEvent::retrieve failed for Truth Electrons" ); + } + + if ( m_config->useTruthMuons() ){ + top::check( evtStore()->retrieve( muons, m_config->sgKeyTruthMuons() ), + "xAOD::TEvent::retrieve failed for Truth Muons" ); + } + + if ( m_config->useTruthPhotons() ){ + top::check( evtStore()->retrieve( photons, m_config->sgKeyTruthPhotons() ), + "xAOD::TEvent::retrieve failed for Truth Photons" ); + } + + if ( m_config->useTruthJets() ){ + top::check( evtStore()->retrieve( jets, m_config->sgKeyTruthJets() ), + "xAOD::TEvent::retrieve failed for Truth Jets" ); + } + + if ( m_config->useTruthLargeRJets() ){ + top::check( evtStore()->retrieve( largeRJets, m_config->sgKeyTruthLargeRJets() ), + "xAOD::TEvent::retrieve failed for Truth Jets Large R" ); + } + + if ( m_config->useTruthMET() ){ + top::check( evtStore()->retrieve( mets, m_config->sgKeyTruthMET() ), + "xAOD::TEvent::retrieve failed for Truth Missing ET" ); + } + + // ====================================================================== + // DRESSING + // We want to put the dressed leptons into the Event container, however, + // after reading from the TOPQ file, their dressed kinematics are stored + // as decorations. Lets (1) create a shallow copied container now, (2) + // set the kinematics for the shallow copies to the dressed values, (3) + // create decorations for the bare (non-dressed) kinematics, and (4) + // deep-copy the selection electrons from that container later. + + // ELECTRONS + if ( m_config->useTruthElectrons() ) { + top::check(loadDressedLeptons(* electrons, + m_electronsDressed, + m_electronsDressedAux), + "Failure to load dressed electrons."); + } + + // MUONS + if ( m_config->useTruthMuons() ){ + top::check(loadDressedLeptons(* muons, + m_muonsDressed, + m_muonsDressedAux), + "Failure to load dressed muons."); + } + + // ====================================================================== + // OBJECT SELECTION + // This yields index collections, one for each + // { electrons, muons, photons, jets, largeRJets }. + std::list<std::size_t> idx_electrons; // -> relative to `electrons` + std::list<std::size_t> idx_muons; // -> relative to `muons` + std::list<std::size_t> idx_photons; // -> relative to `photons` + std::list<std::size_t> idx_jets; // -> relative to `jets` + std::list<std::size_t> idx_largeRJets; // -> relative to `largeRJets` + + // Electrons + if ( m_config->useTruthElectrons() ) { + for ( std::size_t i = 0; i < electrons->size(); ++i ){ + const auto * electron = electrons->at(i); + + // Allow use of mixed-particle input container. + if ( electron->absPdgId() != 11 ){ continue; } + + // FIXME: Is this still needed? + if ( electron->barcode() >= 2e5 ){ continue; } + + if ( m_objectSelector_Electron->apply(* electron) ){ + idx_electrons.push_back( i ); + } + } + } + + // Muons + if ( m_config->useTruthMuons() ){ + for ( std::size_t i = 0; i < muons->size(); ++i ){ + const auto * muon = muons->at(i); + + // Allow use of mixed-particle input container. + if ( muon->absPdgId() != 13 ){ continue; } + + // FIXME: Is this still needed? + if ( muon->barcode() >= 2e5 ){ continue; } + + if ( m_objectSelector_Muon->apply(* muon) ){ + idx_muons.push_back( i ); + } + } + } + + // Photons + if ( m_config->useTruthPhotons() ){ + for ( std::size_t i = 0; i < photons->size(); ++i ){ + const auto * photon = photons->at(i); + + // Allow use of mixed-particle input container. + if ( photon->absPdgId() != 22 ){ continue; } + + // FIXME: Is this still needed? + if ( photon->barcode() >= 2e5 ){ continue; } + + if ( not m_objectSelector_Photon->apply(* photon) ){ + continue; + } + + // Reject photons used for electron dressing. + if (m_config->useTruthElectrons()){ + if (isDressingPhoton(* photon, * electrons)){ + continue; + } + } + + // Reject photons used for muon dressing. + if (m_config->useTruthMuons()){ + if (isDressingPhoton(* photon, * muons)){ + continue; + } + } + idx_photons.push_back( i ); + } + } + + // Jets + if ( m_config->useTruthJets() ){ + for ( std::size_t i = 0; i < jets->size(); ++i ){ + if ( m_objectSelector_Jet->apply( * jets->at( i ) ) ){ + idx_jets.push_back( i ); + } + } + } + + // Large-R-Jets + if ( m_config->useTruthLargeRJets() ){ + for ( std::size_t i = 0; i < largeRJets->size(); ++i ){ + if ( m_objectSelector_LargeRJet->apply( * largeRJets->at( i ) ) ){ + idx_largeRJets.push_back( i ); + } + } + } + + // ====================================================================== + // OVERLAP REMOVAL + // Removal Steps: + // 1. Jets & Muons: + // Remove Muons with dR < 0.4 + // 2. Jets & Electrons: + // Remove Electrons with dR < 0.4 + // 3. Photons & Jets: + // Remove Jets with dR < 0.4 + + // Jets and Muons: Remove Muon with dR < 0.4 + if ( m_config->useTruthMuons() && m_config->useTruthJets() && m_config->doParticleLevelOverlapRemovalMuJet() ) { + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + const std::size_t nMuonsPreOR{idx_muons.size()}; +#endif + + idx_muons.remove_if([& idx_jets, & jets, this](std::size_t m){ + for( auto j : idx_jets ){ + if ( jets->at( j )->p4().DeltaR( m_muonsDressed->at( m )->p4() ) < 0.4 ){ + return true; + } + } + return false; + }); + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + std::cout << "[top::ParticleLevelLoader] Muon-In-Jet OR: " + << nMuonsPreOR << " -> " << idx_muons.size() << std::endl; +#endif + } + + // Jets and Electrons: Remove Electron with dR < 0.4 + if ( m_config->useTruthElectrons() && m_config->useTruthJets() && m_config->doParticleLevelOverlapRemovalElJet() ) { + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + const std::size_t nElectronsPreOR{idx_electrons.size()}; +#endif + + idx_electrons.remove_if([& idx_jets, & jets, this](std::size_t e){ + for( auto j : idx_jets ){ + if ( jets->at( j )->p4().DeltaR( m_electronsDressed->at( e )->p4() ) < 0.4 ){ + return true; + } + } + return false; + }); + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + std::cout << "[top::ParticleLevelLoader] Electron-In-Jet OR: " + << nElectronsPreOR << " -> " << idx_electrons.size() << std::endl; +#endif + } + + // Photons and Jets: Remove Jet with dR < 0.4 + if ( m_config->useTruthPhotons() && m_config->useTruthJets() && m_config->doParticleLevelOverlapRemovalJetPhoton() ) { + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + const std::size_t nJetPreOR{idx_jets.size()}; +#endif + + idx_jets.remove_if([& idx_photons, & photons, & jets](std::size_t j){ + for( auto ph : idx_photons ){ + if ( photons->at( ph )->p4().DeltaR( jets->at( j )->p4() ) < 0.4 ){ + return true; + } + } + return false; + }); + +#ifdef TOP_PARTICLE_LEVEL_DEBUG_OVERLAP_REMOVAL + std::cout << "[top::ParticleLevelLoader] Jet-In-Photon OR: " + << nJetsPreOR << " -> " << idx_jets.size() << std::endl; +#endif + } + + + // ====================================================================== + // WRITE TO LOADER + // 1. Loop index lists for electrons / muons / photons / jets + // 2. Create a deep copy of the item and insert it into the + // appropriate container + // 3. Create a shallow copy of the containers and apply corrections + // if needed (dressing, etc.) + + // Create New Containers holding the "Good" Electrons / Muons / Jets + // and the MET + if ( m_config->useTruthElectrons() ) { + xAOD::TruthParticleContainer * goodElectrons = new xAOD::TruthParticleContainer(); + xAOD::TruthParticleAuxContainer * goodElectronsAux = new xAOD::TruthParticleAuxContainer(); + goodElectrons->setStore( goodElectronsAux ); //< Connect the two + + m_goodElectrons.reset( goodElectrons ); + m_goodElectronsAux.reset( goodElectronsAux ); + + for ( auto e : idx_electrons ){ + const auto & elPtr = m_electronsDressed->at( e ); + xAOD::TruthParticle * electron = new xAOD::TruthParticle(); + electron->makePrivateStore( * elPtr ); + m_goodElectrons->push_back( electron ); + } + } + + if ( m_config->useTruthMuons() ){ + xAOD::TruthParticleContainer * goodMuons = new xAOD::TruthParticleContainer(); + xAOD::TruthParticleAuxContainer * goodMuonsAux = new xAOD::TruthParticleAuxContainer(); + goodMuons->setStore( goodMuonsAux ); //< Connect the two + + m_goodMuons.reset( goodMuons ); + m_goodMuonsAux.reset( goodMuonsAux ); + + for ( auto m : idx_muons ){ + const auto & muPtr = m_muonsDressed->at( m ); + xAOD::TruthParticle * muon = new xAOD::TruthParticle(); + muon->makePrivateStore( * muPtr ); + m_goodMuons->push_back( muon ); + } + } + + if ( m_config->useTruthPhotons() ){ + xAOD::TruthParticleContainer * goodPhotons = new xAOD::TruthParticleContainer(); + xAOD::TruthParticleAuxContainer * goodPhotonsAux = new xAOD::TruthParticleAuxContainer(); + goodPhotons->setStore( goodPhotonsAux ); //< Connect the two + + m_goodPhotons.reset( goodPhotons ); + m_goodPhotonsAux.reset( goodPhotonsAux ); + + for ( auto ph : idx_photons ){ + const auto & phPtr = photons->at( ph ); + xAOD::TruthParticle * photon = new xAOD::TruthParticle(); + photon->makePrivateStore( * phPtr ); + m_goodPhotons->push_back( photon ); + } + } + + if ( m_config->useTruthJets() ){ + xAOD::JetContainer * goodJets = new xAOD::JetContainer(); + xAOD::JetAuxContainer * goodJetsAux = new xAOD::JetAuxContainer(); + goodJets->setStore( goodJetsAux ); //< Connect the two + + m_goodJets.reset( goodJets ); + m_goodJetsAux.reset( goodJetsAux ); + + for ( auto j : idx_jets ){ + const auto & jetPtr = jets->at( j ); + xAOD::Jet * jet = new xAOD::Jet(); + jet->makePrivateStore( * jetPtr ); + m_goodJets->push_back( jet ); + } + } + + if ( m_config->useTruthLargeRJets() ){ + xAOD::JetContainer * goodLargeRJets = new xAOD::JetContainer(); + xAOD::JetAuxContainer * goodLargeRJetsAux = new xAOD::JetAuxContainer(); + goodLargeRJets->setStore( goodLargeRJetsAux ); //< Connect the two + + m_goodLargeRJets.reset( goodLargeRJets ); + m_goodLargeRJetsAux.reset( goodLargeRJetsAux ); + + for ( auto j : idx_largeRJets ){ + const auto & jetPtr = largeRJets->at( j ); + xAOD::Jet * jet = new xAOD::Jet(); + jet->makePrivateStore( * jetPtr ); + m_goodLargeRJets->push_back( jet ); + } + } + + // ====================================================================== + // INSERTION INTO STORAGE + // Put everything into storage, i.e. into the ParticleLevel.event object + plEvent.m_electrons = m_config->useTruthElectrons() ? m_goodElectrons.get() : nullptr; + plEvent.m_muons = m_config->useTruthMuons() ? m_goodMuons.get() : nullptr; + plEvent.m_photons = m_config->useTruthPhotons() ? m_goodPhotons.get() : nullptr; + plEvent.m_jets = m_config->useTruthJets() ? m_goodJets.get() : nullptr; + plEvent.m_largeRJets = m_config->useTruthLargeRJets() ? m_goodLargeRJets.get() : nullptr; + plEvent.m_met = m_config->useTruthMET() ? (* mets)[ "NonInt" ] : nullptr; + + return plEvent; + } + + bool ParticleLevelLoader::loadDressedLeptons(const xAOD::TruthParticleContainer & input, + std::unique_ptr<xAOD::TruthParticleContainer> & store, + std::unique_ptr<xAOD::ShallowAuxContainer> & storeAux) const { + auto dressed = xAOD::shallowCopyContainer(input); + store.reset(dressed.first); + storeAux.reset(dressed.second); + + for (auto pl : * store.get()){ + TLorentzVector fvDressed; + fvDressed.SetPtEtaPhiE(pl->auxdata<float>("pt_dressed"), + pl->auxdata<float>("eta_dressed"), + pl->auxdata<float>("phi_dressed"), + pl->auxdata<float>("e_dressed")); + + // Store original kinematics as decoration + // m->auxdata<int>( "nPhotons_dressed" ) = m->auxdata<int>( "nPhotons_dressed" ); + + pl->auxdata<float>( "pt_bare" ) = pl->pt(); + pl->auxdata<float>( "eta_bare" ) = pl->eta(); + pl->auxdata<float>( "phi_bare" ) = pl->phi(); + pl->auxdata<float>( "e_bare" ) = pl->e(); + + pl->setPx( fvDressed.Px() ); + pl->setPy( fvDressed.Py() ); + pl->setPz( fvDressed.Pz() ); + pl->setE( fvDressed.E() ); + } + + return true; + } + + bool ParticleLevelLoader::isDressingPhoton(const xAOD::TruthParticle & photon, + const xAOD::TruthParticleContainer & dressedParticles, + const float dressingCone /* = 0.1 */) const { + // We do not check whether the original truth particle decoration exists + // and / or is valid because at this point we assume that it was already + // used by the lepton loading function. + static const std::string decoName{"originalTruthParticle"}; + + for (const auto & particle : dressedParticles){ + auto truthProxy = particle->auxdata<ElementLink<xAOD::TruthParticleContainer> >("originalTruthParticle"); + + if ((* truthProxy)->p4().DeltaR(photon.p4()) <= dressingCone){ + return true; + } + + } + + return false; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelMuonObjectSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelMuonObjectSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ce976792e0f7d2c4d1b6c89b50ac75618dd4739b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelMuonObjectSelector.cxx @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelMuonObjectSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:18:45 2015 + +#include "TopParticleLevel/ParticleLevelMuonObjectSelector.h" + +#include "MCTruthClassifier/MCTruthClassifierDefs.h" +#include "TopParticleLevel/TruthTools.h" + +namespace top { + + ParticleLevelMuonObjectSelector::ParticleLevelMuonObjectSelector( Options opt /* = Options() */ ) + : m_opt( opt ){ /* Deliberately Empty */ } + + /* virtual */ bool + ParticleLevelMuonObjectSelector::apply( const xAOD::TruthParticle & truthParticle ) { + + // Obtain the particle type and particle origin from the decoration + // created by the MCTruthClassifier. For legacy reasons, try both + // decoration names. + unsigned int type; + if ( truthParticle.isAvailable<unsigned int>( "particleType" ) ){ + type = truthParticle.auxdata<unsigned int>( "particleType" ); + } else if ( truthParticle.isAvailable<unsigned int>( "classifierParticleType" ) ){ + type = truthParticle.auxdata<unsigned int>( "classifierParticleType" ); + } else { + std::cerr << "Could not obtain MCTruthClassifier result decoration." << std::endl; + std::exit( 1 ); + } + + // -------------------------------------------------- + // Accept muons iff they do not come from a hadron + using namespace MCTruthPartClassifier; + if ( m_opt.not_from_hadron && + type != ParticleType::IsoMuon ){ + return false; + } + + // If it is requested that tauons are hadrons, perform a check of the + // ancestry: It shall not contain a single tauon. + if ( m_opt.tau_is_hadron ){ + auto truthProxy = truthParticle.auxdata<ElementLink<xAOD::TruthParticleContainer> >( "originalTruthParticle" ); + if ( not truthProxy.isValid() ){ + std::cerr << "Could not obtain 'originalTruthParticle' reference." << std::endl; + std::exit( 1 ); + } + if ( truth::isLeptonFromTau( * truthProxy ) ){ + return false; + } + } + + + // -------------------------------------------------- + // Apply kinematic cut on the dressed pT: + // must exceed 25 GeV + if ( truthParticle.auxdata<float>( "pt_dressed" ) < m_opt.pt_min ){ return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the dressed eta: + // must be less than or equal to 2.5 + if ( std::abs( truthParticle.auxdata<float>( "eta_dressed" ) ) > m_opt.eta_max ){ return false; } + + + // -------------------------------------------------- + // Everything that reaches this point has passed the selection + return true; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelPhotonObjectSelector.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelPhotonObjectSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..964255de328e761e1900b8399a7209db72c6ccfc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/ParticleLevelPhotonObjectSelector.cxx @@ -0,0 +1,134 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelPhotonObjectSelector.cxx +// Description: +// Author: Fabian Wilk +// Created: Wed Oct 12 11:41:36 2016 +// +// (c) by The ATLAS Collaboration +// by Fabian Wilk <mail@fabianwilk.de> +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#include "TopParticleLevel/ParticleLevelPhotonObjectSelector.h" + +#include "TopConfiguration/Tokenize.h" + +namespace top { + ParticleLevelPhotonObjectSelector::ParticleLevelPhotonObjectSelector(Options opt /* = Options() */) + : m_opt(opt){ /* Deliberately Empty */ } + + ParticleLevelPhotonObjectSelector::Options::Options(double ptMin /* = 25.e3 */, + double etaMax /* = 2.5 */, + const std::string & Origin /* = "" */, + const std::string & Isolation /* = "" */) : + pt_min(ptMin), + eta_max(etaMax), + origin(), + isolationVar(""), + isolationCut(){ + + // ========================================================= + // Parse the TruthOrigin Configuration Parameter. + if (Origin == "" || Origin == " "|| Origin == "False" || Origin == "None"){ + // Deliberately Empty + } else { + // This allows us to convert from string name to enum value. + MCTruthPartClassifier::ParticleDef def; + + // Tokenize at comma. + std::vector<std::string> tokens; + tokenize(Origin, tokens, ","); + + while (tokens.size()){ + const auto & token = tokens.back(); + + auto it = std::find(def.sParticleOrigin.begin(), + def.sParticleOrigin.end(), + token); + + top::check(it != def.sParticleOrigin.end(), + "[ParticleLevelPhotonObjectSelector] Invalid particle origin '" + token + "'"); + + origin.push_back( + static_cast<MCTruthPartClassifier::ParticleOrigin>( + std::distance(def.sParticleOrigin.begin(), + it))); + + tokens.pop_back(); + } + } + + // ========================================================= + // Parse the TruthIsolation Configuration Parameter + if (Isolation == "" || Isolation == " " || Isolation == "False" || Isolation == "None"){ + isolationVar = ""; + } else { + // Split at space, should be exactly 2 tokens. + std::vector<std::string> tokens; + tokenize(Isolation, tokens, " "); + top::check(tokens.size() == 2, + "[ParticleLevelPhotonObjectSelector] Invalid input for isolation parameter (expected 2 tokens)."); + + isolationVar = tokens.at(0); + isolationCut = std::stof(tokens.at(1)); + } + } + + + /* virtual */ bool ParticleLevelPhotonObjectSelector::apply(const xAOD::TruthParticle & truthParticle){ + // -------------------------------------------------- + // Require that the photon is status=1 (stable) + // TODO: Should we include other statuses? + if (truthParticle.status() != 1){ + return false; + } + + // -------------------------------------------------- + // Apply kinematic cut on the pT: + // must exceed 25 GeV + if ( truthParticle.pt() < m_opt.pt_min ){ return false; } + + // -------------------------------------------------- + // Apply kinematic cut on the eta: + // must be less than or equal to 2.5 + if ( std::abs( truthParticle.eta() ) > m_opt.eta_max ){ return false; } + + // -------------------------------------------------- + // Apply particle origin cut. + if (m_opt.origin.size()){ + unsigned int origin; + if ( truthParticle.isAvailable<unsigned int>( "particleOrigin" ) ){ + origin = truthParticle.auxdata<unsigned int>( "particleOrigin" ); + } else if ( truthParticle.isAvailable<unsigned int>( "classifierParticleOrigin" ) ){ + origin = truthParticle.auxdata<unsigned int>( "classifierParticleOrigin" ); + } else { + top::check(false, "Could not obtain MCTruthClassifier result decoration."); + } + + if (std::find(m_opt.origin.begin(), m_opt.origin.end(), origin) == m_opt.origin.end()){ + return false; + } + } + + // -------------------------------------------------- + // Apply isolation cut + if (m_opt.isolationVar.size()){ + top::check(truthParticle.isAvailable<float>(m_opt.isolationVar), + "[ParticleLevelPhotonObjectSelector] Selected isolation variable not available!"); + if (m_opt.isolationCut <= truthParticle.auxdata<float>(m_opt.isolationVar) / truthParticle.pt()){ + return false; + } + } + + // -------------------------------------------------- + // Everything that reaches this point has passed the selection + return true; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b10ea4e16386126383ae8eb4d67d95814a75da2a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx @@ -0,0 +1,327 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: TruthTools.cxx +// Description: +// Author: Fabian Wilk +// Created: Wed Feb 4 11:05:43 2015 + +#include "TopParticleLevel/TruthTools.h" + +#include "xAODTruth/TruthVertex.h" + +#include "TruthUtils/PIDHelpers.h" + +#include <list> +#include <string> +#include <sstream> +#include <functional> +namespace top { + namespace truth { + + void printDecayChain( const xAOD::TruthParticle * truthPart, + std::ostream & os /* = std::cout */, + const std::string & prefix /* = "" */ ){ + // Protect against a faulty production vertex reference. + if ( not truthPart->prodVtx() ){ + os << prefix << "[" << truthPart->pdgId() << " <- NULL]" << '\n'; + return; + } + + const xAOD::TruthParticle * parent{ truthPart->prodVtx()->incomingParticle( 0 ) }; + os << prefix << "[" << truthPart->pdgId(); + while ( parent ){ + os << " <- " << parent->pdgId(); + if ( parent->prodVtx() ){ + parent = parent->prodVtx()->incomingParticle( 0 ); + } + else { + break; + } + } + os << "]" << '\n'; + } + + + bool isFrom( const xAOD::TruthParticle * truthParticle, + const std::vector<int> & parentPDGIds, + bool bOnlyDirect /* = false */ ){ + // If the input does not have aproper production vertex reference or + // there are no incoming particle to the production vertex, directly + // return false + if ( ! truthParticle->hasProdVtx() || + ! truthParticle->prodVtx() || + truthParticle->prodVtx()->nIncomingParticles() == 0 ) { + return false; + } + + // The current production vertex + const xAOD::TruthVertex * prodVtx = truthParticle->prodVtx(); + // The previous production vertex (initialised to the current + // production vertex) + const xAOD::TruthVertex * prevProdVtx = prodVtx; + + auto numIncoming = prodVtx->nIncomingParticles(); + for ( std::size_t motherIndex = 0; + motherIndex < numIncoming; + ++motherIndex ){ + + const xAOD::TruthParticle * mother= nullptr; + int motherPdgId = truthParticle->pdgId(); + + // Ascend through the decay chain until we find the "actual" + // decay, i.e. a change in the PDG ID. This skips all the + // non-decay truth table entries which come from "particle + // evolution" rather than physical decay + while ( truthParticle->pdgId() == motherPdgId ) { + mother = prodVtx->incomingParticle( motherIndex ); + if ( mother ) { + motherPdgId = mother->pdgId(); + } + else { break; } + + if ( truthParticle->pdgId() != motherPdgId ) { break; } + + // Include protection against cyclic or broken reference + // chains which can occur in SHERPA samples + if( ! mother->hasProdVtx() ) { break; } + if ( prevProdVtx == mother->prodVtx() ) { break; } + + // Update the previous / current production vertex references + prevProdVtx = prodVtx; + prodVtx = mother->prodVtx(); + + // safeguard + if ( ! prodVtx || prodVtx->nIncomingParticles() == 0 ) { break; } + } + + // Check that the mother pointer is valid. If it is not valid, then + // the particle could not possibly come from any of the requested + // PDG Ids, hence return false + if ( ! mother ){ return false; } + + // If the mother PDG ID is in the parentPDGIds collection, then return true + if ( std::find( parentPDGIds.begin(), parentPDGIds.end(), motherPdgId ) != parentPDGIds.end() ){ + return true; + } + + // If we allow chained matching (I.e. not only _direct_ decays) and + // the mother particle does come from the request PDG ID(s), return true + if ( ! bOnlyDirect && isFrom( mother, parentPDGIds, bOnlyDirect ) ){ + return true; + } + } + + // If we did't find an ancestor with the requested pdg id, return false + return false; + } + + bool isFromWZDecay( const xAOD::TruthParticle * truthParticle, + bool bOnlyDirect /* = false */ ) { + // If the input does not have aproper production vertex reference or + // there are no incoming particle to the production vertex, directly + // return false + if ( ! truthParticle->hasProdVtx() || + ! truthParticle->prodVtx() || + truthParticle->prodVtx()->nIncomingParticles() == 0 ) { + return false; + } + + // The current production vertex + const xAOD::TruthVertex * prodVtx = truthParticle->prodVtx(); + // The previous production vertex (initialised to the current + // production vertex) + const xAOD::TruthVertex * prevProdVtx = prodVtx; + + + auto numIncoming = prodVtx->nIncomingParticles(); + for ( std::size_t motherIndex = 0; + motherIndex < numIncoming; + ++motherIndex ){ + + const xAOD::TruthParticle * mother = nullptr; + int motherAbsPdgId = truthParticle->absPdgId(); + + // Ascend through the decay chain until we find the "actual" + // decay, i.e. a change in the PDG ID. This skips all the + // non-decay truth table entries which come from "particle + // evolution" rather than physical decay + while ( truthParticle->absPdgId() == motherAbsPdgId ) { + mother = prodVtx->incomingParticle( motherIndex ); + if ( mother ) { + motherAbsPdgId = mother->absPdgId(); + } + else { break; } + + if ( truthParticle->absPdgId() != motherAbsPdgId ) { break; } + + // Include protection against cyclic or broken reference + // chains which can occur in SHERPA samples + if( ! mother->hasProdVtx() ) { break; } + if ( prevProdVtx == mother->prodVtx() ) { break; } + + // Update the previous / current production vertex references + prevProdVtx = prodVtx; + prodVtx = mother->prodVtx(); + + // safeguard + if ( ! prodVtx || prodVtx->nIncomingParticles() == 0 ) { break; } + } + + // Check that the mother pointer is valid. If it is not valid, then + // the particle could not possibly come from any of the requested + // PDG Ids, hence return false + if ( ! mother ){ return false; } + + // If the direct physical decay in the MC record was from a Z or W + // boson to the truth particle then return true + // Otherwise perform a vertex-based identification of W/Z's + if ( motherAbsPdgId == 23 || motherAbsPdgId == 24 ){ + return true; + } + + // The following vertex-based identification of W/Z's is needed + // for SHERPA samples where the W/Z particle is not explicitly + // in the particle record. At this point if we have a valid + // vertex, it should be a true decay vertex. + // + // If it is a W or Z then two of those decay products should be + // lepton / neutrino pair corresponding to the transitions + // W+ -> l+ nu + // W- -> l- nu~ + // Z -> l+ l- + // Z -> nu nu~ + // Hence loop through the outgoing particles of the truth vertex + // and check that the vertex matches the requirement. We + // simplify this check by just counting the number of leptonic + // outgoing particles which should be equal to 2. It is assumed + // that the MC generator does not produce unphysical decays. + // + // Furthermore, prompt W/Z's should come from a vertex with more + // than one incoming particle. Consequently, test this + // requirement prior to checking the outgoing states. + int nDecay = 0; + if ( prodVtx && prodVtx->nIncomingParticles() > 1 ) { + for ( const auto & child : prodVtx->outgoingParticleLinks() ){ + if ( ( * child )->absPdgId() > 10 && + ( * child )->absPdgId() < 17 ) { + nDecay++; + } + } + } + + // There must be exactly two leptonic outgoing particles in that vertex + if ( nDecay == 2 ){ + return true; + } + + // If we allow chained matching (I.e. not only _direct_ decays) and + // the mother particle does come from a W / Z, return true + if ( ! bOnlyDirect && isFromWZDecay( mother, bOnlyDirect ) ){ + return true; + } + } + + // We did not find any W / Z in the ancestry of the input particle -> + // return false + return false; + } + + bool isLeptonFromTau( const xAOD::TruthParticle * truthParticle ){ + // If the input particle is not a lepton directly terminate the + // algorithm retunring false + if ( truthParticle->absPdgId() != 11 && + truthParticle->absPdgId() != 12 && + truthParticle->absPdgId() != 13 && + truthParticle->absPdgId() != 14 && + truthParticle->absPdgId() != 15 && + truthParticle->absPdgId() != 16 ) { + return false; + } + return isFrom( truthParticle, { 15, -15 }, true ); + } + + bool isNotFromHadron( const xAOD::TruthParticle * truthParticle, + bool bOnlyDirect /* = false */, + bool bTauIsHadron /* = false */ ){ + // If there is no production vertex, either something is wrong, or + // we are at the beginning of the record. However, either way, the + // particle does not come from a hadron, hence return true. + if ( ! truthParticle->hasProdVtx() || + ! truthParticle->prodVtx() || + truthParticle->prodVtx()->nIncomingParticles() == 0 ) { + return true; + } + + // The current production vertex + const xAOD::TruthVertex * prodVtx = truthParticle->prodVtx(); + // The previous production vertex (initialised to the current + // production vertex) + const xAOD::TruthVertex * prevProdVtx = prodVtx; + + // Loop all the particles going into the production vertex of the + // current truth particle. + // * If the mother of any of the is a physical hadron return false + // * If the mother of any of them descends from a physical return false + // * Otherwise return true + auto numIncoming = prodVtx->nIncomingParticles(); + for ( std::size_t motherIndex = 0; + motherIndex < numIncoming; + ++motherIndex ){ + + int motherPdgId = truthParticle->pdgId(); + const xAOD::TruthParticle * mother = nullptr; + + // Ascend through the decay chain until we find the "actual" + // decay, i.e. a change in the PDG ID. This skips all the + // non-decay truth table entries which come from "particle + // evolution" rather than physical decay + while ( truthParticle->pdgId() == motherPdgId ) { + mother = prodVtx->incomingParticle( motherIndex ); + if ( mother ) { + motherPdgId = mother->pdgId(); + } + else { break; } + + // Include protection against cyclic or broken reference + // chains which can occur in SHERPA samples + if( ! mother->hasProdVtx() ) { break; } + if ( prevProdVtx == mother->prodVtx() ) { break; } + + // Update the previous / current production vertex references + prevProdVtx = prodVtx; + prodVtx = mother->prodVtx(); + + // safeguard + if ( ! prodVtx || prodVtx->nIncomingParticles() == 0 ) { break; } + } + + // Check that the mother pointer is valid. If it is not valid, then + // the particle could not possibly come from a hadron, hence return + // true + if ( ! mother ){ return true; } + + // If the mother particle is a "physical decayed" particle (HepMC + // status code) and a hadron, then return false. + if ( mother->status() == 2 && + ( MC::PID::isHadron( motherPdgId ) || + ( bTauIsHadron && MC::PID::isTau( motherPdgId ) ) ) ){ + return false; + } + // } else { + // std::cout << "Mother is: " << motherPdgId << ", " << mother->status() << std::endl; + // } + + // If we allow chained matching (I.e. not only _direct_ decays) and + // the mother particle does come from a hadron, return false + if ( ! bOnlyDirect && ! isNotFromHadron( mother, bOnlyDirect, bTauIsHadron ) ){ + return false; + } + } + // No hadronic && physical parents + return true; + } + + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ObjectSelectorBase.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ObjectSelectorBase.h new file mode 100644 index 0000000000000000000000000000000000000000..209e8cd3355e3e8fcbc444db925ba24f751f801b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ObjectSelectorBase.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ObjectSelectorBase.h +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:46:33 2015 + +#ifndef _TOP_OBJECTSELECTORBASE_H_ +#define _TOP_OBJECTSELECTORBASE_H_ + +namespace top { + + template <typename ObjectT> + class ObjectSelectorBase { + public: + ObjectSelectorBase(){} + virtual ~ObjectSelectorBase(){} + virtual bool apply( const ObjectT & obj ) = 0; + }; +} + + +#endif /* _TOP_OBJECTSELECTORBASE_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelElectronObjectSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelElectronObjectSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..e5cf9de589100520cc1d26891adcfd5eca1540da --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelElectronObjectSelector.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelElectronObjectSelector.h +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:16:10 2015 + +#ifndef _TOP_PARTICLE_LEVEL_ELECTRONOBJECTSELECTOR_H_ +#define _TOP_PARTICLE_LEVEL_ELECTRONOBJECTSELECTOR_H_ + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODTruth/TruthParticleContainer.h" + +namespace top { + + class ParticleLevelElectronObjectSelector + : public ObjectSelectorBase<xAOD::TruthParticle> { + public: + // Struct used to store the cut values used by the object selector. It + // is important that the object has a sensible default config because it + // will be default constructed for the trivial constructor of the object + // selector. + struct Options { + Options( double ptMin = 25.e3, + double etaMax = 2.5, + bool notFromHadron = true, + bool tauIsHadron = false ) : + pt_min( ptMin ), + eta_max( etaMax ), + not_from_hadron( notFromHadron ), + tau_is_hadron( tauIsHadron ){} + double pt_min; + double eta_max; + bool not_from_hadron; + bool tau_is_hadron; + }; + public: + ParticleLevelElectronObjectSelector( Options cuts = Options() ); + virtual bool apply( const xAOD::TruthParticle & truthParticle ); + private: + Options m_opt; + }; + +} + +#endif /* _TOP_PARTICLE_LEVEL_ELECTRONOBJECTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelEvent.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..a4decb7a5bfb2ed6eab3701e4c63844bd641edea --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelEvent.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelEvent.h +// Description: +// Author: Fabian Wilk +// Created: Tue Feb 24 17:54:49 2015 + +#ifndef _TOP_PARTICLELEVELEVENT_H_ +#define _TOP_PARTICLELEVELEVENT_H_ + +#include <string> +#include <unordered_map> + +#include "xAODEventInfo/EventInfo.h" +#include "xAODJet/JetContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODMissingET/MissingET.h" + +namespace top { + + class ParticleLevelEvent { + public: + ParticleLevelEvent() + : m_info( nullptr ), + m_electrons( nullptr ), + m_muons( nullptr ), + m_photons( nullptr ), + m_jets( nullptr ), + m_largeRJets( nullptr ), + m_met( nullptr ), + m_selectionDecisions(){} + + /// Pointer to the event info object + const xAOD::EventInfo * m_info; + + /// Pointer to truth level electrons + const xAOD::TruthParticleContainer * m_electrons; + + /// Pointer to truth level muons + const xAOD::TruthParticleContainer * m_muons; + + /// Pointer to truth level photons + const xAOD::TruthParticleContainer * m_photons; + + /// Pointer to truth level jets + const xAOD::JetContainer * m_jets; + + /// Pointer to the truth level large R jets. + const xAOD::JetContainer * m_largeRJets; + + // Pointer to truth level MET + const xAOD::MissingET * m_met; + + // Maps from the name of an event selection line to the result of + // applying that event selection onto this ParticleLevelEvent. At the + // moment, the mapped value (albeit being of type 'int') is inteded just + // as a true / false statement. Must be mutable because the + // EventSelectionManager will modify it. + mutable std::unordered_map<std::string, int> m_selectionDecisions; + }; + +} + +#endif /* _TOP_PARTICLELEVELEVENT_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelJetObjectSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelJetObjectSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..4eac883a0d83b671956eec664da2db24e6b7488b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelJetObjectSelector.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelJetObjectSelector.h +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:49:37 2015 + +#ifndef _TOP_PARTICLE_LEVEL_JETOBJECTSELECTOR_H_ +#define _TOP_PARTICLE_LEVEL_JETOBJECTSELECTOR_H_ + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODJet/JetContainer.h" + +namespace top { + + class ParticleLevelJetObjectSelector + : public ObjectSelectorBase<xAOD::Jet> { + public: + // Struct used to store the cut values used by the object selector. It + // is important that the object has a sensible default config because it + // will be default constructed for the trivial constructor of the object + // selector. + struct Options { + Options( double ptMin = 25.e3, double etaMax = 2.5 ) : + pt_min( ptMin ), eta_max( etaMax ){} + double pt_min; + double eta_max; + }; + public: + ParticleLevelJetObjectSelector( Options opt = Options() ); + virtual bool apply( const xAOD::Jet & jet ); + private: + Options m_opt; + }; + +} + + +#endif /* _TOP_PARTICLE_LEVEL_JETOBJECTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelLoader.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..bc4ad6980be6fbb122e2bd6711c852c2bc79fff4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelLoader.h @@ -0,0 +1,134 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelLoader.h +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 13:09:33 2015 + +#ifndef _TOP_PARTICLELEVEL_EVENTLOADER_H_ +#define _TOP_PARTICLELEVEL_EVENTLOADER_H_ + +#include <memory> + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "AsgTools/AsgTool.h" + +#include "xAODCore/ShallowCopy.h" + +#include "xAODJet/Jet.h" +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" + +#include "xAODTruth/TruthParticle.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" + +#include "xAODMissingET/MissingET.h" +#include "xAODMissingET/MissingETContainer.h" + +// Forward Declarations +namespace top { + class ParticleLevelEvent; + class TopConfig; +} + +namespace top { + + /*! + * @brief Loading tool which creates a particle level event object. + * + * After creation of the loader tool, it will be in of of two states: either + * it is "active" or not (can be tested using the active() member function). + * If the tool is not active, then the load function is a no-op, it will + * return an "empty" ParticleLevelEvent object. The active() member function + * allows for the enclosing (i.e. calling) program to conditionally branch + * into computing intensive parts depending on whether particle level data + * is available or not. The loader tool is configured to be non-"active" if + * the input data is not monte carlo or any of the required collection names + * are empty respectively None + */ + class ParticleLevelLoader final : public asg::AsgTool { + public: + /*! + * @brief Constructor of the loader tool. + */ + ParticleLevelLoader( const std::shared_ptr<top::TopConfig> & cfg ); + + /*! + * @brief Destructor of the loader tool. + */ + virtual ~ParticleLevelLoader(); + + /*! + * @brief Loading function. Does the actual work. This function will + * load the truth information from the #xaodEvent and return this data + * transformed into a truth level event. The data stored in the + * ParticleLevel is owned by the truth event loader. + * @param xaodEvent The input data event object. + * @return ParticleLevelEvent object. + */ + ParticleLevelEvent load(); + + /*! + * @brief Function that can be used to test whether the ParticleLevelLoader + * is active. The loader is set to inactive if the names of the truth + * collections are unavailable. This is determined at construction. + */ + bool active() const { return m_active; } + + protected: + bool loadDressedLeptons(const xAOD::TruthParticleContainer & input, + std::unique_ptr<xAOD::TruthParticleContainer> & store, + std::unique_ptr<xAOD::ShallowAuxContainer> & storeAux) const; + + bool isDressingPhoton(const xAOD::TruthParticle & photon, + const xAOD::TruthParticleContainer & dressedParticles, + const float dressingCone = 0.1) const; + + private: + // The global config object + const std::shared_ptr<top::TopConfig> & m_config; + + // The tools used for electron, muon, and jet object selection. The + // basic idea is to allow exchanging these tools for custom ones, + // however, this is not implemented (yet). + std::unique_ptr<ObjectSelectorBase<xAOD::TruthParticle> > m_objectSelector_Electron; + std::unique_ptr<ObjectSelectorBase<xAOD::TruthParticle> > m_objectSelector_Muon; + std::unique_ptr<ObjectSelectorBase<xAOD::TruthParticle> > m_objectSelector_Photon; + std::unique_ptr<ObjectSelectorBase<xAOD::Jet> > m_objectSelector_Jet; + std::unique_ptr<ObjectSelectorBase<xAOD::Jet> > m_objectSelector_LargeRJet; + private: + // The dressed leptons (shallow copies of the input containers) + std::unique_ptr<xAOD::TruthParticleContainer> m_electronsDressed; + std::unique_ptr<xAOD::ShallowAuxContainer> m_electronsDressedAux; + + std::unique_ptr<xAOD::TruthParticleContainer> m_muonsDressed; + std::unique_ptr<xAOD::ShallowAuxContainer> m_muonsDressedAux; + + std::unique_ptr<xAOD::TruthParticleContainer> m_goodElectrons; + std::unique_ptr<xAOD::TruthParticleAuxContainer> m_goodElectronsAux; + + std::unique_ptr<xAOD::TruthParticleContainer> m_goodMuons; + std::unique_ptr<xAOD::TruthParticleAuxContainer> m_goodMuonsAux; + + std::unique_ptr<xAOD::TruthParticleContainer> m_goodPhotons; + std::unique_ptr<xAOD::TruthParticleAuxContainer> m_goodPhotonsAux; + + + std::unique_ptr<xAOD::JetContainer> m_goodJets; + std::unique_ptr<xAOD::JetAuxContainer> m_goodJetsAux; + + std::unique_ptr<xAOD::JetContainer> m_goodLargeRJets; + std::unique_ptr<xAOD::JetAuxContainer> m_goodLargeRJetsAux; + + // Flag denoting whether the loader tool is active. Will be set by the + // constructor and remains unchanged afterwards. + const bool m_active; + }; + +} + +#endif /* _TOP_PARTICLELEVEL_EVENTLOADER_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelMuonObjectSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelMuonObjectSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..4e579bec83940a9a6c9fdcfaf568f74a685b3b07 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelMuonObjectSelector.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelMuonObjectSelector.h +// Description: +// Author: Fabian Wilk +// Created: Sun Feb 22 15:16:10 2015 + +#ifndef _TOP_PARTICLE_LEVEL_MUONOBJECTSELECTOR_H_ +#define _TOP_PARTICLE_LEVEL_MUONOBJECTSELECTOR_H_ + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODTruth/TruthParticleContainer.h" + +namespace top { + + class ParticleLevelMuonObjectSelector + : public ObjectSelectorBase<xAOD::TruthParticle> { + public: + // Struct used to store the cut values used by the object selector. It + // is important that the object has a sensible default config because it + // will be default constructed for the trivial constructor of the object + // selector. + struct Options { + Options( double ptMin = 25.e3, + double etaMax = 2.5, + bool notFromHadron = true, + bool tauIsHadron = false ) : + pt_min( ptMin ), + eta_max( etaMax ), + not_from_hadron( notFromHadron ), + tau_is_hadron( tauIsHadron ){} + double pt_min; + double eta_max; + bool not_from_hadron; + bool tau_is_hadron; + }; + public: + ParticleLevelMuonObjectSelector( Options opt = Options() ); + virtual bool apply( const xAOD::TruthParticle & truthParticle ); + private: + Options m_opt; + }; + +} + +#endif /* _TOP_PARTICLE_LEVEL_MUONOBJECTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelPhotonObjectSelector.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelPhotonObjectSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..53b976ebf5a01a7570bb84c8a3d7e12cf4c384d6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/ParticleLevelPhotonObjectSelector.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: ParticleLevelPhotonObjectSelector.h +// Description: +// Author: Fabian Wilk +// Created: Wed Oct 12 11:37:51 2016 +// +// (c) by The ATLAS Collaboration +// by Fabian Wilk <mail@fabianwilk.de> +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#ifndef _TOP_PARTICLE_LEVEL_PHOTONOBJECTSELECTOR_H_ +#define _TOP_PARTICLE_LEVEL_PHOTONOBJECTSELECTOR_H_ + +#include "TopParticleLevel/ObjectSelectorBase.h" + +#include "xAODTruth/TruthParticleContainer.h" + +#include "MCTruthClassifier/MCTruthClassifierDefs.h" + +#include <vector> +#include <string> +#include <sstream> + +#include "TopEvent/EventTools.h" + +namespace top { + + class ParticleLevelPhotonObjectSelector + : public ObjectSelectorBase<xAOD::TruthParticle> { + public: + // Struct used to store the cut values used by the object selector. It + // is important that the object has a sensible default config because it + // will be default constructed for the trivial constructor of the object + // selector. + struct Options { + Options(double ptMin = 25.e3, + double etaMax = 2.5, + const std::string & Origin = "", + const std::string & Isolation = ""); + + double pt_min; + double eta_max; + std::vector<MCTruthPartClassifier::ParticleOrigin> origin; + std::string isolationVar; + float isolationCut; + }; + + public: + ParticleLevelPhotonObjectSelector(Options cuts = Options()); + virtual bool apply(const xAOD::TruthParticle & truthParticle); + + private: + Options m_opt; + }; +} + +#endif /* _TOP_PARTICLE_LEVEL_PHOTONOBJECTSELECTOR_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/TruthTools.h b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/TruthTools.h new file mode 100644 index 0000000000000000000000000000000000000000..0d04a51886cf4d3638cb12ab48133046e7ecc17c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/TopParticleLevel/TruthTools.h @@ -0,0 +1,179 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: TruthTools.h +// Description: +// Author: Fabian Wilk +// Created: Wed Feb 4 11:04:23 2015 + +#ifndef _TOP_PARTICLE_LEVEL_TRUTHTOOLS_H_ +#define _TOP_PARTICLE_LEVEL_TRUTHTOOLS_H_ + +#include <ostream> +#include <iostream> +#include <string> + +#include "xAODTruth/TruthParticleContainer.h" + +namespace top { + namespace truth { + + /*! + * @brief Prints the decay chain leading up to a certain particle to a + * std::ostream. + * @param part Pointer to xAOD::TruthParticle whose decay origin shall + * be printed. + * @param os The std::ostream into which the decay chain shall be + * printed. Defaults to std::cout. + * @param prefix A string which will be prefixed to the output. + */ + void printDecayChain( const xAOD::TruthParticle * part, + std::ostream & os = std::cout, + const std::string & prefix = "" ); + + /** + * @brief Check if a certain pdg ID corresponds to a B hadron. + * This follows the official PDG Monte-Carlo numbering scheme + * (c.f. http://pdg.lbl.gov/2007/reviews/montecarlorpp.pdf) which defines + * the PDG ID to be a 7 digit number in the form + * +- n_r n_L n_q1 n_q2 n_q3 n_J + * where + * n_q1 = 0, n_q2 >= n_q3 (for mesons) + * n_q1 >= n_q2 >= n_q3 (for baryons) + * n_q1 >= n_q2, n_q3 = 0 (for diquarks) + * the n_qi denote the flavour of the quark composing the hadron, i.e. + * n_q = 1 -> d n_q = 2 -> u + * n_q = 3 -> s n_q = 4 -> 4 + * n_q = 5 -> b + * The digit \f$n_J\f$ encodes the total angular momentum \f$J\f$ of a + * compound system. \f$n_L\f$ is used to distinguish compound objects which + * have the same total angular momentum but different spin (\f$S\f$) and orbital + * (\f$L\f$) angular momentum numbers. Finally, \f$n_r\f$ is used to label + * mesons which are radially exited. + * + * @param pdgId The PDG ID to test. + * + * @return True if pdg ID corresponds to B hadron, false otherwise. + */ + inline bool isBHadron( int pdgId ){ + return ( ( 510 < pdgId && pdgId < 555 ) || // Check for (normal) Mesons / Diquarks + ( 5100 < pdgId && pdgId < 5555 ) || // Check for (normal) Baryons + ( pdgId / 100 ) % 10 == 5 || // Check exited Mesons (and Baryons with double beauty) + ( pdgId / 1000 ) % 10 == 5 ); // Check exited Baryons + } + + + /** + * @brief Function to determine whether the input particle was produced + * in the physical decay of a particle of given PDG ID. + * + * The algorithm uses the MC Truth Record. + * The algorithm works by ascending through the decay chain following + * the production vertex reference (obtained by the prodVtx() member + * function of the xAOD::TruthParticle). From the input particle, the + * algorithm ascends through the chain until the PDG ID of the particle + * found as first incoming particle is not equal to the PDG ID of the + * input particle. The last production vertex found during this ascent + * should then correspond to the physical production vertex of the input + * particle. + * + * @param truthParticle The input particle. + * @param parentPDGIds A list of PDG IDs which are valid parents + * @param bOnlyDirect A flag denoting whether "chained matching" is + * allowed. In chained matching mode, intermittend particles are + * allowed, i.e. for the chain + * A -> B -> C + * isFrom( C, A ) is true (for A != B != C). If only direct decays are + * considered, this is only the case if A == B or B == C. Defaults to false. + * + * @return Return true if the input particle was produced in the decay + * of a particle which has a PDG ID that is listed in + * parentPDGIds. Return false otherwise. Also return false if + * the input particle has an invalid production vertex reference. + */ + bool isFrom( const xAOD::TruthParticle * truthParticle, + const std::vector<int> & parentPDGIds, + bool bOnlyDirect = false ); + + /** + * @brief Function to determine whether a given truth particle is a + * result of a decay chain that started in the decay of a W or Z boson. + * + * The algorithm works by ascending through the decay chain following + * the production vertex reference (obtained by the prodVtx() member + * function of the xAOD::TruthParticle). From the input particle, the + * algorithm ascends through the chain until the PDG ID of the particle + * found as first incoming particle is not equal to the PDG ID of the + * input particle. The last production vertex found during this ascent + * should then correspond to the physical production vertex of the input + * particle. + * + * If the PDG ID of the mother particle (i.e. the incoming particle to + * the truth decay vertex) corresponds to a W / Z boson the algorithm + * terminates directly, returning true. Otherwise a vertex-based check + * is employed (which was designed to operate on SHERPA samples, c.f. + * the JetSimTools-00-02-09 package + * [svn: /Reconstruction/Jet/JetSimTools]). + * + * @param truthParticle The input particle. + * @param bOnlyDirect A flag denoting whether "chained matching" is + * allowed. In chained matching mode, intermittend particles are + * allowed, i.e. for the chain + * A -> B -> C + * isFrom( C, A ) is true (for A != B != C). If only direct decays are + * considered, this is only the case if A == B or B == C. Defaults to false. + * + * @return Return true if the input particle was created in a physical + * decay of a W or Z boson. Otherwise return false. Will also + * return false if the prduction vertex of the input particle is + * invalid or has zero incoming particles. + */ + bool isFromWZDecay( const xAOD::TruthParticle * truthParticle, + bool bOnlyDirect = false ); + + /** + * @brief Function the check if a particle is a lepton which was + * produced in the decay of a tau lepton. + * + * @param truthParticle The input truth particle which will be checked. + * + * @return True if the input particle is a lepton and it has a parent + * which was a tau. False otherwise. Will also return false if + * the production vertex of the input particle is invalid. + */ + bool isLeptonFromTau( const xAOD::TruthParticle * truthParticle ); + + /** + * @brief Check whether a given truth particle is a lepton. + * @param truthParticle The input truth particle to be tested. + * @return Return true if input is a lepton, false otherwise. + */ + inline bool isLepton( const xAOD::TruthParticle * truthParticle ){ + return ( 10 < truthParticle->absPdgId() && truthParticle->absPdgId() < 17 ); + } + + /*! + * @brief Check whether a given truth particle is not produced in the + * decay of physical hadrons or their descendents. This must be done in + * a recursive manner, i.e. the decay chain must be traversed upwards + * until the initial state is found. + * @param truthParticle The truth particle to be tested. + * @param bOnlyDirect A flag denoting whether "chained matching" is + * allowed. In chained matching mode, intermittend particles are + * allowed, i.e. for the chain + * A -> B -> C + * isFrom( C, A ) is true (for A != B != C). If only direct decays are + * considered, this is only the case if A == B or B == C. Defaults to + * false. + * @param bTauIsHadron If true, any intermediate tauons are treated as hadrons. + * @return True if truthParticle does not descend from a physical + * hadron, false otherwise. + */ + bool isNotFromHadron( const xAOD::TruthParticle * truthParticle, + bool bOnlyDirect = false, bool bTauIsHadron = false ); + + } +} + +#endif /* _TOP_PARTICLE_LEVEL_TRUTHTOOLS_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..0e209c860a377b21f760bee8e7baf0cb56381c89 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/cmt/Makefile.RootCore @@ -0,0 +1,55 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = TopParticleLevel + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = -g + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = xAODTruth xAODJet xAODMissingET xAODCore xAODRootAccess TopEvent TopConfiguration MCTruthClassifier + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ca87a65978478f07d23628e63367244600cdc62 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt @@ -0,0 +1,39 @@ +# Auto-generated on: 2017-03-08 14:47:38.930377 + +# Declare the name of this package: +atlas_subdir( TopPartons None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODCore + AthContainers + AthLinks + AsgTools + xAODTruth + TopConfiguration ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore TMVA Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( TopPartons _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( TopPartons Root/*.cxx Root/*.h Root/*.icc + TopPartons/*.h TopPartons/*.icc TopPartons/*/*.h + TopPartons/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS TopPartons + LINK_LIBRARIES xAODCore + AthContainers + AthLinks + AsgTools + xAODTruth + TopConfiguration + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTbbarPartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTbbarPartonHistory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..934af91221533251441e072d52c47b1227444f35 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTbbarPartonHistory.cxx @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopPartons/CalcTbbarPartonHistory.h" +#include "TopConfiguration/TopConfig.h" + +namespace top{ + + CalcTbbarPartonHistory::CalcTbbarPartonHistory(const std::string& name) : CalcTopPartonHistory( name ){} + + void CalcTbbarPartonHistory::tbbarHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* tbbarPartonHistory){ + + tbbarPartonHistory->IniVarTbbar(); + + TLorentzVector t_before, t_after; + TLorentzVector Wp; + TLorentzVector b_from_top; + TLorentzVector WpDecay1; + TLorentzVector WpDecay2; + int WpDecay1_pdgId; + int WpDecay2_pdgId; + bool event_top = CalcTopPartonHistory::topWb(truthParticles, 6, t_before, t_after, Wp, b_from_top, WpDecay1, WpDecay1_pdgId, WpDecay2, WpDecay2_pdgId); + if(!event_top)event_top = CalcTopPartonHistory::topWb(truthParticles, -6, t_before, t_after, Wp, b_from_top, WpDecay1, WpDecay1_pdgId, WpDecay2, WpDecay2_pdgId); + + TLorentzVector b_beforeFSR; + TLorentzVector b_afterFSR; + bool event_b = CalcTopPartonHistory::b(truthParticles, b_beforeFSR, b_afterFSR); + + if (event_top && event_b){ + TLorentzVector temp = t_before+b_beforeFSR; + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_beforeFSR_m" ) = temp.M(); + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_beforeFSR_pt" ) = temp.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_beforeFSR_phi" ) = temp.Phi(); + fillEtaBranch(tbbarPartonHistory,"MC_tbbar_beforeFSR_eta", temp); + + temp = WpDecay1+WpDecay2+b_from_top + b_afterFSR; + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_afterFSR_m" ) = temp.M(); + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_afterFSR_pt" ) = temp.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_tbbar_afterFSR_phi" ) = temp .Phi(); + fillEtaBranch(tbbarPartonHistory, "MC_tbbar_afterFSR_eta", temp); + }//if + if (event_top){ + tbbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_m" ) = t_before.M(); + tbbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_pt" ) = t_before.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_phi" ) = t_before.Phi(); + fillEtaBranch(tbbarPartonHistory,"MC_t_beforeFSR_eta", t_before); + + tbbarPartonHistory->auxdecor< float >( "MC_W_from_t_m" ) = Wp.M(); + tbbarPartonHistory->auxdecor< float >( "MC_W_from_t_pt" ) = Wp.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_W_from_t_phi" ) = Wp.Phi(); + fillEtaBranch(tbbarPartonHistory, "MC_W_from_t_eta", Wp); + + tbbarPartonHistory->auxdecor< float >( "MC_b_from_t_m" ) = b_from_top.M(); + tbbarPartonHistory->auxdecor< float >( "MC_b_from_t_pt" ) = b_from_top.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_b_from_t_phi" ) = b_from_top.Phi(); + fillEtaBranch(tbbarPartonHistory,"MC_b_from_t_eta", b_from_top); + + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_m" ) = WpDecay1.M(); + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_pt" ) = WpDecay1.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_phi" ) = WpDecay1.Phi(); + tbbarPartonHistory->auxdecor< int >( "MC_Wdecay1_from_t_pdgId" ) = WpDecay1_pdgId; + fillEtaBranch(tbbarPartonHistory,"MC_Wdecay1_from_t_eta", WpDecay1); + + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_m" ) = WpDecay2.M(); + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_pt" ) = WpDecay2.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_phi" ) = WpDecay2.Phi(); + tbbarPartonHistory->auxdecor< int >( "MC_Wdecay2_from_t_pdgId" ) = WpDecay2_pdgId; + fillEtaBranch(tbbarPartonHistory,"MC_Wdecay2_from_t_eta", WpDecay2); + }//if + if (event_b){ + + tbbarPartonHistory->auxdecor< float >( "MC_b_beforeFSR_m" ) = b_beforeFSR.M(); + tbbarPartonHistory->auxdecor< float >( "MC_b_beforeFSR_pt" ) = b_beforeFSR.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_b_beforeFSR_phi" ) = b_beforeFSR.Phi(); + fillEtaBranch(tbbarPartonHistory,"MC_b_beforeFSR_eta", b_beforeFSR); + + tbbarPartonHistory->auxdecor< float >( "MC_b_afterFSR_m" ) = b_afterFSR.M(); + tbbarPartonHistory->auxdecor< float >( "MC_b_afterFSR_pt" ) = b_afterFSR.Pt(); + tbbarPartonHistory->auxdecor< float >( "MC_b_afterFSR_phi" ) = b_afterFSR.Phi(); + fillEtaBranch(tbbarPartonHistory,"MC_b_afterFSR_eta", b_afterFSR); + + }//if + + } + + StatusCode CalcTbbarPartonHistory::execute() + { + // Get the Truth Particles + const xAOD::TruthParticleContainer* truthParticles(nullptr); + ATH_CHECK( evtStore()->retrieve( truthParticles , m_config->sgKeyMCParticle() ) ); + + // Create the partonHistory xAOD object + xAOD::PartonHistoryAuxContainer* partonAuxCont = new xAOD::PartonHistoryAuxContainer{}; + xAOD::PartonHistoryContainer* partonCont = new xAOD::PartonHistoryContainer{}; + partonCont->setStore( partonAuxCont ); + + xAOD::PartonHistory* tbbarPartonHistory = new xAOD::PartonHistory{}; + partonCont->push_back( tbbarPartonHistory ); + + // Recover the parton history for tbbar events + tbbarHistorySaver(truthParticles, tbbarPartonHistory); + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyTopPartonHistory(); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( partonCont , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( partonAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTopPartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTopPartonHistory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9a1646a146a6a0af6ce3deb8c3452eb15126a84a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTopPartonHistory.cxx @@ -0,0 +1,304 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CalcTopPartonHistory.cxx 800464 2017-03-13 18:06:24Z tpelzer $ +#include "TopPartons/CalcTopPartonHistory.h" +#include "TopPartons/PartonHistory.h" +#include "TopConfiguration/TopConfig.h" +#include "TopPartons/CalcTtbarPartonHistory.h" +#include "xAODTruth/TruthVertex.h" + +namespace top{ + + CalcTopPartonHistory::CalcTopPartonHistory( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr) + { + declareProperty( "config" , m_config ); + } + + ///Store the four-momentum of the post-FSR top or anti-top found using statusCodes + ///This would only work if there is at most one "true" top of each charge (i.e. won't work for SS tops or 4 tops) + ///This code was adapted from the 7TeV parton-level differential ttbar routine: https://svnweb.cern.ch/trac/atlasphys-top/browser/Physics/Top/Software/MCvalidation/Rivet/Rivet2.X/trunk/routines/ATLAS_2014_I1304289/ATLAS_2014_I1304289.cc + bool CalcTopPartonHistory::topAfterFSR_SC(const xAOD::TruthParticleContainer* truthParticles, int start, TLorentzVector& top_afterFSR_SC_p4){ + + /// Step1: create vectors of particles of each status codes + // Vectors to hold any status=3 (anti-)top quarks (Pythia 6) + std::vector<const xAOD::TruthParticle*> v_status3_top; + // Vectors to hold any status=155 (anti-)top quarks (Herwig 6) + std::vector<const xAOD::TruthParticle*> v_status155_top; + // Vectors to hold any status=11 (anti-)top quarks for Herwig++ + std::vector<const xAOD::TruthParticle*> v_status11_top; + // Vectors to hold any status=22 (anti-)top quarks + std::vector<const xAOD::TruthParticle*> v_statusOther_top; + + /// Step2: loop on the container of particles and fill the above created vectors + for (const xAOD::TruthParticle* particle : *truthParticles) { + if (particle->pdgId() != start) continue; // only keep particles of a given pdgID (e.g. 6 or -6) + + if (particle->status()==3) { + v_status3_top.push_back(particle); + } + else if (particle->status()==155) { + v_status155_top.push_back(particle); + } + else if (particle->status()==11) {// for Herwig++: take only the tops that decay into Wb!!! + if (!particle->hasDecayVtx()) continue; + const xAOD::TruthVertex* vertex = particle->decayVtx(); + if (vertex == nullptr) continue; + if (vertex->nOutgoingParticles() == 2) v_status11_top.push_back(particle); + } + else { + v_statusOther_top.push_back(particle); + } + } + + /// Step3: for some of the statuscodes, keep only the last of the vector + // If there are more than 1 status 3 tops or anti-tops, only keep the last one put into the vector + if(v_status3_top.size()>1) { + v_status3_top = std::vector<const xAOD::TruthParticle*>(v_status3_top.end() - 1, v_status3_top.end()); + } + // If there are more than 1 status 11 tops or anti-tops, only keep the last one put into the vector + if(v_status11_top.size()>1) { + v_status11_top = std::vector<const xAOD::TruthParticle*>(v_status11_top.end() - 1, v_status11_top.end()); + } + // Rach: check for Pythia 8 as well + // If there are more than 1 status 3 tops or anti-tops, only keep the last one put into the vector + if(v_statusOther_top.size()>1) { + v_statusOther_top = std::vector<const xAOD::TruthParticle*>(v_statusOther_top.end() - 1, v_statusOther_top.end()); + } + + /// Step4: chose which statuscode to take according to what is found in the event + const xAOD::TruthParticle* top = nullptr; + // If there are status 3 tops and no status 155 tops this is probably a Pythia event, so used the status 3s. + if(v_status3_top.size() == 1 && v_status155_top.size() == 0) { + top = v_status3_top[0]; + } + // If there are status 155 tops this must be a Herwig event, so use the status 155s. + if( v_status155_top.size() == 1 && v_status3_top.size() == 0) { + top = v_status155_top[0]; + } + // If there are tops with other status this must be a Pythia8 event, so use them. + if( v_statusOther_top.size() == 1 && v_status155_top.size() == 0 && v_status3_top.size()==0) { + top = v_statusOther_top[0]; + } + // If there are status 155 tops this must be a Herwig event, so use the status 155s. + if( v_status11_top.size() == 1 && v_status3_top.size() == 0) { + top = v_status11_top[0]; + } + + /// Step5: if everything worked, set the 4-vector to its value and return true + if (top != nullptr) { + top_afterFSR_SC_p4 = top->p4(); + return true; + } + return false; + } + + // for b coming from W'->tb + bool CalcTopPartonHistory::b( const xAOD::TruthParticleContainer* truthParticles, + TLorentzVector& b_beforeFSR, TLorentzVector& b_afterFSR){ + for (const xAOD::TruthParticle* particle : *truthParticles) { + + if (fabs(particle->pdgId()) != 5) continue; + + bool skipit(false); + for (size_t i=0; i< particle->nParents(); i++ ) { + const xAOD::TruthParticle* parent = particle->parent(i); + if (parent && (parent->isTop() || fabs(parent->pdgId())==5) ){ + skipit=true; + break; + }//if + }//for + + if( skipit) continue; + + b_beforeFSR = particle->p4(); + b_afterFSR = findAfterFSR(particle)->p4(); + + return true; + } + + + return false; + } + + + bool CalcTopPartonHistory::topWb( const xAOD::TruthParticleContainer* truthParticles, + int start, TLorentzVector& t_beforeFSR_p4, TLorentzVector& t_afterFSR_p4, TLorentzVector& W_p4, + TLorentzVector& b_p4, TLorentzVector& Wdecay1_p4, + int& Wdecay1_pdgId, TLorentzVector& Wdecay2_p4, int& Wdecay2_pdgId){ + + bool hasT = false; + bool hasW = false; + bool hasB = false; + bool hasWdecayProd1 = false; + bool hasWdecayProd2 = false; + + for (const xAOD::TruthParticle* particle : *truthParticles) { + + if (particle->pdgId() != start) continue; + + if (hasParticleIdenticalParent(particle)) continue; // kepping only top before FSR + + t_beforeFSR_p4 = particle->p4(); // top before FSR + hasT = true; + + // demanding the last tops after FSR + particle = findAfterFSR(particle); + t_afterFSR_p4 = particle->p4(); // top after FSR + + for (size_t k=0; k < particle->nChildren(); k++) { + const xAOD::TruthParticle* topChildren = particle->child(k); + + if (fabs(topChildren->pdgId()) == 24){ + + W_p4 = topChildren->p4(); // W boson after FSR + hasW = true; + + // demanding the last W after FSR + topChildren = findAfterFSR(topChildren); + + for (size_t q = 0; q < topChildren->nChildren(); ++q) { + const xAOD::TruthParticle* WChildren = topChildren->child(q); + if (fabs(WChildren->pdgId())<17){ + if (WChildren->pdgId()>0){ + Wdecay1_p4 = WChildren->p4(); + Wdecay1_pdgId = WChildren->pdgId(); + hasWdecayProd1 = true; + }else{ + Wdecay2_p4 = WChildren->p4(); + Wdecay2_pdgId = WChildren->pdgId(); + hasWdecayProd2 = true; + }//else + }//if + }//for + + } else if (fabs(topChildren->pdgId()) == 5) { + b_p4 = topChildren->p4(); + hasB = true; + } //else if + + } //for (size_t k=0; k < particle->nChildren(); k++) + if (hasT && hasW && hasB && hasWdecayProd1 && hasWdecayProd2) return true; + } //for (const xAOD::TruthParticle* particle : *truthParticles) + + return false; + + } + + bool CalcTopPartonHistory::Wlv( const xAOD::TruthParticleContainer* truthParticles, + TLorentzVector& W_p4, + TLorentzVector& Wdecay1_p4, int& Wdecay1_pdgId, + TLorentzVector& Wdecay2_p4, int& Wdecay2_pdgId){ + + bool hasW = false; + bool hasWdecayProd1 = false; + bool hasWdecayProd2 = false; + + for (const xAOD::TruthParticle* particle : *truthParticles) { + + + if (fabs(particle->pdgId()) != 24) continue; + //std::cout << "PDGID: " << particle->pdgId() << std::endl; + + // demanding the last W after FSR + particle = findAfterFSR(particle); + W_p4 = particle->p4(); // W boson after FSR + hasW = true; + + for (size_t k=0; k < particle->nChildren(); k++) { + const xAOD::TruthParticle* WChildren = particle->child(k); + if (fabs(WChildren->pdgId())<17){ + if (WChildren->pdgId()%2==1){ // charged lepton in the Wlv case + Wdecay1_p4 = WChildren->p4(); + Wdecay1_pdgId = WChildren->pdgId(); + hasWdecayProd1 = true; + }else{// neutral lepton in the Wlv case + Wdecay2_p4 = WChildren->p4(); + Wdecay2_pdgId = WChildren->pdgId(); + hasWdecayProd2 = true; + }//else + }//if + + } //for (size_t k=0; k < particle->nChildren(); k++) + + if (hasW && hasWdecayProd1 && hasWdecayProd2) return true; + } //for (const xAOD::TruthParticle* particle : *truthParticles) + + + return false; + + } + + + const xAOD::TruthParticle* CalcTopPartonHistory::findAfterFSR(const xAOD::TruthParticle* particle) { + bool isAfterFSR(false); + const int particle_ID = particle->pdgId(); + int forLoop = 0; + while(!isAfterFSR){ + + forLoop = 0; + for (size_t j=0; j< particle->nChildren(); j++ ) { + const xAOD::TruthParticle* tmp_children = particle->child(j); + if (tmp_children && tmp_children->pdgId()==particle_ID){ + particle = particle->child(j); + forLoop++; + break; + }//if + }//for + + if (forLoop == 0) isAfterFSR = true; + }//while + return particle; + } + + bool CalcTopPartonHistory::hasParticleIdenticalParent(const xAOD::TruthParticle* particle) { + bool skipit(false); + for (size_t i=0; i< particle->nParents(); i++ ) { + const xAOD::TruthParticle* parent = particle->parent(i); + if (parent && parent->pdgId()==particle->pdgId()){ + skipit=true; + break; + }//if + }//for + return skipit; + } + + StatusCode CalcTopPartonHistory::execute() + { + // Get the Truth Particles + const xAOD::TruthParticleContainer* truthParticles(nullptr); + ATH_CHECK( evtStore()->retrieve( truthParticles , m_config->sgKeyMCParticle() ) ); + + // Create the partonHistory xAOD object + xAOD::PartonHistoryAuxContainer* partonAuxCont = new xAOD::PartonHistoryAuxContainer{}; + xAOD::PartonHistoryContainer* partonCont = new xAOD::PartonHistoryContainer{}; + partonCont->setStore( partonAuxCont ); + + xAOD::PartonHistory* partonHistory = new xAOD::PartonHistory{}; + partonCont->push_back( partonHistory ); + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyTopPartonHistory(); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( partonCont , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( partonAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + void CalcTopPartonHistory::fillEtaBranch( xAOD::PartonHistory* partonHistory, std::string branchName, TLorentzVector &tlv){ + if (tlv.CosTheta()==1.) partonHistory->auxdecor< float >( branchName ) = 1000.; + else if (tlv.CosTheta()==-1.) partonHistory->auxdecor< float >( branchName ) = 1000.; + else partonHistory->auxdecor< float >( branchName ) = tlv.Eta(); + return; + + + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTtbarPartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTtbarPartonHistory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4b269fa12e77f21806ff31ebf99523f071936e49 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTtbarPartonHistory.cxx @@ -0,0 +1,162 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopPartons/CalcTtbarPartonHistory.h" +#include "TopConfiguration/TopConfig.h" + +namespace top{ + + CalcTtbarPartonHistory::CalcTtbarPartonHistory(const std::string& name) : CalcTopPartonHistory( name ){} + + void CalcTtbarPartonHistory::ttbarHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* ttbarPartonHistory){ + + ttbarPartonHistory->IniVarTtbar(); + + TLorentzVector t_before, t_after, t_after_SC; + TLorentzVector Wp; + TLorentzVector b; + TLorentzVector WpDecay1; + TLorentzVector WpDecay2; + int WpDecay1_pdgId; + int WpDecay2_pdgId; + bool event_top = CalcTopPartonHistory::topWb(truthParticles, 6, t_before, t_after, Wp, b, WpDecay1, WpDecay1_pdgId, WpDecay2, WpDecay2_pdgId); + bool event_top_SC = CalcTopPartonHistory::topAfterFSR_SC(truthParticles, 6, t_after_SC); + + TLorentzVector tbar_before, tbar_after, tbar_after_SC; + TLorentzVector Wm; + TLorentzVector bbar; + TLorentzVector WmDecay1; + TLorentzVector WmDecay2; + int WmDecay1_pdgId; + int WmDecay2_pdgId; + bool event_topbar = CalcTopPartonHistory::topWb(truthParticles, -6, tbar_before, tbar_after, Wm, bbar, WmDecay1, WmDecay1_pdgId, WmDecay2, WmDecay2_pdgId); + bool event_topbar_SC = CalcTopPartonHistory::topAfterFSR_SC(truthParticles, -6, tbar_after_SC); + + if (event_top && event_topbar){ + TLorentzVector temp = t_before+tbar_before; + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_beforeFSR_m" ) = temp.M(); + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_beforeFSR_pt" ) = temp.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_beforeFSR_phi" ) = temp.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_ttbar_beforeFSR_eta", temp); + + temp = WmDecay1+WmDecay2+b + WpDecay1+WpDecay2+bbar; + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_afterFSR_m" ) = temp.M(); + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_afterFSR_pt" ) = temp.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_ttbar_afterFSR_phi" ) = temp .Phi(); + fillEtaBranch(ttbarPartonHistory, "MC_ttbar_afterFSR_eta", temp); + }//if + if (event_top){ + ttbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_m" ) = t_before.M(); + ttbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_pt" ) = t_before.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_t_beforeFSR_phi" ) = t_before.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_t_beforeFSR_eta", t_before); + + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_m" ) = t_after.M(); + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_pt" ) = t_after.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_phi" ) = t_after.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_t_afterFSR_eta", t_after); + + if (event_top_SC) { + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_SC_m" ) = t_after_SC.M(); + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_SC_pt" ) = t_after_SC.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_t_afterFSR_SC_phi" ) = t_after_SC.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_t_afterFSR_SC_eta", t_after_SC); + } + + ttbarPartonHistory->auxdecor< float >( "MC_W_from_t_m" ) = Wp.M(); + ttbarPartonHistory->auxdecor< float >( "MC_W_from_t_pt" ) = Wp.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_W_from_t_phi" ) = Wp.Phi(); + fillEtaBranch(ttbarPartonHistory, "MC_W_from_t_eta", Wp); + + ttbarPartonHistory->auxdecor< float >( "MC_b_from_t_m" ) = b.M(); + ttbarPartonHistory->auxdecor< float >( "MC_b_from_t_pt" ) = b.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_b_from_t_phi" ) = b.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_b_from_t_eta", b); + + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_m" ) = WpDecay1.M(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_pt" ) = WpDecay1.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_t_phi" ) = WpDecay1.Phi(); + ttbarPartonHistory->auxdecor< int >( "MC_Wdecay1_from_t_pdgId" ) = WpDecay1_pdgId; + fillEtaBranch(ttbarPartonHistory,"MC_Wdecay1_from_t_eta", WpDecay1); + + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_m" ) = WpDecay2.M(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_pt" ) = WpDecay2.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_t_phi" ) = WpDecay2.Phi(); + ttbarPartonHistory->auxdecor< int >( "MC_Wdecay2_from_t_pdgId" ) = WpDecay2_pdgId; + fillEtaBranch(ttbarPartonHistory,"MC_Wdecay2_from_t_eta", WpDecay2); + }//if + if (event_topbar){ + + ttbarPartonHistory->auxdecor< float >( "MC_tbar_beforeFSR_m" ) = tbar_before.M(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_beforeFSR_pt" ) = tbar_before.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_beforeFSR_phi" ) = tbar_before.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_tbar_beforeFSR_eta", tbar_before); + + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_m" ) = tbar_after.M(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_pt" ) = tbar_after.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_phi" ) = tbar_after.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_tbar_afterFSR_eta", tbar_after); + + if (event_topbar_SC) { + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_SC_m" ) = tbar_after_SC.M(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_SC_pt" ) = tbar_after_SC.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_tbar_afterFSR_SC_phi" ) = tbar_after_SC.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_tbar_afterFSR_SC_eta", tbar_after_SC); + } + + ttbarPartonHistory->auxdecor< float >( "MC_W_from_tbar_m" ) = Wm.M(); + ttbarPartonHistory->auxdecor< float >( "MC_W_from_tbar_pt" ) = Wm.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_W_from_tbar_phi" ) = Wm.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_W_from_tbar_eta", Wm); + + ttbarPartonHistory->auxdecor< float >( "MC_b_from_tbar_m" ) = bbar.M(); + ttbarPartonHistory->auxdecor< float >( "MC_b_from_tbar_pt" ) = bbar.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_b_from_tbar_phi" ) = bbar.Phi(); + fillEtaBranch(ttbarPartonHistory,"MC_b_from_tbar_eta", bbar); + + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_tbar_m" ) = WmDecay1.M(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_tbar_pt" ) = WmDecay1.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay1_from_tbar_phi" ) = WmDecay1.Phi(); + ttbarPartonHistory->auxdecor< int >( "MC_Wdecay1_from_tbar_pdgId" ) = WmDecay1_pdgId; + fillEtaBranch(ttbarPartonHistory,"MC_Wdecay1_from_tbar_eta", WmDecay1); + + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_tbar_m" ) = WmDecay2.M(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_tbar_pt" ) = WmDecay2.Pt(); + ttbarPartonHistory->auxdecor< float >( "MC_Wdecay2_from_tbar_phi" ) = WmDecay2.Phi(); + ttbarPartonHistory->auxdecor< int >( "MC_Wdecay2_from_tbar_pdgId" ) = WmDecay2_pdgId; + fillEtaBranch(ttbarPartonHistory,"MC_Wdecay2_from_tbar_eta", WmDecay2); + }//if + + } + + StatusCode CalcTtbarPartonHistory::execute() + { + // Get the Truth Particles + const xAOD::TruthParticleContainer* truthParticles(nullptr); + ATH_CHECK( evtStore()->retrieve( truthParticles , m_config->sgKeyMCParticle() ) ); + + // Create the partonHistory xAOD object + xAOD::PartonHistoryAuxContainer* partonAuxCont = new xAOD::PartonHistoryAuxContainer{}; + xAOD::PartonHistoryContainer* partonCont = new xAOD::PartonHistoryContainer{}; + partonCont->setStore( partonAuxCont ); + + xAOD::PartonHistory* ttbarPartonHistory = new xAOD::PartonHistory{}; + partonCont->push_back( ttbarPartonHistory ); + + // Recover the parton history for ttbar events + ttbarHistorySaver(truthParticles, ttbarPartonHistory); + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyTopPartonHistory(); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( partonCont , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( partonAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcWlvPartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcWlvPartonHistory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b99e3f04aa253cbd6661dce75ef2e57af367f199 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcWlvPartonHistory.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopPartons/CalcWlvPartonHistory.h" +#include "TopConfiguration/TopConfig.h" + +namespace top{ + + CalcWlvPartonHistory::CalcWlvPartonHistory(const std::string& name) : CalcTopPartonHistory( name ){} + + void CalcWlvPartonHistory::WlvHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* wlvPartonHistory){ + + wlvPartonHistory->IniVarWlv(); + + TLorentzVector W; + TLorentzVector WDecay1; + TLorentzVector WDecay2; + int WDecay1_pdgId; + int WDecay2_pdgId; + bool goodevent = CalcTopPartonHistory::Wlv(truthParticles, W, WDecay1, WDecay1_pdgId, WDecay2, WDecay2_pdgId); + + + if (goodevent){ + wlvPartonHistory->auxdecor< float >( "MC_W_m" ) = W.M(); + wlvPartonHistory->auxdecor< float >( "MC_W_pt" ) = W.Pt(); + wlvPartonHistory->auxdecor< float >( "MC_W_phi" ) = W.Phi(); + fillEtaBranch(wlvPartonHistory, "MC_W_eta", W); + + + wlvPartonHistory->auxdecor< float >( "MC_l_m" ) = WDecay1.M(); + wlvPartonHistory->auxdecor< float >( "MC_l_pt" ) = WDecay1.Pt(); + wlvPartonHistory->auxdecor< float >( "MC_l_phi" ) = WDecay1.Phi(); + wlvPartonHistory->auxdecor< int >( "MC_l_pdgId" ) = WDecay1_pdgId; + fillEtaBranch(wlvPartonHistory,"MC_l_eta", WDecay1); + + wlvPartonHistory->auxdecor< float >( "MC_v_m" ) = WDecay2.M(); + wlvPartonHistory->auxdecor< float >( "MC_v_pt" ) = WDecay2.Pt(); + wlvPartonHistory->auxdecor< float >( "MC_v_phi" ) = WDecay2.Phi(); + wlvPartonHistory->auxdecor< int >( "MC_v_pdgId" ) = WDecay2_pdgId; + fillEtaBranch(wlvPartonHistory,"MC_v_eta", WDecay2); + }//if + + + } + + StatusCode CalcWlvPartonHistory::execute() + { + // Get the Truth Particles + const xAOD::TruthParticleContainer* truthParticles(nullptr); + ATH_CHECK( evtStore()->retrieve( truthParticles , m_config->sgKeyMCParticle() ) ); + + // Create the partonHistory xAOD object + xAOD::PartonHistoryAuxContainer* partonAuxCont = new xAOD::PartonHistoryAuxContainer{}; + xAOD::PartonHistoryContainer* partonCont = new xAOD::PartonHistoryContainer{}; + partonCont->setStore( partonAuxCont ); + + xAOD::PartonHistory* wlvPartonHistory = new xAOD::PartonHistory{}; + partonCont->push_back( wlvPartonHistory ); + + // Recover the parton history for wlv events + WlvHistorySaver(truthParticles, wlvPartonHistory); + + // Save to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyTopPartonHistory(); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( partonCont , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( partonAuxCont , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..c5ad90ea174f7dbeb95caf611abf10fdc5da0526 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/LinkDef.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TopPartons/PartonHistory.h" + +#ifdef __CINT__ +#pragma extra_include "TopPartons/PartonHistory.h"; + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#pragma link C++ class xAOD::PartonHistory+; +#pragma link C++ class xAOD::PartonHistoryContainer+; +#pragma link C++ class xAOD::PartonHistoryAuxContainer+; + + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/PartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/PartonHistory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..89085e0bb9bd1c8c6ab317aa72a5c6eb9baafe5f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/PartonHistory.cxx @@ -0,0 +1,193 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: PartonHistory.cxx 800464 2017-03-13 18:06:24Z tpelzer $ +#include "TopPartons/PartonHistory.h" +#include "xAODCore/AddDVProxy.h" + +namespace xAOD{ + /// Aux Container + PartonHistoryAuxContainer::PartonHistoryAuxContainer() : + AuxContainerBase() + { + } + + /// Interface class + PartonHistory::PartonHistory() : + SG::AuxElement() + { + } + + //Initialize variables for ttbar events + void PartonHistory::IniVarTtbar(){ + + //ttbar variables + this->auxdecor< float >( "MC_ttbar_beforeFSR_m" ) = -1; + this->auxdecor< float >( "MC_ttbar_beforeFSR_pt") = -1; + this->auxdecor< float >( "MC_ttbar_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_ttbar_beforeFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_ttbar_afterFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_ttbar_afterFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_ttbar_afterFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_ttbar_afterFSR_phi" ) = -1000 ; + + //t variables + this->auxdecor< float >( "MC_t_beforeFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_t_beforeFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_t_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_t_beforeFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_t_afterFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_t_afterFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_t_afterFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_t_afterFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_t_afterFSR_SC_m" ) = -1 ; + this->auxdecor< float >( "MC_t_afterFSR_SC_pt" ) = -1 ; + this->auxdecor< float >( "MC_t_afterFSR_SC_eta" ) = -1000 ; + this->auxdecor< float >( "MC_t_afterFSR_SC_phi" ) = -1000 ; + + //tbar variables + this->auxdecor< float >( "MC_tbar_beforeFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_tbar_beforeFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_tbar_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_tbar_beforeFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_tbar_afterFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_tbar_afterFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_tbar_afterFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_tbar_afterFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_tbar_afterFSR_SC_m" ) = -1 ; + this->auxdecor< float >( "MC_tbar_afterFSR_SC_pt" ) = -1 ; + this->auxdecor< float >( "MC_tbar_afterFSR_SC_eta" ) = -1000 ; + this->auxdecor< float >( "MC_tbar_afterFSR_SC_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_W_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_W_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_W_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_W_from_t_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_W_from_tbar_m" ) = -1 ; + this->auxdecor< float >( "MC_W_from_tbar_pt" ) = -1 ; + this->auxdecor< float >( "MC_W_from_tbar_eta" ) = -1000 ; + this->auxdecor< float >( "MC_W_from_tbar_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_b_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_b_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_b_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_b_from_t_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_b_from_tbar_m" ) = -1 ; + this->auxdecor< float >( "MC_b_from_tbar_pt" ) = -1 ; + this->auxdecor< float >( "MC_b_from_tbar_eta" ) = -1000 ; + this->auxdecor< float >( "MC_b_from_tbar_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_Wdecay1_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay1_from_t_pdgId") = 0 ; + + this->auxdecor< float >( "MC_Wdecay1_from_tbar_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_tbar_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_tbar_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay1_from_tbar_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay1_from_tbar_pdgId") = 0 ; + + this->auxdecor< float >( "MC_Wdecay2_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay2_from_t_pdgId") = 0 ; + + this->auxdecor< float >( "MC_Wdecay2_from_tbar_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_tbar_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_tbar_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay2_from_tbar_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay2_from_tbar_pdgId") = 0 ; + + } + + //Initialize variables for tbbar events + void PartonHistory::IniVarTbbar(){ + + //ttbar variables + this->auxdecor< float >( "MC_tbbar_beforeFSR_m" ) = -1; + this->auxdecor< float >( "MC_tbbar_beforeFSR_pt") = -1; + this->auxdecor< float >( "MC_tbbar_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_tbbar_beforeFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_tbbar_afterFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_tbbar_afterFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_tbbar_afterFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_tbbar_afterFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_t_beforeFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_t_beforeFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_t_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_t_beforeFSR_phi" ) = -1000 ; + + //tbbar variables + this->auxdecor< float >( "MC_b_beforeFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_b_beforeFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_b_beforeFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_b_beforeFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_b_afterFSR_m" ) = -1 ; + this->auxdecor< float >( "MC_b_afterFSR_pt" ) = -1 ; + this->auxdecor< float >( "MC_b_afterFSR_eta" ) = -1000 ; + this->auxdecor< float >( "MC_b_afterFSR_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_W_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_W_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_W_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_W_from_t_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_b_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_b_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_b_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_b_from_t_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_Wdecay1_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay1_from_t_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay1_from_t_pdgId") = 0 ; + + this->auxdecor< float >( "MC_Wdecay2_from_t_m" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_pt" ) = -1 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_eta" ) = -1000 ; + this->auxdecor< float >( "MC_Wdecay2_from_t_phi" ) = -1000 ; + this->auxdecor< int >( "MC_Wdecay2_from_t_pdgId") = 0 ; + + } + + //Initialize variables for Wlv events + void PartonHistory::IniVarWlv(){ + + // W + this->auxdecor< float >( "MC_W_m" ) = -1 ; + this->auxdecor< float >( "MC_W_pt" ) = -1 ; + this->auxdecor< float >( "MC_W_eta" ) = -1000 ; + this->auxdecor< float >( "MC_W_phi" ) = -1000 ; + + this->auxdecor< float >( "MC_l_m" ) = -1 ; + this->auxdecor< float >( "MC_l_pt" ) = -1 ; + this->auxdecor< float >( "MC_l_eta" ) = -1000 ; + this->auxdecor< float >( "MC_l_phi" ) = -1000 ; + this->auxdecor< int >( "MC_l_pdgId") = 0 ; + + this->auxdecor< float >( "MC_v_m" ) = -1 ; + this->auxdecor< float >( "MC_v_pt" ) = -1 ; + this->auxdecor< float >( "MC_v_eta" ) = -1000 ; + this->auxdecor< float >( "MC_v_phi" ) = -1000 ; + this->auxdecor< int >( "MC_v_pdgId") = 0 ; + + } + + +} +ADD_NS_DV_PROXY( xAOD , PartonHistoryContainer ); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTbbarPartonHistory.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTbbarPartonHistory.h new file mode 100644 index 0000000000000000000000000000000000000000..693903d0181f4771bbcdbc3ef1227f8e5ba9f962 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTbbarPartonHistory.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPPARTONS_CALCTBBARPARTONHISTORY_H +#define ANALYSISTOP_TOPPARTONS_CALCTBBARPARTONHISTORY_H + +/** + * @author John Morris <john.morris@cern.ch> + * @author Silvestre Marino Romano <sromanos@cern.ch> + * @author Samuel Calvet <scalvet@cern.ch> + * + * @brief CalcTbbarPartonHistory + * Class derived from CalcTopPartonHistory, used to store tbbar variables + * + * $Revision: 777122 $ + * $Date: 2016-10-07 15:57:57 +0200 (Fri, 07 Oct 2016) $ + * + **/ + + +// Framework include(s): +#include "TopPartons/CalcTopPartonHistory.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "TopPartons/PartonHistory.h" + +// forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class CalcTbbarPartonHistory : public CalcTopPartonHistory{ + public: + explicit CalcTbbarPartonHistory( const std::string& name ); + virtual ~CalcTbbarPartonHistory() {} + + //Storing parton history for tbbar resonance analysis + CalcTbbarPartonHistory(const CalcTbbarPartonHistory& rhs) = delete; + CalcTbbarPartonHistory(CalcTbbarPartonHistory&& rhs) = delete; + CalcTbbarPartonHistory& operator=(const CalcTbbarPartonHistory& rhs) = delete; + + void tbbarHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* tbbarPartonHistory); + + virtual StatusCode execute(); + + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTopPartonHistory.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTopPartonHistory.h new file mode 100644 index 0000000000000000000000000000000000000000..859d7ae41d5df2a0d19f80a952ff509c4467885e --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTopPartonHistory.h @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CalcTopPartonHistory.h 800464 2017-03-13 18:06:24Z tpelzer $ +#ifndef ANALYSISTOP_TOPPARTONS_CALCTOPPARTONHISTORY_H +#define ANALYSISTOP_TOPPARTONS_CALCTOPPARTONHISTORY_H + +/** + * @author John Morris <john.morris@cern.ch> + * @author Silvestre Marino Romano <sromanos@cern.ch> + * @author Samuel Calvet <scalvet@cern.ch> + * + * @brief CalcTopPartonHistory + * Determine the history of the top partons + * + * $Revision: 800464 $ + * $Date: 2017-03-13 19:06:24 +0100 (Mon, 13 Mar 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <vector> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AthContainers/DataVector.h" +#include "AthContainers/AuxElement.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "TopPartons/PartonHistory.h" + +// forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class CalcTopPartonHistory : public asg::AsgTool { + public: + explicit CalcTopPartonHistory( const std::string& name ); + virtual ~CalcTopPartonHistory() {} + + CalcTopPartonHistory(const CalcTopPartonHistory& rhs) = delete; + CalcTopPartonHistory(CalcTopPartonHistory&& rhs) = delete; + CalcTopPartonHistory& operator=(const CalcTopPartonHistory& rhs) = delete; + + ///Store the four-momentum of the post-FSR top or anti-top found using statusCodes + ///This would only work if there is at most one "true" top of each charge (i.e. won't work for SS tops or 4 tops) + ///This code was adapted from the 7TeV parton-level differential ttbar routine: https://svnweb.cern.ch/trac/atlasphys-top/browser/Physics/Top/Software/MCvalidation/Rivet/Rivet2.X/trunk/routines/ATLAS_2014_I1304289/ATLAS_2014_I1304289.cc + bool topAfterFSR_SC(const xAOD::TruthParticleContainer* truthParticles, int start, TLorentzVector& top_afterFSR_SC_p4); + + ///Store the four-momentum of several particles in the top decay chain + bool topWb(const xAOD::TruthParticleContainer* truthParticles, int start, TLorentzVector& t_beforeFSR_p4, TLorentzVector& t_afterFSR_p4, TLorentzVector& W_p4, TLorentzVector& b_p4, TLorentzVector& Wdecay1_p4, int& Wdecay1_pdgId, TLorentzVector& Wdecay2_p4, int& Wdecay2_pdgId); + + ///Store the four-momentum of b (not from tops_ before and after FSR + bool b(const xAOD::TruthParticleContainer* truthParticles, TLorentzVector& b_beforeFSR, TLorentzVector& b_afterFSR); + + ///Store the four-momentum of several particles in the W decay chain + bool Wlv(const xAOD::TruthParticleContainer* truthParticles, TLorentzVector& W_p4, TLorentzVector& Wdecay1_p4, int& Wdecay1_pdgId, TLorentzVector& Wdecay2_p4, int& Wdecay2_pdgId); + + ///Return particle after FSR (before the decay vertex) + const xAOD::TruthParticle* findAfterFSR(const xAOD::TruthParticle* particle); + + ///Return true when particle is a top before FSR + bool hasParticleIdenticalParent(const xAOD::TruthParticle* particle); + + virtual StatusCode execute(); + protected: + std::shared_ptr<top::TopConfig> m_config; + + void fillEtaBranch(xAOD::PartonHistory* partonHistory,std:: string branchName, TLorentzVector &tlv); + + }; +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTtbarPartonHistory.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTtbarPartonHistory.h new file mode 100644 index 0000000000000000000000000000000000000000..2b0e7cbac023b273ccf61d4065ad3a3fb77c313f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcTtbarPartonHistory.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPPARTONS_CALCTTBARPARTONHISTORY_H +#define ANALYSISTOP_TOPPARTONS_CALCTTBARPARTONHISTORY_H + +/** + * @author John Morris <john.morris@cern.ch> + * @author Silvestre Marino Romano <sromanos@cern.ch> + * @author Samuel Calvet <scalvet@cern.ch> + * + * @brief CalcTtbarPartonHistory + * Class derived from CalcTopPartonHistory, used to store ttbar variables + * + * $Revision: 658996 $ + * $Date: 2015-04-04 17:57:15 +0200 (Sat, 04 Apr 2015) $ + * + **/ + + +// Framework include(s): +#include "TopPartons/CalcTopPartonHistory.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "TopPartons/PartonHistory.h" + +// forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class CalcTtbarPartonHistory : public CalcTopPartonHistory{ + public: + explicit CalcTtbarPartonHistory( const std::string& name ); + virtual ~CalcTtbarPartonHistory() {} + + //Storing parton history for ttbar resonance analysis + CalcTtbarPartonHistory(const CalcTtbarPartonHistory& rhs) = delete; + CalcTtbarPartonHistory(CalcTtbarPartonHistory&& rhs) = delete; + CalcTtbarPartonHistory& operator=(const CalcTtbarPartonHistory& rhs) = delete; + + void ttbarHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* ttbarPartonHistory); + + virtual StatusCode execute(); + + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcWlvPartonHistory.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcWlvPartonHistory.h new file mode 100644 index 0000000000000000000000000000000000000000..2946584d035cbf1ac07d04e4b0bda58a5789e18a --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/CalcWlvPartonHistory.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ANALYSISTOP_TOPPARTONS_CALCWLVPARTONHISTORY_H +#define ANALYSISTOP_TOPPARTONS_CALCWLVPARTONHISTORY_H + +/** + * @author John Morris <john.morris@cern.ch> + * @author Silvestre Marino Romano <sromanos@cern.ch> + * @author Samuel Calvet <scalvet@cern.ch> + * + * @brief CalcWlvPartonHistory + * Class derived from CalcTopPartonHistory, used to store ttbar variables + * + * $Revision: 782353 $ + * $Date: 2016-11-04 13:11:17 +0100 (Fri, 04 Nov 2016) $ + * + **/ + + +// Framework include(s): +#include "TopPartons/CalcTopPartonHistory.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "TopPartons/PartonHistory.h" + +// forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class CalcWlvPartonHistory : public CalcTopPartonHistory{ + public: + explicit CalcWlvPartonHistory( const std::string& name ); + virtual ~CalcWlvPartonHistory() {} + + //Storing parton history for ttbar resonance analysis + CalcWlvPartonHistory(const CalcWlvPartonHistory& rhs) = delete; + CalcWlvPartonHistory(CalcWlvPartonHistory&& rhs) = delete; + CalcWlvPartonHistory& operator=(const CalcWlvPartonHistory& rhs) = delete; + + void WlvHistorySaver(const xAOD::TruthParticleContainer* truthParticles, xAOD::PartonHistory* wlvPartonHistory); + + virtual StatusCode execute(); + + }; + +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/PartonHistory.h b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/PartonHistory.h new file mode 100644 index 0000000000000000000000000000000000000000..5bbfdb28caed1ad1d53db8c93c0f7e2e1efae79b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/TopPartons/PartonHistory.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: PartonHistory.h 782353 2016-11-04 12:11:17Z scalvet $ +#ifndef ANALYSISTOP_TOPPARTONS_PARTONHISORTY_H +#define ANALYSISTOP_TOPPARTONS_PARTONHISORTY_H + +/** + * @author John Morris <john.morris@cern.ch> + * @author Silvestre Marino Romano <sromanos@cern.ch> + * @author Samuel Calvet <scalvet@cern.ch> + * + * @brief PartonHistory + * A simple xAOD class which we can persist into a mini-xAOD + * The xAOD EDM is way too complex, so let's simplify it + * It's not like ROOT can do schema evolution...... + * + * In order for this object to be used by any + * PartonHistory factory, it contains no AuxElements + * Everything should be done via decoration + * + * This really should be an AuxInfoBase type of xAOD object + * But John can't figure out how to copy these to the + * output mini-xAOD.....yet + * + * $Revision: 782353 $ + * $Date: 2016-11-04 13:11:17 +0100 (Fri, 04 Nov 2016) $ + * + **/ + +// EDM include(s): +#include "AthContainers/DataVector.h" +#include "AthContainers/AuxElement.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/CLASS_DEF.h" +#include <vector> + +namespace xAOD{ + + /// Aux Container + class PartonHistoryAuxContainer : public AuxContainerBase { + public: + /// Default constructor + PartonHistoryAuxContainer(); + }; // end Aux container + + /// Interface class + class PartonHistory : public SG::AuxElement { + public: + /// Default constructor + PartonHistory(); + /// Default desturctor + virtual ~PartonHistory(){} + + void IniVarTtbar(); + void IniVarTbbar(); + void IniVarWlv(); + + }; + typedef DataVector < xAOD::PartonHistory > PartonHistoryContainer; +} + +// Dictonaries +CLASS_DEF( xAOD::PartonHistory , 135846343 , 1 ) +CLASS_DEF( xAOD::PartonHistoryContainer , 1219079565 , 1 ) +CLASS_DEF( xAOD::PartonHistoryAuxContainer , 1244378748 , 1 ) + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..6dedb09a834c26600e59632531bcf2533c55d29b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/cmt/Makefile.RootCore @@ -0,0 +1,17 @@ +PACKAGE = TopPartons +PACKAGE_PRELOAD = TMVA +PACKAGE_CXXFLAGS = -g +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = xAODCore AthContainers AthLinks AsgTools xAODTruth TopConfiguration +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_NOGRID = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 +PACKAGE_REFLEX = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f3581b88c2f386e6f3432669e1fc791b395bc43 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt @@ -0,0 +1,79 @@ +# Auto-generated on: 2017-03-08 14:47:39.125284 + +# Declare the name of this package: +atlas_subdir( TopSystematicObjectMaker None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + xAODCore + xAODRootAccess + xAODEventInfo + PATInterfaces + AsgTools + xAODEgamma + xAODMuon + xAODJet + ElectronPhotonFourMomentumCorrection + ElectronPhotonSelectorTools + ElectronPhotonShowerShapeFudgeTool + MuonMomentumCorrections + MuonSelectorTools + TauAnalysisTools + JetCalibTools + JetCPInterfaces + JetResolution + JetInterface + METInterface + METUtilities + IsolationSelection + IsolationCorrections + TopConfiguration + TopEvent + TopJetSubstructure + xAODTracking + InDetTrackSystematicsTools ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) + +# Custom definitions needed for this package: +add_definitions( -g ) + +# Build a library that other components can link against: +atlas_add_library( TopSystematicObjectMaker Root/*.cxx Root/*.h Root/*.icc + TopSystematicObjectMaker/*.h TopSystematicObjectMaker/*.icc TopSystematicObjectMaker/*/*.h + TopSystematicObjectMaker/*/*.icc + PUBLIC_HEADERS TopSystematicObjectMaker + LINK_LIBRARIES xAODCore + xAODRootAccess + xAODEventInfo + PATInterfaces + AsgTools + xAODEgamma + xAODMuon + xAODJet + ElectronPhotonFourMomentumCorrectionLib + ElectronPhotonSelectorToolsLib + ElectronPhotonShowerShapeFudgeToolLib + MuonMomentumCorrectionsLib + MuonSelectorToolsLib + TauAnalysisToolsLib + JetCalibToolsLib + JetCPInterfaces + JetResolutionLib + JetInterface + METInterface + METUtilitiesLib + IsolationSelectionLib + IsolationCorrectionsLib + TopConfiguration + TopEvent + TopJetSubstructure + xAODTracking + InDetTrackSystematicsToolsLib + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/EgammaObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/EgammaObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f4a2bb43595701e0b7ad212365564d04080ac595 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/EgammaObjectCollectionMaker.cxx @@ -0,0 +1,384 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: EgammaObjectCollectionMaker.cxx 802735 2017-04-11 16:38:01Z tpelzer $ +#include "TopSystematicObjectMaker/EgammaObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/ElectronAuxContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "xAODTracking/TrackParticlexAODHelpers.h" +#include "PATInterfaces/SystematicsUtil.h" + +#include <list> + +namespace top{ + + EgammaObjectCollectionMaker::EgammaObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_specifiedSystematicsPhotons(), + m_specifiedSystematicsElectrons(), + m_recommendedSystematicsPhotons(), + m_recommendedSystematicsElectrons(), + + m_calibrationTool("CP::EgammaCalibrationAndSmearingTool"), + m_photonFudgeTool("PhotonFudgeTool"), + + m_isolationTool_LooseTrackOnly("CP::IsolationTool_LooseTrackOnly"), + m_isolationTool_Loose("CP::IsolationTool_Loose"), + m_isolationTool_Gradient("CP::IsolationTool_Gradient"), + m_isolationTool_GradientLoose("CP::IsolationTool_GradientLoose"), + m_isolationTool_FixedCutTight("CP::IsolationTool_FixedCutTight"), + m_isolationTool_FixedCutTightTrackOnly("CP::IsolationTool_FixedCutTightTrackOnly"), + m_isolationTool_FixedCutTightCaloOnly("CP::IsolationTool_FixedCutTightCaloOnly"), + m_isolationTool_FixedCutLoose("CP::IsolationTool_FixedCutLoose"), + m_isolationCorr("CP::IsolationCorrectionTool") + { + declareProperty( "config" , m_config ); + + declareProperty( "EgammaCalibrationAndSmearingTool" , m_calibrationTool ); + + declareProperty( "IsolationTool_LooseTrackOnly" , m_isolationTool_LooseTrackOnly ); + declareProperty( "IsolationTool_Loose" , m_isolationTool_Loose ); + declareProperty( "IsolationTool_Gradient" , m_isolationTool_Gradient ); + declareProperty( "IsolationTool_GradientLoose" , m_isolationTool_GradientLoose ); + declareProperty( "IsolationTool_FixedCutTight" , m_isolationTool_FixedCutTight ); + declareProperty( "IsolationTool_FixedCutTightTrackOnly" , m_isolationTool_FixedCutTightTrackOnly ); + declareProperty( "IsolationTool_FixedCutTightCaloOnly" , m_isolationTool_FixedCutTightCaloOnly ); + declareProperty( "IsolationTool_FixedCutLoose" , m_isolationTool_FixedCutLoose ); + declareProperty( "IsolationCorrectionTool", m_isolationCorr ); + } + + StatusCode EgammaObjectCollectionMaker::initialize() + { + ATH_MSG_INFO(" top::EgammaObjectCollectionMaker initialize" ); + + top::check( m_calibrationTool.retrieve() , "Failed to retrieve egamma calibration tool" ); + + if (m_config->usePhotons()) { + top::check(m_isolationTool_FixedCutTight.retrieve(), + "Failed to retrieve Isolation Tool" ); + top::check(m_isolationTool_FixedCutTightCaloOnly.retrieve(), + "Failed to retrieve Isolation Tool"); + top::check(m_isolationTool_FixedCutLoose.retrieve(), + "Failed to retrieve Isolation Tool"); + top::check(m_photonFudgeTool.retrieve(), + "Failed to retrieve photon shower shape fudge tool"); + } + + if (m_config->useElectrons()) { + top::check( m_isolationTool_LooseTrackOnly.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_Loose.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_Gradient.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_GradientLoose.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_FixedCutTight.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_FixedCutTightTrackOnly.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_FixedCutLoose.retrieve() , "Failed to retrieve Isolation Tool" ); + } + + top::check( m_isolationCorr.retrieve() , "Failed to retrieve Isolation Correction Tool" ); + + std::set<std::string> systPhoton; + std::set<std::string> systElectron; + + const std:: string& syststr = m_config->systematics(); + std::set<std::string> syst; + + if( !m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr) ){ + bool ok = m_config->getSystematicsList(syststr, syst); + if(!ok){ + ATH_MSG_ERROR(" top::EgammaObjectCollectionMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + if(!m_config->contains(syst, "AllElectrons")){ + systElectron=syst; + } + if(!m_config->contains(syst, "AllPhotons")){ + systPhoton=syst; + } + } + + specifiedSystematicsPhotons( systPhoton ); + specifiedSystematicsElectrons( systElectron ); + + if (m_config->usePhotons()) { + m_config->systematicsPhotons( specifiedSystematicsPhotons() ); + } + if (m_config->useElectrons()) { + m_config->systematicsElectrons( specifiedSystematicsElectrons() ); + } + + return StatusCode::SUCCESS; + } + + StatusCode EgammaObjectCollectionMaker::executePhotons() + { + ///-- Get base photons from xAOD --/// + const xAOD::PhotonContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyPhotons() ) , "Failed to retrieve Photons" ); + + ///-- Loop over all systematics --/// + for( auto systematic : m_specifiedSystematicsPhotons ){ + + ///-- Tell tool which systematic to use --/// + top::check( m_calibrationTool->applySystematicVariation( systematic ) , "Failed to applySystematicVariation" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container and apply corrections--/// + for( auto photon : *(shallow_xaod_copy.first) ){ + + ///-- Apply correction to object --/// + // Needs a calo cluster so carry on if no cluster + if (!photon->caloCluster()) continue; + top::check( m_calibrationTool->applyCorrection( *photon ) , "Failed to applyCorrection" ); + + top::check(m_isolationCorr->applyCorrection(*photon), + "Failed to apply photon isolation leakage correction"); + + // Only apply shower shape fudging on full simulation MC + if (m_config->isMC() && !m_config->isAFII()) { + top::check(m_photonFudgeTool->applyCorrection(*photon), + "Failed to apply photon shower shape fudge tool"); + } + + ///-- Isolation selection --/// + char passIsol_FixedCutTight(0); + char passIsol_FixedCutTightCaloOnly(0); + char passIsol_FixedCutLoose(0); + if (m_isolationTool_FixedCutTight->accept(*photon)) { + passIsol_FixedCutTight = 1; + } + if (m_isolationTool_FixedCutTightCaloOnly->accept(*photon)) { + passIsol_FixedCutTightCaloOnly = 1; + } + if (m_isolationTool_FixedCutLoose->accept(*photon)) { + passIsol_FixedCutLoose = 1; + } + photon->auxdecor<char>("AnalysisTop_Isol_FixedCutTight") = passIsol_FixedCutTight; + photon->auxdecor<char>("AnalysisTop_Isol_FixedCutTightCaloOnly") = passIsol_FixedCutTightCaloOnly; + photon->auxdecor<char>("AnalysisTop_Isol_FixedCutLoose") = passIsol_FixedCutLoose; + } + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for photons, MET recalculation may struggle" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + std::string outputSGKey = m_config->sgKeyPhotons( systematic.hash() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } // Loop over all systematics + + return StatusCode::SUCCESS; + } + + StatusCode EgammaObjectCollectionMaker::executeElectrons() + { + + const xAOD::EventInfo* eventInfo(nullptr); + top::check( evtStore()->retrieve( eventInfo, m_config->sgKeyEventInfo() ), "Failed to retrieve EventInfo"); + float beam_pos_sigma_x = eventInfo->beamPosSigmaX(); + float beam_pos_sigma_y = eventInfo->beamPosSigmaY(); + float beam_pos_sigma_xy = eventInfo->beamPosSigmaXY(); + + ///-- Get base electrons from xAOD --/// + const xAOD::ElectronContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyElectrons() ) , "Failed to retrieve Electrons" ); + + ///-- Loop over all systematics --/// + for( auto systematic : m_specifiedSystematicsElectrons ){ + + ///-- Tell tool which systematic to use -/// + top::check( m_calibrationTool->applySystematicVariation( systematic ) , "Failed to applySystematicVariation" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container --/// + for( auto electron : *(shallow_xaod_copy.first) ){ + + // Apply correction to object + // should not affect derivations if there is no CC or track thinning + if (electron->caloCluster() != nullptr && electron->trackParticle() != nullptr) { // derivations might remove CC and tracks for low pt electrons + top::check( m_calibrationTool->applyCorrection( *electron ) , "Failed to applyCorrection" ); + + top::check( m_isolationCorr->applyCorrection( *electron ), "Failed to apply leakage correction" ); + + double d0sig = xAOD::TrackingHelpers::d0significance( electron->trackParticle(), + beam_pos_sigma_x, + beam_pos_sigma_y, + beam_pos_sigma_xy ); + electron->auxdecor<float>("d0sig") = d0sig; + + if( eventInfo->isAvailable<float>("AnalysisTop_PRIVTX_z_position") ){ + float vtx_z = eventInfo->auxdata<float>("AnalysisTop_PRIVTX_z_position"); + float delta_z0 = electron->trackParticle()->z0() + electron->trackParticle()->vz() - vtx_z; + electron->auxdecor<float>("delta_z0") = delta_z0; + electron->auxdecor<float>("delta_z0_sintheta") = delta_z0*std::sin( electron->trackParticle()->theta() ); + + } + } + + ///-- Isolation selection --/// + char passIsol_LooseTrackOnly(0),passIsol_Loose(0),passIsol_FixedCutTight(0),passIsol_FixedCutTightTrackOnly(0),passIsol_FixedCutLoose(0); + char passIsol_Gradient(0),passIsol_GradientLoose(0); + if (m_isolationTool_LooseTrackOnly->accept( *electron )) {passIsol_LooseTrackOnly = 1;} + if (m_isolationTool_Loose->accept( *electron )) {passIsol_Loose = 1;} + if (m_isolationTool_Gradient->accept( *electron )) {passIsol_Gradient = 1;} + if (m_isolationTool_GradientLoose->accept( *electron )) {passIsol_GradientLoose = 1;} + if (m_isolationTool_FixedCutTight->accept( *electron )) {passIsol_FixedCutTight = 1;} + if (m_isolationTool_FixedCutTightTrackOnly->accept( *electron )) {passIsol_FixedCutTightTrackOnly = 1;} + if (m_isolationTool_FixedCutLoose->accept( *electron )) {passIsol_FixedCutLoose = 1;} + + electron->auxdecor<char>("AnalysisTop_Isol_LooseTrackOnly") = passIsol_LooseTrackOnly; + electron->auxdecor<char>("AnalysisTop_Isol_Loose") = passIsol_Loose; + electron->auxdecor<char>("AnalysisTop_Isol_Gradient") = passIsol_Gradient; + electron->auxdecor<char>("AnalysisTop_Isol_GradientLoose") = passIsol_GradientLoose; + electron->auxdecor<char>("AnalysisTop_Isol_FixedCutTight") = passIsol_FixedCutTight; + electron->auxdecor<char>("AnalysisTop_Isol_FixedCutTightTrackOnly") = passIsol_FixedCutTightTrackOnly; + electron->auxdecor<char>("AnalysisTop_Isol_FixedCutLoose") = passIsol_FixedCutLoose; + + } + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for electrons, MET recalculation may struggle" ); + + // Save corrected xAOD Container to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyElectronsStandAlone( systematic.hash() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } // Loop over all systematics + + return StatusCode::SUCCESS; + } + + StatusCode EgammaObjectCollectionMaker::printoutPhotons() + { + // Loop over all systematics + for( auto s : m_specifiedSystematicsPhotons ){ + const xAOD::PhotonContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyPhotons( s.hash() ) ) , "Failed to retrieve Photons" ); + + ATH_MSG_INFO(" Photons with sgKey = "<<m_config->sgKeyPhotons( s.hash() ) ); + for( auto x : *xaod ){ + float ptcone30(0.); + x->isolationValue( ptcone30 , xAOD::Iso::ptcone30 ); + ATH_MSG_INFO(" ph pT , eta , ptcone30 = "<<x->pt()<<" , "<<x->eta()<<" , "<<ptcone30 ); + } + } + + return StatusCode::SUCCESS; + } + + + StatusCode EgammaObjectCollectionMaker::printoutElectrons() + { + // Loop over all systematics + for( auto s : m_specifiedSystematicsElectrons ){ + const xAOD::ElectronContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyElectronsStandAlone( s.hash() ) ), "Failed to retrieve Electrons" ); + + ATH_MSG_INFO(" Electrons with sgKey = "<<m_config->sgKeyElectronsStandAlone( s.hash() ) ); + for( auto x : *xaod ){ + float ptcone30(0.); + x->isolationValue( ptcone30 , xAOD::Iso::ptcone30 ); + ATH_MSG_INFO(" El pT , eta , ptcone30 = "<<x->pt()<<" , "<<x->eta()<<" , "<<ptcone30 ); + } + } + + return StatusCode::SUCCESS; + } + + void EgammaObjectCollectionMaker::specifiedSystematicsPhotons ( const std::set<std::string>& specifiedSystematics ) + { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( m_calibrationTool->recommendedSystematics() ); + + for (auto s : systList) { + m_recommendedSystematicsPhotons.push_back(s); + if (s.name() == "") { + m_specifiedSystematicsPhotons.push_back(s); + } + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematicsPhotons.push_back(s); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematicsPhotons.push_back(s); + } + } + } + } + } + } + m_recommendedSystematicsPhotons.sort(); + m_recommendedSystematicsPhotons.unique(); + m_specifiedSystematicsPhotons.sort(); + m_specifiedSystematicsPhotons.unique(); + } + + void EgammaObjectCollectionMaker::specifiedSystematicsElectrons( const std::set<std::string>& specifiedSystematics ) + { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( m_calibrationTool->recommendedSystematics() ); + + for (auto s : systList) { + m_recommendedSystematicsElectrons.push_back(s); + if (s.name() == "") { + m_specifiedSystematicsElectrons.push_back(s); + } + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematicsElectrons.push_back(s); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematicsElectrons.push_back(s); + } + } + } + } + } + } + m_recommendedSystematicsElectrons.sort(); + m_recommendedSystematicsElectrons.unique(); + m_specifiedSystematicsElectrons.sort(); + m_specifiedSystematicsElectrons.unique(); + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ElectronInJetSubtractionCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ElectronInJetSubtractionCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..00a827c1153dc1ad18ef57229e1054a29fd069f4 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ElectronInJetSubtractionCollectionMaker.cxx @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronInJetSubtractionCollectionMaker.cxx 680332 2015-07-04 01:25:47Z morrisj $ +#include "TopSystematicObjectMaker/ElectronInJetSubtractionCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEgamma/ElectronAuxContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODCore/ShallowCopy.h" + +namespace top{ + + ElectronInJetSubtractionCollectionMaker::ElectronInJetSubtractionCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + m_doLooseCuts(false) + { + declareProperty( "config" , m_config ); + } + + StatusCode ElectronInJetSubtractionCollectionMaker::initialize() + { + if (!m_config->isMC()) + m_doLooseCuts = true; + + if (m_config->doOverlapRemovalOnLooseLeptonDef()) + m_doLooseCuts = true; + + if (m_config->doLooseEvents()) + m_doLooseCuts = true; + + return StatusCode::SUCCESS; + } + + StatusCode ElectronInJetSubtractionCollectionMaker::execute() + { + // Loop over nominal, all electron syst and all jet syst + // For each: + // Create a shallow electron and a shallow jet collection + // Run the subtraction algorithm: + // - Modify some jet 4-momentum + // - Veto some electrons + // Place modified shallow collections into TStore + + for (auto currentSystematic : *m_config->systHashElectronInJetSubtraction()) { + + // Get the Electrons + const xAOD::ElectronContainer* electrons(nullptr); + top::check(evtStore()->retrieve(electrons, m_config->sgKeyElectronsStandAlone( currentSystematic ) ) , "ElectronInJetSubtractionCollectionMaker::execute() Failed to retrieve electrons" ); + + // Get the Jets + const xAOD::JetContainer* jets(nullptr); + top::check(evtStore()->retrieve(jets, m_config->sgKeyJetsStandAlone( currentSystematic ) ) , "ElectronInJetSubtractionCollectionMaker::execute() Failed to retrieve jets" ); + + // Shallow copy the electrons + std::pair< xAOD::ElectronContainer*, xAOD::ShallowAuxContainer* > shallow_electrons = xAOD::shallowCopyContainer( *electrons ); + // Shallow copy the jets + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer( *jets ); + + // Apply the Electron In Jet Subtraction + // The actual calculation is performed in another package + m_subtractionAlgorithm.apply( shallow_electrons.first , shallow_jets.first ); + + // Save the modified electrons to TStore + std::string outputElectronsSGKey = m_config->sgKeyElectrons( currentSystematic ); + std::string outputElectronsSGKeyAux = outputElectronsSGKey + "Aux."; + + xAOD::TReturnCode saveElectrons = evtStore()->tds()->record( shallow_electrons.first , outputElectronsSGKey ); + xAOD::TReturnCode saveElectronsAux = evtStore()->tds()->record( shallow_electrons.second , outputElectronsSGKeyAux ); + if( !saveElectrons || !saveElectronsAux ){ + return StatusCode::FAILURE; + } + + // Save the modified jets to TStore + std::string outputJetsSGKey = m_config->sgKeyJets( currentSystematic , false ); + std::string outputJetsSGKeyAux = outputJetsSGKey + "Aux."; + + xAOD::TReturnCode saveJets = evtStore()->tds()->record( shallow_jets.first , outputJetsSGKey ); + xAOD::TReturnCode saveJetsAux = evtStore()->tds()->record( shallow_jets.second , outputJetsSGKeyAux ); + if( !saveJets || !saveJetsAux ){ + return StatusCode::FAILURE; + } + + + // If we are using loose lepton definitions anywhere, we'd better make more jet colelctions + // We subtract loose leptons from these jets + // We now have loose jets! fun fun fun, we all love combinatorics + + if (m_doLooseCuts) { + // Shallow copy the jets + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jetsLoose = xAOD::shallowCopyContainer( *jets ); + + // Apply the Electron In Jet Subtraction + // The actual calculation is performed in another package + m_subtractionAlgorithm.apply( shallow_electrons.first , shallow_jetsLoose.first , m_doLooseCuts ); + + // Save the modified jets to TStore + std::string outputJetsLooseSGKey = m_config->sgKeyJets( currentSystematic , m_doLooseCuts ); + std::string outputJetsLooseSGKeyAux = outputJetsLooseSGKey + "Aux."; + + xAOD::TReturnCode saveJetsLoose = evtStore()->tds()->record( shallow_jetsLoose.first , outputJetsLooseSGKey ); + xAOD::TReturnCode saveJetsLooseAux = evtStore()->tds()->record( shallow_jetsLoose.second , outputJetsLooseSGKeyAux ); + if( !saveJetsLoose || !saveJetsLooseAux ){ + return StatusCode::FAILURE; + } + } + + + } + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/GhostTrackSystematicsMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/GhostTrackSystematicsMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6391f63cb8d6b2acf77dcd5456267b436db3f000 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/GhostTrackSystematicsMaker.cxx @@ -0,0 +1,514 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: GhostTrackSystematicsMaker.cxx +// Description: +// Author: Fabian Wilk +// Created: Mon Oct 24 16:59:28 2016 +// +// (c) by Fabian Wilk <mail@fabianwilk.de> +// The ATLAS Collaboration +// +// This file is licensed under a Creative Commons Attribution-ShareAlike 4.0 +// International License. +// +// You should have received a copy of the license along with this work. +// If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. + +#include "TopSystematicObjectMaker/GhostTrackSystematicsMaker.h" + +#include <limits> + +#include "PATInterfaces/SystematicsUtil.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODBase/IParticleHelpers.h" + +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/TrackParticleAuxContainer.h" + +#include "TopEvent/EventTools.h" +#include "TopConfiguration/TopConfig.h" + +#include "InDetTrackSystematicsTools/InDetTrackSystematics.h" +#include "InDetTrackSystematicsTools/InDetTrackSmearingTool.h" +#include "InDetTrackSystematicsTools/InDetTrackBiasingTool.h" +#include "InDetTrackSystematicsTools/InDetTrackTruthFilterTool.h" +#include "InDetTrackSystematicsTools/InDetTrackTruthOriginTool.h" +#include "InDetTrackSystematicsTools/JetTrackFilterTool.h" + +namespace top { + + /* explicit */ GhostTrackSystematicsMaker::GhostTrackSystematicsMaker(const std::string & name) + : ::asg::AsgTool(name), + m_config(nullptr), + m_runPeriods(), + m_specifiedSystematics(), + m_recommendedSystematics(), + m_nominalSystematicSet(), + m_tools() { + + declareProperty("config" , m_config); + } + + /* virtual */ GhostTrackSystematicsMaker::~GhostTrackSystematicsMaker(){ + + } + + StatusCode GhostTrackSystematicsMaker::initialize(){ + ATH_MSG_INFO(" top::GhostTrackSystematicsMaker initialize" ); + + m_runPeriods = m_config->runPeriodsJetGhostTrack(); + + // Retrieve the systematics tools. Each individual function will cause + // program abortion upon failure. This is intended as there's no + // meaningful method of recovery. + // These tools are setup and initialised in the TopCPTools package, and we just retrieve them here. + top::check(retrieveGhostTrackCPTool(), + "Failed to retrieve the ghost track CP tools"); + + // Setup the recommended systematics. This utilises the tools that were + // setup before. + const std:: string & syststr = m_config->systematics(); + + if (m_config->isSystNominal(syststr)){ + specifiedSystematics({}); + } else if (m_config->isSystAll(syststr)){ + specifiedSystematics({"AllGhostTrack"}); + } else { + std::set<std::string> syst; + bool ok = m_config->getSystematicsList(syststr, syst); + if (not ok) { + ATH_MSG_ERROR(" top::GhostTrackSystematicsMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + + // No need to manually handle the AllGhostTrack case in here. + specifiedSystematics(syst); + } + + // Pass the systematics list back to the top::TopConfig object. + m_config->systematicsJetGhostTrack(specifiedSystematics()); + + ATH_MSG_INFO(" top::GhostTrackSystematicsMaker completed initialize" ); + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::applyNoOpSystematic(xAOD::JetContainer * nominal, + const CP::SystematicSet & syst) const { + ///-- Loop over the xAOD Container --/// + for(const auto & jet : * nominal ){ + // Copy nominal ghost track container into the systematic variation. + const auto & nominalGhostTracks = + jet->getAssociatedObjects<xAOD::IParticle>(m_config->decoKeyJetGhostTrack()); + jet->setAssociatedObjects(m_config->decoKeyJetGhostTrack(syst.hash()), + nominalGhostTracks); + } + + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::applyTruthFilterSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackTruthFilterTool * tool, + const CP::SystematicSet & syst) const { + ///-- Inform the tool --/// + top::check(tool->applySystematicVariation(syst), + "Failed to configure tool for systematic variation"); + + ///-- Loop over the xAOD Container --/// + for(const auto & jet : * nominal ){ + const auto & ghostTracks = + jet->getAssociatedObjects<xAOD::IParticle>(m_config->decoKeyJetGhostTrack()); + std::vector<const xAOD::IParticle *> newGhosts; + + for (std::size_t iGhost=0; iGhost<ghostTracks.size(); ++iGhost){ + const xAOD::TrackParticle * + tp{dynamic_cast<const xAOD::TrackParticle*>(ghostTracks[iGhost])}; + top::check(tp, "Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track"); + + if (not tool->accept(tp)){ + continue; + } + + // We can re-use the existing xAOD::IParticle. + newGhosts.push_back(ghostTracks[iGhost]); + } + + jet->setAssociatedObjects(m_config->decoKeyJetGhostTrack(syst.hash()), newGhosts); + } + + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::applyJetTrackFilterSystematic(xAOD::JetContainer * nominal, + InDet::JetTrackFilterTool * tool, + const CP::SystematicSet & syst) const { + ///-- Inform the tool --/// + top::check(tool->applySystematicVariation(syst), + "Failed to configure tool for systematic variation"); + + ///-- Loop over the xAOD Container --/// + for(const auto & jet : * nominal ){ + const auto & ghostTracks = jet->getAssociatedObjects<xAOD::IParticle>(m_config->decoKeyJetGhostTrack()); + std::vector<const xAOD::IParticle *> newGhosts; + + for (std::size_t iGhost=0; iGhost<ghostTracks.size(); ++iGhost){ + const xAOD::TrackParticle * + tp{dynamic_cast<const xAOD::TrackParticle*>(ghostTracks[iGhost])}; + top::check(tp, "Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track"); + + if (not tool->accept(tp, nominal)){ + continue; + } + + // We can re-use the existing xAOD::IParticle. + newGhosts.push_back(ghostTracks[iGhost]); + } + + jet->setAssociatedObjects(m_config->decoKeyJetGhostTrack(syst.hash()), newGhosts); + } + + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::applySmearingSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackSmearingTool * tool, + const CP::SystematicSet & syst) const { + ///-- Inform the tool --/// + top::check(tool->applySystematicVariation(syst), + "Failed to configure tool for systematic variation"); + + const std::string sgKey{m_config->decoKeyJetGhostTrack() + + "_Particles_" + syst.name()}; + const std::string sgKeyAux{sgKey + "Aux."}; + + + ///-- Loop over the xAOD Container --/// + xAOD::TrackParticleContainer * newTrackParticles = new xAOD::TrackParticleContainer; + top::check(evtStore()->record(newTrackParticles, sgKey), + "Failed to record systematically varied track particle container" ); + xAOD::TrackParticleAuxContainer * newTrackParticlesAux = new xAOD::TrackParticleAuxContainer; + top::check(evtStore()->record(newTrackParticlesAux, sgKeyAux), + "Failed to record systematically varied track particle container" ); + newTrackParticles->setStore(newTrackParticlesAux); + + for (const auto & jet : * nominal){ + const auto & ghostTracks = jet->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack()); + + std::vector<const xAOD::IParticle *> newGhosts; + + for (std::size_t iGhost=0; iGhost<ghostTracks.size(); ++iGhost){ + const xAOD::TrackParticle * + tp{dynamic_cast<const xAOD::TrackParticle*>(ghostTracks.at(iGhost))}; + top::check(tp, "Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track"); + + xAOD::TrackParticle * newTp{nullptr}; + top::check(tool->correctedCopy(* tp, newTp), + "Failure to apply ghost track systematic"); + top::check(newTp, "Systematically varied xAOD::TrackParticle is nullptr"); + + newTrackParticles->push_back(newTp); + newGhosts.push_back(newTp); + } + + jet->setAssociatedObjects(m_config->decoKeyJetGhostTrack(syst.hash()), newGhosts); + } + + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::applyBiasingSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackBiasingTool * tool, + const CP::SystematicSet & syst) const { + ///-- Inform the tool --/// + top::check(tool->applySystematicVariation(syst), + "Failed to configure tool for systematic variation"); + + const std::string sgKey{m_config->decoKeyJetGhostTrack() + + "_Particles_" + syst.name()}; + const std::string sgKeyAux{sgKey + "Aux."}; + + + ///-- Loop over the xAOD Container --/// + xAOD::TrackParticleContainer * newTrackParticles = new xAOD::TrackParticleContainer; + top::check(evtStore()->record(newTrackParticles, sgKey), + "Failed to record systematically varied track particle container" ); + xAOD::TrackParticleAuxContainer * newTrackParticlesAux = new xAOD::TrackParticleAuxContainer; + top::check(evtStore()->record(newTrackParticlesAux, sgKeyAux), + "Failed to record systematically varied track particle container" ); + newTrackParticles->setStore(newTrackParticlesAux); + + for (const auto & jet : * nominal){ + const auto & ghostTracks = jet->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack()); + + std::vector<const xAOD::IParticle *> newGhosts; + + for (std::size_t iGhost=0; iGhost<ghostTracks.size(); ++iGhost){ + const xAOD::TrackParticle * + tp{dynamic_cast<const xAOD::TrackParticle*>(ghostTracks.at(iGhost))}; + top::check(tp, "Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track"); + + xAOD::TrackParticle * newTp{nullptr}; + top::check(tool->correctedCopy(* tp, newTp), + "Failure to apply ghost track systematic"); + top::check(newTp, "Systematically varied xAOD::TrackParticle is nullptr"); + + newTrackParticles->push_back(newTp); + newGhosts.push_back(newTp); + } + + jet->setAssociatedObjects(m_config->decoKeyJetGhostTrack(syst.hash()), newGhosts); + } + + return StatusCode::SUCCESS; + } + + StatusCode GhostTrackSystematicsMaker::execute(){ + ATH_MSG_DEBUG(" top::GhostTrackSystematicsMaker execute:" ); + + // We don't want to do anything on Data -> bail early so that we can + // rely on the inputs to be MC. + if (not m_config->isMC()){ + return StatusCode::SUCCESS; + } + + ///-- Get nominal jets --/// + xAOD::JetContainer * nominalJets(nullptr); + top::check(evtStore()->retrieve(nominalJets, + m_config->sgKeyJetsStandAlone(m_nominalSystematicSet.hash())), + "Failed to retrieve Jets"); + + + ///-- SMEARING --/// + for (const auto & syst : m_systs.smearing){ + // std::cout << "[A] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applySmearingSystematic(nominalJets, &(* m_tools.smearing), syst), + "Failure to apply GhostTrackSystematic"); + } + + ///-- BIASING --/// + InDet::InDetTrackBiasingTool * biasingTool{nullptr}; + if (m_runPeriods.size() == 1){ + biasingTool = &(* m_tools.bias[0]); + + top::check(biasingTool, "Failure to selected biasing tool"); + for (const auto & syst : m_systs.bias){ + // std::cout << "[B] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applyBiasingSystematic(nominalJets, biasingTool, syst), + "Failure to apply GhostTrackSystematic"); + } + } else { + const xAOD::EventInfo * ei{nullptr}; + top::check(evtStore()->retrieve(ei, "EventInfo"), + "Failure to retrieve EventInfo"); + + top::check(ei->isAvailable<unsigned int>("RandomRunNumber"), + "Require that RandomRunNumber decoration is available."); + auto randomRunNumber = ei->auxdataConst<unsigned int>("RandomRunNumber"); + + if (randomRunNumber == 0){ + for (const auto & syst : m_systs.bias){ + // std::cout << "[B.1] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applyNoOpSystematic(nominalJets, syst), + "Failure to apply GhostTrackSystematic"); + } + } else { + top::check(m_runPeriods[0] <= randomRunNumber, + "RandomRunNumber is below valid range."); + top::check(randomRunNumber < m_runPeriods[m_runPeriods.size() - 1], + "RandomRunNumber is above valid range."); + + for (std::size_t i=1; i<m_runPeriods.size(); ++i){ + if (randomRunNumber < m_runPeriods[i]){ + biasingTool = &(* m_tools.bias[i - 1]); + break; + } + } + top::check(biasingTool, "Failure to selected biasing tool"); + for (const auto & syst : m_systs.bias){ + // std::cout << "[B.2] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applyBiasingSystematic(nominalJets, biasingTool, syst), + "Failure to apply GhostTrackSystematic"); + } + } + } + + ///-- TRUTH FILTER --/// + for (const auto & syst : m_systs.truthFilter){ + // std::cout << "[C] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applyTruthFilterSystematic(nominalJets, &(* m_tools.truthFilter), syst), + "Failure to apply GhostTrackSystematic"); + } + + ///-- JET TRACK FILTER --/// + for (const auto & syst : m_systs.jetTrackFilter){ + // std::cout << "[D] SYSTEMATIC = " << m_config->systematicName(syst.hash()) << std::endl; + top::check(applyJetTrackFilterSystematic(nominalJets, &(* m_tools.jetTrackFilter), syst), + "Failure to apply GhostTrackSystematic"); + } + + ATH_MSG_DEBUG(" top::GhostTrackSystematicsMaker completed execute" ); + return StatusCode::SUCCESS; + } + + + void GhostTrackSystematicsMaker::specifiedSystematics(const std::set<std::string> & specifiedSystematics) { + // NOTE: For this function -- unlike the "proper" ObjectCollectionMakers in AnalysisTop -- an empty specifiedSystematics input is considered to represent "No Systematics". All GhostTrack systematics can be requested with the string "AllGhostTrack". + const bool allGhostTrackSystematics = m_config->contains(specifiedSystematics, + "AllGhostTrack"); + + // Acquire the recommended systematics from the various tools and put + // into containers that store the per-tool systematics as well as a + // global container. At a later point we'll make the per-tool containers + // unique and check that the containers for various tools are + // orthogonal. + std::set<CP::SystematicSet> systs; + + // SMEARING + m_systs.smearing = + CP::make_systematics_vector(m_tools.smearing->recommendedSystematics()); + systs.insert(m_systs.smearing.begin(), m_systs.smearing.end()); + + // BIAS + for (const auto & tool : m_tools.bias){ + m_systs.bias = + CP::make_systematics_vector(tool->recommendedSystematics()); + systs.insert(m_systs.bias.begin(), m_systs.bias.end()); + } + + // TRUTH FILTER + m_systs.truthFilter = + CP::make_systematics_vector(m_tools.truthFilter->recommendedSystematics()); + systs.insert(m_systs.truthFilter.begin(), m_systs.truthFilter.end()); + + // JET TRACK FILTER + m_systs.jetTrackFilter = + CP::make_systematics_vector(m_tools.jetTrackFilter->recommendedSystematics()); + systs.insert(m_systs.jetTrackFilter.begin(), m_systs.jetTrackFilter.end()); + + // PUT INTO RECOMMENDED AND SPECIFIED + for (const auto & s : systs){ + // We don't want nominal. + if (s.name() == ""){ + continue; + } + + m_recommendedSystematics.push_back(s); + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (not m_config->isSystNominal(m_config->systematics())) { + if (allGhostTrackSystematics) { + m_specifiedSystematics.push_back(s); + continue; + } + + for (const auto & i : specifiedSystematics) { + if (i == s.name()) { + m_specifiedSystematics.push_back(s); + } + } + } + } + } + + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + + // Make the sublists unique and remove any elements that have not "been specified". + m_systs.makeUnique(); + m_systs.removeNonSpecified(m_specifiedSystematics); + + // Lastly, let use introduce a safeguard which ensures that the + // systematics selected for the various tools are orthogonal. This is + // done by asserting that the sum of the sizes of the individual + // systematics lists equals the size of the list of specified + // systematics. We can do this because we've made the individual + // per-tool containers unique (in makeUnique). + top::check(m_systs.numSystematics() == m_specifiedSystematics.size(), + "Sanity check failed"); + } + + StatusCode GhostTrackSystematicsMaker::retrieveGhostTrackCPTool(){ + ATH_MSG_INFO(" Retrieving ghost track CPTools" ); + + std::string smearingToolName{"top::GhostTrackCPTools::InDetTrackSmearingTool"}; + if (asg::ToolStore::contains<InDet::InDetTrackSmearingTool>(smearingToolName)) { + m_tools.smearing = + asg::ToolStore::get<InDet::InDetTrackSmearingTool>(smearingToolName); + } + else { + ATH_MSG_ERROR(" Impossible to retrieve " + smearingToolName ); + return StatusCode::FAILURE; + } + + std::string biasToolPrefix{"top::GhostTrackCPTools::InDetTrackBiasingTool"}; + top::check(not m_runPeriods.empty(), "Assertion failed"); + // Two cases are possible: + // - Either a single run number was specified to the runPeriods + // parameter in which case we'll use exactly that run number, or + // - at least two numbers have been specified, which then define + // (potentially multiple) run number ranges. + unsigned int end = 0; + if (m_runPeriods.size() == 1) { + end = 1; + m_tools.bias.resize(1); + } + else { + end = m_runPeriods.size()-1; + m_tools.bias.resize(m_runPeriods.size()-1); + } + for (unsigned int i = 0; i<end; i++) { + std::string biasToolName{""}; + if (m_runPeriods.size() == 1) { + biasToolName = biasToolPrefix + "_" + std::to_string(m_runPeriods[0]); + } + else { + biasToolName = biasToolPrefix + "_" + std::to_string(m_runPeriods[i]) + "_" + std::to_string(m_runPeriods[i + 1]); + } + if (asg::ToolStore::contains<InDet::InDetTrackBiasingTool>(biasToolName)){ + m_tools.bias[i] = asg::ToolStore::get<InDet::InDetTrackBiasingTool>(biasToolName); + } + else { + ATH_MSG_ERROR(" Impossible to retrieve " + biasToolName ); + return StatusCode::FAILURE; + } + } + + std::string truthOriginToolName{"top::GhostTrackCPTools::InDetTrackTruthOriginTool"}; + if (asg::ToolStore::contains<InDet::InDetTrackTruthOriginTool>(truthOriginToolName)){ + m_tools.truthOrigin = asg::ToolStore::get<InDet::InDetTrackTruthOriginTool>(truthOriginToolName); + } + else { + ATH_MSG_ERROR(" Impossible to retrieve " + truthOriginToolName ); + return StatusCode::FAILURE; + } + + std::string truthFilterToolName{"top::GhostTrackCPTools::InDetTrackTruthFilterTool"}; + if (asg::ToolStore::contains<InDet::InDetTrackTruthFilterTool>(truthFilterToolName)){ + m_tools.truthFilter = asg::ToolStore::get<InDet::InDetTrackTruthFilterTool>(truthFilterToolName); + } + else { + ATH_MSG_ERROR(" Impossible to retrieve " + truthFilterToolName ); + return StatusCode::FAILURE; + } + + std::string jetTrackFilterToolName{"top::GhostTrackCPTools::JetTrackFilterTool"}; + if (asg::ToolStore::contains<InDet::JetTrackFilterTool>(jetTrackFilterToolName)){ + m_tools.jetTrackFilter = asg::ToolStore::get<InDet::JetTrackFilterTool>(jetTrackFilterToolName); + } + else { + ATH_MSG_ERROR(" Impossible to retrieve " + jetTrackFilterToolName ); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7c1bdf02d213f4a4ea0815b118d0ee08f52d97c3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx @@ -0,0 +1,740 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: JetObjectCollectionMaker.cxx 802997 2017-04-17 01:24:36Z tpelzer $ +#include "TopSystematicObjectMaker/JetObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "xAODMissingET/MissingETContainer.h" +#include "PATInterfaces/SystematicsUtil.h" + +#include "TopJetSubstructure/TopJetSubstructure.h" +#include "TopJetSubstructure/LargeJetTrimmer.h" +#include "TopJetSubstructure/SubjetMaker.h" + +namespace top{ + +JetObjectCollectionMaker::JetObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + m_doJER(false), + m_doFull_JER(false), + + m_specifiedSystematics(), + m_specifiedSystematicsLargeR(), + m_specifiedSystematicsTrackJets(), + m_recommendedSystematics(), + m_nominalSystematicSet(), + + m_jetCalibrationTool("JetCalibrationTool"), + m_jetCalibrationToolLargeR("JetCalibrationToolLargeR"), + + m_jetUncertaintiesTool("JetUncertaintiesTool"), + m_jetUncertaintiesToolReducedNPScenario1("JetUncertaintiesToolReducedNPScenario1"), + m_jetUncertaintiesToolReducedNPScenario2("JetUncertaintiesToolReducedNPScenario2"), + m_jetUncertaintiesToolReducedNPScenario3("JetUncertaintiesToolReducedNPScenario3"), + m_jetUncertaintiesToolReducedNPScenario4("JetUncertaintiesToolReducedNPScenario4"), + + m_jetUncertaintiesToolLargeR_strong("JetUncertaintiesToolLargeR_Strong"), + m_jetUncertaintiesToolLargeR_medium("JetUncertaintiesToolLargeR_Medium"), + m_jetUncertaintiesToolLargeR_weak("JetUncertaintiesToolLargeR_Weak"), + + m_jetJERSmearingTool("JetJERSmearingTool"), + m_jetUpdateJvtTool("JetUpdateJvtTool"), + m_fjvtTool("fJVTTool"), + + m_jetSubstructure(nullptr), + + m_systMap_AllNP(), + m_systMap_ReducedNPScenario1(), + m_systMap_ReducedNPScenario2(), + m_systMap_ReducedNPScenario3(), + m_systMap_ReducedNPScenario4(), + m_systMap_LargeR_strong(), + m_systMap_JER() +{ + declareProperty( "config" , m_config ); + + declareProperty( "JetCalibrationTool" , m_jetCalibrationTool ); + declareProperty( "JetCalibrationToolLargeR" , m_jetCalibrationToolLargeR ); + + declareProperty( "JetUncertaintiesToolLargeR" , m_jetUncertaintiesToolLargeR_strong); + declareProperty( "JetUncertaintiesTool" , m_jetUncertaintiesTool); + declareProperty( "JetUncertaintiesToolReducedNPScenario1" , m_jetUncertaintiesToolReducedNPScenario1 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario2" , m_jetUncertaintiesToolReducedNPScenario2 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario3" , m_jetUncertaintiesToolReducedNPScenario3 ); + declareProperty( "JetUncertaintiesToolReducedNPScenario4" , m_jetUncertaintiesToolReducedNPScenario4 ); + + declareProperty( "JetJERSmearingTool" , m_jetJERSmearingTool ); + declareProperty( "JetUpdateJvtTool" , m_jetUpdateJvtTool ); + + declareProperty( "TruthJetCollectionForHSTagging" , m_truthJetCollForHS = "AntiKt4TruthJets" ); +} + +StatusCode JetObjectCollectionMaker::initialize() { + ATH_MSG_INFO(" top::JetObjectCollectionMaker initialize" ); + + ///-- Lets do the nominal systematics --/// + ///-- JetObjectCollectionMaker is a little different from the others --/// + m_specifiedSystematics.push_back(CP::SystematicSet()); + m_specifiedSystematicsLargeR.push_back(CP::SystematicSet()); + m_specifiedSystematicsTrackJets.push_back(CP::SystematicSet()); + m_recommendedSystematics.push_back(CP::SystematicSet()); + + + top::check( m_jetCalibrationTool.retrieve() , "Failed to retrieve JetCalibrationTool" ); + if (m_config->useLargeRJets()) { + top::check( m_jetCalibrationToolLargeR.retrieve(), + "Failed to retrieve JetCalibrationToolLargeR" ); + top::check( m_jetUncertaintiesToolLargeR_strong.retrieve(), + "Failed to retrieve JetUncertaintiesToolLargeR_Strong" ); + top::check( m_jetUncertaintiesToolLargeR_medium.retrieve(), + "Failed to retrieve JetUncertaintiesToolLargeR_Medium" ); + top::check( m_jetUncertaintiesToolLargeR_weak.retrieve(), + "Failed to retrieve JetUncertaintiesToolLargeR_Weak" ); + } + + // If we are using particle flow jets then we + // don't have any uncertainties so skip the retrieval. + if (!m_config->useParticleFlowJets()) { + ///-- JER uncertainties model --/// + if (m_config->jetJERSmearingModel() == "Full") + m_doFull_JER = true; + if (m_config->jetJERSmearingModel() == "Simple") + m_doFull_JER = false; + + ///-- Are we doing JER? Let's not repeat this logic over and over --/// + if (m_config->isMC()) + m_doJER = true; + if (!m_config->isMC() && m_doFull_JER) + m_doJER = true; + + + if (m_config->isMC()) { + if (!m_config->doMultipleJES()) { + top::check( m_jetUncertaintiesTool.retrieve() , "Failed to retrieve JetUncertaintiesToolAllNP" ); + } + if (m_config->doMultipleJES()) { + top::check( m_jetUncertaintiesToolReducedNPScenario1.retrieve() , "Failed to retrieve JetUncertaintiesToolReducedNPScenario1" ); + top::check( m_jetUncertaintiesToolReducedNPScenario2.retrieve() , "Failed to retrieve JetUncertaintiesToolReducedNPScenario2" ); + top::check( m_jetUncertaintiesToolReducedNPScenario3.retrieve() , "Failed to retrieve JetUncertaintiesToolReducedNPScenario3" ); + top::check( m_jetUncertaintiesToolReducedNPScenario4.retrieve() , "Failed to retrieve JetUncertaintiesToolReducedNPScenario4" ); + } + } + + top::check( m_jetJERSmearingTool.retrieve() , "Failed to retrieve JetJERSmearingTool" ); + } + + top::check( m_jetUpdateJvtTool.retrieve() , "Failed to retrieve JetUpdateJvtTool" ); + top::check(m_fjvtTool.retrieve(), "Failed to retrieve fJVTTool"); + + // Take this from the TopConfiguration + // A blank vector will setup all systematics + + const std:: string& syststr = m_config->systematics(); + std::set<std::string> syst,systLargeR; + + if( !m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr)){ + bool ok = m_config->getSystematicsList(syststr, syst); + bool okLargeR = m_config->getSystematicsList(syststr, systLargeR); + if (!ok || !okLargeR) { + ATH_MSG_ERROR(" top::JetObjectCollectionMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + if (m_config->contains(syst, "AllJets")) { + syst.clear(); + systLargeR.clear(); + } + } + + // If we are using particle flow jets then we + // don't have any uncertainties so skip + // trying to use the tools + if (!m_config->useParticleFlowJets()) { + ///-- JES systematics --/// + if (m_config->isMC()) { + std::string allNP("JET_"+m_config->jetUncertainties_NPModel()+"_"),np1("JET_NPScenario1_"),np2("JET_NPScenario2_"),np3("JET_NPScenario3_"),np4("JET_NPScenario4_"); + std::string largeR_strong("LARGERJET_Strong_"), + largeR_medium("LARGERJET_Medium_"), + largeR_weak("LARGERJET_Weak_"); + + if (!m_config->doMultipleJES()) { + specifiedSystematics( syst , m_jetUncertaintiesTool , m_systMap_AllNP , allNP ); + } + if (m_config->doMultipleJES()) { + specifiedSystematics( syst , m_jetUncertaintiesToolReducedNPScenario1 , m_systMap_ReducedNPScenario1 , np1 ); + specifiedSystematics( syst , m_jetUncertaintiesToolReducedNPScenario2 , m_systMap_ReducedNPScenario2 , np2 ); + specifiedSystematics( syst , m_jetUncertaintiesToolReducedNPScenario3 , m_systMap_ReducedNPScenario3 , np3 ); + specifiedSystematics( syst , m_jetUncertaintiesToolReducedNPScenario4 , m_systMap_ReducedNPScenario4 , np4 ); + } + if (m_config->useLargeRJets()) { + specifiedSystematics( syst , m_jetUncertaintiesToolLargeR_strong , m_systMap_LargeR_strong , largeR_strong , true); + specifiedSystematics( syst , m_jetUncertaintiesToolLargeR_medium , m_systMap_LargeR_medium , largeR_medium , true); + specifiedSystematics( syst , m_jetUncertaintiesToolLargeR_weak , m_systMap_LargeR_weak , largeR_weak , true); + } + } + + ///-- JER systematics --/// + if (m_doJER) + specifiedSystematics( syst , m_jetJERSmearingTool , m_systMap_JER ); + } + + // See http://cern.ch/go/nHF6 for more information + if (m_config->doLargeRSmallRCorrelations()) { + systMap* smallR_systs = &m_systMap_AllNP; + if (m_config->doMultipleJES()) { + smallR_systs = &m_systMap_ReducedNPScenario1; + } + addCorrelation("CORR_LargeRSmallR_A", *smallR_systs, + "JET_GroupedNP_2", + m_systMap_LargeR_strong, "JET_Top_Run1_Tau32"); + + addCorrelation("CORR_LargeRSmallR_B", *smallR_systs, + "JET_GroupedNP_2", + m_systMap_LargeR_weak, "JET_Rtrk_Baseline_pT"); + + addCorrelation("CORR_LargeRSmallR_C__1up", m_systMap_LargeR_weak, + "JET_Rtrk_Baseline_mass__1up-JET_Top_Run1_Tau32__1up", + m_specifiedSystematicsLargeR); + + addCorrelation("CORR_LargeRSmallR_C__1down", m_systMap_LargeR_weak, + "JET_Rtrk_Baseline_mass__1down-JET_Top_Run1_Tau32__1down", + m_specifiedSystematicsLargeR); + } + + ///-- Large R jet substructure --/// + if (m_config->jetSubstructureName() == "Trimmer") + m_jetSubstructure.reset(new top::LargeJetTrimmer); + + if (m_config->jetSubstructureName() == "SubjetMaker") + m_jetSubstructure.reset(new top::SubjetMaker); + + m_config->systematicsJets( specifiedSystematics() ); + m_config->systematicsLargeRJets( specifiedSystematicsLargeR() ); + m_config->systematicsTrackJets( m_specifiedSystematicsTrackJets ); + + return StatusCode::SUCCESS; +} + +StatusCode JetObjectCollectionMaker::executeJets() { + bool isLargeR(false); + return execute( isLargeR ); +} + +StatusCode JetObjectCollectionMaker::executeLargeRJets() { + bool isLargeR(true); + return execute( isLargeR ); +} + +StatusCode JetObjectCollectionMaker::execute( const bool isLargeR ) { + // decorating the HS jets with truth info on which are HS jets + if (!isLargeR & m_config->isMC()) { + top::check( decorateHSJets() , "Failed to decorate jets with truth info of which are HS - this is needed for JVT scale-factors!"); + } + + ///-- First calibrate the nominal jets, everything else comes from this, so let's only do it once not 3000 times --/// + top::check( calibrate( isLargeR ) , "Failed to calibrate jets"); + + // No uncertainties yet for pflow + // - return SUCCESS after calibration + if (m_config->useParticleFlowJets()) + return StatusCode::SUCCESS; + + ///-- JES, JER regular atk4 for now --/// + if (!isLargeR) { + ///-- JES --/// + if (m_config->isMC()) { + if (!m_config->doMultipleJES()) { + top::check( applySystematic( m_jetUncertaintiesTool , m_systMap_AllNP ) , "Failed to apply JES"); + } + if (m_config->doMultipleJES()) { + top::check( applySystematic( m_jetUncertaintiesToolReducedNPScenario1 , m_systMap_ReducedNPScenario1 ) , "Failed to apply JES"); + top::check( applySystematic( m_jetUncertaintiesToolReducedNPScenario2 , m_systMap_ReducedNPScenario2 ) , "Failed to apply JES"); + top::check( applySystematic( m_jetUncertaintiesToolReducedNPScenario3 , m_systMap_ReducedNPScenario3 ) , "Failed to apply JES"); + top::check( applySystematic( m_jetUncertaintiesToolReducedNPScenario4 , m_systMap_ReducedNPScenario4 ) , "Failed to apply JES"); + } + } + + ///-- JER --/// + if (m_doJER) + top::check( applySystematic ( m_jetJERSmearingTool , m_systMap_JER ) , "Failed to apply JER" ); + } else { + if (m_config->isMC()) { + top::check( applySystematic( m_jetUncertaintiesToolLargeR_strong , m_systMap_LargeR_strong, true ) , "Failed to apply large-R syst."); + top::check( applySystematic( m_jetUncertaintiesToolLargeR_medium , m_systMap_LargeR_medium, true ) , "Failed to apply large-R syst."); + top::check( applySystematic( m_jetUncertaintiesToolLargeR_weak , m_systMap_LargeR_weak, true ) , "Failed to apply large-R syst."); + } + } + + return StatusCode::SUCCESS; +} + +StatusCode JetObjectCollectionMaker::calibrate(const bool isLargeR) { + ///-- Get base jets from xAOD --/// + std::string sgKey = isLargeR ? m_config->sgKeyLargeRJets() : m_config->sgKeyJets(); + + const xAOD::JetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , sgKey ) , "Failed to retrieve Jets" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container --/// + for( auto jet : *(shallow_xaod_copy.first) ){ + + if (!isLargeR) { ///-- small-R jets used in most analyses --/// + ///-- Calibrate jet --/// + + top::check(m_jetCalibrationTool->applyCalibration(*jet), "Failed to applyCalibration"); + + // only multiply by JSF and bJSF if one of them != 1.0 (used by top mass analysis) + float JSF = m_config -> JSF(); + float bJSF = m_config -> bJSF(); + + if(JSF != 1.0 || bJSF != 1.0){ + + int truthflav = -1; + if(jet->isAvailable<int>("HadronConeExclTruthLabelID")){ + jet->getAttribute("HadronConeExclTruthLabelID", truthflav); + } + + xAOD::JetFourMom_t jet_p4 = jet->jetP4()*JSF; + if(truthflav == 5) jet_p4 = jet_p4*bJSF; + + jet -> setJetP4(jet_p4); + + } + // end application JSF/bJSF + + + top::check(decorateBJets(*jet), "Failed to decorate if b-jet"); + } + + if (isLargeR && m_jetSubstructure.get() != nullptr) { + m_jetSubstructure->correctJet( *jet ); + } + + if (isLargeR) { + ///-- Calibrate jet --/// + + float tau3 = jet->getAttribute<float>("Tau3_wta"); + float tau2 = jet->getAttribute<float>("Tau2_wta"); + float tau1 = jet->getAttribute<float>("Tau1_wta"); + + jet -> auxdecor<float>("Tau32_wta") = fabs(tau2) > 1.e-6 ? (tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool + jet -> auxdecor<float>("Tau21_wta") = fabs(tau1) > 1.e-6 ? (tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool + + top::check( m_jetCalibrationToolLargeR->applyCalibration( *jet ) , "Failed to applyCalibration" ); + } + + ///-- Update JVT --/// + if (!isLargeR) { + jet->auxdecor<float>("AnalysisTop_JVT") = m_jetUpdateJvtTool->updateJvt( *jet ); + } + + } + + // Check if the derivation we are running on contains + // MET_Track (once), if so apply the fJVT decoration + // if not then don't + static bool checked_track_MET = false; + if (!checked_track_MET) { + if (evtStore()->contains<xAOD::MissingETContainer>("MET_Track")) { + m_do_fjvt = true; + } + else { + if (m_config->fwdJetAndMET() == "fJVT") + ATH_MSG_ERROR(" Cannot retrieve MET_Track while fJVT is to be applied on forward jets" ); + else + ATH_MSG_WARNING(" Cannot retrieve MET_Track, so fJVT information will probably be wrong in output" ); + } + checked_track_MET = true; + } + + if (m_do_fjvt) { + top::check(!m_fjvtTool->modify(*shallow_xaod_copy.first), + "Failed to apply fJVT decoration"); + } + + ///-- Save calibrated jet to TStore --/// + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for jets, MET recalculation may struggle" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + std::string outputSGKey; + if (!isLargeR) { + outputSGKey = m_config->sgKeyJetsStandAlone( m_nominalSystematicSet.hash() ); + } + if (isLargeR) { + outputSGKey = m_config->sgKeyLargeRJets( m_nominalSystematicSet.hash() ); + } + + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + + +StatusCode JetObjectCollectionMaker::applySystematic(ToolHandle<ICPJetUncertaintiesTool>& tool, + const std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map, + bool isLargeR ) { + ///-- Get calibrated jets --/// + const xAOD::JetContainer* xaod(nullptr); + if (!isLargeR) { + top::check( evtStore()->retrieve( xaod , m_config->sgKeyJetsStandAlone( m_nominalSystematicSet.hash() ) ) , "Failed to retrieve Jets" ); + } else { + top::check( evtStore()->retrieve( xaod , m_config->sgKeyLargeRJets( m_nominalSystematicSet.hash() ) ) , "Failed to retrieve Jets" ); + } + + ///-- Loop over the systematics --/// + + for (Itr syst=map.begin();syst!=map.end();++syst) { + ///-- Don't do the nominal, we've already done that --/// + if ((*syst).second.hash() != m_nominalSystematicSet.hash()) { + + ///-- Tell the tool which systematic to use --/// + ///-- Here we use the second, original CP::SystematicSet --/// + top::check( tool->applySystematicVariation((*syst).second) , + "Failed to applySystematicVariation" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > + shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container --/// + for( auto jet : *(shallow_xaod_copy.first) ){ + + if (isLargeR) { + + if ((*syst).first.name().find("LARGER") == std::string::npos) + continue; + + ///-- Only large R jets with the following properties can be calibrated.--/// + bool calibratable_jet = (jet->m()/jet->pt() <= 1 + && std::fabs(jet->eta()) <= 2.0 + && jet->pt() > 150e3 + && jet->pt() < 3000e3); + if(!calibratable_jet) + continue; + } + ///-- Apply Corrrection --/// + top::check( tool->applyCorrection( *jet ) , "Failed to applyCorrection" ); + ///-- Update JVT --/// + if (!isLargeR) jet->auxdecor<float>("AnalysisTop_JVT") = m_jetUpdateJvtTool->updateJvt( *jet ); + } + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink(*xaod, + *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links" + " for jets, MET recalculation may struggle" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + ///-- Here we use the first, AnalysisTop modified CP::SystematicSer --/// + ///-- This allows us to run multiple JES scenarios, which all have the same hash values --/// + std::string outputSGKey; + if (isLargeR) { + outputSGKey = m_config->sgKeyLargeRJets( (*syst).first.hash() ); + } else { + outputSGKey = m_config->sgKeyJetsStandAlone( (*syst).first.hash() ); + } + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } + } + + return StatusCode::SUCCESS; +} + + + +StatusCode JetObjectCollectionMaker::applySystematic(ToolHandle<IJERSmearingTool>& tool, + const std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map ) { + ///-- Get calibrated jets --/// + const xAOD::JetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyJetsStandAlone( m_nominalSystematicSet.hash() ) ) , "Failed to retrieve Jets" ); + + ///-- Loop over the systematics --/// + + for (Itr syst=map.begin();syst!=map.end();++syst) { + ///-- Don't do the nominal, we've already done that --/// + if ((*syst).second.hash() != m_nominalSystematicSet.hash()) { + + ///-- Tell the tool which systematic to use --/// + ///-- Here we use the second, original CP::SystematicSet --/// + top::check( tool->applySystematicVariation( (*syst).second ) , "Failed to apply systematic" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container --/// + for( auto jet : *(shallow_xaod_copy.first) ){ + ///-- Apply Corrrection --/// + top::check( tool->applyCorrection( *jet ) , "Failed to applyCorrection" ); + ///-- Update JVT --/// + jet->auxdecor<float>("AnalysisTop_JVT") = m_jetUpdateJvtTool->updateJvt( *jet ); + } + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for jets, MET recalculation may struggle" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + ///-- Here we use the first, AnalysisTop modified CP::SystematicSer --/// + ///-- This allows us to run multiple JES scenarios, which all have the same hash values --/// + std::string outputSGKey = m_config->sgKeyJetsStandAlone( (*syst).first.hash() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode JetObjectCollectionMaker::executeTrackJets() { + ///-- No calibrations or systematics yet --/// + ///-- Just make a shallow copy to keep these in line with everything else --/// + + const xAOD::JetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyTrackJets() ) , "Failed to retrieve Jets" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- set links to original objects --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for track jets" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + std::string outputSGKey = m_config->sgKeyTrackJets( m_config->nominalHashValue() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +StatusCode JetObjectCollectionMaker::printoutJets() { + bool isLargeR(false); + return this->printout( isLargeR ); +} + +StatusCode JetObjectCollectionMaker::printoutLargeRJets() { + bool isLargeR(true); + return this->printout( isLargeR ); +} + +StatusCode JetObjectCollectionMaker::printout( const bool isLargeR ) { + ///-- Loop over all systematics --/// + for( auto s : m_specifiedSystematics ){ + std::string sgKey = isLargeR ? m_config->sgKeyLargeRJets() : m_config->sgKeyJets(); + + const xAOD::JetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , sgKey ) , "Failed to retrieve Jets" ); + + ATH_MSG_INFO(" Jets with sgKey = "<<sgKey ); + for( auto x : *xaod ){ + ATH_MSG_INFO(" Jet pT , eta = "<<x->pt()<<" , "<<x->eta() ); + } + } + + return StatusCode::SUCCESS; +} + + +void JetObjectCollectionMaker::specifiedSystematics(const std::set<std::string>& specifiedSystematics, + const ToolHandle<ICPJetUncertaintiesTool>& tool, + std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map, + const std::string& modName, bool isLargeR ) { + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( tool->recommendedSystematics() ); + + for (auto s : systList) { + if (s.size() == 1) { + CP::SystematicSet::const_iterator ss = s.begin(); + CP::SystematicSet modSet( modName + ss->name() ); + + m_recommendedSystematics.push_back(modSet); + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + if (!isLargeR) + m_specifiedSystematics.push_back(modSet); + else + m_specifiedSystematicsLargeR.push_back(modSet); + map.insert( std::make_pair(modSet,s) ); + } else if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == modSet.name() ) { + if (!isLargeR) + m_specifiedSystematics.push_back(modSet); + else + m_specifiedSystematicsLargeR.push_back(modSet); + map.insert( std::make_pair(modSet,s) ); + } + } + } // User has specified a systematic + + } // Don't do anything if the user requests nominal only + } // size() == 1 -- this means that there is a CP::SystematicVariation + } // Loop over systList + } // MC only + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + + m_specifiedSystematicsLargeR.sort(); + m_specifiedSystematicsLargeR.unique(); +} + + + + +///-- Don't really need to do this, but would rather stay consistent with JetObjectCollectionMaker --/// +///-- This could be done like all the other xyzObjectCollectionMakers, but would need to change the way execute() works --/// +void JetObjectCollectionMaker::specifiedSystematics( const std::set<std::string>& specifiedSystematics, + const ToolHandle<IJERSmearingTool>& tool, + std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map ) { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( tool->recommendedSystematics() ); + + for (auto s : systList) { + m_recommendedSystematics.push_back(s); + + ///-- Are we doing JER? Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (m_doJER) { + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematics.push_back(s); + map.insert( std::make_pair(s,s) ); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematics.push_back(s); + map.insert( std::make_pair(s,s) ); + } + } + } + } + } + } + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); +} + +StatusCode JetObjectCollectionMaker::decorateBJets(xAOD::Jet& jet) { + // initialise decorator and accessor + static SG::AuxElement::Decorator<char> isbjet("IsBjet"); + static const std::string labelB = "HadronConeExclTruthLabelID"; + static SG::AuxElement::Accessor<int> truth_label(labelB); + + // Is b-jet if truth label == 5 and pT > 20 GeV + isbjet(jet) = (jet.pt() > 20000. && truth_label(jet) == 5); + + return StatusCode::SUCCESS; +} + +StatusCode JetObjectCollectionMaker::decorateHSJets() { + // initialise decorator + static SG::AuxElement::Decorator<char> isHS("AnalysisTop_isHS"); + + // retrieve small-R jets collection + const xAOD::JetContainer* jets(nullptr); + top::check( evtStore()->retrieve( jets , m_config->sgKeyJets() ) , "Failed to retrieve small-R jet collection"+m_config->sgKeyJets() ); + + // retrieve truth jet collection + const xAOD::JetContainer *truthJets = nullptr; + top::check( evtStore()->retrieve(truthJets, m_truthJetCollForHS) , "Unable to retrieve truth jet container "+m_truthJetCollForHS+" - this is needed to define HS jets for application of JVT" ); + + for(const auto& jet : *jets) { + bool ishs = false; + for(const auto& tjet : *truthJets) { + if (tjet->p4().DeltaR(jet->p4())<0.3 && tjet->pt()>10e3) ishs = true; + } + isHS(*jet)=ishs; + } + + return StatusCode::SUCCESS; +} + +void JetObjectCollectionMaker::addCorrelation(const std::string& name, + systMap& map_one, + const std::string& syst_one_name, + systMap& map_two, + const std::string& syst_two_name) { + + std::vector<std::string> directions = {"__1up", "__1down"}; + for (const std::string& d : directions) { + std::string tree_name = name+d; + map_one.insert(std::make_pair(CP::SystematicSet(tree_name), + CP::SystematicSet(syst_one_name+d))); + map_two.insert(std::make_pair(CP::SystematicSet(tree_name), + CP::SystematicSet(syst_two_name+d))); + + m_specifiedSystematics.push_back(tree_name); + m_specifiedSystematicsLargeR.push_back(tree_name); + + } // loop through up and down + + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + + m_specifiedSystematicsLargeR.sort(); + m_specifiedSystematicsLargeR.unique(); + +} + +void JetObjectCollectionMaker::addCorrelation(const std::string& name, + systMap& map_one, + const std::string& syst_one_name, + std::list<CP::SystematicSet>& jet_specified) { + + map_one.insert(std::make_pair(CP::SystematicSet(name), + CP::SystematicSet(syst_one_name))); + + jet_specified.push_back(name); + + jet_specified.sort(); + jet_specified.unique(); + +} + +} // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d82fe4cb5f5412fdbc71b7caa69b59334bd527aa --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx @@ -0,0 +1,342 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MissingETObjectCollectionMaker.cxx 792986 2017-01-19 11:10:37Z grancagn $ +#include "TopSystematicObjectMaker/MissingETObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" +#include "TopEvent/SystematicEvent.h" + + +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODMissingET/MissingETAuxContainer.h" +#include "METUtilities/METHelpers.h" +#include "xAODCore/ShallowCopy.h" +#include "PATInterfaces/SystematicsUtil.h" + +namespace top{ + + MissingETObjectCollectionMaker::MissingETObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config( nullptr ), + + m_specifiedSystematics(), + m_recommendedSystematics(), + + m_MET_core( "setMe" ), + m_MET_map( "setMe" ), + m_met_maker("met::METMaker"), + m_met_systematics("met::METSystematicsTool") + { + declareProperty( "config" , m_config ); + declareProperty( "METMaker" , m_met_maker ); + declareProperty( "met_systematics" , m_met_systematics ); + } + + StatusCode MissingETObjectCollectionMaker::initialize() + { + ATH_MSG_INFO(" top::MissingETObjectCollectionMaker initialize" ); + + top::check( m_met_maker.retrieve() , "Failed to retrieve met maker tool" ); + top::check( m_met_systematics.retrieve() , "Failed to retrieve met systematic tool" ); + + std::string jet_collection = m_config->sgKeyJets(); + jet_collection.erase(jet_collection.length() - 4); //erase "Jets" from jet collection name + + m_MET_core = "MET_Core_"+jet_collection; + m_MET_map = "METAssoc_"+jet_collection; + + ///-- Set Systematics Information --/// + const std:: string& syststr = m_config->systematics(); + std::set<std::string> syst; + + if( !m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr)){ + bool ok = m_config->getSystematicsList(syststr, syst); + if (!ok) { + ATH_MSG_ERROR(" top::MissingETObjectCollectionMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + if (m_config->contains(syst, "AllMET")) { + syst.clear(); + } + } + + specifiedSystematics( syst ); + + m_config->systematicsMET( specifiedSystematics() ); + + return StatusCode::SUCCESS; + } + + StatusCode MissingETObjectCollectionMaker::recalculateMET() + { + + // met core contains the soft terms we need to add to our met calculation + const xAOD::MissingETContainer* xaod_met_core(nullptr); + top::check( evtStore()->retrieve( xaod_met_core , m_MET_core ) , "Failed to retrieve MET Core" ); + + // This maps the met terms to objects + const xAOD::MissingETAssociationMap* xaod_met_map(nullptr); + top::check( evtStore()->retrieve( xaod_met_map , m_MET_map ) , "Failed to retrieve MET Association Map" ); + + if (!m_config->doLooseTreeOnly()) { + // All the tight systematic events + const xAOD::SystematicEventContainer* systEvents(nullptr); + top::check( evtStore()->retrieve(systEvents,m_config->sgKeyTopSystematicEvents()) , "Failed to retrieve TopEvents" ); + + for (auto x : *systEvents) + top::check( recalculateEventMET( x, xaod_met_core, xaod_met_map ), + "Failed to recalculate MET for event"); + } // tight events + if (m_config->doLooseEvents()) { + // All the loose systematic events + const xAOD::SystematicEventContainer* systEventsLoose(nullptr); + top::check( evtStore()->retrieve(systEventsLoose,m_config->sgKeyTopSystematicEventsLoose()) , "Failed to retrieve TopEventsLoose" ); + + for (auto x : *systEventsLoose) + top::check( recalculateEventMET( x, xaod_met_core, xaod_met_map ), + "Failed to recalculate MET for loose event"); + } // Loose events + + return StatusCode::SUCCESS; + } + + StatusCode MissingETObjectCollectionMaker::recalculateEventMET(xAOD::SystematicEvent* event, + const xAOD::MissingETContainer* xaod_met_core, + const xAOD::MissingETAssociationMap* xaod_met_map) { + + // decoration for objects that pass pre OR selection + std::string passPreORSelection = "passPreORSelection"; + + bool is_loose_event = (event->isLooseEvent() == 1 ? true : false); + + // default behaviour for top analysis - use the "Tight" definitions + bool looseLeptonOR(is_loose_event); + if (m_config->doOverlapRemovalOnLooseLeptonDef()) { + looseLeptonOR = true; + // change decoration we check + passPreORSelection = "passPreORSelectionLoose"; + } + + std::size_t hash = event->hashValue(); + + // Make a new MET container that we are going to use + xAOD::MissingETContainer * new_met_container = new xAOD::MissingETContainer(); + xAOD::MissingETAuxContainer * new_met_aux_container = new xAOD::MissingETAuxContainer(); + new_met_container->setStore(new_met_aux_container); + + // Reset all the met map associations + xaod_met_map->resetObjSelectionFlags(); + + // Apparently we need to add objects to the METMaker in a specific order + // Start by retrieving jet container, we need it to perform e-jet ghost-matching + xAOD::JetContainer* xaod_jet(nullptr); + top::check( evtStore()->retrieve( xaod_jet , m_config->sgKeyJets(hash,looseLeptonOR) ), "Failed to retrieve Jets" ); + // 1. Electrons + const xAOD::ElectronContainer* xaod_el(nullptr); + if(m_config->useElectrons()){ + // Get all calibrated electrons + top::check( evtStore()->retrieve( xaod_el , m_config->sgKeyElectrons(hash) ), "Failed to retrieve Electrons" ); + + // Add those that pass pre-overlap removal selection to met_electrons + ConstDataVector<xAOD::ElectronContainer> met_electrons(SG::VIEW_ELEMENTS); + for( const auto& el: *xaod_el ) + if ( el->isAvailable<char>(passPreORSelection) + && el->auxdata<char>(passPreORSelection) == 1 ) + met_electrons.push_back(el); + + // Recalculate electron MET term using electrons that pass overlap removal + top::check( m_met_maker->rebuildMET("RefEle", xAOD::Type::Electron, + new_met_container, met_electrons.asDataVector(), + xaod_met_map), "Failed to rebuild electron MET term"); + } + + // 2. Photons + if(m_config->usePhotons()){ + + // Get calibrated photons + const xAOD::PhotonContainer* xaod_photon(nullptr); + top::check( evtStore()->retrieve( xaod_photon , m_config->sgKeyPhotons(hash) ), "Failed to retrieve Photons" ); + + // Add those that pass pre-overlap removal to met_photons + ConstDataVector<xAOD::PhotonContainer> met_photons(SG::VIEW_ELEMENTS); + for( const auto& photon: *xaod_photon ) + if ( photon->isAvailable<char>(passPreORSelection) + && photon->auxdata<char>(passPreORSelection) == 1 ) + met_photons.push_back(photon); + + top::check( m_met_maker->rebuildMET("RefPhoton", xAOD::Type::Photon, + new_met_container, met_photons.asDataVector(), + xaod_met_map), "Failed to rebuild photon MET term" ); + } + + // 3. Taus + if(m_config->useTaus()){ + + // Get calibrated taus + const xAOD::TauJetContainer* xaod_tau(nullptr); + top::check( evtStore()->retrieve( xaod_tau , m_config->sgKeyTaus(hash) ), "Failed to retrieve Taus" ); + + // Add those that pass pre-overlap removal to met_taus + ConstDataVector<xAOD::TauJetContainer> met_taus(SG::VIEW_ELEMENTS); + for( const auto& tau: *xaod_tau ) + if ( tau->isAvailable<char>(passPreORSelection) + && tau->auxdata<char>(passPreORSelection) == 1 ) + met_taus.push_back(tau); + + top::check( m_met_maker->rebuildMET("RefTau", xAOD::Type::Tau, + new_met_container, met_taus.asDataVector(), + xaod_met_map), "Failed to rebuild tau MET term" ); + } + + // 4. Muons + const xAOD::MuonContainer* xaod_mu(nullptr); // Need these for ghost matching + if(m_config->useMuons()){ + // Get calibrated muons + top::check( evtStore()->retrieve( xaod_mu , m_config->sgKeyMuons(hash) ), "Failed to retrieve Muons" ); + + // Add those that pass pre-overlap removal to met_muons + ConstDataVector<xAOD::MuonContainer> met_muons(SG::VIEW_ELEMENTS); + for( const auto& mu: *xaod_mu ) + if ( mu->isAvailable<char>(passPreORSelection) + && mu->auxdata<char>(passPreORSelection) == 1 ) + met_muons.push_back(mu); + + // Recalculate muon MET term using muons that pass overlap removal + top::check( m_met_maker->rebuildMET("RefMuon", xAOD::Type::Muon, + new_met_container, met_muons.asDataVector(), + xaod_met_map), "Failed to rebuild muon MET term"); + + // Muon-jet ghost association + // performed after muon handing to METUtility, but before jets + if (xaod_mu) { + met::addGhostMuonsToJets(*xaod_mu, *xaod_jet); + } + } + + + // 5. Jets + // We do not perfom any selection on jets here. Give them all to the METMaker, it does its own thing + top::check( m_met_maker->rebuildJetMET("RefJet", "SoftClus", "PVSoftTrk", + new_met_container, xaod_jet, + xaod_met_core, xaod_met_map, + m_config->doJVTinMET() ), "Failed to rebuild jet MET term" ); + + + ///-- John thinks that the systematics go here --/// + ///-- This may well be wrong --/// + + for (auto systematic : m_specifiedSystematics) { + if (systematic.hash() == event->hashValue() && systematic.hash() != m_config->nominalHashValue() ){ + ///-- Tell tool which systematic to use --/// + top::check( m_met_systematics->applySystematicVariation( systematic ) , "Failed to applySystematicVariation" ); + + // code lifted and modified from: + // https://svnweb.cern.ch/trac/atlasoff/browser/Reconstruction/MET/METUtilities/tags/METUtilities-00-01-43/util/example_METMaker_METSystematicsTool.cxx + + //get the soft cluster term, and applyCorrection + xAOD::MissingET * softClusMet = (*new_met_container)["SoftClus"]; + if (softClusMet != nullptr) { //check we retrieved the clust term + top::check( m_met_systematics->applyCorrection(*softClusMet) , "Failed to applyCorrection" ); + } + + xAOD::MissingET * softTrkMet = (*new_met_container)["PVSoftTrk"]; + if (softTrkMet != nullptr) { //check we retrieved the soft trk + top::check( m_met_systematics->applyCorrection(*softTrkMet) , "Failed to applyCorrection" ); + } + + } + } + + /************************************************************ + We could use this to build TrackMET but should be careful as we would probably + want a different met_container and it shouldn't contain photons (and I don't think taus either...) + This function should NOT be used with the previous rebuildJetMET (one or the other) + + top::check( m_met_maker->rebuildTrackMET("RefJetTrk", "PVSoftTrk", + new_met_container, xaod_jet, + xaod_met_core, xaod_met_map, + false), "Failed to rebuild track MET term" ); + ************************************************************/ + + + // This will sum up all the contributions we've made so far e.g. + // Total MET = RefEle + RefPhoton + RefTau + RefMuon + RefJet + PVSoftTrk (Track Soft Term) + + top::check( m_met_maker->buildMETSum("FinalTrk" , new_met_container, MissingETBase::Source::Track), + "Failed to rebuild Final Track MET"); + + /************************************************************ + // We are only going to build a single MET Sum now for clarity. The final argument is the soft term we + // want to use. The recommended one is the track soft term (TST) as above. + + top::check( m_met_maker->buildMETSum("FinalClus", new_met_container, MissingETBase::Source::EMTopo), + "Failed to rebuild Final Cluster MET"); + ************************************************************/ + + // Save corrected xAOD Container to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyMissingEt(hash); + if( is_loose_event ) outputSGKey = m_config->sgKeyMissingEtLoose(hash); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( new_met_container, outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( new_met_aux_container, outputSGKeyAux ); + + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + + return StatusCode::SUCCESS; + + } + + + void MissingETObjectCollectionMaker::specifiedSystematics( const std::set<std::string>& specifiedSystematics ) + { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( m_met_systematics->recommendedSystematics() ); + + for (auto s : systList) { + + ///-- Recommendation is to use soft track terms and not soft calo terms --/// + ///-- Soft calo systematics are irrelevant, let's ignore them --/// + if (s.name().find("SoftCalo") == std::string::npos) { + + m_recommendedSystematics.push_back(s); + if (s.name() == "") { + m_specifiedSystematics.push_back(s); + } + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematics.push_back(s); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematics.push_back(s); + } + } + } + } + } + } + } + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..737654d4492397041b17c11f1a0e026b24cf60c8 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx @@ -0,0 +1,219 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MuonObjectCollectionMaker.cxx 799839 2017-03-08 11:07:28Z grancagn $ +#include "TopSystematicObjectMaker/MuonObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODMuon/MuonAuxContainer.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "xAODTracking/TrackParticlexAODHelpers.h" +#include "PATInterfaces/SystematicsUtil.h" + +namespace top{ + + MuonObjectCollectionMaker::MuonObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_specifiedSystematics(), + m_recommendedSystematics(), + + m_calibrationTool("CP::MuonCalibrationAndSmearingTool"), + m_isolationTool_LooseTrackOnly("CP::IsolationTool_LooseTrackOnly"), + m_isolationTool_Loose("CP::IsolationTool_Loose"), + m_isolationTool_Gradient("CP::IsolationTool_Gradient"), + m_isolationTool_GradientLoose("CP::IsolationTool_GradientLoose"), + m_isolationTool_FixedCutTightTrackOnly("CP::IsolationTool_FixedCutTightTrackOnly"), + m_isolationTool_FixedCutLoose("CP::IsolationTool_FixedCutLoose"), + m_muonSelectionToolVeryLooseVeto("CP::MuonSelectionToolVeryLooseVeto") + { + declareProperty( "config" , m_config ); + + declareProperty( "MuonCalibrationAndSmearingTool" , m_calibrationTool ); + declareProperty( "IsolationTool_LooseTrackOnly" , m_isolationTool_LooseTrackOnly ); + declareProperty( "IsolationTool_Loose" , m_isolationTool_Loose ); + declareProperty( "IsolationTool_Gradient" , m_isolationTool_Gradient ); + declareProperty( "IsolationTool_GradientLoose" , m_isolationTool_GradientLoose ); + declareProperty( "IsolationTool_FixedCutTightTrackOnly" , m_isolationTool_FixedCutTightTrackOnly ); + declareProperty( "IsolationTool_FixedCutLoose" , m_isolationTool_FixedCutLoose ); + declareProperty( "MuonSelectionToolVeryLooseVeto" , m_muonSelectionToolVeryLooseVeto ); + } + + StatusCode MuonObjectCollectionMaker::initialize() + { + ATH_MSG_INFO(" top::MuonObjectCollectionMaker initialize" ); + + top::check( m_calibrationTool.retrieve() , "Failed to retrieve muon calibration tool" ); + top::check( m_isolationTool_LooseTrackOnly.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_Loose.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_Gradient.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_GradientLoose.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_FixedCutTightTrackOnly.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_isolationTool_FixedCutLoose.retrieve() , "Failed to retrieve Isolation Tool" ); + top::check( m_muonSelectionToolVeryLooseVeto.retrieve() , "Failed to retrieve Selection Tool" ); + + ///-- Set Systematics Information --/// + const std:: string& syststr = m_config->systematics(); + std::set<std::string> syst; + + if( !m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr)){ + bool ok = m_config->getSystematicsList(syststr, syst); + if (!ok) { + ATH_MSG_ERROR(" top::MuonObjectCollectionMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + if (m_config->contains(syst, "AllMuons")) { + syst.clear(); + } + } + + specifiedSystematics( syst ); + + m_config->systematicsMuons( specifiedSystematics() ); + + ATH_MSG_INFO(" top::MuonObjectCollectionMaker completed initialize" ); + return StatusCode::SUCCESS; + } + + StatusCode MuonObjectCollectionMaker::execute() + { + + const xAOD::EventInfo* eventInfo(nullptr); + top::check( evtStore()->retrieve( eventInfo, m_config->sgKeyEventInfo() ), "Failed to retrieve EventInfo"); + float beam_pos_sigma_x = eventInfo->beamPosSigmaX(); + float beam_pos_sigma_y = eventInfo->beamPosSigmaY(); + float beam_pos_sigma_xy = eventInfo->beamPosSigmaXY(); + + ///-- Get base muons and tracks from xAOD --/// + const xAOD::MuonContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyMuons() ) , "Failed to retrieve Muons" ); + + ///-- Loop over all systematics --/// + for( auto systematic : m_specifiedSystematics ){ + + ///-- Tell tool which systematic to use --/// + top::check( m_calibrationTool->applySystematicVariation( systematic ) , "Failed to applySystematicVariation" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::MuonContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container and apply corrections--/// + for( auto muon : *(shallow_xaod_copy.first) ){ + + ///-- Apply momentum correction --/// + if (muon->primaryTrackParticle()) { + top::check( m_calibrationTool->applyCorrection( *muon ) , "Failed to applyCorrection" ); + + // don't do the decorations unless the muons are at least Loose + // this is because it may fail if the muons are at just VeryLoose + if (m_muonSelectionToolVeryLooseVeto->accept(*muon)) { + double d0sig = xAOD::TrackingHelpers::d0significance( muon->primaryTrackParticle(), + beam_pos_sigma_x, + beam_pos_sigma_y, + beam_pos_sigma_xy ); + muon->auxdecor<float>("d0sig") = d0sig; + + if( eventInfo->isAvailable<float>("AnalysisTop_PRIVTX_z_position") ){ + float vtx_z = eventInfo->auxdata<float>("AnalysisTop_PRIVTX_z_position"); + float delta_z0 = muon->primaryTrackParticle()->z0() + muon->primaryTrackParticle()->vz() - vtx_z; + muon->auxdecor<float>("delta_z0") = delta_z0; + muon->auxdecor<float>("delta_z0_sintheta") = delta_z0*std::sin( muon->primaryTrackParticle()->theta() ); + } + } + } + + ///-- Isolation selection --/// + char passIsol_LooseTrackOnly(0),passIsol_Loose(0),passIsol_FixedCutTightTrackOnly(0); + char passIsol_Gradient(0),passIsol_GradientLoose(0),passIsol_FixedCutLoose(0); + if (m_isolationTool_LooseTrackOnly->accept( *muon )) {passIsol_LooseTrackOnly = 1;} + if (m_isolationTool_Loose->accept( *muon )) {passIsol_Loose = 1;} + if (m_isolationTool_Gradient->accept( *muon )) {passIsol_Gradient = 1;} + if (m_isolationTool_GradientLoose->accept( *muon )) {passIsol_GradientLoose = 1;} + if (m_isolationTool_FixedCutTightTrackOnly->accept( *muon )) {passIsol_FixedCutTightTrackOnly = 1;} + if (m_isolationTool_FixedCutLoose->accept( *muon )) {passIsol_FixedCutLoose = 1;} + + muon->auxdecor<char>("AnalysisTop_Isol_LooseTrackOnly") = passIsol_LooseTrackOnly; + muon->auxdecor<char>("AnalysisTop_Isol_Loose") = passIsol_Loose; + muon->auxdecor<char>("AnalysisTop_Isol_Gradient") = passIsol_Gradient; + muon->auxdecor<char>("AnalysisTop_Isol_GradientLoose") = passIsol_GradientLoose; + muon->auxdecor<char>("AnalysisTop_Isol_FixedCutTightTrackOnly") = passIsol_FixedCutTightTrackOnly; + muon->auxdecor<char>("AnalysisTop_Isol_FixedCutLoose") = passIsol_FixedCutLoose; + } + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for muons, MET recalculation may struggle" ); + + ///-- Save corrected xAOD Container to StoreGate / TStore --/// + std::string outputSGKey = m_config->sgKeyMuons( systematic.hash() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + } // Loop over all systematics + + return StatusCode::SUCCESS; + } + + StatusCode MuonObjectCollectionMaker::printout() + { + ///-- Loop over all systematics --/// + for( auto systematic : m_specifiedSystematics ){ + const xAOD::MuonContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyMuons( systematic.hash() ) ) , "Failed to retrieve Muons" ); + + ATH_MSG_INFO(" Muons with sgKey = "<< m_config->sgKeyMuons( systematic.hash() ) ); + for( auto muon : *xaod ){ + ATH_MSG_INFO(" MU pT , eta = "<< muon->pt() <<" , "<< muon->eta() ); + } + } + + return StatusCode::SUCCESS; + } + + + void MuonObjectCollectionMaker::specifiedSystematics( const std::set<std::string>& specifiedSystematics ) + { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( m_calibrationTool->recommendedSystematics() ); + + for (auto s : systList) { + m_recommendedSystematics.push_back(s); + if (s.name() == "") { + m_specifiedSystematics.push_back(s); + } + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematics.push_back(s); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematics.push_back(s); + } + } + } + } + } + } + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fd1bfbf2b435957e11d10d12bc101640c9c801b6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/ObjectCollectionMaker.cxx @@ -0,0 +1,151 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ObjectCollectionMaker.cxx 790414 2016-12-19 00:49:08Z tpelzer $ +#include "TopSystematicObjectMaker/ObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +// EDM include(s): +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODJet/JetContainer.h" + +namespace top{ + + ObjectCollectionMaker::ObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_egammaMaker(nullptr), + m_muonMaker(nullptr), + m_tauMaker(nullptr), + m_jetMaker(nullptr), + m_metMaker(nullptr) + { + declareProperty( "config" , m_config ); + } + + StatusCode ObjectCollectionMaker::initialize() + { + ATH_MSG_INFO(" top::ObjectCollectionMaker initialize" ); + + m_egammaMaker = std::unique_ptr<top::EgammaObjectCollectionMaker> ( new top::EgammaObjectCollectionMaker ( "top::EgammaObjectCollectionMaker" ) ); + m_muonMaker = std::unique_ptr<top::MuonObjectCollectionMaker> ( new top::MuonObjectCollectionMaker ( "top::MuonObjectCollectionMaker" ) ); + m_tauMaker = std::unique_ptr<top::TauObjectCollectionMaker> ( new top::TauObjectCollectionMaker ( "top::TauObjectCollectionMaker" ) ); + m_jetMaker = std::unique_ptr<top::JetObjectCollectionMaker> ( new top::JetObjectCollectionMaker ( "top::JetObjectCollectionMaker" ) ); + m_metMaker = std::unique_ptr<top::MissingETObjectCollectionMaker> ( new top::MissingETObjectCollectionMaker( "top::MissingETObjectCollectionMaker" ) ); + m_ghostTrackSystMaker = std::unique_ptr<top::GhostTrackSystematicsMaker> ( new top::GhostTrackSystematicsMaker("top::GhostTrackSystematicsMaker") ); + + if( m_config->usePhotons() || m_config->useElectrons() ){ + top::check( m_egammaMaker->setProperty( "config" , m_config ) , "Failed to setProperty" ); + top::check( m_egammaMaker->initialize() , "Failed to initialize" ); + } + + if( m_config->useMuons() ){ + top::check( m_muonMaker->setProperty( "config" , m_config ) , "Failed to setProperty" ); + top::check( m_muonMaker->initialize() , "Failed to initialize" ); + } + + if( m_config->useTaus() ){ + top::check( m_tauMaker->setProperty( "config" , m_config ) , "Failed to setProperty" ); + top::check( m_tauMaker->initialize() , "Failed to initialize" ); + } + + if( m_config->useJets() || m_config->useLargeRJets() ){ + top::check( m_jetMaker->setProperty( "config" , m_config ) , "Failed to setProperty" ); + top::check( m_jetMaker->initialize() , "Failed to initialize" ); + } + + if( m_config->useJets() && m_config->useJetGhostTrack() ){ + top::check( m_ghostTrackSystMaker->setProperty( "config" , m_config ), + "Failed to setProperty" ); + + top::check( m_ghostTrackSystMaker->initialize() , + "Failed to initialize" ); + } + + top::check( m_metMaker->setProperty( "config" , m_config ) , "Failed to setProperty" ); + top::check( m_metMaker->initialize() , "Failed to initialize" ); + + return StatusCode::SUCCESS; + } + + StatusCode ObjectCollectionMaker::execute() + { + + if( m_config->usePhotons() ){ top::check( m_egammaMaker->executePhotons() , "Failed to executePhotons()" ); } + if( m_config->useElectrons() ){ top::check( m_egammaMaker->executeElectrons() , "Failed to executeElectrons()" ); } + if( m_config->useMuons() ){ top::check( m_muonMaker->execute() , "Failed to executeMuons()" ); } + if( m_config->useTaus() ){ top::check( m_tauMaker->execute() , "Failed to executeTaus()" ); } + if( m_config->useJets() ){ top::check( m_jetMaker->executeJets() , "Failed to executeJets()" ); } + if( m_config->useLargeRJets() ){ top::check( m_jetMaker->executeLargeRJets() , "Failed to executeLargeRJets()" ); } + if( m_config->useTrackJets() ){ top::check( m_jetMaker->executeTrackJets() , "Failed to executeTrackJets() " ); } + + // This must come _AFTER_ the jets have been calibrated! + if( m_config->useJets() && m_config->useJetGhostTrack() ){ top::check( m_ghostTrackSystMaker->execute() , "Failed to executeGhostTrackSystematics() " ); } + + + return StatusCode::SUCCESS; + } + + StatusCode ObjectCollectionMaker::recalculateMET() + { + top::check( m_metMaker->recalculateMET() , "Failed to recalculateMET()" ); + return StatusCode::SUCCESS; + } + + StatusCode ObjectCollectionMaker::printout() + { + if( m_config->usePhotons() ){ top::check( m_egammaMaker->printoutPhotons() , "Failed to printoutPhotons()" ); } + if( m_config->useElectrons() ){ top::check( m_egammaMaker->printoutElectrons() , "Failed to printoutElectrons()" ); } + if( m_config->useMuons() ){ top::check( m_muonMaker->printout() , "Failed to printoutMuons()" ); } + if( m_config->useTaus() ){ top::check( m_tauMaker->printout() , "Failed to printoutTaus()" ); } + if( m_config->useJets() ){ top::check( m_jetMaker->printoutJets() , "Failed to printoutJets()" ); } + if( m_config->useLargeRJets() ){ top::check( m_jetMaker->printoutLargeRJets() , "Failed to printoutLargeRJets()" ); } + + return StatusCode::SUCCESS; + } + + bool ObjectCollectionMaker::isTruthDxAOD() const + { + ///-- If any of the following aren't present, then assume we're running over a truth DxAOD --/// + if (m_config->usePhotons()) { + if (!evtStore()->contains<xAOD::PhotonContainer>( m_config->sgKeyPhotons() )) { + return true; + } + } + + if (m_config->useElectrons()) { + if (!evtStore()->contains<xAOD::ElectronContainer>( m_config->sgKeyElectrons() )) { + return true; + } + } + + if (m_config->useMuons()) { + if (!evtStore()->contains<xAOD::MuonContainer>( m_config->sgKeyMuons() )) { + return true; + } + } + + if (m_config->useTaus()) { + if (!evtStore()->contains<xAOD::TauJetContainer>( m_config->sgKeyTaus() )) { + return true; + } + } + + if (m_config->useJets()) { + if (!evtStore()->contains<xAOD::JetContainer>( m_config->sgKeyJets() )) { + return true; + } + } + + ///-- If we have made it this far, then all reco objects are available --/// + ///-- Therefore we can't be running over a truth DxAOD --/// + return false; + } + +} diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/TauObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/TauObjectCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f091f6a7f73b543b9587cc070c93b743aaac8b5d --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/TauObjectCollectionMaker.cxx @@ -0,0 +1,156 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TauObjectCollectionMaker.cxx $ +#include "TopSystematicObjectMaker/TauObjectCollectionMaker.h" +#include "TopConfiguration/TopConfig.h" +#include "TopEvent/EventTools.h" + +#include "xAODTau/TauJetContainer.h" +#include "xAODTau/TauJetAuxContainer.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODBase/IParticleHelpers.h" +#include "PATInterfaces/SystematicsUtil.h" + +namespace top{ + + TauObjectCollectionMaker::TauObjectCollectionMaker( const std::string& name ) : + asg::AsgTool( name ), + m_config(nullptr), + + m_specifiedSystematics(), + m_recommendedSystematics(), + + m_calibrationTool("TauAnalysisTools::TauSmearingTool") + + { + declareProperty( "config" , m_config ); + + declareProperty( "TauSmearingTool" , m_calibrationTool ); + } + + StatusCode TauObjectCollectionMaker::initialize() + { + ATH_MSG_INFO(" top::TauObjectCollectionMaker initialize" ); + + top::check( m_calibrationTool.retrieve() , "Failed to retrieve tau calibration tool" ); + + ///-- Set Systematics Information --/// + const std:: string& syststr = m_config->systematics(); + std::set<std::string> syst; + + if( !m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr)){ + bool ok = m_config->getSystematicsList(syststr, syst); + if (!ok) { + ATH_MSG_ERROR(" top::TauObjectCollectionMaker could not determine systematic list" ); + return StatusCode::FAILURE; + } + if (m_config->contains(syst, "AllTaus")) { + syst.clear(); + } + } + + specifiedSystematics( syst ); + + m_config->systematicsTaus( specifiedSystematics() ); + + return StatusCode::SUCCESS; + } + + StatusCode TauObjectCollectionMaker::execute() + { + ///-- Get base taus from xAOD --/// + const xAOD::TauJetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyTaus() ) , "Failed to retrieve Taus" ); + + ///-- Loop over all systematics --/// + for( auto systematic : m_specifiedSystematics ){ + + ///-- Tell tool which systematic to use --/// + top::check( m_calibrationTool->applySystematicVariation( systematic ) , "Failed to applySystematicVariation" ); + + ///-- Shallow copy of the xAOD --/// + std::pair< xAOD::TauJetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer( *xaod ); + + ///-- Loop over the xAOD Container and apply corrections--/// + for( auto tau : *(shallow_xaod_copy.first) ){ + ///-- Apply momentum correction --/// + top::check( m_calibrationTool->applyCorrection( *tau ) , "Failed to applyCorrection" ); + } + + + ///-- set links to original objects- needed for MET calculation --/// + bool setLinks = xAOD::setOriginalObjectLink( *xaod, *shallow_xaod_copy.first ); + if (!setLinks) + ATH_MSG_ERROR(" Cannot set original object links for taus, MET recalculation may struggle" ); + + // Save corrected xAOD Container to StoreGate / TStore + std::string outputSGKey = m_config->sgKeyTaus( systematic.hash() ); + std::string outputSGKeyAux = outputSGKey + "Aux."; + + xAOD::TReturnCode save = evtStore()->tds()->record( shallow_xaod_copy.first , outputSGKey ); + xAOD::TReturnCode saveAux = evtStore()->tds()->record( shallow_xaod_copy.second , outputSGKeyAux ); + if( !save || !saveAux ){ + return StatusCode::FAILURE; + } + + } // Loop over all systematics + + return StatusCode::SUCCESS; + } + + StatusCode TauObjectCollectionMaker::printout() + { + ///-- Loop over all systematics --/// + for( auto s : m_specifiedSystematics ){ + const xAOD::TauJetContainer* xaod(nullptr); + top::check( evtStore()->retrieve( xaod , m_config->sgKeyTaus( s.hash() ) ) , "Failed to retrieve Taus" ); + + ATH_MSG_INFO(" Taus with sgKey = "<<m_config->sgKeyTaus( s.hash() ) ); + for( auto x : *xaod ){ + ATH_MSG_INFO(" TAU pT , eta = "<<x->pt()<<" , "<<x->eta() ); + } + } + + return StatusCode::SUCCESS; + } + + + void TauObjectCollectionMaker::specifiedSystematics( const std::set<std::string>& specifiedSystematics ) + { + ///-- Get the recommended systematics from the tool, in std::vector format --/// + const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector( m_calibrationTool->recommendedSystematics() ); + + for (auto s : systList) { + m_recommendedSystematics.push_back(s); + if (s.name() == "") { + m_specifiedSystematics.push_back(s); + } + + ///-- MC only --/// + if (m_config->isMC()) { + ///-- Are we only doing Nominal? Did the user specify specific systematics to use? --/// + if (!m_config->isSystNominal( m_config->systematics() )) { + if (specifiedSystematics.size() == 0) { + m_specifiedSystematics.push_back(s); + } + if (specifiedSystematics.size() > 0) { + for (auto i : specifiedSystematics) { + if ( i == s.name() ) { + m_specifiedSystematics.push_back(s); + } + } + } + } + } + } + m_recommendedSystematics.sort(); + m_recommendedSystematics.unique(); + m_specifiedSystematics.sort(); + m_specifiedSystematics.unique(); + } + +} + + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/EgammaObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/EgammaObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..ee3e1b2a6a0530ea5b1c39946d2b6a570177d521 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/EgammaObjectCollectionMaker.h @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: EgammaObjectCollectionMaker.h 802735 2017-04-11 16:38:01Z tpelzer $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_EGAMMAOBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_EGAMMAOBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief EgammaObjectCollectionMaker + * Makes all systematic variations of photons and electrons + * + * $Revision: 802735 $ + * $Date: 2017-04-11 18:38:01 +0200 (Tue, 11 Apr 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <list> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "ElectronPhotonFourMomentumCorrection/IEgammaCalibrationAndSmearingTool.h" +#include "ElectronPhotonShowerShapeFudgeTool/IElectronPhotonShowerShapeFudgeTool.h" +#include "IsolationSelection/IIsolationSelectionTool.h" +#include "IsolationCorrections/IIsolationCorrectionTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class EgammaObjectCollectionMaker final : public asg::AsgTool { + public: + explicit EgammaObjectCollectionMaker( const std::string& name ); + virtual ~EgammaObjectCollectionMaker(){} + + // Delete Standard constructors + EgammaObjectCollectionMaker(const EgammaObjectCollectionMaker& rhs) = delete; + EgammaObjectCollectionMaker(EgammaObjectCollectionMaker&& rhs) = delete; + EgammaObjectCollectionMaker& operator=(const EgammaObjectCollectionMaker& rhs) = delete; + + StatusCode initialize(); + + StatusCode executePhotons(); + StatusCode executeElectrons(); + + StatusCode printoutPhotons(); + StatusCode printoutElectrons(); + + // return specific Systematic + inline virtual const std::list<CP::SystematicSet>& specifiedSystematicsPhotons() const {return m_specifiedSystematicsPhotons;} + inline virtual const std::list<CP::SystematicSet>& specifiedSystematicsElectrons() const {return m_specifiedSystematicsElectrons;} + + // return all recommendedSystematics + inline const std::list<CP::SystematicSet>& recommendedSystematicsPhotons() const {return m_recommendedSystematicsPhotons;} + inline const std::list<CP::SystematicSet>& recommendedSystematicsElectrons() const {return m_recommendedSystematicsElectrons;} + + protected: + // specify Systematic + virtual void specifiedSystematicsPhotons ( const std::set<std::string>& specifiedSystematics ); + virtual void specifiedSystematicsElectrons( const std::set<std::string>& specifiedSystematics ); + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::list<CP::SystematicSet> m_specifiedSystematicsPhotons; + std::list<CP::SystematicSet> m_specifiedSystematicsElectrons; + + std::list<CP::SystematicSet> m_recommendedSystematicsPhotons; + std::list<CP::SystematicSet> m_recommendedSystematicsElectrons; + + ToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_calibrationTool; + ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_photonFudgeTool; + + ///-- Isolation --/// + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_LooseTrackOnly; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Loose; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Gradient; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_GradientLoose; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutTight; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutTightTrackOnly; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutTightCaloOnly; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutLoose; + + ToolHandle<CP::IIsolationCorrectionTool> m_isolationCorr; + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ElectronInJetSubtractionCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ElectronInJetSubtractionCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..0c7437f51e27bc74e4f5a68626c0185c2dd8d469 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ElectronInJetSubtractionCollectionMaker.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ElectronInJetSubtractionCollectionMaker.h 653798 2015-03-12 19:24:22Z morrisj $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_ELECTRONINJETSUBTRACTIONCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_ELECTRONINJETSUBTRACTIONCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief ElectronInJetSubtractionCollectionMaker + * Makes all needed collections for the Electron in jet subtraction + * Used by boosted analysis + * + * Will require a set of electron and jet collections for: + * Nominal + * All Electron systematics + * All Jet systematics + * + * This class does not do the actual subtraction algorithm + * This class prepares the collections and calls the algorithm + * + * $Revision: 653798 $ + * $Date: 2015-03-12 20:24:22 +0100 (Thu, 12 Mar 2015) $ + * + **/ + +// system include(s): +#include <memory> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODJet/JetContainer.h" + +// ElectronInJetSubtractionAlgorithm +#include "TopJetSubstructure/ElectronInJetSubtractionAlgorithm.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class ElectronInJetSubtractionCollectionMaker final : public asg::AsgTool { + public: + explicit ElectronInJetSubtractionCollectionMaker( const std::string& name ); + virtual ~ElectronInJetSubtractionCollectionMaker(){} + + // Delete Standard constructors + ElectronInJetSubtractionCollectionMaker(const ElectronInJetSubtractionCollectionMaker& rhs) = delete; + ElectronInJetSubtractionCollectionMaker(ElectronInJetSubtractionCollectionMaker&& rhs) = delete; + ElectronInJetSubtractionCollectionMaker& operator=(const ElectronInJetSubtractionCollectionMaker& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + private: + std::shared_ptr<top::TopConfig> m_config; + bool m_doLooseCuts; + // The algorithm + top::ElectronInJetSubtractionAlgorithm m_subtractionAlgorithm; + }; +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/GhostTrackSystematicsMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/GhostTrackSystematicsMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..e5f19550dc04a7984877f150ec15ad4d5ea61c6f --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/GhostTrackSystematicsMaker.h @@ -0,0 +1,211 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Filename: GhostTrackSystematicsMaker.h +// Description: +// Author: Fabian Wilk +// Created: Mon Oct 24 16:54:17 2016 +// +// by Fabian Wilk <mail@fabianwilk.de> +// The ATLAS Collaboration + +#ifndef _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_ +#define _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_ + +#include <list> +#include <set> +#include <string> +#include <vector> +#include <utility> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +#include "PATInterfaces/SystematicSet.h" + +#include "xAODJet/JetContainer.h" + + +// Forward Declarations. +namespace InDet { + class InDetTrackSystematicsTool; + class InDetTrackSmearingTool; + class InDetTrackBiasingTool; + class InDetTrackTruthFilterTool; + class InDetTrackTruthOriginTool; + class JetTrackFilterTool; +} + +namespace top { + class TopConfig; +} + +namespace top { + + /* + * @brief Tool for making systematics that affect ghost-associated tracks of + * jets available. + * + * Ghost-associated tracks are available on jets through the + * getAssociatedObjects function which retrieves a + * + * std::vector<const xAOD::IParticle*> + * + * container that is decorated onto each jet object. + * + * This tool, produces one copy of this container for each of the affecting + * and requested systematics. Some systematics change only the number of + * tracks (efficiency-style systematics) while other only smear (some) of + * the track particle properties. + * + * The requested systematics are retrieved from top::TopConfig, filtered to + * only contain those affecting the ghost tracks, and propagated back to + * the top::TopConfig instance so that they become available to any tool + * which wishes to query + * + * - the affecting systematics, + * - the decoration name used for the varied ghost track container + * + * Generally, a tool should use the function + * + * top::TopConfig::systMapJetGhostTrack() + * + * to retrieve the mapping from the hash value of a systematic to the + * CP::SystematicSet of that variation for all (configured and requested) + * systematics that affect the ghost tracks (this map includes the nominal + * systematic). The decoration name can then be retrieved using + * + * top::TopConfig::decoKeyJetGhostTrack(std::size_t hash) + */ + class GhostTrackSystematicsMaker final : public asg::AsgTool { + public: + explicit GhostTrackSystematicsMaker(const std::string & name); + virtual ~GhostTrackSystematicsMaker(); + + GhostTrackSystematicsMaker(const GhostTrackSystematicsMaker & rhs) = delete; + GhostTrackSystematicsMaker(GhostTrackSystematicsMaker && rhs) = delete; + GhostTrackSystematicsMaker & operator=(const GhostTrackSystematicsMaker & rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + /* + * @brief Retrieve the specified (requested) systematics list.* + * + * Unless systematics have been requested through the + * specifiedSystematics setter function, this will be an empty list. + */ + inline virtual const std::list<CP::SystematicSet> & specifiedSystematics() const; + + /* + * @brief Retrieve the recommended systematics list. + * + * This will return a meaningless (probably empty) list unless the + * setter function specifiedSystematics has been called or the tool has + * been initialized (which call specifiedSystematics using the data + * obtained from top::TopConfig). + */ + inline const std::list<CP::SystematicSet> & recommendedSystematics() const; + + /*! + * @brief Specify the systematics to be used. + * @param specifiedSystematics Set of systematics (by name) to be used; + * an empty set will result in no systematic variation. + */ + virtual void specifiedSystematics(const std::set<std::string> & specifiedSystematics); + + protected: + StatusCode applyNoOpSystematic(xAOD::JetContainer * nominal, + const CP::SystematicSet & syst) const; + + StatusCode applyTruthFilterSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackTruthFilterTool * tool, + const CP::SystematicSet & syst) const; + + StatusCode applySmearingSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackSmearingTool * tool, + const CP::SystematicSet & syst) const; + + StatusCode applyBiasingSystematic(xAOD::JetContainer * nominal, + InDet::InDetTrackBiasingTool * tool, + const CP::SystematicSet & syst) const; + + StatusCode applyJetTrackFilterSystematic(xAOD::JetContainer * nominal, + InDet::JetTrackFilterTool * tool, + const CP::SystematicSet & syst) const; + + private: + StatusCode retrieveGhostTrackCPTool(); + + private: + std::shared_ptr<top::TopConfig> m_config; + std::vector<std::uint32_t> m_runPeriods; + + std::list<CP::SystematicSet> m_specifiedSystematics; + std::list<CP::SystematicSet> m_recommendedSystematics; + + CP::SystematicSet m_nominalSystematicSet; + + struct { + void makeUnique(){ + static auto exec = [](std::vector<CP::SystematicSet> & data){ + std::sort(data.begin(), data.end()); + data.erase(std::unique(data.begin(), data.end()), + data.end()); + }; + + exec(smearing); + exec(truthFilter); + exec(bias); + exec(jetTrackFilter); + } + + void removeNonSpecified(const std::list<CP::SystematicSet> & specified){ + auto fnCmp = [&specified](CP::SystematicSet & s){ + return std::find(specified.begin(), + specified.end(), + s) == specified.end(); + }; + + auto exec = [&specified, &fnCmp](std::vector<CP::SystematicSet> & data){ + data.erase(std::remove_if(data.begin(), data.end(), fnCmp), + data.end()); + }; + + exec(smearing); + exec(truthFilter); + exec(bias); + exec(jetTrackFilter); + } + + std::size_t numSystematics() const { + return smearing.size() + truthFilter.size() + bias.size() + jetTrackFilter.size(); + } + + std::vector<CP::SystematicSet> smearing, truthFilter, bias, jetTrackFilter; + } m_systs; + + struct { + ToolHandle<InDet::InDetTrackSmearingTool> smearing; + ToolHandle<InDet::InDetTrackTruthOriginTool> truthOrigin; + ToolHandle<InDet::InDetTrackTruthFilterTool> truthFilter; + ToolHandle<InDet::JetTrackFilterTool> jetTrackFilter; + + std::vector<ToolHandle<InDet::InDetTrackBiasingTool> > bias; + } m_tools; + }; + + /* inline virtual */ const std::list<CP::SystematicSet> & GhostTrackSystematicsMaker::specifiedSystematics() const { + return m_specifiedSystematics; + + } + /* inline */ const std::list<CP::SystematicSet> & GhostTrackSystematicsMaker::recommendedSystematics() const { + return m_recommendedSystematics; + } + + +} + +#endif /* _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_ */ diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/JetObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/JetObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..8bc19a79a6894171c37aa20fea70abf353aca70b --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/JetObjectCollectionMaker.h @@ -0,0 +1,160 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: JetObjectCollectionMaker.h 794215 2017-01-27 15:12:13Z tpelzer $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_JETOBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_JETOBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief JetObjectCollectionMaker + * Makes all systematic variations of jets + * + * This is actually quite a complex tool + * The steps are as follows + * (1) Calibrate data/MC jets and save this collection to TStore + * (2) Loop over the various NP JES scenarios, using the output of (1) as an input + * (3) Loop over the various NP JER scenarios, using the output of (1) as an input + * (2.a , 3.a) Re-calculate the JVT for each jet + * + * $Revision: 794215 $ + * $Date: 2017-01-27 16:12:13 +0100 (Fri, 27 Jan 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <list> +#include <unordered_map> + + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" +#include "xAODJet/JetConstituentVector.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "JetCalibTools/IJetCalibrationTool.h" +#include "JetCPInterfaces/ICPJetUncertaintiesTool.h" +#include "JetResolution/IJERSmearingTool.h" +#include "JetInterface/IJetUpdateJvt.h" + +#include "TopJetSubstructure/TopJetSubstructure.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class JetObjectCollectionMaker final : public asg::AsgTool { + + using systMap = std::unordered_map<CP::SystematicSet,CP::SystematicSet>; + + public: + explicit JetObjectCollectionMaker( const std::string& name ); + virtual ~JetObjectCollectionMaker(){} + + // Delete Standard constructors + JetObjectCollectionMaker(const JetObjectCollectionMaker& rhs) = delete; + JetObjectCollectionMaker(JetObjectCollectionMaker&& rhs) = delete; + JetObjectCollectionMaker& operator=(const JetObjectCollectionMaker& rhs) = delete; + + StatusCode initialize(); + + StatusCode executeJets(); + StatusCode executeLargeRJets(); + StatusCode executeTrackJets(); + + StatusCode printoutJets(); + StatusCode printoutLargeRJets(); + + // return specific Systematic + inline virtual const std::list<CP::SystematicSet>& specifiedSystematics() const {return m_specifiedSystematics;} + inline virtual const std::list<CP::SystematicSet>& specifiedSystematicsLargeR() const {return m_specifiedSystematicsLargeR;} + + // return all recommendedSystematics + inline const std::list<CP::SystematicSet>& recommendedSystematics() const {return m_recommendedSystematics;} + + protected: + // specify Systematic + virtual void specifiedSystematics( const std::set<std::string>& specifiedSystematics , const ToolHandle<ICPJetUncertaintiesTool>& tool , std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map , const std::string& modName , bool isLargeR = false); + virtual void specifiedSystematics( const std::set<std::string>& specifiedSystematics , const ToolHandle<IJERSmearingTool>& tool , std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map ); + + StatusCode execute( const bool isLargeR ); + + StatusCode calibrate( const bool isLargeR ); + virtual StatusCode applySystematic( ToolHandle<ICPJetUncertaintiesTool>& tool, const std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map , bool isLargeR = false); + virtual StatusCode applySystematic( ToolHandle<IJERSmearingTool>& tool, const std::unordered_map<CP::SystematicSet,CP::SystematicSet>& map ); + + StatusCode printout( const bool isLargeR ); + + void addCorrelation(const std::string& name, + systMap& map_one, + const std::string& syst_one_name, + systMap& map_two, + const std::string& syst_two_name); + + void addCorrelation(const std::string& name, + systMap& map_one, + const std::string& syst_one_name, + std::list<CP::SystematicSet>& jet_specified); + + + private: + std::shared_ptr<top::TopConfig> m_config; + bool m_doJER; + bool m_doFull_JER; + + bool m_do_fjvt = false; + + std::list<CP::SystematicSet> m_specifiedSystematics; + std::list<CP::SystematicSet> m_specifiedSystematicsLargeR; + std::list<CP::SystematicSet> m_specifiedSystematicsTrackJets; + std::list<CP::SystematicSet> m_recommendedSystematics; + CP::SystematicSet m_nominalSystematicSet; + + ToolHandle<IJetCalibrationTool> m_jetCalibrationTool; + ToolHandle<IJetCalibrationTool> m_jetCalibrationToolLargeR; + + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario1; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario2; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario3; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario4; + + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_strong; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_medium; + ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR_weak; + + ToolHandle<IJERSmearingTool> m_jetJERSmearingTool; + ToolHandle<IJetUpdateJvt> m_jetUpdateJvtTool; + ToolHandle<IJetModifier> m_fjvtTool; + + std::string m_truthJetCollForHS; + + std::unique_ptr<top::TopJetSubstructure> m_jetSubstructure; + + systMap m_systMap_AllNP; + systMap m_systMap_ReducedNPScenario1; + systMap m_systMap_ReducedNPScenario2; + systMap m_systMap_ReducedNPScenario3; + systMap m_systMap_ReducedNPScenario4; + systMap m_systMap_LargeR_strong; + systMap m_systMap_LargeR_medium; + systMap m_systMap_LargeR_weak; + systMap m_systMap_JER; + typedef std::unordered_map<CP::SystematicSet,CP::SystematicSet>::const_iterator Itr; + + StatusCode decorateBJets(xAOD::Jet& jet); + StatusCode decorateHSJets(); + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MissingETObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MissingETObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..d23a7cc679d82bcbd46e8967e1f07eb8ac178b02 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MissingETObjectCollectionMaker.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MissingETObjectCollectionMaker.h 683191 2015-07-15 16:05:25Z morrisj $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_MISSINGETOBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_MISSINGETOBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief MissingETObjectCollectionMaker + * Makes all systematic variations of Missing ET + * + * $Revision: 683191 $ + * $Date: 2015-07-15 18:05:25 +0200 (Wed, 15 Jul 2015) $ + * + **/ + +// system include(s): +#include <memory> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +#include "METInterface/IMETMaker.h" +#include "METInterface/IMETSystematicsTool.h" + +namespace xAOD{ + class SystematicEvent; +} + +namespace top{ + class TopConfig; +} + +namespace top{ + + class MissingETObjectCollectionMaker final : public asg::AsgTool { + public: + explicit MissingETObjectCollectionMaker( const std::string& name ); + virtual ~MissingETObjectCollectionMaker(){} + + // Delete Standard constructors + MissingETObjectCollectionMaker(const MissingETObjectCollectionMaker& rhs ) = delete; + MissingETObjectCollectionMaker(MissingETObjectCollectionMaker&& rhs ) = delete; + MissingETObjectCollectionMaker& operator=(const MissingETObjectCollectionMaker& rhs ) = delete; + + StatusCode initialize(); + StatusCode recalculateMET(); + + // return specific Systematic + inline virtual const std::list<CP::SystematicSet>& specifiedSystematics() const {return m_specifiedSystematics;} + + // return all recommendedSystematics + inline const std::list<CP::SystematicSet>& recommendedSystematics() const {return m_recommendedSystematics;} + + protected: + // specify Systematic + virtual void specifiedSystematics( const std::set<std::string>& specifiedSystematics ); + + + private: + + StatusCode recalculateEventMET( xAOD::SystematicEvent* event, + const xAOD::MissingETContainer* met_core, + const xAOD::MissingETAssociationMap* met_map); + + std::shared_ptr<top::TopConfig> m_config; + + std::list<CP::SystematicSet> m_specifiedSystematics; + std::list<CP::SystematicSet> m_recommendedSystematics; + + std::string m_MET_core; + std::string m_MET_map; + + ToolHandle<IMETMaker> m_met_maker; + ToolHandle<IMETSystematicsTool> m_met_systematics; + + }; +} + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..5cde1ae054e356a0143d93b37c9efb0371d8ebb3 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/MuonObjectCollectionMaker.h @@ -0,0 +1,93 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MuonObjectCollectionMaker.h 799839 2017-03-08 11:07:28Z grancagn $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_MUONOBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_MUONOBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief MuonObjectCollectionMaker + * Makes all systematic variations of muons. + * Momentum Corrections are applied using the calibration tool. + * Efficiency Corrections are applied using the efficiency tool. + * + * $Revision: 799839 $ + * $Date: 2017-03-08 12:07:28 +0100 (Wed, 08 Mar 2017) $ + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <list> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "MuonMomentumCorrections/IMuonCalibrationAndSmearingTool.h" +#include "IsolationSelection/IIsolationSelectionTool.h" +// the following is needed to make sure all muons for which d0sig is calculated are at least Loose +#include "MuonSelectorTools/IMuonSelectionTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class MuonObjectCollectionMaker final : public asg::AsgTool { + public: + explicit MuonObjectCollectionMaker( const std::string& name ); + virtual ~MuonObjectCollectionMaker(){} + + // Delete Standard constructors + MuonObjectCollectionMaker(const MuonObjectCollectionMaker& rhs) = delete; + MuonObjectCollectionMaker(MuonObjectCollectionMaker&& rhs) = delete; + MuonObjectCollectionMaker& operator=(const MuonObjectCollectionMaker& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + StatusCode printout(); + + // return specific Systematic + inline virtual const std::list<CP::SystematicSet>& specifiedSystematics() const {return m_specifiedSystematics;} + + // return all recommendedSystematics + inline const std::list<CP::SystematicSet>& recommendedSystematics() const {return m_recommendedSystematics;} + + protected: + // specify Systematic + virtual void specifiedSystematics( const std::set<std::string>& specifiedSystematics ); + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::list<CP::SystematicSet> m_specifiedSystematics; + std::list<CP::SystematicSet> m_recommendedSystematics; + + ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_calibrationTool; + + ///-- Isolation --/// + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_LooseTrackOnly; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Loose; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_Gradient; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_GradientLoose; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutTight; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutTightTrackOnly; + ToolHandle<CP::IIsolationSelectionTool> m_isolationTool_FixedCutLoose; + // the following is needed to make sure all muons for which d0sig is calculated are at least Loose + ToolHandle<CP::IMuonSelectionTool> m_muonSelectionToolVeryLooseVeto; + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..01d2625df73d29f75889af327635298a3f19a288 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/ObjectCollectionMaker.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: ObjectCollectionMaker.h 790414 2016-12-19 00:49:08Z tpelzer $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_OBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_OBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief ObjectCollectionMaker + * Makes all systematic variations of all objects + * + * $Revision: 790414 $ + * $Date: 2016-12-19 01:49:08 +0100 (Mon, 19 Dec 2016) $ + * + **/ + +// system include(s): +#include <vector> +#include <memory> + +// Framework include(s): +#include "AsgTools/AsgTool.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +#include "TopSystematicObjectMaker/EgammaObjectCollectionMaker.h" +#include "TopSystematicObjectMaker/MuonObjectCollectionMaker.h" +#include "TopSystematicObjectMaker/TauObjectCollectionMaker.h" +#include "TopSystematicObjectMaker/JetObjectCollectionMaker.h" +#include "TopSystematicObjectMaker/MissingETObjectCollectionMaker.h" +#include "TopSystematicObjectMaker/GhostTrackSystematicsMaker.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class ObjectCollectionMaker final : public asg::AsgTool { + public: + explicit ObjectCollectionMaker( const std::string& name ); + virtual ~ObjectCollectionMaker() {} + + ObjectCollectionMaker(const ObjectCollectionMaker& rhs) = delete; + ObjectCollectionMaker(ObjectCollectionMaker&& rhs) = delete; + ObjectCollectionMaker& operator=(const ObjectCollectionMaker& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + StatusCode recalculateMET(); + StatusCode printout(); + + bool isTruthDxAOD() const; + + private: + + std::shared_ptr<top::TopConfig> m_config; + std::unique_ptr<top::EgammaObjectCollectionMaker> m_egammaMaker; + std::unique_ptr<top::MuonObjectCollectionMaker> m_muonMaker; + std::unique_ptr<top::TauObjectCollectionMaker> m_tauMaker; + std::unique_ptr<top::JetObjectCollectionMaker> m_jetMaker; + std::unique_ptr<top::MissingETObjectCollectionMaker> m_metMaker; + std::unique_ptr<top::GhostTrackSystematicsMaker> m_ghostTrackSystMaker; + }; + +} // namespace + +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/TauObjectCollectionMaker.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/TauObjectCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..7202821469a0234f8bea4610a433a53916114efc --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/TopSystematicObjectMaker/TauObjectCollectionMaker.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TauObjectCollectionMaker.h $ +#ifndef ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_TAUOBJECTCOLLECTIONMAKER_H +#define ANALYSISTOP_TOPSYSTEMATICOBJECTMAKER_TAUOBJECTCOLLECTIONMAKER_H + +/** + * @author John Morris <john.morris@cern.ch> + * + * @brief TauObjectCollectionMaker + * Makes all systematic variations of taus + * + * + **/ + +// system include(s): +#include <memory> +#include <set> +#include <list> + +// Framework include(s): +#include "AsgTools/AsgTool.h" +#include "AsgTools/ToolHandle.h" + +// Systematic include(s): +#include "PATInterfaces/SystematicSet.h" + +// CP Tool include(s): +#include "TauAnalysisTools/ITauSmearingTool.h" +#include "TauAnalysisTools/ITauTruthMatchingTool.h" + +// Forward declaration(s): +namespace top{ + class TopConfig; +} + +namespace top{ + + class TauObjectCollectionMaker final : public asg::AsgTool { + public: + explicit TauObjectCollectionMaker( const std::string& name ); + virtual ~TauObjectCollectionMaker(){} + + // Delete Standard constructors + TauObjectCollectionMaker(const TauObjectCollectionMaker& rhs) = delete; + TauObjectCollectionMaker(TauObjectCollectionMaker&& rhs) = delete; + TauObjectCollectionMaker& operator=(const TauObjectCollectionMaker& rhs) = delete; + + StatusCode initialize(); + StatusCode execute(); + + StatusCode printout(); + + // return specific Systematic + inline virtual const std::list<CP::SystematicSet>& specifiedSystematics() const {return m_specifiedSystematics;} + + // return all recommendedSystematics + inline const std::list<CP::SystematicSet>& recommendedSystematics() const {return m_recommendedSystematics;} + + protected: + // specify Systematic + virtual void specifiedSystematics( const std::set<std::string>& specifiedSystematics ); + + private: + std::shared_ptr<top::TopConfig> m_config; + + std::list<CP::SystematicSet> m_specifiedSystematics; + std::list<CP::SystematicSet> m_recommendedSystematics; + + ToolHandle<TauAnalysisTools::ITauSmearingTool> m_calibrationTool; + + }; +} // namespace +#endif diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/cmt/Makefile.RootCore b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..21fce744671bb4231d6ff0f242cdfd16664a87d6 --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/cmt/Makefile.RootCore @@ -0,0 +1,17 @@ +PACKAGE = TopSystematicObjectMaker +PACKAGE_PRELOAD = +PACKAGE_CXXFLAGS = -g +PACKAGE_OBJFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_BINFLAGS = +PACKAGE_LIBFLAGS = +PACKAGE_DEP = xAODCore xAODRootAccess xAODEventInfo PATInterfaces AsgTools xAODEgamma xAODMuon xAODJet ElectronPhotonFourMomentumCorrection ElectronPhotonSelectorTools ElectronPhotonShowerShapeFudgeTool MuonMomentumCorrections TauAnalysisTools JetCalibTools JetCPInterfaces JetResolution JetInterface METInterface METUtilities IsolationSelection IsolationCorrections TopConfiguration TopEvent TopJetSubstructure xAODTracking InDetTrackSystematicsTools +PACKAGE_TRYDEP = +PACKAGE_CLEAN = +PACKAGE_NOGRID = +PACKAGE_PEDANTIC = 1 +PACKAGE_NOOPT = 0 +PACKAGE_NOCC = 0 +PACKAGE_REFLEX = 0 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/share/mainpage.h b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/share/mainpage.h new file mode 100644 index 0000000000000000000000000000000000000000..d76e4632c036af2abf72e7262ccd9c7b71833bda --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/share/mainpage.h @@ -0,0 +1,10 @@ +/** + * @page tsompage TopSystematicObjectMaker + * + * - top::ObjectCollectionMaker + * + * - top::EgammaObjectCollectionMaker + * - top::MuonObjectCollectionMaker + * - top::JetObjectCollectionMaker + * - top::MissingETObjectCollectionMaker + */ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/CMakeLists.txt b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f81ab970926607b6152a56215859e4edd25216 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/CMakeLists.txt @@ -0,0 +1,40 @@ +# Auto-generated on: 2017-03-09 14:53:36.740759 + +# Declare the name of this package: +atlas_subdir( UpgradePerformanceFunctions None ) + +# This package depends on other packages: +atlas_depends_on_subdirs( PUBLIC + PathResolver ) + +# This package uses ROOT: +find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf Physics ) + +# Generate a CINT dictionary source file: +atlas_add_root_dictionary( UpgradePerformanceFunctions _cintDictSource + ROOT_HEADERS Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) + +# Build a library that other components can link against: +atlas_add_library( UpgradePerformanceFunctions Root/*.cxx Root/*.h Root/*.icc + UpgradePerformanceFunctions/*.h UpgradePerformanceFunctions/*.icc UpgradePerformanceFunctions/*/*.h + UpgradePerformanceFunctions/*/*.icc ${_cintDictSource} + PUBLIC_HEADERS UpgradePerformanceFunctions + LINK_LIBRARIES PathResolver + ${ROOT_LIBRARIES} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ) + +# Install data files from the package: +atlas_install_data( share/* ) + +# Build the executables of the package: +atlas_add_executable( plotPerformanceFunctions + util/plotPerformanceFunctions.cxx + LINK_LIBRARIES PathResolver + ${ROOT_LIBRARIES} + UpgradePerformanceFunctions ) +atlas_add_executable( testPerformanceFunctions + util/testPerformanceFunctions.cxx + LINK_LIBRARIES PathResolver + ${ROOT_LIBRARIES} + UpgradePerformanceFunctions ) diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/README b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/README new file mode 100644 index 0000000000000000000000000000000000000000..848c35745e4d57e28acd2679e5931ed45a5e6aeb --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/README @@ -0,0 +1,9 @@ +This package can be used to mimic the expected performance of the +upgraded ATLAS detectors in the HL-LHC era. Analytic functions +describe the expected detector response. They should be applied to +truth-level particles and events. + +More details on the use of specific classes, methods, and utility +codes can be found on the following TWiki: +https://twiki.cern.ch/twiki/bin/view/AtlasProtected/UpgradePerformanceFunctions + diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/ElectronPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/ElectronPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..846f9b296d4d4945f78f856e1034a00ebb48ed65 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/ElectronPerformanceFunctions.cxx @@ -0,0 +1,475 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ELECTRONPERFORMANCEFUNCTIONS_CXX +#define ELECTRONPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +void UpgradePerformanceFunctions::setElectronWorkingPoint(ElectronCutLevel cutLevel) { + m_eleCutLevel = cutLevel; +} + +void UpgradePerformanceFunctions::setElectronRandomSeed(unsigned seed) { + m_electronRandom.SetSeed(seed); +} + +float UpgradePerformanceFunctions::getElectronSmearedEnergy(float eMeV, float eta) { + float deltaE = m_electronRandom.Gaus(0., getElectronEnergyResolution(eMeV, eta)); + return (eMeV+deltaE); +} + + +//********************************************************************* +float UpgradePerformanceFunctions::getElectronEfficiency(float ptMeV, float eta) +//********************************************************************* +//---- Get the electron ID efficiency +{ + + //---- old code + // if (m_eleCutLevel==looseElectron) { + // return 0.97 - 0.103*exp(1.-ptGeV/15.0); + // } else if (m_eleCutLevel==tightElectron) { + // return 0.85 - 0.191*exp(1.-ptGeV/20.0); + // } + // std::cout << "getElectronEfficiency: Invalid working point." << std::endl; + // return 0.0; + + float ptGeV = ptMeV / 1000.; + + //---- define all the different efficiency maps + const int nEtBins=6; + const int netaBins=9; + + //---- Loose efficiencies + const float ElEff_Step1p6_mu200_Loose[nEtBins][netaBins] = { + {0.811966, 0.157915, 0.774224, 0.255651, 0.683, 0.673, 0.496, 0.549, 0.593 }, // Et[ 7 - 15] + {0.742899, 0.156085, 0.750086, 0.251285, 0.660, 0.736, 0.447, 0.622, 0.650 }, // Et[ 15 - 20] + {0.880800, 0.196373, 0.857302, 0.276088, 0.676, 0.783, 0.475, 0.704, 0.714 }, // Et[ 20 - 30] + {0.911897, 0.203653, 0.886948, 0.294688, 0.624, 0.831, 0.482, 0.766, 0.766 }, // Et[ 30 - 50] + {0.929496, 0.222480, 0.907982, 0.294609, 0.705, 0.851, 0.537, 0.808, 0.812 }, // Et[ 50 - 80] + {0.942924, 0.240126, 0.924407, 0.273356, 0.649, 0.855, 0.702, 0.890, 0.800 }, // Et[ 80 - 120] + }; + //---- Medium efficiencies + const float ElEff_Step1p6_mu200_Medium[nEtBins][netaBins] = { // Uses Tight Gold mu=200 for forward electrons + {0.711072, 0.121269, 0.686265, 0.222915, 0.390, 0.494, 0.311, 0.343, 0.394 }, // Et[ 7 - 15] + {0.665538, 0.129042, 0.662286, 0.217019, 0.476, 0.538, 0.298, 0.395, 0.470 }, // Et[ 15 - 20] + {0.806082, 0.152595, 0.778103, 0.253627, 0.497, 0.598, 0.301, 0.467, 0.495 }, // Et[ 20 - 30] + {0.837797, 0.174947, 0.817937, 0.281170, 0.478, 0.652, 0.311, 0.538, 0.556 }, // Et[ 30 - 50] + {0.904484, 0.202508, 0.876919, 0.288759, 0.527, 0.689, 0.340, 0.594, 0.595 }, // Et[ 50 - 80] + {0.932139, 0.224329, 0.913220, 0.273356, 0.514, 0.671, 0.421, 0.589, 0.600 }, // Et[ 80 - 120] + }; + //---- Tight efficiencies + const float ElEff_Step1p6_mu200_Tight[nEtBins][netaBins] = { + {0.502564, 0.0865130, 0.511916, 0.179267, 0.390, 0.494, 0.311, 0.343, 0.394 }, // Et[ 7 - 15] + {0.477559, 0.0881834, 0.479972, 0.151342, 0.476, 0.538, 0.298, 0.395, 0.470 }, // Et[ 15 - 20] + {0.610466, 0.0885553, 0.575190, 0.182265, 0.497, 0.598, 0.301, 0.467, 0.495 }, // Et[ 20 - 30] + {0.622935, 0.1266680, 0.625772, 0.221215, 0.478, 0.652, 0.311, 0.538, 0.556 }, // Et[ 30 - 50] + {0.780432, 0.1690660, 0.752847, 0.250731, 0.527, 0.689, 0.340, 0.594, 0.595 }, // Et[ 50 - 80] + {0.883690, 0.1974720, 0.850847, 0.242215, 0.514, 0.671, 0.421, 0.589, 0.600 }, // Et[ 80 - 120] + }; + + + float *mapToUse = (float *) ElEff_Step1p6_mu200_Loose; + + if(m_layout == UpgradePerformanceFunctions::Step1p6){ + if(m_avgMu == 200){ + if(m_eleCutLevel==UpgradePerformanceFunctions::looseElectron) mapToUse = (float *) ElEff_Step1p6_mu200_Loose; + else if(m_eleCutLevel==UpgradePerformanceFunctions::mediumElectron) mapToUse = (float *) ElEff_Step1p6_mu200_Medium; + else if(m_eleCutLevel==UpgradePerformanceFunctions::tightElectron) mapToUse = (float *) ElEff_Step1p6_mu200_Tight; + else std::cout << "getElectronEfficiency: working point." << std::endl; + } else { + std::cout << "getElectronEfficiency: Invalid <mu> value." << std::endl; + } + } else{ + std::cout << "getElectronEfficiency: Invalid layout." << std::endl; + } + + + float efficiency = 1.; + efficiency = interpolateElectronIDMap(mapToUse, ptGeV, eta); + + // HGTD hack to improve Electron ID/ISO efficiency + if (m_bUseHGTD0 || m_bUseHGTD1){ + if (fabs(eta) > 2.4 && fabs(eta) < 3.6) + efficiency = 1.2*efficiency; + } + + + + if(efficiency>1.0) efficiency = 1.0; + + return efficiency; + +} + + +//********************************************************************* +float UpgradePerformanceFunctions::interpolateElectronIDMap(float *ptEtaMap,float pT,float eta) +//********************************************************************* +{ + //---- get efficiency value from the 2D maps: linear interpolation in pT and no interpolation in eta + + const int netaBins=9+1; + const float etaBins[netaBins]={0.00,1.37,1.52,2.37,2.47,2.50,3.16,3.35,4.00,4.90}; + const int nEtBins=6+1; + const float EtBins[nEtBins]={7.0,15.0,20.0,30.0,50.0,80.0,120.00}; + + //---- if pt is out of range, use values estimated at the boundaries + if(pT < 7) pT = 7.1; + if(pT >=120) pT =119.; + if( fabs(eta)>4.9 ) return 0.; //---- no electrons after |eta|=4.9 + + + //--- find associated bin eta + int etaBin =0; + for( int ietaBin = 0 ; ietaBin < netaBins ; ietaBin++ ){ + if( fabs(eta) < etaBins[ietaBin] ) {etaBin = ietaBin-1; break;} + } + + + //--- linear interpolation in pT + int EtBin=0.; + for(int ipT=0;ipT<nEtBins-1;ipT++){ + float binCenter=(EtBins[ipT+1]-EtBins[ipT])/2.+EtBins[ipT]; + // printf("bin center =%f \n",binCenter); + if(pT<binCenter) {EtBin=ipT; break;} + } + if(EtBin==0) EtBin=1; + if(pT>(EtBins[nEtBins-1]-EtBins[nEtBins -2])/2.+EtBins[nEtBins -2]) EtBin = nEtBins -2; + + float y0=ptEtaMap[etaBin+(EtBin-1)*(netaBins-1)]; + float y1=ptEtaMap[etaBin+EtBin*(netaBins-1)]; + float x0=(EtBins[EtBin]-EtBins[EtBin-1])/2.+EtBins[EtBin-1]; + float x1=(EtBins[EtBin+1]-EtBins[EtBin])/2.+EtBins[EtBin]; + + float value = y0 +(y1-y0)/(x1-x0) * (pT-x0); + // printf("ID Interpolation: pt=%f eta=%f ptBin=%d etaBin=%d y0=%f y1=%f x0=%f x1=%f eff_int=%f \n", + // pT, eta, EtBin,etaBin,y0,y1,x0,x1,value); + + return value; +} + + +//********************************************************************* +float UpgradePerformanceFunctions::getElectronFakeRate(float ptMeV, float eta) +//********************************************************************* +{ + //---- returns the probability to find a fake electron in a true jet + //---- pt and eta passed as arguments are the one of the true jet. + + + //----- old code + // if (m_eleCutLevel==looseElectron) { + // return 0.11*exp(-0.033*ptGeV); + // } else if (m_eleCutLevel==tightElectron) { + // return 0.0048*exp(-0.035*ptGeV); + // } + // std::cout << "getElectronFakeRate: Invalid working point." << std::endl; + // return 0.0; + + float ptGeV = ptMeV / 1000.; + + //---- define all the different rejection maps + const int nEtBins=6; + const int netaBins=9; + + //---- Loose rejections + const float ElRej_Step1p6_mu200_Loose[nEtBins][netaBins] = { + {0.00195988, 0.00216694, 0.00192640, 0.001870430, 0.03387, 0.21455, 0.03159, 0.05765, 0.10045 }, // Et[ 7 - 15] + {0.00151187, 0.00166038, 0.00111048, 0.000465166, 0.03352, 0.07307, 0.00990, 0.02623, 0.05692 }, // Et[ 15 - 20] + {0.01049130, 0.01070800, 0.01025600, 0.004284760, 0.01399, 0.07198, 0.01366, 0.03694, 0.05564 }, // Et[ 20 - 30] + {0.02967210, 0.02160850, 0.01595040, 0.009497750, 0.01000, 0.07853, 0.00737, 0.04065, 0.08466 }, // Et[ 30 - 50] + {0.02899700, 0.01360980, 0.01074280, 0.009661120, 0.00200, 0.06102, 0.00377, 0.02259, 0.08377 }, // Et[ 50 - 80] + {0.01316430, 0.00536150, 0.00440815, 0.004994890, 0.00200, 0.02148, 0.00400, 0.01124, 0.08000 }, // Et[ 80 - 120] + }; + //---- Medium rejections + const float ElRej_Step1p6_mu200_Medium[nEtBins][netaBins] = { // Uses Tight for forward + {0.000543203, 0.00101639, 0.001031270, 0.000934764, 0.00178, 0.04728, 0.00776, 0.01083, 0.05098 }, // Et[ 7 - 15] + {0.000545234, 0.00077875, 0.000603672, 0.000155274, 0.00400, 0.01879, 0.00275, 0.00351, 0.02338 }, // Et[ 15 - 20] + {0.003723280, 0.00600581, 0.005556440, 0.002600780, 0.00200, 0.02239, 0.00216, 0.00693, 0.02708 }, // Et[ 20 - 30] + {0.008094550, 0.00918458, 0.007661610, 0.006000600, 0.00200, 0.02764, 0.00246, 0.00976, 0.03101 }, // Et[ 30 - 50] + {0.005466250, 0.00500072, 0.004162790, 0.002824940, 0.00200, 0.01569, 0.00300, 0.00821, 0.03074 }, // Et[ 50 - 80] + {0.001913070, 0.00125468, 0.001579960, 0.001103200, 0.00200, 0.00983, 0.00400, 0.00900, 0.03000 }, // Et[ 80 - 120] + }; + //---- Tight rejections + const float ElRej_Step1p6_mu200_Tight[nEtBins][netaBins] = { + {0.000254955, 0.000338584, 0.000272351, 8.71700e-07, 0.00178, 0.04728, 0.00776, 0.01083, 0.05098 }, // Et[ 7 - 15] + {0.000200977, 0.000104911, 0.000151485, 0.000154067, 0.00400, 0.01879, 0.00275, 0.00351, 0.02338 }, // Et[ 15 - 20] + {0.001551070, 0.002399770, 0.001684880, 0.000680364, 0.00200, 0.02239, 0.00216, 0.00693, 0.02708 }, // Et[ 20 - 30] + {0.003018910, 0.002903950, 0.002375240, 0.001279900, 0.00200, 0.02764, 0.00246, 0.00976, 0.03101 }, // Et[ 30 - 50] + {0.001606890, 0.001138090, 0.000816277, 0.001022920, 0.00200, 0.01569, 0.00300, 0.00821, 0.03074 }, // Et[ 50 - 80] + {0.000484336, 0.000187961, 0.000255402, 0.000796447, 0.00200, 0.00983, 0.00400, 0.00900, 0.03000 }, // Et[ 80 - 120] + }; + + + float *mapToUse = (float *) ElRej_Step1p6_mu200_Loose; + + if(m_layout == UpgradePerformanceFunctions::Step1p6){ + if(m_avgMu == 200){ + if(m_eleCutLevel==UpgradePerformanceFunctions::looseElectron) mapToUse = (float *) ElRej_Step1p6_mu200_Loose; + else if(m_eleCutLevel==UpgradePerformanceFunctions::mediumElectron) mapToUse = (float *) ElRej_Step1p6_mu200_Medium; + else if(m_eleCutLevel==UpgradePerformanceFunctions::tightElectron) mapToUse = (float *) ElRej_Step1p6_mu200_Tight; + else std::cout << "getElectronFakeRate: Invalid working point." << std::endl; + } else { + std::cout << "getElectronFakeRate: Invalid <mu> value." << std::endl; + } + } else{ + std::cout << "getElectronFakeRate: Invalid layout." << std::endl; + } + + + + float efficiency = 1.; + efficiency = interpolateElectronIDMap(mapToUse, ptGeV, eta); + + if(efficiency>1.0) efficiency = 1.0; + if(efficiency<=0.0) efficiency = 0.0001; + + return efficiency; + +} + + +//********************************************************************* +float UpgradePerformanceFunctions::getElectronEnergyResolution(float eMeV, float eta) +//********************************************************************* +{ + //---- Returns the absolute energy resolution in MeV + + //---- old code + // const double ET_pu=0.6; //0.6 GeV in ET for mu=80,in a trigger tower, after pu suppression; supposed identical for a cluster; taken from ATLAS-TDR-022-2013 page 25 + // float S=0; + // float C=0; + // if (fabs(eta)<1.4) { + // S = 0.10; + // C = 0.010; + // } + // else { + // S = 0.15; + // C = 0.015; + // } + // + // double mu = m_avgMu; + // double sigma2 = 0.3*0.3 + ET_pu*ET_pu*cosh(eta)*cosh(eta)*mu/80. + S*S*eGeV + C*C*eGeV*eGeV; + // return sqrt(sigma2); + + + float eGeV = eMeV / 1000.; + + + //---- define all the different resolution maps + const int nEtBins=6; + const int netaBins=13; + + const float ElERes_Step1p6_mu200[nEtBins][netaBins] = { + {0.1198100*100., 0.1802750*100., 0.1152670*100., 0.0983971*100., 23.463, 31.330, 30.128, 30.949, 31.443, 31.591, 66.794, 50.884, 41.477 }, // Et[ 7 - 15] + {0.0818551*100., 0.1259540*100., 0.0787411*100., 0.0671563*100., 20.472, 22.108, 26.614, 34.214, 21.778, 36.023, 41.312, 26.732, 38.689 }, // Et[ 15 - 20] + {0.0584391*100., 0.1038040*100., 0.0565978*100., 0.0525409*100., 4.708, 15.902, 18.687, 25.653, 18.251, 21.885, 29.429, 29.209, 27.694 }, // Et[ 20 - 30] + {0.0392075*100., 0.0779442*100., 0.0393392*100., 0.0407998*100., 4.059, 10.854, 12.880, 22.009, 13.843, 17.826, 21.827, 18.746, 23.942 }, // Et[ 30 - 50] + {0.0284292*100., 0.0615827*100., 0.0300611*100., 0.0351892*100., 2.645, 7.612, 9.939, 21.029, 10.993, 12.557, 19.503, 11.262, 19.107 }, // Et[ 50 - 80] + {0.0206782*100., 0.0481260*100., 0.0226532*100., 0.0312146*100., 3.379, 7.322, 12.745, 25.013, 12.438, 11.777, 13.288, 15.000, 18.000 }, // Et[ 80 - 120] + }; + + float *mapToUse = (float *) ElERes_Step1p6_mu200; + + if(m_layout == UpgradePerformanceFunctions::Step1p6){ + if(m_avgMu == 200){ + mapToUse = (float *) ElERes_Step1p6_mu200; + } else { + std::cout << "getElectronEnergyResolution: Invalid <mu> value." << std::endl; + } + } else{ + std::cout << "getElectronEnergyResolution: Invalid layout." << std::endl; + } + + + + float resolution = 1.; + float Et = eGeV/cosh(eta); + resolution = interpolateElectronResolutionMap(mapToUse, Et, eta); + resolution = resolution/100. * eMeV; + + return resolution; + +} + + +//********************************************************************* +float UpgradePerformanceFunctions::interpolateElectronResolutionMap(float *ptEtaMap,float pT,float eta) +//********************************************************************* +{ + //---- get resolution value from the 2D maps: linear interpolation in pT and no interpolation in eta + + + const int nEtBins=6+1; + const float EtBins[nEtBins]={7.0,15.0,20.0,30.0,50.0,80.0,120.00}; + const int netaBins=13+1; + const float etaBins[netaBins]={0.00,1.37,1.52,2.37,2.47,2.50,2.80,3.16,3.35,3.70,4.00,4.30,4.60,4.90}; + + + + //---- if pt or eta is out of range, use values estimated at the boundaries + if(pT < 7) pT = 7.1; + if(pT >=120) pT =119.; + if( fabs(eta)>4.9 ) eta = 4.8; + + + //--- find associated bin in eta + int etaBin =0; + for( int ietaBin = 0 ; ietaBin < netaBins ; ietaBin++ ){ + if( fabs(eta) < etaBins[ietaBin] ) {etaBin = ietaBin-1; break;} + } + + + //--- linear interpolation in pT + int EtBin=0.; + for(int ipT=0;ipT<nEtBins-1;ipT++){ + float binCenter=(EtBins[ipT+1]-EtBins[ipT])/2.+EtBins[ipT]; + // printf("bin center =%f \n",binCenter); + if(pT<binCenter) {EtBin=ipT; break;} + } + if(EtBin==0) {EtBin=1;} + if(pT>(EtBins[nEtBins-1]-EtBins[nEtBins -2])/2.+EtBins[nEtBins -2]) {EtBin = nEtBins -2;} + + float y0=ptEtaMap[etaBin+(EtBin-1)*(netaBins-1)]; + float y1=ptEtaMap[etaBin+EtBin*(netaBins-1)]; + float x0=(EtBins[EtBin]-EtBins[EtBin-1])/2.+EtBins[EtBin-1]; + float x1=(EtBins[EtBin+1]-EtBins[EtBin])/2.+EtBins[EtBin]; + + float value = y0 +(y1-y0)/(x1-x0) * (pT-x0); + + // printf("Resol Interpolation: pt=%f eta=%f ptBin=%d etaBin=%d y0=%f y1=%f x0=%f x1=%f eff_int=%f \n", + // pT, eta, EtBin,etaBin,y0,y1,x0,x1,value); + + return value; +} + +float UpgradePerformanceFunctions::getElectronFakeRescaledEnergy(float eMeV, float eta) +{ + // + // if (m_eleCutLevel == looseElectron) { + // float binning[20] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 200}; + // float scales[20] = {-0.60, -0.636549, -0.677891, -0.701189, -0.707942, -0.703792, -0.701427, -0.700264, -0.70114, -0.701068, -0.698009, -0.692705, -0.681838, -0.678387, -0.676639, -0.668481, -0.663736, -0.668471, -0.666521, -0.665515}; + // float sigmas[20] = {0.13, 0.132724, 0.143584, 0.145539, 0.149064, 0.153829, 0.156095, 0.157976, 0.160515, 0.162841, 0.169783, 0.174657, 0.183426, 0.185493, 0.189531, 0.194585, 0.201598, 0.195728, 0.202998, 0.206324}; + // + // //Checking which bin we are in + // int i=0; + // while (i<19 && eMeV/1000.>binning[i+1]) i++; + // + // return eMeV * (1 + m_electronRandom.Gaus(scales[i],sigmas[i]) ); + // } else if (m_eleCutLevel == tightElectron) { + // float binning[20] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 200}; + // float scales[20] = {-0.5, -0.541424, -0.601461, -0.621471, -0.621278, -0.608145, -0.622162, -0.624346, -0.622605, -0.637172, -0.620544, -0.637961, -0.637561, -0.610907, -0.630854, -0.60472, -0.622769, -0.64527, -0.610933, -0.612421}; + // float sigmas[20] = {0.17, 0.174439, 0.183794, 0.191502, 0.196909, 0.195764, 0.185789, 0.182931, 0.184728, 0.185637, 0.201431, 0.198198, 0.204317, 0.215402, 0.220042, 0.228437, 0.224068, 0.196602, 0.215806, 0.22049}; + // + // //Checking which bin we are in + // int i=0; + // while (i<19 && eMeV/1000.>binning[i+1]) i++; + // + // return eMeV * (1 + m_electronRandom.Gaus(scales[i],sigmas[i]) ); + // } + // std::cout << "getElectronFakeRescaledEnergy: Invalid working point." << std::endl; + // return 0.; + + float eGeV = eMeV / 1000.; + + //---- define all the different resolution maps + const int nEtBins=6; + const int netaBins=13; + + const float FakeElERes_Step1p6_mu200[nEtBins][netaBins] = { + {0.215850*100., 0.2509200*100., 0.226899*100., 0.2177890*100., 26.483, 29.914, 25.624, 19.891, 26.264, 40.642, 37.070, 25.230, 27.114 }, // Et[ 7 - 15] + {0.127096*100., 0.0954196*100., 0.137824*100., 0.1581890*100., 19.351, 19.388, 21.214, 21.687, 22.560, 24.960, 28.403, 19.745, 18.065 }, // Et[ 15 - 20] + {0.108781*100., 0.1208100*100., 0.123372*100., 0.0899702*100., 17.189, 26.337, 26.394, 27.880, 28.668, 28.830, 19.176, 20.914, 21.044 }, // Et[ 20 - 30] + {0.114487*100., 0.1151550*100., 0.123138*100., 0.1039210*100., 28.864, 26.548, 28.442, 21.397, 31.808, 33.471, 32.299, 34.021, 13.374 }, // Et[ 30 - 50] + {0.132072*100., 0.1280030*100., 0.146805*100., 0.1293320*100., 17.310, 25.298, 30.297, 22.810, 24.702, 40.313, 25.989, 13.648, 13.000 }, // Et[ 50 - 80] + {0.149085*100., 0.1444860*100., 0.163099*100., 0.1728600*100., 20.000, 29.422, 26.174, 18.309, 27.016, 30.000, 25.000, 13.000, 13.000 }, // Et[ 80 - 120] + }; + + const float FakeElEMean_Step1p6_mu200[nEtBins][netaBins] = { + {-0.129779*100., -0.0694363*100., -0.120145*100., -0.192361*100., -41.114, -37.021, -35.317, -42.786, -38.173, -27.559, -21.585, -35.194, -35.063 }, // Et[ 7 - 15] + {-0.469581*100., -0.4570630*100., -0.450520*100., -0.458052*100., -59.498, -55.379, -51.320, -54.775, -50.341, -44.135, -41.046, -45.722, -52.332 }, // Et[ 15 - 20] + {-0.608841*100., -0.6018530*100., -0.594601*100., -0.642869*100., -62.387, -57.335, -56.578, -57.478, -54.888, -47.901, -53.553, -53.412, -49.805 }, // Et[ 20 - 30] + {-0.694832*100., -0.7042020*100., -0.681389*100., -0.717625*100., -56.299, -64.534, -63.959, -70.303, -52.127, -42.937, -42.434, -43.946, -61.434 }, // Et[ 30 - 50] + {-0.740818*100., -0.7518000*100., -0.720020*100., -0.760622*100., -88.036, -68.803, -62.959, -70.482, -44.580, -64.827, -47.059, -70.419, -66.659 }, // Et[ 50 - 80] + {-0.737606*100., -0.7561220*100., -0.711455*100., -0.777686*100., -83.808, -68.931, -67.335, -83.441, -73.737, -42.267, -44.499, -30.000, -50.000 }, // Et[ 80 - 120] + }; + + float resolution = 1.; + float mean = 1.; + float Et = eGeV/cosh(eta); + resolution = interpolateElectronResolutionMap((float *) FakeElERes_Step1p6_mu200, Et, eta); + resolution = resolution/100.; + + mean = interpolateElectronResolutionMap((float *) FakeElEMean_Step1p6_mu200, Et, eta); + mean = mean/100.; + + float fakeElEnergy = eMeV * (1 + m_electronRandom.Gaus(mean,resolution) ); + + //printf("Fake el. energy = %f [ mean=%f res=%f ] Et=%f eta=%f\n",fakeElEnergy/1000.,mean/1000.,resolution/1000., Et, eta); + + return fakeElEnergy; + +} + +//********************************************************************* +float UpgradePerformanceFunctions::getElectronChargeFlipProb(float eMeV, float eta) +//********************************************************************* +{ + if(m_layout == UpgradePerformanceFunctions::Step1p6){ + if(m_avgMu == 200){ + if(m_eleCutLevel==UpgradePerformanceFunctions::looseElectron) + { + if(eta<=1.37) return 0.000574553; + else if(eta<=1.52) return 0.00112754; + else if(eta<=2.37) return 0.0028518; + else if(eta<=2.47) return 0.006875; + else + { + std::cout<<"WARNING from ElectronPerformanceFunctions: No track for electrons with eta>2.47! Setting ElectronChargeFlipProb to -1"<<std::endl; + return -1; + } + //return 0.00150572; //Inclusive number + } + else if(m_eleCutLevel==UpgradePerformanceFunctions::mediumElectron) + { + if(eta<=1.37) return 0.000517473; + else if(eta<=1.52) return 0.00118747; + else if(eta<=2.37) return 0.0029035; + else if(eta<=2.47) return 0.00714048; + else + { + std::cout<<"WARNING from ElectronPerformanceFunctions: No track for electrons with eta>2.47! Setting ElectronChargeFlipProb to -1"<<std::endl; + return -1; + } + //return 0.00143039; //Inclusive number + } + else if(m_eleCutLevel==UpgradePerformanceFunctions::tightElectron) + { + if(eta<=1.37) return 0.000393824; + else if(eta<=1.52) return 0.00166078; + else if(eta<=2.37) return 0.00292826; + else if(eta<=2.47) return 0.00722175; + else + { + std::cout<<"WARNING from ElectronPerformanceFunctions: No track for electrons with eta>2.47! Setting ElectronChargeFlipProb to -1"<<std::endl; + return -1; + } + //return 0.00133191; //Inclusive number + } + else std::cout << "getElectronEfficiency: working point." << std::endl; + } else { + std::cout << "getElectronEfficiency: Invalid <mu> value." << std::endl; + } + } else{ + std::cout << "getElectronEfficiency: Invalid layout." << std::endl; + } + + // Return error value if there is a problem + return -1; + +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/FlavourTaggingPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/FlavourTaggingPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e54f47410ab1b060698513cc98bab1d4ca072149 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/FlavourTaggingPerformanceFunctions.cxx @@ -0,0 +1,189 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FLAVOURTAGGINGPERFORMANCEFUNCTIONS_CXX +#define FLAVOURTAGGINGPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +#include <map> +using std::map; + +#include <TF2.h> +#include <TFile.h> + +#ifdef ROOTCORE +// Framework include(s): +#include "PathResolver/PathResolver.h" +#endif // ROOTCORE + +void UpgradePerformanceFunctions::setFlavourTaggingCalibrationFilename(TString flavourTaggingCalibrationFilename) { + std::cout << "Flavour tagging histogram input filename is " + << flavourTaggingCalibrationFilename << std::endl; + std::string file = flavourTaggingCalibrationFilename.Data(); +#ifdef ROOTCORE + // Get file from data path + file = PathResolverFindCalibFile(file); + std::cout << "Found flavour tagging histogram file: " << file << std::endl; +#endif // ROOTCORE + m_flavourTaggingCalibrationFilename = file; +} + +float UpgradePerformanceFunctions::getFlavourTagEfficiency(float ptMeV, float eta, char flavour, TString tagger, int operating_point, bool track_confirmation) { + double ptGeV = ptMeV/1000.; + + // the function returns b/c/l-tagging efficincies obtained using ttbar samples + + // flavour is a char: IN CAPS! + // 'B' (to get the b-tag efficiency) + // 'C' (to get the c-tag efficiency) + // 'L' (to get the mistag rate) + // 'P' (to get the PU-tag efficiency) + + // pT range protection + // if (ptGeV<20) ptGeV = 20; + if (ptGeV<20) return 0.; + + // high pT approximation + double highpt_factor = 1; + if (ptGeV>300) { + double x = ptGeV; if (x>1000) x = 1000; + if (tagger=="mv1_flat_high_pt") { + if (flavour=='C') { + highpt_factor = 1.6070808467835-0.00243838298663*x+1.4234528100804e-06*x*x-1.3617421117693e-10*x*x*x; + } else if (flavour=='L' || flavour=='P') { + highpt_factor = 7.5679905186556-0.029707488878509*x+2.8845677013756e-05*x*x-9.327955049668e-09*x*x*x; + highpt_factor = exp(highpt_factor-1); + } + highpt_factor = 1./highpt_factor; + } else if (tagger=="mv1") { + double p1 = 0; + if (flavour=='B') p1 = -6.17434e-04; + else if (flavour=='C') p1 = -7.20231e-04; + else /* L,P */ p1 = 2.78547e-04; + highpt_factor = 1 + p1*(x-300); + } + } + if (tagger=="mv1_flat_high_pt") tagger = "mv1"; + + // load the parameterization + // see r-tags list at https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AtlasProductionGroupMC12Upgrade + const int nopt = 7; + const char* chopt[nopt] = { + "mu200_sc6226", + "mu200_sc6285", + "mu200_sc6284", + "mu140_sc6153", + "mu140_sc6295", + "mu140_sc6294", + "mu80_sc6296" + }; + + static double etamax[nopt] = { + 4,3.3,2.7,4,3.3,2.7,2.7 + }; + + int ipar; + if (m_avgMu==200 && m_layout==gold ) ipar = 0; + else if (m_avgMu==200 && m_layout==silver) ipar = 1; + else if (m_avgMu==200 && m_layout==bronze) ipar = 2; + else if (m_avgMu==140 && m_layout==gold ) ipar = 3; + else if (m_avgMu==140 && m_layout==silver) ipar = 4; + else if (m_avgMu==140 && m_layout==bronze) ipar = 5; + else if (m_avgMu==80 && m_layout==bronze) ipar = 6; + else { + static bool first = true; + if (first) { + std::cout << "flavor tagging for mu=" << m_avgMu << ", layout=" << m_layout << " is not implemented" << std::endl; + first = false; + } + return 0; + } + int iopt = ipar; + + // eta range protection + if (eta<0) eta = -eta; + if (eta>etamax[iopt]) return 0; + + const int ntag = 3; + ipar *= ntag; + if (tagger=="comb") { /* ipar += 0; */ } + else if (tagger=="mv1") ipar += 1; + else if (tagger=="ip3d") ipar += 2; + else { + static bool first = true; + if (first) { + std::cout << "tagger \"" << tagger << "\" is not implemented" << std::endl; + first = false; + } + return 0; + } + + const int nopp = 2; + ipar *= nopp; + if (operating_point==70) { /* ipar += 0; */ } + else if (operating_point==85) ipar += 1; + else { + static bool first = true; + if (first) { + std::cout << "operating point " << operating_point << " for tagger \"" << tagger << "\" is not implemented" << std::endl; + first = false; + } + return 0; + } + + const int ntc = 2; + ipar *= ntc; + if (track_confirmation) ++ipar; + + const int nfl = 4; // 0='L', 1='C', 2='B', 3='P' + + // load parameterizations + static TF2* fitfun[nopt*ntag*nopp*ntc*nfl] = {0}; + static TFile* ff = 0; + int ix = ipar*nfl; + std::string calibFile = m_flavourTaggingCalibrationFilename.Data(); //"flavor_tags_v0.3.root"; + if (fitfun[ix]==0) { + // load new parameterization + std::cout << "Loading " << calibFile << std::endl; + if (ff==0) ff = new TFile(calibFile.c_str(), "READ"); + for (int jfl = 0; jfl<nfl; ++jfl) { + TString sff = "fitfun_"; sff += chopt[iopt]; sff += "_"; sff += tagger; + if (track_confirmation) sff += "_TC"; + if (operating_point==85) sff += "_085"; + sff += "_"; sff += char('0'+jfl); + std::cout << "Load <" << sff << ">" << std::endl; + fitfun[ix+jfl] = (TF2*)ff->Get(sff); + } + } + + // load additional pt limits + static double pt_limits[nfl] = {0}; + if (pt_limits[0]==0) { + TF1* fun_pt_limits = (TF1*)ff->Get("pt_limits"); + if (fun_pt_limits) { + std::cout << "Loading additional pT limits:"; + for (int i = 0; i<nfl; ++i) std::cout << " " << (pt_limits[i] = fun_pt_limits->Eval(i)); + std::cout << std::endl; + } else { + std::cout << "No additional pT limits, using default" << std::endl; + for (int i = 0; i<nfl; ++i) pt_limits[i] = 300; // GeV + } + } + if (flavour=='L' && ptGeV>pt_limits[0]) ptGeV = pt_limits[0]; + if (flavour=='C' && ptGeV>pt_limits[1]) ptGeV = pt_limits[1]; + if (flavour=='B' && ptGeV>pt_limits[2]) ptGeV = pt_limits[2]; + if (flavour=='P' && ptGeV>pt_limits[3]) ptGeV = pt_limits[3]; + + // calculate the efficiency + float eff = -1; + if (flavour=='L') eff = fitfun[ix]->Eval(ptGeV,eta); + else if (flavour=='C') eff = fitfun[ix+1]->Eval(ptGeV,eta); + else if (flavour=='B') eff = fitfun[ix+2]->Eval(ptGeV,eta); + else if (flavour=='P') eff = fitfun[ix+3]->Eval(ptGeV,eta); + + return eff*highpt_factor; +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/JetPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/JetPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d9140aface84bc2b6f49062507e783ae2358756f --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/JetPerformanceFunctions.cxx @@ -0,0 +1,156 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETPERFORMANCEFUNCTIONS_CXX +#define JETPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +void UpgradePerformanceFunctions::setJetRandomSeed(unsigned seed) { + m_jetRandom.SetSeed(seed); +} + +float UpgradePerformanceFunctions::getJetSmearedEnergy(float ptMeV, float eta, bool useJetArea) { + if(ptMeV < 5000. || ptMeV > 1500000.){ + std::cout << " getJetSmearedEnergy valid only in range 10-1500 GeV)" << std::endl; + return 0; + } + if(fabs(eta) > 4.5){ + // std::cout << " getJetSmearedEnergy valid only in eta range (-4.5 - 4.5), current eta: " << eta << std::endl; + return 0; + } + + double mysigma = getJetEnergyResolution(ptMeV, eta, useJetArea); + double smearFactor = m_jetRandom.Gaus(1, mysigma); + return std::max(ptMeV*smearFactor, 1E-08); +} + +float UpgradePerformanceFunctions::getJetEnergyResolution(float ptMeV, float eta, bool useJetArea) { + // This currently returns relative energy resolution. + + //eta binning + //double Etamin[4]={0,0.8,1.2,2.8}; + //double Etamax[4]={0.8,1.2,2.8,4.5}; + eta = fabs(eta); + + double sigma = 0; + double N = 0; double S = 0; double C = 0; + double A = 0; double B = 0; + + if( 0 <= eta && eta < 0.8){ + C = 0.055; + S = 0.74; + if(!useJetArea){ + A = 3.16; + B = 0.07; + } + else{ + A = 3.2; + B = 0.035; + } + } + else if(0.8 <= eta && eta < 1.2){ + C = 0.053; + S = 0.85; + if(!useJetArea){ + A = 3.03; + B = 0.07; + } + else{ + A = 2.9; + B = 0.04; + } + } + else if( 1.2 <= eta && eta < 2.8){ + C = 0.056; + S = 0.56; + if(!useJetArea){ + A = 3.32; + B = 0.08; + } + else{ + A = 3.5; + B = 0.03; + } + } + else if( 2.8 <= eta && eta < 4.5){ + C = 0.054; + S = 0.83; + if(!useJetArea){ + A = 2.84; + B = 0.11; + } + else{ + A = 2.9; + B = 0.06; + } + } + else {std::cout << "getJetEnergyResolution: eta value not allowed: " << eta << std::endl;} + + N = A + B*m_avgMu; //same as old f_N function + sigma = sqrt(N*N / (ptMeV/1000. * ptMeV/1000.) + S*S/(ptMeV/1000.) + C*C); //same as old f_reso + return sigma; +} + +// float UpgradePerformanceFunctions::getTrackJetConfirmEff(float ptGeV, float eta) { +// if (m_avgMu!=150) { +// std::cout << "WARNING : track-jet confirmation not implemented for mu!=150 !" << std::endl; +// return 1e6; +// } +// if (fabs(eta)>2.1) { +// std::cout << "WARNING : track-jet confirmation not implemented for abs(eta)>2.1 !" << std::endl; +// return 1e6; +// } + +// if (ptGeV<20.) { +// std::cout << "WARNING : track-jet confirmation not implemented for pT<20000 MeV !" << std::endl; +// return 0.; +// } +// else if (ptGeV<25.) +// return 0.75; +// else if (ptGeV<35.) +// return 0.80; +// return 0.95; +//} + +float UpgradePerformanceFunctions::getJetPtThresholdForFakeRate(float eta, float fakeRate, bool useTrackConfirmation) { + // Note output is now in MeV + if (m_avgMu!=150) { + std::cout << "WARNING : fake rate parametrization not implemented for mu!=150 !" << std::endl; + return 1e6; + } + + float a=0, b=0; + if (fabs(eta)<2.1) { + if (!useTrackConfirmation) { + a=36.; + b=-0.16; + } + else { + a=18.; + b=-0.18; + } + } + else { + if (useTrackConfirmation) { + std::cout << "WARNING : Track Confirmation not available for fake rate parametrization about eta=2.1 !" << std::endl; + return 1e6; + } + if (fabs(eta)<2.8) { + a=32.; + b=-0.19; + } + else if (fabs(eta)<3.2) { + a=31.; + b=-0.19; + } + else if (fabs(eta)<4.5) { + a=19.; + b=-0.21; + } + } + return (a * pow(fakeRate, b))*1000.; +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/LinkDef.h b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..f9fa452558b6689ef1035f603096f64ab7ab8510 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/LinkDef.h @@ -0,0 +1,12 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ nestedclass; + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MissingETPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MissingETPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1dc75a5f1662799d566026c204f2bc312d3b6c70 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MissingETPerformanceFunctions.cxx @@ -0,0 +1,178 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MISSINGETPERFORMANCEFUNCTIONS_CXX +#define MISSINGETPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" +#include "TFile.h" + +#ifdef ROOTCORE +// Framework include(s): +#include "PathResolver/PathResolver.h" +#endif // ROOTCORE + +void UpgradePerformanceFunctions::setMETRandomSeed(unsigned seed) { + m_METRandom.SetSeed(seed); +} + +void UpgradePerformanceFunctions::loadMETHistograms(TString filename) { + std::cout << "Loading Missing ET histogram file " << filename << std::endl; + std::string METFile = filename.Data(); +#ifdef ROOTCORE +// Get file from data path + METFile = PathResolverFindCalibFile(METFile); + std::cout << "Found Missing ET histogram file: " << METFile << std::endl; +#endif // ROOTCORE + + TFile *m_infile=new TFile(METFile.c_str(),"READ"); + +// m_SumEtH[0][nominal]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu60_th60_calibrated")); +// m_SumEtH[0][process]=static_cast<TH1F*>(m_infile->Get("sumetPU_j0_mu60_th60_calibrated")); +// m_SumEtH[0][thresholdUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu60_th80_uncalibrated")); +// m_SumEtH[0][thresholdDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu60_th40_uncalibrated")); +// m_SumEtH[0][resoUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu60_th60_calibrated")); +// m_SumEtH[0][resoDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu60_th60_calibrated")); +// m_Ress[0]=static_cast<TGraphErrors*>(m_infile->Get("METresol_j0_mu60_th60_calibrated")); + +// m_SumEtH[1][nominal]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu80_th80_calibrated")); +// m_SumEtH[1][process]=static_cast<TH1F*>(m_infile->Get("sumetPU_j0_mu80_th80_calibrated")); +// m_SumEtH[1][thresholdUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_j3_mu80_th100_uncalibrated")); +// m_SumEtH[1][thresholdDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu80_th60_uncalibrated")); +// m_SumEtH[1][resoUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu80_th80_calibrated")); +// m_SumEtH[1][resoDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu80_th80_calibrated")); +// m_Ress[1]=static_cast<TGraphErrors*>(m_infile->Get("METresol_j0_mu80_th80_calibrated")); + +// m_SumEtH[2][nominal]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu140_th140_calibrated")); +// m_SumEtH[2][process]=static_cast<TH1F*>(m_infile->Get("sumetPU_j0_mu140_th140_calibrated")); +// m_SumEtH[2][thresholdUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu140_th200_uncalibrated")); +// m_SumEtH[2][thresholdDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu140_th100_uncalibrated")); +// m_SumEtH[2][resoUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu140_th140_calibrated")); +// m_SumEtH[2][resoDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu140_th140_calibrated")); +// m_Ress[2]=static_cast<TGraphErrors*>(m_infile->Get("METresol_j0_mu140_th140_calibrated")); + + m_SumEtH[3][nominal]=static_cast<TH1F*>(m_infile->Get("h_sumetPU")); +// m_SumEtH[3][nominal]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu200_th200_uncalibrated")); +// m_SumEtH[3][process]=static_cast<TH1F*>(m_infile->Get("sumetPU_j0_mu200_th200_uncalibrated")); +// m_SumEtH[3][thresholdUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu200_th200_uncalibrated")); +// m_SumEtH[3][thresholdDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu200_th140_uncalibrated")); +// m_SumEtH[3][resoUp]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu200_th200_uncalibrated")); +// m_SumEtH[3][resoDown]=static_cast<TH1F*>(m_infile->Get("sumetPU_zprime_mu200_th200_uncalibrated")); +// m_Ress[3]=static_cast<TGraphErrors*>(m_infile->Get("METresol_j0_mu200_th200_uncalibrated")); + +} + +UpgradePerformanceFunctions::MET UpgradePerformanceFunctions::getMETSmeared(float sumEtMeV, float METxMeV, float METyMeV, METSyst systValue) { + double sumETPU; + double sumET; + double METPUreso; + + double METPUsmearX; + double METPUsmearY; + UpgradePerformanceFunctions::MET tmpMET; + + int PUcondition; + // typedef enum {mu60=0, mu80=1, mu140=2, mu200=3} mu; + if (m_avgMu <= 60.) PUcondition = 0; + else if (m_avgMu <= 80.) PUcondition = 1; + else if (m_avgMu <= 140.) PUcondition = 2; + else PUcondition = 3; + + if (PUcondition!=3 || systValue != nominal){ + std::cout<<"getMETSmeared error: The only parametrization approved is for the nominal working point <mu>=200!"<<std::endl; + std::cout<<" The tool will return the truth MET"<<std::endl; + tmpMET.first=METxMeV; + tmpMET.second=METyMeV; + return tmpMET; + } + + sumETPU=m_SumEtH[PUcondition][systValue]->GetRandom(); + sumET=(sumETPU*1000.)+sumEtMeV; // in MeV + + METPUreso=getMETResolution(sumET, systValue); + + METPUsmearX=m_METRandom.Gaus(0,METPUreso); + METPUsmearY=m_METRandom.Gaus(0,METPUreso); + + tmpMET.first=METxMeV+METPUsmearX; + tmpMET.second=METyMeV+METPUsmearY; + + return tmpMET; +} + +float UpgradePerformanceFunctions::getMETResolution(float sumEtMeV, METSyst systValue) { + // The sumEtMeV input should include any pileup contribution + // This is done correctly in getMETSmeared (see above) + double METPUreso=0; +// double METPUresoNom=0; +// double METPUresoVar=0; +// double METPUresoTh=0; +// double METPUDelta=0; + float sumEtGeV = sumEtMeV/1000.; + + int PUcondition; + // typedef enum {mu60=0, mu80=1, mu140=2, mu200=3} mu; + if (m_avgMu <= 60.) PUcondition = 0; + else if (m_avgMu <= 80.) PUcondition = 1; + else if (m_avgMu <= 140.) PUcondition = 2; + else PUcondition = 3; + + if (PUcondition!=3 || systValue != nominal){ + std::cout<<"getMETResolution error: The only parametrization approved is for the nominal working point <mu>=200!"<<std::endl; + std::cout<<" The tool will return 0"<<std::endl; + return 0.; + } + +// double m_par1[4] = {18.71, 24.01, 32.12, 30.58}; +// double m_par2[4] = {0.6502, 0.6793, 0.6502, 0.872}; +// double m_lowsumet[4] = {700., 900., 1300., 1500.}; +// double m_highsumet[4] = {1100., 1100., 1700., 1900.}; +// +// /*MinBias*/ +// if (sumEtGeV<m_lowsumet[PUcondition]) +// METPUresoNom=m_Ress[PUcondition]->Eval(sumEtGeV); +// /*Transition*/ +// else if (sumEtGeV<m_highsumet[PUcondition]) +// METPUresoNom=m_Ress[PUcondition]->Eval(m_lowsumet[PUcondition])+((sumEtGeV-m_lowsumet[PUcondition])*(m_par1[PUcondition]+m_par2[PUcondition]*sqrt(m_highsumet[PUcondition])-m_Ress[PUcondition]->Eval(m_lowsumet[PUcondition]))/(m_highsumet[PUcondition]-m_lowsumet[PUcondition])); +// /*Z´ fit*/ +// else METPUresoNom=m_par1[PUcondition]+m_par2[PUcondition]*sqrt(sumEtGeV); +// +// //5% systematics sample dependence, and extrapolation at low sumET wiht the fit +// METPUresoVar=(m_par1[PUcondition]+m_par2[PUcondition]*sqrt(sumEtGeV))*0.95; +// METPUresoVar=(METPUresoNom-METPUresoVar); +// +// //5 GeV systematics for the threshold effect +// METPUresoTh=5; +// +// //Sum in quadrature +// METPUDelta=sqrt(METPUresoTh*METPUresoTh+METPUresoVar*METPUresoVar); +// METPUreso=METPUresoNom; + + double fitParsGold[4] = {36.133, 0.00125496, 3.13886e-06, -3.79944e-10}; + double fitParsSilver[4] = {37.5551, -0.000627389, 6.11304e-06, -6.52893e-10}; + double fitParsBronze[4] = {39.049, -0.00202729, 8.30795e-06, -9.24871e-10}; + + if (m_layout==gold) { + METPUreso = ((fitParsGold[3]*sumEtGeV + fitParsGold[2])*sumEtGeV + fitParsGold[1])*sumEtGeV + fitParsGold[0]; + } else if (m_layout==silver) { + METPUreso = ((fitParsSilver[3]*sumEtGeV + fitParsSilver[2])*sumEtGeV + fitParsSilver[1])*sumEtGeV + fitParsSilver[0]; + } else if (m_layout==bronze) { + METPUreso = ((fitParsBronze[3]*sumEtGeV + fitParsBronze[2])*sumEtGeV + fitParsBronze[1])*sumEtGeV + fitParsBronze[0]; + } else { + std::cout << "getMETResolution error: layout " << m_layout << " is not implemented. Returning 0." << std::endl; + METPUreso = 0.; + } + +// if (systValue==resoDown ){ +// METPUreso=METPUresoNom-METPUDelta; +// if (METPUreso<0) METPUreso=0;//to be sure we do not have negative smearings. +// } +// if (systValue==resoUp){ +// METPUreso=METPUresoNom+METPUDelta; +// } + + return METPUreso*1000.; // conversion to MeV +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MuonPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MuonPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e5ed9255a85b99e3901b1debced35dd624ab4a6e --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/MuonPerformanceFunctions.cxx @@ -0,0 +1,135 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONPERFORMANCEFUNCTIONS_CXX +#define MUONPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +void UpgradePerformanceFunctions::setMuonWorkingPoint(MuonCutLevel cutLevel) { + m_muonCutLevel = cutLevel; +} + +float UpgradePerformanceFunctions::getMuonEfficiency(float ptMeV, float eta) { + // Returns the muon efficiency for the specified eta region. + // For 'tight=true' this corresponds to 0.97 everywhere, except the acceptance gap at eta~0 + // For 'tight=false' (i.e. loose muons) is 0.99 everywhere, except the acceptance gap at eta~0*/ + //M.Corradi: NEW VERSION FROM 30/7/2013 + // using 2012 values from M. Goblirsch + + if (ptMeV < 4000.|| fabs(eta)>4.0) return 0; + + double max_eta =2.7; + if (m_layout == gold || m_layout == LoIVF ) max_eta=4.0; + + // large eta extension + if (fabs(eta)>2.7){ + if (m_layout == gold || m_layout == LoIVF ) + { + if (m_muonCutLevel == looseMuon){ // large-eta extension + return 0.99; + } else { + return 0.95; + } + } + return 0; + } + + if (m_muonCutLevel == looseMuon) { // loose selection : CB + ST + calo tagged for |eta|<0.1 + SA for 2.5<|eta|<2.7 + return 0.99; + } else if (m_muonCutLevel == tightMuon) { // CB "tight" selection + if (fabs(eta)<0.1) { + return 0.54; + } else if (fabs(eta)<max_eta) { + return 0.97; + } else { + return 0; + } + } + std::cout << "getMuonEfficiency: Invalid working point." << std::endl; + return 0.; +} + +float UpgradePerformanceFunctions::getMuonPtResolution(float ptMeV, float eta) { + // All of the coefficients expect pT in GeV, so we convert the input and output + float ptGeV = ptMeV/1000.; + + // ID resolution parameters, for use only if ITK resolution not available // + // double a1_barrel(0.01607); + // double a2_barrel(0.000307); // unit: 1/GeV + + // double a1_endcap(0.030); + // double a2_endcap(0.000387); // unit: 1/GeV + + // double a1, a2; + + // MS resolution parameters // + + double b0_barrel(0.24); // unit: GeV + double b1_barrel(0.02676); + double b2_barrel(0.00012); // unit: 1/GeV + + double b0_endcap(0.0); // unit: GeV + double b1_endcap(0.0388); + double b2_endcap(0.00016); // unit: 1/GeV + + double b0, b1, b2; + + // resolution components // + double sigma_ID, sigma_MS, sigma_CB; + + /////////////////////////////////////// + // CALCULATE THE MOMENTUM RESOLUTION // + /////////////////////////////////////// + + + sigma_ID = getTrackPtResolution(ptMeV, eta) / 1000.; + //sigma_ID = 10.; + + + if (fabs(eta)>2.7) { // large eta tagger momentum measurement comes from ITK + return sigma_ID*1000; + } + + + // a parameters are for ID, b parameters are for MS + if (fabs(eta)<1.05) { + // a1 = a1_barrel; + // a2 = a2_barrel; + + b0 = b0_barrel; + b1 = b1_barrel; + b2 = b2_barrel; + } else { + // a1 = a1_endcap; + // a2 = a2_endcap; + + b0 = b0_endcap; + b1 = b1_endcap; + b2 = b2_endcap; + } + + sigma_MS = ptGeV*sqrt((b0/ptGeV)*(b0/ptGeV)+ + b1*b1+ + (b2*ptGeV)*(b2*ptGeV)); + + + // Combine ID and MS to get combined resolution CB + + if (sigma_ID > 0.) { + sigma_CB = sigma_ID*sigma_MS/sqrt(sigma_ID*sigma_ID+sigma_MS*sigma_MS); + } else { + sigma_CB = sigma_MS; + } + return sigma_CB*1000.; // back to MeV +} + +float UpgradePerformanceFunctions::getMuonQOverPtResolution(float ptMeV, float eta){ + // This is resolution of q/p_T : + return getMuonPtResolution(ptMeV, eta)/ptMeV/ptMeV; +} + + + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PhotonPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PhotonPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5dfeca398b323165d96e47e74e5730c85696e986 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PhotonPerformanceFunctions.cxx @@ -0,0 +1,278 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PHOTONPERFORMANCEFUNCTIONS_CXX +#define PHOTONPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" +#include "TFile.h" +#include <sstream> + +#ifdef ROOTCORE +// Framework include(s): +#include "PathResolver/PathResolver.h" +#endif // ROOTCORE + +void UpgradePerformanceFunctions::setPhotonWorkingPoint(PhotonCutLevel cutLevel) { + m_photonCutLevel = cutLevel; +} + +void UpgradePerformanceFunctions::initPhotonFakeHistograms(TString filename){ + // TString filename = "/afs/cern.ch/user/r/rpolifka/HGTDHInvAnalysis/UpgradePerformanceFunctions/share/PhotonFakes.root"; + std::cout << "Loading Photon Fake Rate histogram file " << filename << std::endl; + std::string FakeFile = filename.Data(); +#ifdef ROOTCORE + // Get file from data path + FakeFile = PathResolverFindCalibFile(FakeFile); + std::cout << "Found Photon Fake Rate histogram file: " << FakeFile << std::endl; +#endif // ROOTCORE + + TFile *m_infile=new TFile(FakeFile.c_str(),"READ"); + + // hardcode number of allowed bins + + // const int nHS = 200; + // const int nPU = 30; + + TString hsname = "PhotHSJetIsTightBkg2D"; + TString puname = "PhotPUJetIsTightBkg2D"; + + TH2D *hhs = (TH2D*)m_infile->Get(hsname); + TH2D *hpu = (TH2D*)m_infile->Get(puname); + + //HS + + for (int i = 3; i <=50; i++){ + + std::ostringstream hsstream; + hsstream << "HSFake" << i; + TString hnamehs = hsstream.str(); + TH1D *htemp = (TH1D*)hhs->ProjectionY(hnamehs,i,i); + TH1D *htemp2 = (TH1D*)htemp->Clone(); + + + // std::cout << " HS 2D bin " << i << " bin min: " << hhs->GetXaxis()->GetBinLowEdge(i) << " bin max: " << hhs->GetXaxis()->GetBinLowEdge(i)+ hhs->GetXaxis()->GetBinWidth(i) << " integral: " << htemp2->Integral() << std::endl; + + hsfakes.push_back(htemp2); + } + + // int nhhs = hsfakes.size(); + + std::cout << " HS Fake Initialisation done" << std::endl; + + // for (int i = 0; i < nhhs;i++){ + // TH1D *htemp = (TH1D*)hsfakes[i]; + // // std::cout << " HS histogram " << i << " with integral: " << htemp->Integral() << " nbins: " << htemp->GetNbinsX() << " xmin: " << htemp->GetBinLowEdge(1) << " xmax: " << htemp->GetBinLowEdge(htemp->GetNbinsX())+htemp->GetBinWidth(htemp->GetNbinsX()) << std::endl; + // } + + //PU + + + for (int i = 5; i <=30; i++){ + + std::ostringstream pustream; + pustream << "PUFake" << i; + TString hnamepu = pustream.str(); + TH1D *htemp = (TH1D*)hpu->ProjectionY(hnamepu,i,i); + + pufakes.push_back(htemp); + } + + // int nhpu = pufakes.size(); + + std::cout << " PU Fake Initialisation done" << std::endl; + + // for (int i = 0; i < nhpu;i++){ + // TH1D *htemp = (TH1D*)pufakes[i]; + // // std::cout << " histogram " << i << " with integral: " << htemp->Integral() << " nbins: " << htemp->GetNbinsX() << " xmin: " << htemp->GetBinLowEdge(1) << " xmax: " << htemp->GetBinLowEdge(htemp->GetNbinsX())+htemp->GetBinWidth(htemp->GetNbinsX()) << std::endl; + // } + +} + +void UpgradePerformanceFunctions::setPhotonRandomSeed(unsigned seed) { + m_photonRandom.SetSeed(seed); +} + +float UpgradePerformanceFunctions::getPhotonEfficiency(float ptMeV) { + if (ptMeV < 20.*1000.) { + // Hard cut at pT=20 GeV + return 0.0; + } else { + if (m_photonCutLevel == loosePhoton) { + std::cout << "getPhotonEfficiency: No efficiency for loosePhotons" << std::endl; + return 0.0; + } else if (m_photonCutLevel == tightPhoton) { + // return 0.76 - 1.98*exp(-1.0*ptMeV/16100.); old param + return 0.862882 - 1.10804*exp(-1.0*ptMeV/33561.5); + } else { + std::cout << "getPhotonEfficiency: Invalid working point." << std::endl; + return 0.0; + } + } +} + +float UpgradePerformanceFunctions::getPhotonFakeRate(float ptMeV) { + + float fakerate = 0.; + + // based on Crystal Ball function + double m = ptMeV/1000.; + double alpha = 0.218954; + double n = 0.708690; + double m0 = 60.; + double sigma = 16.2482; + double N = 0.000538849; + + Double_t t = (m-m0)/sigma; + if (alpha > 0) t = -t; + + Double_t absAlpha = fabs((Double_t)alpha); + + if (t >= -absAlpha) { + fakerate = N*exp(-0.5*t*t); + } + else { + Double_t a = TMath::Power(n/absAlpha,n)*exp(-0.5*absAlpha*absAlpha); + Double_t b= n/absAlpha - absAlpha; + + fakerate = N*a/TMath::Power(b - t, n); + } + + if (ptMeV < 20.*1000.) { + // Hard cut at 20 GeV + return 0.0; + } else { + if (m_photonCutLevel == loosePhoton) { + return 0.99; + } else if (m_photonCutLevel == tightPhoton) { + // return 9.3E-3*exp(-1.0*ptMeV/27500.); old parametrisation + return fakerate; + } else { + std::cout << "getPhotonFakeRate: Invalid working point." << std::endl; + return 0.0; + } + } +} + +float UpgradePerformanceFunctions::getElectronToPhotonFakeRate(float ptMeV, float eta) { + if (ptMeV < 20.*1000.) { + // Hard cut-off at 20 GeV + return 0.0; + } else { + // Private communication with Monika Wielers + if (fabs(eta)<1.37) return 0.02; + else if (fabs(eta)>1.52) return 0.05; + else return 0.0; + } +} + +float UpgradePerformanceFunctions::getPhotonPileupFakeRate(float ptMeV) { + + double m = ptMeV/1000.; + float fakerate = 0.00190945*TMath::Exp(-61.4829*TMath::Exp(- 0.0758085*m)); + + if (ptMeV < 20.*1000.) { + return 0.0; + } else { + if (m_photonCutLevel == loosePhoton) { + return 0.99; + } else if (m_photonCutLevel == tightPhoton) { + // return 9.3E-3*exp(-1.0*ptMeV/27500.); old parametrisation + return fakerate; + } else { + std::cout << "getPhotonFakeRate: Invalid working point." << std::endl; + return 0.0; + } + } +} + +float UpgradePerformanceFunctions::getPhotonEnergyResolution(float eMeV, float eta) { + //--- use the same energy resolution as for electrons + float energyResolution = getElectronEnergyResolution(eMeV, eta); + return energyResolution; +} + +float UpgradePerformanceFunctions::getPhotonSmearedEnergy(float eMeV, float eta) { + double deltaE = m_photonRandom.Gaus(0, getPhotonEnergyResolution(eMeV, eta)); + return (eMeV+deltaE); +} + +TLorentzVector UpgradePerformanceFunctions::getPhotonSmearedVector(const TLorentzVector* init) { + double eta = init->Eta(); + double phi = init->Phi(); + double EMeV = init->E(); + double EGeV = init->E()/1000.; // needed for angular smearing + + const double sigma_theta_cst=0.080;//conservatively,from Fig 12 page 51 in http://arxiv.org/abs/0901.0512 + double sigma_eta = cosh(eta)*sigma_theta_cst/sqrt(EGeV); + double eta_sm = eta + m_photonRandom.Gaus(0.,sigma_eta); + + const double sigma_phi_cst = 0.010; //(from Fig 10 page 51 of http://arxiv.org/abs/0901.0512) + double sigma_phi = sigma_phi_cst/sqrt(EGeV); + double phi_sm = phi + m_photonRandom.Gaus(0.,sigma_phi); + + float E_sm = getPhotonSmearedEnergy(EMeV, eta_sm); + double pt_sm = E_sm/cosh(fabs(eta_sm)); + + TLorentzVector return_vec; + return_vec.SetPtEtaPhiE(pt_sm, eta_sm, phi_sm, E_sm); + return return_vec; +} + +float UpgradePerformanceFunctions::getPhotonFakeRescaledET(float eTMeV) { + // return (eMeV*(m_photonRandom.Gaus(0.74,0.126))); + + float fakedEt = 0.; + + // minimum is 20 GeV, maximum is 500 GeV + + if (eTMeV < 20000. || eTMeV > 500000.){ + std::cout << "UpgradePerformanceFunctions::getPhotonFakeRescaledET("<< eTMeV <<"): ET out of allowed range os 20000-500000MeV" << std::endl; + return 0.; + } else{ + + // estimate which histogram should be called + + int ind = TMath::Floor( (eTMeV-20000)/10000.); + + TH1D *htemp = (TH1D*)hsfakes.at(ind); + + fakedEt = htemp->GetRandom()*1000.; + + // std::cout << " HS histogram " << ind << " with integral: " << htemp->Integral() << " nbins: " << htemp->GetNbinsX() << " xmin: " << htemp->GetBinLowEdge(1) << " xmax: " << htemp->GetBinLowEdge(htemp->GetNbinsX())+htemp->GetBinWidth(htemp->GetNbinsX()) << " --> jet pt: " << eTMeV << " faked ET: " << fakedEt << std::endl; + + return fakedEt; + } + +} + +float UpgradePerformanceFunctions::getPhotonPileupFakeRescaledET(float eTMeV) { + // return (eMeV*(m_photonRandom.Gaus(0.74,0.126))); + + float fakedEt = 0.; + + // minimum is 20 GeV, maximum is 500 GeV + + if (eTMeV < 20000 || eTMeV > 150000.){ + std::cout << "UpgradePerformanceFunctions::getPhotonPileupFakeRescaledET("<< eTMeV <<"): ET out of allowed range os 20000-150000MeV" << std::endl; + return 0.; + } else{ + + // estimate which histogram should be called + + int ind = TMath::Floor( (eTMeV-20000)/5000.); + + TH1D *htemp = (TH1D*)pufakes.at(ind); + + fakedEt = htemp->GetRandom()*1000.; + + //std::cout << " PU histogram " << ind << " with integral: " << htemp->Integral() << " nbins: " << htemp->GetNbinsX() << " xmin: " << htemp->GetBinLowEdge(1) << " xmax: " << htemp->GetBinLowEdge(htemp->GetNbinsX())+htemp->GetBinWidth(htemp->GetNbinsX()) << " --> jet pt: " << eTMeV << " faked ET: " << fakedEt << std::endl; + + return fakedEt; + } + +} + + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PileupOverlay.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PileupOverlay.cxx new file mode 100644 index 0000000000000000000000000000000000000000..479a876b971bd6e46eee7d739c12f0cd4fd897f6 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/PileupOverlay.cxx @@ -0,0 +1,749 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PILEUPOVERLAY_CXX +#define PILEUPOVERLAY_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" +#include "TFile.h" + +void UpgradePerformanceFunctions::setPileupRandomSeed(unsigned seed) { + m_pileupRandom.SetSeed(seed); +} +void UpgradePerformanceFunctions::setPileupEfficiencyScheme(PileupEff puscheme){ + m_pueff = puscheme; + std::cout << " UpgradePerformanceFunctions::setPileupEfficiencyScheme::You set efficiency scheme to " << m_pueff << std::endl; +} + +void UpgradePerformanceFunctions::setPileupEff(float hseff){ + m_fEff = hseff; + std::cout << " UpgradePerformanceFunctions::setPileupEff::You set efficiency to " << m_fEff << std::endl; + + // if (fabs( m_fHSEff - 0.7 ) < 0.001) { + // std::cout << " Using 70% HS Efficiency working point " << std::endl; + // m_bHS70 = true; + // } else if (fabs( m_fHSEff - 0.8 ) < 0.001){ + // std::cout << " Using 80% HS Efficiency working point " << std::endl; + // m_bHS80 = true; + // } else if (fabs( m_fHSEff - 0.9 ) < 0.001){ + // std::cout << " Using 90% HS Efficiency working point " << std::endl; + // m_bHS90 = true; + // } +} + +// void UpgradePerformanceFunctions::setPileupHSForwardEff(float hseff){ +// m_fHSEffForw = hseff; +// } + +// void UpgradePerformanceFunctions::setPileupLETFTrackConf(bool bletf){ +// m_bUseLetf = bletf; +// } + +// void UpgradePerformanceFunctions::setPileupUseMediumTracker(bool bmedtc){ +// m_bUseMedTC = bmedtc; +// } + +void UpgradePerformanceFunctions::setPileupUseTrackConf(bool usetr) { + m_bUseTrackConf = usetr; +} + +bool UpgradePerformanceFunctions::getPileupTrackConfSetting() { + return m_bUseTrackConf; +} + + +void UpgradePerformanceFunctions::setPileupJetPtThresholdMeV(float ptThresholdMeV) { + m_fPileupJetThresholdMeV = ptThresholdMeV; +} + +float UpgradePerformanceFunctions::getPileupJetPtThresholdMeV() { + return m_fPileupJetThresholdMeV; +} + + +void UpgradePerformanceFunctions::setPileupTemplatesPath(TString pileupTemplateFilenamePath) { + + TString sPuPath =pileupTemplateFilenamePath; + std::cout << " PUPath in: " << pileupTemplateFilenamePath << std::endl; + + // check the end of the string for a "/" + + float fLenPuStr = sPuPath.Length(); + TString sLast = sPuPath[fLenPuStr-1]; + + if (!sLast.Contains("/")) + sPuPath = sPuPath+"/"; + + // construct the full path to different libraries + if ( TMath::Abs(m_avgMu - 140.) < 0.1) + sPuPath = sPuPath+"PULibrary140_1.root"; + + if ( TMath::Abs(m_avgMu - 200.) < 0.1) + sPuPath = sPuPath+"PULibrary200_1.root"; + + + std::cout << " PUPath: " << sPuPath << std::endl; + initializePileupTemplates(sPuPath); + +} + + + + +void UpgradePerformanceFunctions::initializePileupTemplates(TString pileupTemplateFilename) { + if ( !(m_avgMu == 140 || m_avgMu == 200) ) { + std::cout << "Error in pileup library: pileup is implemented for mu=140 and 200 only!" << std::endl; + return; + } + + m_fPileupTCMaxPtMeV = 70000.; + + bool b05 = false; + bool b25 = false; + bool b30 = false; + bool b35 = false; + bool b40 = false; + bool b50 = false; + + // init of bools + if (fabs(m_fPileupJetThresholdMeV - 25000.) < 0.1) + b25 = true; + else if (fabs(m_fPileupJetThresholdMeV - 30000.) < 0.1) + b30 = true; + else if (fabs(m_fPileupJetThresholdMeV - 35000.) < 0.1) + b35 = true; + else if (fabs(m_fPileupJetThresholdMeV - 40000.) < 0.1) + b40 = true; + else if (fabs(m_fPileupJetThresholdMeV - 50000.) < 0.1) + b50 = true; + else + b05 = true; + + std::cout << " UpgradePerformanceFunctions::initializePileupTemplates::Your pileup jet pt threshold is " << m_fPileupJetThresholdMeV << " MeV " << std::endl; + + // m_bHS70 = false; + // m_bHS80 = false; + // m_bHS90 = false; + + std::cout << " UpgradePerformanceFunctions::initializePileupTemplates::Loading pileup jet library file for mu="<< m_avgMu<<": " << pileupTemplateFilename << std::endl; + + std::string pileupFile = pileupTemplateFilename.Data(); +#ifdef ROOTCORE +// Get file from data path +// pileupFile = PathResolverFindCalibFile(pileupFile); + +// pileupFile="../public/PULibrary.root"; + std::cout << "Found pileup jet library file: " << pileupFile << std::endl; +#endif // ROOTCORE + + + TFile *ftemplate = new TFile(pileupFile.c_str(),"READ"); + TString treeName; + TString treePt; + TString treeEta; + TString treePhi; + TString treeE; + + // based on your threshold, open the right tree + if (b25) { + treeName = "PUEvtTree25"; + treePt = "m25_pt"; + treeEta = "m25_eta"; + treePhi = "m25_phi"; + treeE = "m25_E"; + } else if (b30) { + treeName = "PUEvtTree30"; + treePt = "m30_pt"; + treeEta = "m30_eta"; + treePhi = "m30_phi"; + treeE = "m30_E"; + } else if (b35) { + treeName = "PUEvtTree35"; + treePt = "m35_pt"; + treeEta = "m35_eta"; + treePhi = "m35_phi"; + treeE = "m35_E"; + } else if (b40) { + treeName = "PUEvtTree40"; + treePt = "m40_pt"; + treeEta = "m40_eta"; + treePhi = "m40_phi"; + treeE = "m40_E"; + } else if (b50) { + treeName = "PUEvtTree50"; + treePt = "m50_pt"; + treeEta = "m50_eta"; + treePhi = "m50_phi"; + treeE = "m50_E"; + } else { + treeName = "PUEvtTree05"; + treePt = "m05_pt"; + treeEta = "m05_eta"; + treePhi = "m05_phi"; + treeE = "m05_E"; + std::cout << "WARNING::initializePileupTemplates - You have set your jet threshold to " << m_fPileupJetThresholdMeV << " MeV -> outside of allowed range, no threshold set and you will get plenty of PU jets!! (and it will take ages). Have a nice day" << b05 << std::endl; + } + + std::cout << " UpgradePerformanceFunctions::initializePileupTemplates::Initializing pileupTemplates with name: " << treeName + << " PtBranch name: " << treePt + << " EtaBranch name: " << treeEta + << " PhiBranch name: " << treePhi + << " and EnBranch name: " << treeE << std::endl; + + m_pileupTree30 = (TTree*)ftemplate->Get(treeName); + std::cout << " UpgradePerformanceFunctions::initializePileupTemplates::Number of events in the Pileup Overlay library: " << m_pileupTree30->GetEntries() << std::endl; + + m_pileupPt30 = 0; + m_pileupEta30 = 0; + m_pileupPhi30 = 0; + m_pileupE30 = 0; + m_pileupTree30->SetBranchAddress(treePt, &m_pileupPt30); + m_pileupTree30->SetBranchAddress(treeEta, &m_pileupEta30); + m_pileupTree30->SetBranchAddress(treePhi, &m_pileupPhi30); + m_pileupTree30->SetBranchAddress(treeE, &m_pileupE30); + + std::cout << " UpgradePerformanceFunctions::initializePileupTemplates::loadPileupTemplates successfully completed " << std::endl; + + // initialize TC + + if (m_bUseTrackConf) + std::cout<< " UpgradePerformanceFunctions::initializePileupTemplates::You are using Tracking Confirmation" << std::endl; + else + std::cout<< " WARNING :: UpgradePerformanceFunctions::initializePileupTemplates::You are NOT using Tracking Confirmation" << std::endl; + + // version from Marianna Testa from 17.7.2015 + // 6 scenarios for Mu200, central region (= bronze) + + float fHS70Nominal200[m_nPUPtBins] = {0.00655021,0.00657876,0.00578142,0.00670391}; + float fHS80Nominal200[m_nPUPtBins] = {0.0128369, 0.0132928,0.0100504,0.0121145}; + float fHS90Nominal200[m_nPUPtBins] = {0.0366681, 0.0383563,0.0180194,0.0167449}; + + float fPU02Nominal200[m_nPUPtBins] = {0.853741,0.844738,0.911594,0.965879}; + float fPU05Nominal200[m_nPUPtBins] = {0.922095,0.916188,0.966736,0.989596}; + float fPU10Nominal200[m_nPUPtBins] = {0.948818,0.950567,0.98141,0.993905}; + + // 6 scenarios for Mu200, medium region (= silver) + + float fHS70Medium200[m_nPUPtBins] = {0.0179052,0.0181347,0.00919735,0.00586602}; + float fHS80Medium200[m_nPUPtBins] = {0.0335118,0.0347988,0.0173066,0.00759878}; + float fHS90Medium200[m_nPUPtBins] = {0.0779999,0.0811618,0.0449882,0.0178825}; + + float fPU02Medium200[m_nPUPtBins] = {0.709526,0.710547,0.81575,0.917082}; + float fPU05Medium200[m_nPUPtBins] = {0.857033,0.851397,0.906623,0.972068}; + float fPU10Medium200[m_nPUPtBins] = {0.919615,0.914685,0.941338,0.984482}; + + // 6 scenarios for Mu200, extended region (= gold) + + float fHS70Extended200[m_nPUPtBins] = {0.0200319,0.0199557,0.0110303,0.0121212}; + float fHS80Extended200[m_nPUPtBins] = {0.0411415,0.0429245,0.0194322,0.0151515}; + float fHS90Extended200[m_nPUPtBins] = {0.0888737,0.0940972,0.0466814,0.0181818}; + + float fPU02Extended200[m_nPUPtBins] = {0.699877,0.700218,0.809446,0.931242}; + float fPU05Extended200[m_nPUPtBins] = {0.850517,0.835516,0.904409,0.977778}; + float fPU10Extended200[m_nPUPtBins] = {0.910625,0.905812,0.933026,0.986765}; + + // TO BE UPDATED + // 6 scenarios for Mu140, central region (= bronze) + + float fHS70Nominal140[m_nPUPtBins] = {0.00655021,0.00657876,0.00578142,0.00670391}; + float fHS80Nominal140[m_nPUPtBins] = {0.0128369, 0.0132928,0.0100504,0.0121145}; + float fHS90Nominal140[m_nPUPtBins] = {0.0366681, 0.0383563,0.0180194,0.0167449}; + + float fPU02Nominal140[m_nPUPtBins] = {0.853741,0.844738,0.911594,0.965879}; + float fPU05Nominal140[m_nPUPtBins] = {0.922095,0.916188,0.966736,0.989596}; + float fPU10Nominal140[m_nPUPtBins] = {0.948818,0.950567,0.98141,0.993905}; + + // 6 scenarios for Mu140, medium region (= silver) + + float fHS70Medium140[m_nPUPtBins] = {0.0179052,0.0181347,0.00919735,0.00586602}; + float fHS80Medium140[m_nPUPtBins] = {0.0335118,0.0347988,0.0173066,0.00759878}; + float fHS90Medium140[m_nPUPtBins] = {0.0779999,0.0811618,0.0449882,0.0178825}; + + float fPU02Medium140[m_nPUPtBins] = {0.709526,0.710547,0.81575,0.917082}; + float fPU05Medium140[m_nPUPtBins] = {0.857033,0.851397,0.906623,0.972068}; + float fPU10Medium140[m_nPUPtBins] = {0.919615,0.914685,0.941338,0.984482}; + + // 6 scenarios for Mu140, extended region (= gold) + + float fHS70Extended140[m_nPUPtBins] = {0.0200319,0.0199557,0.0110303,0.0121212}; + float fHS80Extended140[m_nPUPtBins] = {0.0411415,0.0429245,0.0194322,0.0151515}; + float fHS90Extended140[m_nPUPtBins] = {0.0888737,0.0940972,0.0466814,0.0181818}; + + float fPU02Extended140[m_nPUPtBins] = {0.699877,0.700218,0.809446,0.931242}; + float fPU05Extended140[m_nPUPtBins] = {0.850517,0.835516,0.904409,0.977778}; + float fPU10Extended140[m_nPUPtBins] = {0.910625,0.905812,0.933026,0.986765}; + + // central region + + // mu 200 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS70Nominal200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS80Nominal200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS90Nominal200[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU02Nominal200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU05Nominal200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU10Nominal200[i]; + } + + // mu 140 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS70Nominal140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS80Nominal140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fHS90Nominal140[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU02Nominal140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU05Nominal140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffNominalArray[i] = fPU10Nominal140[i]; + } + + // medium region + + // mu 200 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS70Medium200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS80Medium200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS90Medium200[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU02Medium200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU05Medium200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU10Medium200[i]; + } + + // mu 140 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS70Medium140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS80Medium140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fHS90Medium140[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU02Medium140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU05Medium140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffMediumArray[i] = fPU10Medium140[i]; + } + + // extended region + + // mu 200 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS70Extended200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS80Extended200[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS90Extended200[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU02Extended200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU05Extended200[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 200) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU10Extended200[i]; + } + + // mu 140 + + if (m_pueff == HS && fabs(m_fEff - 0.7) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS70Extended140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.8) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS80Extended140[i]; + } + if (m_pueff == HS && fabs(m_fEff - 0.9) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fHS90Extended140[i]; + } + + if (m_pueff == PU && fabs(m_fEff - 0.02) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU02Extended140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.05) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU05Extended140[i]; + } + if (m_pueff == PU && fabs(m_fEff - 0.1) < 0.001 && fabs( m_avgMu - 140) < 0.1){ + for (int i = 0; i < m_nPUPtBins; i++) + fEffExtendedArray[i] = fPU10Extended140[i]; + } + + // additional HGTD prints - makes not much sense + + // if (m_bUseHGTD0 && m_bUseTrackConf){ + // std::cout << " Using HGTD0 parametrisation with HSEff = " << m_HGTDHSEff << " and PUEff = " << m_HGTDPUEff << std::endl; + // } + + + return; +} + +std::vector<TLorentzVector> UpgradePerformanceFunctions::getPileupJets() { + std::vector<TLorentzVector> pujets; + + int iNevts = m_pileupTree30->GetEntries(); + int indx = m_pileupRandom.Integer(iNevts); + + m_pileupTree30->GetEntry(indx); + int nj = m_pileupEta30->size(); + + if (nj > 0) { // loop over number of actual PU jets in the event + for (int ia = 0; ia < nj; ia++) { + TLorentzVector jet; + // Jets are stored with units of GeV, so we need to convert to MeV output + jet.SetPtEtaPhiE(m_pileupPt30->at(ia),m_pileupEta30->at(ia), + m_pileupPhi30->at(ia),m_pileupE30->at(ia)); + pujets.push_back(jet); + } + } + return pujets; +} + +float UpgradePerformanceFunctions::getTrackJetConfirmEff(float ptMeV, float eta, TString jetType) { + float ptGeV = ptMeV/1000.; + // float m_fPileupTCMaxPtGeV = m_fPileupTCMaxPtMeV/1000.; + float tceff = 1.0; // jet survival probability + + // if TC is OFF, return 1.00 for everything + + if (!m_bUseTrackConf){ + tceff = 1.0; + return tceff; + } + + if (!jetType.Contains("HS") && !jetType.Contains("PU")) { + std::cout << "WARNING: jet type " << jetType + << " not supported. Allowed types are HS and PU." << std::endl; + tceff = 1.0; + } + + if (ptGeV<30.) { + std::cout << "WARNING : track-jet confirmation not implemented for pT<30 GeV !" << std::endl; + tceff = 1.0; + } + + // completely new approach + + // estimate the pT bin + int nPt = -1; + if ( 30. <= ptGeV && ptGeV < 40. ) + nPt = 0; + if ( 40. <= ptGeV && ptGeV < 50. ) + nPt = 1; + if ( 50. <= ptGeV && ptGeV < 70. ) + nPt = 2; + if ( 70. <= ptGeV && ptGeV <= 100. ) + nPt = 3; + + bool bHS = false; + + if( jetType.Contains("HS") ) // jet type, not Efficiency Scheme!! + bHS = true; + if( jetType.Contains("PU") ) // jet type, not Efficiency Scheme!! + bHS = false; + + // apply only in correct pt range + + if (nPt > -1){ + + // now clearly distinguish all three scenarios + + // ----------- Bronze ------------ + + if ( m_layout == bronze ){ + + if (fabs(eta)> m_BronzeEtaMax) + tceff = 1.00; // nothing changes above 2.4 + else{ + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffNominalArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffNominalArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + + } + } + // ----------- Silver ------------ + + if ( m_layout == silver ){ + if (fabs(eta)> m_SilverEtaMax) + tceff = 1.00; // nothing changes above 3.2 + else if (fabs(eta)> m_BronzeEtaMax) { // the actual silver part + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffMediumArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffMediumArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + } else { // nominal part stays the same + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffNominalArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffNominalArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + } + } + + // ----------- Gold ------------ + + if ( m_layout == gold ){ + if (fabs(eta)> m_GoldEtaMax) + tceff = 1.00; // nothing changes above 3.8 + + else if (fabs(eta)> m_SilverEtaMax) { // the actual gold part + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffExtendedArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffExtendedArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + } + + else if (fabs(eta)> m_BronzeEtaMax) { // medium part stays the same + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffMediumArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffMediumArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + } else { // nominal part stays the same + + if (m_pueff == HS){ // HS Efficiency Scheme + if (bHS){ // HS jet + tceff = m_fEff; + } else { // PU jet + tceff = fEffNominalArray[nPt]; + } + } + + if (m_pueff == PU){ // PU Efficiency Scheme + if (bHS){ // HS jet + tceff = fEffNominalArray[nPt]; + } else { // PU jet + tceff = m_fEff; + } + } + } + } + } + + // std::cout << " m_bUseHGTD0: " << m_bUseHGTD0 << " m_bUseHGTD1: " << m_bUseHGTD1 << std::endl; + // HGTD add-on two scenarios which surely could be done nicer + if (m_bUseHGTD0 || m_bUseHGTD1){ + + float minHGTD = 0.; + if (m_bUseHGTD0) + minHGTD = m_HGTD0min; + if (m_bUseHGTD1) + minHGTD = m_HGTD1min; + + if (fabs(eta)> m_HGTDmax){ + tceff = 1.00; // nothing changes above 4.3 + } + else if ( fabs(eta) > minHGTD ) { + // simple scenario for the start - flat in pt (20-100 GeV) and eta, only affecting the HS efficiency --> assumes 2%PU scenario + // if (ptGeV > 30. && ptGeV < 100.){ + if (ptGeV > 20. && ptGeV < 100.){ + float tceff1 = tceff; + if (bHS){ + if (fabs(eta) > 2.4) + tceff = tceff1+0.15; + else + tceff = tceff1+0.05; + } + } + } + // else we keep what is in the central region + } + + + return tceff; +} + +void UpgradePerformanceFunctions::setUseHGTD0(bool usehgtd0){ + m_bUseHGTD0 = usehgtd0; + if (m_ExtHGTDTrig){ + m_JetTrigMaxEta = m_HGTDMaxTrigEta; + m_JetTrig4jMin = m_HGTD0MinExtTrigPt; + } else { // max trigger eta stays default 3.2 + m_JetTrig4jMin = m_HGTD0MinTrigPt; + } + +} + +void UpgradePerformanceFunctions::setUseHGTD1(bool usehgtd1){ + m_bUseHGTD1 = usehgtd1; + if (m_ExtHGTDTrig){ + m_JetTrigMaxEta = m_HGTDMaxTrigEta; + m_JetTrig4jMin = m_HGTD1MinExtTrigPt; + } else { // max trigger eta stays default 3.2 + m_JetTrig4jMin = m_HGTD1MinTrigPt; + } + + +} + +void UpgradePerformanceFunctions::extendJetTrigger(bool exttrig){ + m_ExtHGTDTrig = exttrig; +} + + +float UpgradePerformanceFunctions::getHGTDMinEta(){ + + float mineta = -1000.; + + if(m_bUseHGTD0) + mineta = m_HGTD0min; + if(m_bUseHGTD1) + mineta = m_HGTD1min; + + return mineta; +} +float UpgradePerformanceFunctions::getHGTDMaxEta(){ + return m_HGTDmax; +} + + + +// void UpgradePerformanceFunctions::setHGTDHSEff(float hgtdhseff){ +// m_HGTDHSEff = hgtdhseff; +// } +// void UpgradePerformanceFunctions::setHGTDPUEff(float hgtdpueff){ +// m_HGTDPUEff = hgtdpueff; +// } + + + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TauPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TauPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9befa7c3ae792215df63959360a3ac52e151a9ab --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TauPerformanceFunctions.cxx @@ -0,0 +1,121 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TAUPERFORMANCEFUNCTIONS_CXX +#define TAUPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +void UpgradePerformanceFunctions::setTauRandomSeed(unsigned seed) { + m_tauRandom.SetSeed(seed); +} + +float UpgradePerformanceFunctions::getTauEfficiency(float etMeV, float eta, short prong) { + // prong variable must be 1 or 3 + float Reco_Pt_cut = 20000.; + float Reco_eta_cut = 2.5; + if (etMeV<Reco_Pt_cut || fabs(eta)>Reco_eta_cut){ + std::cout << "WARNING: No Reco SF for these taus - either pt or eta are out of the acceptance !" << std::endl; + return 0; + } + if (prong==1) + return 0.55; + else if (prong==3) + return 0.50; + else { + std::cout << "getTauEfficiency: no efficiency available for prong=" << prong << std::endl; + return 0; + } +} + +float UpgradePerformanceFunctions::getTauFakeRate(float etMeV, float eta, short prong) { + float Jet_Pt_cut = 20000.; + float Jet_eta_cut = 2.5; + float Fake_SF,Fake_SF_20,Fake_SF_40,Fake_SF_60,Fake_SF_80; + if (prong==1){ + Fake_SF = 0.05; + Fake_SF_20 = 0.13; + Fake_SF_40 = 0.06; + Fake_SF_60 = 0.03; + Fake_SF_80 = 0.01; + } else if (prong==3) { + Fake_SF = 0.02; + Fake_SF_20 = 0.47; + Fake_SF_40 = 0.30; + Fake_SF_60 = 0.21; + Fake_SF_80 = 0.09; + } else { + std::cout << "getTauFakeRate: no fake rate available for prong=" << prong << std::endl; + return 0; + } + if (etMeV<Jet_Pt_cut || fabs(eta)>Jet_eta_cut) { + std::cout << "getTauFakeRate: no fake rate available for these jets - either pt or eta are out of the acceptance !" << std::endl; + return 0; + } + else { + if (etMeV>=20000. && etMeV<40000.) + return Fake_SF*Fake_SF_20; + else if (etMeV >= 40000. && etMeV < 60000.) + return Fake_SF*Fake_SF_40; + else if (etMeV >= 60000. && etMeV < 80000.) + return Fake_SF*Fake_SF_60; + else if (etMeV >= 80000.) + return Fake_SF*Fake_SF_80; + } + return 0.; +} + +float UpgradePerformanceFunctions::getTauEnergyResolution(float eMeV, float eta, short prong) { + float stocB, stocE; + // grab parameters for mu=40 and mu=140 points + // then interpolate mu between 40 and 140. + // do not extrapolate below 40 since we have no studies there + // linear extrapolate above 140, but only up to 200 + float mu1 = 40.0; + float mu2 = 140.0; + float mumin = 40.0; + float mumax = 200.0; + + float mu = m_avgMu; + if (mu<mumin){ + std::cout << "WARNING: mu outside range: " << mu << " (mumin: " << mumin << "), choosing " << mumin << std::endl; + mu = mumin; + } + if (mu>mumax){ + std::cout << "WARNING: mu outside range: " << mu << " (mumax: " << mumax << "), choosing " << mumax << std::endl; + mu = mumax; + } + float stocB1, stocB2; + float stocE1, stocE2; + if (prong == 1){ + stocB1 = 0.96; + stocB2 = 1.31; + stocE1 = 0.04; + stocE2 = 0.02; + } + else if(prong == 3){ + stocB1 = 1.08; + stocB2 = 1.35; + stocE1 = 0.04; + stocE2 = 0.04; + } + else{ + std::cout << "getTauEnergyResolution: no energy resolution available for prong=" << prong << " eta=" << eta << std::endl; + return 0; + } + + //interpolate parameters + stocB = stocB1 + (mu-mu1)/(mu2-mu1) * (stocB2-stocB1); + stocE = stocE1 + (mu-mu1)/(mu2-mu1) * (stocE2-stocE1); + + double relativeUncertainty = hypot(stocB/sqrt(eMeV/1000.), stocE); + // return initE * (m_random3.Gaus(1, (stocB/sqrt(initE/1000.)))) * (m_random3.Gaus(1, stocE)) ; + return eMeV*relativeUncertainty; +} + +float UpgradePerformanceFunctions::getTauSmearedEnergy(float eMeV, float eta, short prong) { + return (eMeV + m_tauRandom.Gaus(0., getTauEnergyResolution(eMeV, eta, prong))); +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TrackingPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TrackingPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4bf9d8b8a2531e37fc2fe5c1eee7baa6eabd42c0 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TrackingPerformanceFunctions.cxx @@ -0,0 +1,20273 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKINGPERFORMANCEFUNCTIONS_CXX +#define TRACKINGPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" +#include "TH2D.h" + +namespace UpgradePerformance { + // Forward declarations of these very long lookup tables + double ITKPercentageresol_LoIfix(double ptMeV, double eta); + double ITKPercentageresol_LoIVFfix(double ptMeV, double eta); + double ITKPercentageresol_LoIfixBronze(double ptMeV, double eta); + double ITKPercentageresol_ExtBrl(double ptMeV, double eta); + double ITKPercentageresol_InclBrl(double ptMeV, double eta); +} + +float UpgradePerformanceFunctions::getTrackPtResolution(float ptMeV, float eta) { + using namespace UpgradePerformance; + + switch (m_layout ) { + case ExtBrl : + return ptMeV * ITKPercentageresol_ExtBrl(ptMeV, fabs(eta)); + break; + case InclBrl : + return ptMeV * ITKPercentageresol_InclBrl(ptMeV, fabs(eta)); + break; + case LoI : + return ptMeV * ITKPercentageresol_LoIfix(ptMeV, fabs(eta)); + break; + case bronze : + return ptMeV * ITKPercentageresol_LoIfixBronze(ptMeV, fabs(eta)); + break; + case gold : + case silver : + case LoIVF : + return ptMeV * ITKPercentageresol_LoIVFfix(ptMeV, fabs(eta)); + break; + default : + std::cout << "getTrackPtResolution: Invalid layout." << std::endl; + break; + } + return 0.; +} + +float UpgradePerformanceFunctions::getTrackInvPtResolution(float invptMeV, float eta) { + using namespace UpgradePerformance; + switch (m_layout ) { + case ExtBrl : + return invptMeV * ITKPercentageresol_ExtBrl(1./invptMeV, fabs(eta)); + break; + case InclBrl : + return invptMeV * ITKPercentageresol_InclBrl(1./invptMeV, fabs(eta)); + break; + case LoI : + return invptMeV * ITKPercentageresol_LoIfix(1./invptMeV, fabs(eta)); + break; + case bronze : + return invptMeV * ITKPercentageresol_LoIfixBronze(1./invptMeV, fabs(eta)); + break; + case gold : + case silver : + case LoIVF : + return invptMeV * ITKPercentageresol_LoIVFfix(1./invptMeV, fabs(eta)); + break; + default : + std::cout << "getTrackPtResolution: Invalid layout." << std::endl; + break; + } + return 0.; +} + +float UpgradePerformanceFunctions::getTrackPtRelativeResolution(float ptMeV, float eta) { + using namespace UpgradePerformance; + switch (m_layout ) { + case ExtBrl : + return ITKPercentageresol_ExtBrl(ptMeV, fabs(eta)); + break; + case InclBrl : + return ITKPercentageresol_InclBrl(ptMeV, fabs(eta)); + break; + case LoI : + return ITKPercentageresol_LoIfix(ptMeV, fabs(eta)); + break; + case bronze : + return ITKPercentageresol_LoIfixBronze(ptMeV, fabs(eta)); + break; + case gold : + case silver : + case LoIVF : + return ITKPercentageresol_LoIVFfix(ptMeV, fabs(eta)); + break; + default : + std::cout << "getTrackPtResolution: Invalid layout." << std::endl; + break; + } + return 0.; +} + + +// Fractional resolution in % +double UpgradePerformance::ITKPercentageresol_LoIVFfix(double ptMeV, double eta){ + double ptGeV = ptMeV/1000.; + static TH2D *ssigpTa; + static bool init = false; + + if (fabs(eta)>4.04) return 0.; + + if(!init){ + Double_t xAxis1[402] = {0, 0.005, 0.015, 0.025, 0.035, 0.045, 0.055, 0.065, 0.075, 0.085, 0.095, 0.105, 0.115, 0.125, 0.135, 0.145, 0.155, 0.165, 0.175, 0.185, 0.195, 0.205, 0.215, 0.225, 0.235, 0.245, 0.255, 0.265, 0.275, 0.285, 0.295, 0.305, 0.315, 0.325, 0.335, 0.345, 0.355, 0.365, 0.375, 0.385, 0.395, 0.405, 0.415, 0.425, 0.435, 0.445, 0.455, 0.465, 0.475, 0.485, 0.495, 0.505, 0.515, 0.525, 0.535, 0.545, 0.555, 0.565, 0.575, 0.585, 0.595, 0.605, 0.615, 0.625, 0.635, 0.645, 0.655, 0.665, 0.675, 0.685, 0.695, 0.705, 0.715, 0.725, 0.735, 0.745, 0.755, 0.765, 0.775, 0.785, 0.795, 0.805, 0.815, 0.825, 0.835, 0.845, 0.855, 0.865, 0.875, 0.885, 0.895, 0.905, 0.915, 0.925, 0.935, 0.945, 0.955, 0.965, 0.975, 0.985, 0.995, 1.005, 1.015, 1.025, 1.035, 1.045, 1.055, 1.065, 1.075, 1.085, 1.095, 1.105, 1.115, 1.125, 1.135, 1.145, 1.155, 1.165, 1.175, 1.185, 1.195, 1.205, 1.215, 1.225, 1.235, 1.245, 1.255, 1.265, 1.275, 1.285, 1.295, 1.305, 1.315, 1.325, 1.335, 1.345, 1.355, 1.365, 1.375, 1.385, 1.395, 1.405, 1.415, 1.425, 1.435, 1.445, 1.455, 1.465, 1.475, 1.485, 1.495, 1.505, 1.515, 1.525, 1.535, 1.545, 1.555, 1.565, 1.575, 1.585, 1.595, 1.605, 1.615, 1.625, 1.635, 1.645, 1.655, 1.665, 1.675, 1.685, 1.695, 1.705, 1.715, 1.725, 1.735, 1.745, 1.755, 1.765, 1.775, 1.785, 1.795, 1.805, 1.815, 1.825, 1.835, 1.845, 1.855, 1.865, 1.875, 1.885, 1.895, 1.905, 1.915, 1.925, 1.935, 1.945, 1.955, 1.965, 1.975, 1.985, 1.995, 2.005, 2.015, 2.025, 2.035, 2.045, 2.055, 2.065, 2.075, 2.085, 2.095, 2.105, 2.115, 2.125, 2.135, 2.145, 2.155, 2.165, 2.175, 2.185, 2.195, 2.205, 2.215, 2.225, 2.235, 2.245, 2.255, 2.265, 2.275, 2.285, 2.295, 2.305, 2.315, 2.325, 2.335, 2.345, 2.355, 2.365, 2.375, 2.385, 2.395, 2.405, 2.415, 2.425, 2.435, 2.445, 2.455, 2.465, 2.475, 2.485, 2.495, 2.505, 2.515, 2.525, 2.535, 2.545, 2.555, 2.565, 2.575, 2.585, 2.595, 2.605, 2.615, 2.625, 2.635, 2.645, 2.655, 2.665, 2.675, 2.685, 2.695, 2.705, 2.715, 2.725, 2.735, 2.745, 2.755, 2.765, 2.775, 2.785, 2.795, 2.805, 2.815, 2.825, 2.835, 2.845, 2.855, 2.865, 2.875, 2.885, 2.895, 2.905, 2.915, 2.925, 2.935, 2.945, 2.955, 2.965, 2.975, 2.985, 2.995, 3.005, 3.015, 3.025, 3.035, 3.045, 3.055, 3.065, 3.075, 3.085, 3.095, 3.105, 3.115, 3.125, 3.135, 3.145, 3.155, 3.165, 3.175, 3.185, 3.195, 3.205, 3.215, 3.225, 3.235, 3.245, 3.255, 3.265, 3.275, 3.285, 3.295, 3.305, 3.315, 3.325, 3.335, 3.345, 3.355, 3.365, 3.375, 3.385, 3.395, 3.405, 3.415, 3.425, 3.435, 3.445, 3.455, 3.465, 3.475, 3.485, 3.495, 3.505, 3.515, 3.525, 3.535, 3.545, 3.555, 3.565, 3.575, 3.585, 3.595, 3.605, 3.615, 3.625, 3.635, 3.645, 3.655, 3.665, 3.675, 3.685, 3.695, 3.705, 3.715, 3.725, 3.735, 3.745, 3.755, 3.765, 3.775, 3.785, 3.795, 3.805, 3.815, 3.825, 3.835, 3.845, 3.855, 3.865, 3.875, 3.885, 3.895, 3.905, 3.915, 3.925, 3.935, 3.945, 3.955, 3.965, 3.975, 3.985, 3.995, 4.04}; + Double_t yAxis1[21] = {0, 0.1, 0.35, 0.75, 1.5, 3.5, 7.5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 150, 350, 750, 4000, 7070}; + + ssigpTa = new TH2D("ssigpTa","ssigpTa",401, xAxis1,20, yAxis1); + ssigpTa->SetDirectory(0); + ssigpTa->SetBinContent(404,0.00376935); + ssigpTa->SetBinContent(405,0.00403546); + ssigpTa->SetBinContent(406,0.00381162); + ssigpTa->SetBinContent(407,0.00381217); + ssigpTa->SetBinContent(408,0.00381294); + ssigpTa->SetBinContent(409,0.00381393); + ssigpTa->SetBinContent(410,0.00381514); + ssigpTa->SetBinContent(411,0.00381656); + ssigpTa->SetBinContent(412,0.00381818); + ssigpTa->SetBinContent(413,0.00382003); + ssigpTa->SetBinContent(414,0.00382212); + ssigpTa->SetBinContent(415,0.0038244); + ssigpTa->SetBinContent(416,0.00382692); + ssigpTa->SetBinContent(417,0.00382964); + ssigpTa->SetBinContent(418,0.00383262); + ssigpTa->SetBinContent(419,0.00383577); + ssigpTa->SetBinContent(420,0.00383916); + ssigpTa->SetBinContent(421,0.00384277); + ssigpTa->SetBinContent(422,0.00384662); + ssigpTa->SetBinContent(423,0.00385064); + ssigpTa->SetBinContent(424,0.00385492); + ssigpTa->SetBinContent(425,0.0038594); + ssigpTa->SetBinContent(426,0.00386414); + ssigpTa->SetBinContent(427,0.00386906); + ssigpTa->SetBinContent(428,0.00387425); + ssigpTa->SetBinContent(429,0.00387962); + ssigpTa->SetBinContent(430,0.00388525); + ssigpTa->SetBinContent(431,0.00389108); + ssigpTa->SetBinContent(432,0.00389714); + ssigpTa->SetBinContent(433,0.00390344); + ssigpTa->SetBinContent(434,0.00390993); + ssigpTa->SetBinContent(435,0.00391666); + ssigpTa->SetBinContent(436,0.00392361); + ssigpTa->SetBinContent(437,0.00393079); + ssigpTa->SetBinContent(438,0.00393821); + ssigpTa->SetBinContent(439,0.00394585); + ssigpTa->SetBinContent(440,0.00395369); + ssigpTa->SetBinContent(441,0.00396177); + ssigpTa->SetBinContent(442,0.00397009); + ssigpTa->SetBinContent(443,0.00397863); + ssigpTa->SetBinContent(444,0.00398739); + ssigpTa->SetBinContent(445,0.00399641); + ssigpTa->SetBinContent(446,0.00400562); + ssigpTa->SetBinContent(447,0.00401509); + ssigpTa->SetBinContent(448,0.00402474); + ssigpTa->SetBinContent(449,0.00403467); + ssigpTa->SetBinContent(450,0.00404481); + ssigpTa->SetBinContent(451,0.00405522); + ssigpTa->SetBinContent(452,0.00406581); + ssigpTa->SetBinContent(453,0.00407667); + ssigpTa->SetBinContent(454,0.00408774); + ssigpTa->SetBinContent(455,0.00409907); + ssigpTa->SetBinContent(456,0.00411062); + ssigpTa->SetBinContent(457,0.0041224); + ssigpTa->SetBinContent(458,0.00413443); + ssigpTa->SetBinContent(459,0.00414672); + ssigpTa->SetBinContent(460,0.00415923); + ssigpTa->SetBinContent(461,0.00417199); + ssigpTa->SetBinContent(462,0.00418499); + ssigpTa->SetBinContent(463,0.00419821); + ssigpTa->SetBinContent(464,0.00421168); + ssigpTa->SetBinContent(465,0.00422538); + ssigpTa->SetBinContent(466,0.00423936); + ssigpTa->SetBinContent(467,0.00425357); + ssigpTa->SetBinContent(468,0.00426805); + ssigpTa->SetBinContent(469,0.00428276); + ssigpTa->SetBinContent(470,0.00429774); + ssigpTa->SetBinContent(471,0.00431297); + ssigpTa->SetBinContent(472,0.00432846); + ssigpTa->SetBinContent(473,0.0043442); + ssigpTa->SetBinContent(474,0.00436019); + ssigpTa->SetBinContent(475,0.00437648); + ssigpTa->SetBinContent(476,0.00439297); + ssigpTa->SetBinContent(477,0.00440978); + ssigpTa->SetBinContent(478,0.00442682); + ssigpTa->SetBinContent(479,0.00444416); + ssigpTa->SetBinContent(480,0.00446178); + ssigpTa->SetBinContent(481,0.00447964); + ssigpTa->SetBinContent(482,0.00449781); + ssigpTa->SetBinContent(483,0.00451624); + ssigpTa->SetBinContent(484,0.00453498); + ssigpTa->SetBinContent(485,0.00455396); + ssigpTa->SetBinContent(486,0.00457327); + ssigpTa->SetBinContent(487,0.00459285); + ssigpTa->SetBinContent(488,0.00461273); + ssigpTa->SetBinContent(489,0.00463291); + ssigpTa->SetBinContent(490,0.0046534); + ssigpTa->SetBinContent(491,0.00467419); + ssigpTa->SetBinContent(492,0.00469528); + ssigpTa->SetBinContent(493,0.00471669); + ssigpTa->SetBinContent(494,0.00473843); + ssigpTa->SetBinContent(495,0.00476048); + ssigpTa->SetBinContent(496,0.00478285); + ssigpTa->SetBinContent(497,0.00480556); + ssigpTa->SetBinContent(498,0.00482862); + ssigpTa->SetBinContent(499,0.00485199); + ssigpTa->SetBinContent(500,0.00487574); + ssigpTa->SetBinContent(501,0.00489983); + ssigpTa->SetBinContent(502,0.00492428); + ssigpTa->SetBinContent(503,0.0049491); + ssigpTa->SetBinContent(504,0.00497428); + ssigpTa->SetBinContent(505,0.00499983); + ssigpTa->SetBinContent(506,0.00502577); + ssigpTa->SetBinContent(507,0.0050521); + ssigpTa->SetBinContent(508,0.00512786); + ssigpTa->SetBinContent(509,0.00522874); + ssigpTa->SetBinContent(510,0.00542079); + ssigpTa->SetBinContent(511,0.00562221); + ssigpTa->SetBinContent(512,0.00576652); + ssigpTa->SetBinContent(513,0.00579631); + ssigpTa->SetBinContent(514,0.00582647); + ssigpTa->SetBinContent(515,0.00585708); + ssigpTa->SetBinContent(516,0.0058881); + ssigpTa->SetBinContent(517,0.00591953); + ssigpTa->SetBinContent(518,0.00595139); + ssigpTa->SetBinContent(519,0.00598369); + ssigpTa->SetBinContent(520,0.00601647); + ssigpTa->SetBinContent(521,0.00596671); + ssigpTa->SetBinContent(522,0.0058563); + ssigpTa->SetBinContent(523,0.00579236); + ssigpTa->SetBinContent(524,0.00584228); + ssigpTa->SetBinContent(525,0.00592532); + ssigpTa->SetBinContent(526,0.00600789); + ssigpTa->SetBinContent(527,0.00608967); + ssigpTa->SetBinContent(528,0.00617063); + ssigpTa->SetBinContent(529,0.00625074); + ssigpTa->SetBinContent(530,0.00619557); + ssigpTa->SetBinContent(531,0.00608133); + ssigpTa->SetBinContent(532,0.00586874); + ssigpTa->SetBinContent(533,0.00571002); + ssigpTa->SetBinContent(534,0.00564251); + ssigpTa->SetBinContent(535,0.0057559); + ssigpTa->SetBinContent(536,0.00587054); + ssigpTa->SetBinContent(537,0.00598661); + ssigpTa->SetBinContent(538,0.00610439); + ssigpTa->SetBinContent(539,0.00622345); + ssigpTa->SetBinContent(540,0.00634355); + ssigpTa->SetBinContent(541,0.00633138); + ssigpTa->SetBinContent(542,0.00624783); + ssigpTa->SetBinContent(543,0.00622637); + ssigpTa->SetBinContent(544,0.00633454); + ssigpTa->SetBinContent(545,0.00644296); + ssigpTa->SetBinContent(546,0.00655136); + ssigpTa->SetBinContent(547,0.00665977); + ssigpTa->SetBinContent(548,0.00676815); + ssigpTa->SetBinContent(549,0.00666967); + ssigpTa->SetBinContent(550,0.00646951); + ssigpTa->SetBinContent(551,0.0063777); + ssigpTa->SetBinContent(552,0.00638312); + ssigpTa->SetBinContent(553,0.00632729); + ssigpTa->SetBinContent(554,0.00632674); + ssigpTa->SetBinContent(555,0.00643748); + ssigpTa->SetBinContent(556,0.00654905); + ssigpTa->SetBinContent(557,0.00666056); + ssigpTa->SetBinContent(558,0.00677343); + ssigpTa->SetBinContent(559,0.00688786); + ssigpTa->SetBinContent(560,0.00700225); + ssigpTa->SetBinContent(561,0.00711629); + ssigpTa->SetBinContent(562,0.00723174); + ssigpTa->SetBinContent(563,0.0073484); + ssigpTa->SetBinContent(564,0.00737881); + ssigpTa->SetBinContent(565,0.00735909); + ssigpTa->SetBinContent(566,0.00738603); + ssigpTa->SetBinContent(567,0.00725894); + ssigpTa->SetBinContent(568,0.00701426); + ssigpTa->SetBinContent(569,0.00689222); + ssigpTa->SetBinContent(570,0.00701426); + ssigpTa->SetBinContent(571,0.00713891); + ssigpTa->SetBinContent(572,0.00726514); + ssigpTa->SetBinContent(573,0.00739131); + ssigpTa->SetBinContent(574,0.00751988); + ssigpTa->SetBinContent(575,0.00764392); + ssigpTa->SetBinContent(576,0.00776171); + ssigpTa->SetBinContent(577,0.00788676); + ssigpTa->SetBinContent(578,0.00804942); + ssigpTa->SetBinContent(579,0.00822778); + ssigpTa->SetBinContent(580,0.00838862); + ssigpTa->SetBinContent(581,0.00851798); + ssigpTa->SetBinContent(582,0.00829956); + ssigpTa->SetBinContent(583,0.00790057); + ssigpTa->SetBinContent(584,0.00765526); + ssigpTa->SetBinContent(585,0.00774777); + ssigpTa->SetBinContent(586,0.00783839); + ssigpTa->SetBinContent(587,0.00792625); + ssigpTa->SetBinContent(588,0.00798522); + ssigpTa->SetBinContent(589,0.0080391); + ssigpTa->SetBinContent(590,0.00773257); + ssigpTa->SetBinContent(591,0.0072719); + ssigpTa->SetBinContent(592,0.00699802); + ssigpTa->SetBinContent(593,0.00709591); + ssigpTa->SetBinContent(594,0.00719689); + ssigpTa->SetBinContent(595,0.00730227); + ssigpTa->SetBinContent(596,0.00774271); + ssigpTa->SetBinContent(597,0.00835232); + ssigpTa->SetBinContent(598,0.00880117); + ssigpTa->SetBinContent(599,0.00892358); + ssigpTa->SetBinContent(600,0.0090515); + ssigpTa->SetBinContent(601,0.00918244); + ssigpTa->SetBinContent(602,0.00931276); + ssigpTa->SetBinContent(603,0.00944184); + ssigpTa->SetBinContent(604,0.00956988); + ssigpTa->SetBinContent(605,0.00945387); + ssigpTa->SetBinContent(606,0.00921499); + ssigpTa->SetBinContent(607,0.00909704); + ssigpTa->SetBinContent(608,0.00921974); + ssigpTa->SetBinContent(609,0.00964494); + ssigpTa->SetBinContent(610,0.010228); + ssigpTa->SetBinContent(611,0.0106744); + ssigpTa->SetBinContent(612,0.010828); + ssigpTa->SetBinContent(613,0.0109836); + ssigpTa->SetBinContent(614,0.0111373); + ssigpTa->SetBinContent(615,0.0112935); + ssigpTa->SetBinContent(616,0.0111491); + ssigpTa->SetBinContent(617,0.0108465); + ssigpTa->SetBinContent(618,0.0106934); + ssigpTa->SetBinContent(619,0.0108454); + ssigpTa->SetBinContent(620,0.0113492); + ssigpTa->SetBinContent(621,0.0120304); + ssigpTa->SetBinContent(622,0.0125365); + ssigpTa->SetBinContent(623,0.0126997); + ssigpTa->SetBinContent(624,0.0128729); + ssigpTa->SetBinContent(625,0.0130574); + ssigpTa->SetBinContent(626,0.0132435); + ssigpTa->SetBinContent(627,0.0134278); + ssigpTa->SetBinContent(628,0.0128264); + ssigpTa->SetBinContent(629,0.0118163); + ssigpTa->SetBinContent(630,0.0111824); + ssigpTa->SetBinContent(631,0.0115923); + ssigpTa->SetBinContent(632,0.0121482); + ssigpTa->SetBinContent(633,0.012581); + ssigpTa->SetBinContent(634,0.0127586); + ssigpTa->SetBinContent(635,0.0129429); + ssigpTa->SetBinContent(636,0.0131269); + ssigpTa->SetBinContent(637,0.0133019); + ssigpTa->SetBinContent(638,0.0134672); + ssigpTa->SetBinContent(639,0.0136361); + ssigpTa->SetBinContent(640,0.0136828); + ssigpTa->SetBinContent(641,0.0139461); + ssigpTa->SetBinContent(642,0.0144425); + ssigpTa->SetBinContent(643,0.0149276); + ssigpTa->SetBinContent(644,0.0151285); + ssigpTa->SetBinContent(645,0.0153371); + ssigpTa->SetBinContent(646,0.0155552); + ssigpTa->SetBinContent(647,0.0157722); + ssigpTa->SetBinContent(648,0.0159821); + ssigpTa->SetBinContent(649,0.0161983); + ssigpTa->SetBinContent(650,0.016429); + ssigpTa->SetBinContent(651,0.0166743); + ssigpTa->SetBinContent(652,0.0171956); + ssigpTa->SetBinContent(653,0.0178463); + ssigpTa->SetBinContent(654,0.0183381); + ssigpTa->SetBinContent(655,0.0185809); + ssigpTa->SetBinContent(656,0.0188411); + ssigpTa->SetBinContent(657,0.0190922); + ssigpTa->SetBinContent(658,0.019353); + ssigpTa->SetBinContent(659,0.0196432); + ssigpTa->SetBinContent(660,0.0199575); + ssigpTa->SetBinContent(661,0.0202705); + ssigpTa->SetBinContent(662,0.020755); + ssigpTa->SetBinContent(663,0.0213363); + ssigpTa->SetBinContent(664,0.0218103); + ssigpTa->SetBinContent(665,0.022137); + ssigpTa->SetBinContent(666,0.0224854); + ssigpTa->SetBinContent(667,0.0228549); + ssigpTa->SetBinContent(668,0.0232076); + ssigpTa->SetBinContent(669,0.0235705); + ssigpTa->SetBinContent(670,0.0239392); + ssigpTa->SetBinContent(671,0.0243651); + ssigpTa->SetBinContent(672,0.0248206); + ssigpTa->SetBinContent(673,0.0252509); + ssigpTa->SetBinContent(674,0.0256526); + ssigpTa->SetBinContent(675,0.0260818); + ssigpTa->SetBinContent(676,0.0265134); + ssigpTa->SetBinContent(677,0.0269288); + ssigpTa->SetBinContent(678,0.0273255); + ssigpTa->SetBinContent(679,0.0277343); + ssigpTa->SetBinContent(680,0.0281183); + ssigpTa->SetBinContent(681,0.0284704); + ssigpTa->SetBinContent(682,0.0288786); + ssigpTa->SetBinContent(683,0.0293831); + ssigpTa->SetBinContent(684,0.0299043); + ssigpTa->SetBinContent(685,0.0304113); + ssigpTa->SetBinContent(686,0.0309096); + ssigpTa->SetBinContent(687,0.0313987); + ssigpTa->SetBinContent(688,0.0318794); + ssigpTa->SetBinContent(689,0.0323473); + ssigpTa->SetBinContent(690,0.0327976); + ssigpTa->SetBinContent(691,0.0332461); + ssigpTa->SetBinContent(692,0.0337297); + ssigpTa->SetBinContent(693,0.0342576); + ssigpTa->SetBinContent(694,0.0348336); + ssigpTa->SetBinContent(695,0.0354498); + ssigpTa->SetBinContent(696,0.0360781); + ssigpTa->SetBinContent(697,0.0366859); + ssigpTa->SetBinContent(698,0.0372341); + ssigpTa->SetBinContent(699,0.0353407); + ssigpTa->SetBinContent(700,0.0321961); + ssigpTa->SetBinContent(701,0.0301796); + ssigpTa->SetBinContent(702,0.0305428); + ssigpTa->SetBinContent(703,0.0309639); + ssigpTa->SetBinContent(704,0.0314307); + ssigpTa->SetBinContent(705,0.031895); + ssigpTa->SetBinContent(706,0.0323515); + ssigpTa->SetBinContent(707,0.0328017); + ssigpTa->SetBinContent(708,0.0332283); + ssigpTa->SetBinContent(709,0.0336678); + ssigpTa->SetBinContent(710,0.0341384); + ssigpTa->SetBinContent(711,0.034613); + ssigpTa->SetBinContent(712,0.0350458); + ssigpTa->SetBinContent(713,0.0354701); + ssigpTa->SetBinContent(714,0.0359749); + ssigpTa->SetBinContent(715,0.0365686); + ssigpTa->SetBinContent(716,0.0372079); + ssigpTa->SetBinContent(717,0.0378413); + ssigpTa->SetBinContent(718,0.0384681); + ssigpTa->SetBinContent(719,0.0423062); + ssigpTa->SetBinContent(720,0.0477518); + ssigpTa->SetBinContent(721,0.0515679); + ssigpTa->SetBinContent(722,0.0522397); + ssigpTa->SetBinContent(723,0.0529964); + ssigpTa->SetBinContent(724,0.0537462); + ssigpTa->SetBinContent(725,0.0544663); + ssigpTa->SetBinContent(726,0.0551197); + ssigpTa->SetBinContent(727,0.0556585); + ssigpTa->SetBinContent(728,0.0561304); + ssigpTa->SetBinContent(729,0.0565801); + ssigpTa->SetBinContent(730,0.057052); + ssigpTa->SetBinContent(731,0.0574912); + ssigpTa->SetBinContent(732,0.0580153); + ssigpTa->SetBinContent(733,0.0587329); + ssigpTa->SetBinContent(734,0.0596744); + ssigpTa->SetBinContent(735,0.0606807); + ssigpTa->SetBinContent(736,0.0616298); + ssigpTa->SetBinContent(737,0.0625252); + ssigpTa->SetBinContent(738,0.0634295); + ssigpTa->SetBinContent(739,0.0643312); + ssigpTa->SetBinContent(740,0.0651772); + ssigpTa->SetBinContent(741,0.0659891); + ssigpTa->SetBinContent(742,0.0666738); + ssigpTa->SetBinContent(743,0.0671047); + ssigpTa->SetBinContent(744,0.0672537); + ssigpTa->SetBinContent(745,0.0673086); + ssigpTa->SetBinContent(746,0.0675473); + ssigpTa->SetBinContent(747,0.0680767); + ssigpTa->SetBinContent(748,0.0687918); + ssigpTa->SetBinContent(749,0.0695324); + ssigpTa->SetBinContent(750,0.0704126); + ssigpTa->SetBinContent(751,0.0715024); + ssigpTa->SetBinContent(752,0.0727042); + ssigpTa->SetBinContent(753,0.0739178); + ssigpTa->SetBinContent(754,0.0751282); + ssigpTa->SetBinContent(755,0.0762994); + ssigpTa->SetBinContent(756,0.0774026); + ssigpTa->SetBinContent(757,0.0784439); + ssigpTa->SetBinContent(758,0.0794428); + ssigpTa->SetBinContent(759,0.0804994); + ssigpTa->SetBinContent(760,0.0814559); + ssigpTa->SetBinContent(761,0.0823259); + ssigpTa->SetBinContent(762,0.0831898); + ssigpTa->SetBinContent(763,0.0842252); + ssigpTa->SetBinContent(764,0.0852436); + ssigpTa->SetBinContent(765,0.0862144); + ssigpTa->SetBinContent(766,0.0871692); + ssigpTa->SetBinContent(767,0.0881025); + ssigpTa->SetBinContent(768,0.0890303); + ssigpTa->SetBinContent(769,0.0898539); + ssigpTa->SetBinContent(770,0.0905595); + ssigpTa->SetBinContent(771,0.0912017); + ssigpTa->SetBinContent(772,0.0918366); + ssigpTa->SetBinContent(773,0.0923262); + ssigpTa->SetBinContent(774,0.0927084); + ssigpTa->SetBinContent(775,0.0931759); + ssigpTa->SetBinContent(776,0.0937229); + ssigpTa->SetBinContent(777,0.0941004); + ssigpTa->SetBinContent(778,0.0943373); + ssigpTa->SetBinContent(779,0.0952367); + ssigpTa->SetBinContent(780,0.0972312); + ssigpTa->SetBinContent(781,0.100253); + ssigpTa->SetBinContent(782,0.10351); + ssigpTa->SetBinContent(783,0.106283); + ssigpTa->SetBinContent(784,0.111832); + ssigpTa->SetBinContent(785,0.118243); + ssigpTa->SetBinContent(786,0.122884); + ssigpTa->SetBinContent(787,0.124361); + ssigpTa->SetBinContent(788,0.126269); + ssigpTa->SetBinContent(789,0.127528); + ssigpTa->SetBinContent(790,0.128071); + ssigpTa->SetBinContent(791,0.128056); + ssigpTa->SetBinContent(792,0.128494); + ssigpTa->SetBinContent(793,0.130754); + ssigpTa->SetBinContent(794,0.134705); + ssigpTa->SetBinContent(795,0.138991); + ssigpTa->SetBinContent(796,0.143036); + ssigpTa->SetBinContent(797,0.147691); + ssigpTa->SetBinContent(798,0.152926); + ssigpTa->SetBinContent(799,0.157828); + ssigpTa->SetBinContent(800,0.161423); + ssigpTa->SetBinContent(801,0.163129); + ssigpTa->SetBinContent(802,0.16236); + ssigpTa->SetBinContent(803,0.170684); + ssigpTa->SetBinContent(804,0.161661); + ssigpTa->SetBinContent(807,0.00749609); + ssigpTa->SetBinContent(808,0.00724557); + ssigpTa->SetBinContent(809,0.00735266); + ssigpTa->SetBinContent(810,0.00735373); + ssigpTa->SetBinContent(811,0.00735522); + ssigpTa->SetBinContent(812,0.00735714); + ssigpTa->SetBinContent(813,0.00735943); + ssigpTa->SetBinContent(814,0.00736217); + ssigpTa->SetBinContent(815,0.0073653); + ssigpTa->SetBinContent(816,0.00736884); + ssigpTa->SetBinContent(817,0.00737288); + ssigpTa->SetBinContent(818,0.0073773); + ssigpTa->SetBinContent(819,0.00738209); + ssigpTa->SetBinContent(820,0.00738739); + ssigpTa->SetBinContent(821,0.00739312); + ssigpTa->SetBinContent(822,0.00739923); + ssigpTa->SetBinContent(823,0.00740576); + ssigpTa->SetBinContent(824,0.00741273); + ssigpTa->SetBinContent(825,0.00742012); + ssigpTa->SetBinContent(826,0.00742789); + ssigpTa->SetBinContent(827,0.00743609); + ssigpTa->SetBinContent(828,0.00744481); + ssigpTa->SetBinContent(829,0.00745389); + ssigpTa->SetBinContent(830,0.00746343); + ssigpTa->SetBinContent(831,0.00747339); + ssigpTa->SetBinContent(832,0.00748377); + ssigpTa->SetBinContent(833,0.00749459); + ssigpTa->SetBinContent(834,0.00750585); + ssigpTa->SetBinContent(835,0.00751753); + ssigpTa->SetBinContent(836,0.00752969); + ssigpTa->SetBinContent(837,0.00754222); + ssigpTa->SetBinContent(838,0.0075552); + ssigpTa->SetBinContent(839,0.00756856); + ssigpTa->SetBinContent(840,0.00758242); + ssigpTa->SetBinContent(841,0.00759673); + ssigpTa->SetBinContent(842,0.00761143); + ssigpTa->SetBinContent(843,0.0076266); + ssigpTa->SetBinContent(844,0.00764213); + ssigpTa->SetBinContent(845,0.00765818); + ssigpTa->SetBinContent(846,0.00767467); + ssigpTa->SetBinContent(847,0.00769157); + ssigpTa->SetBinContent(848,0.00770893); + ssigpTa->SetBinContent(849,0.00772677); + ssigpTa->SetBinContent(850,0.00774494); + ssigpTa->SetBinContent(851,0.00776362); + ssigpTa->SetBinContent(852,0.00778271); + ssigpTa->SetBinContent(853,0.00780231); + ssigpTa->SetBinContent(854,0.00782228); + ssigpTa->SetBinContent(855,0.00784277); + ssigpTa->SetBinContent(856,0.00786367); + ssigpTa->SetBinContent(857,0.00788508); + ssigpTa->SetBinContent(858,0.0079069); + ssigpTa->SetBinContent(859,0.00792915); + ssigpTa->SetBinContent(860,0.00795191); + ssigpTa->SetBinContent(861,0.0079751); + ssigpTa->SetBinContent(862,0.00799874); + ssigpTa->SetBinContent(863,0.00802288); + ssigpTa->SetBinContent(864,0.00804749); + ssigpTa->SetBinContent(865,0.00807255); + ssigpTa->SetBinContent(866,0.00809806); + ssigpTa->SetBinContent(867,0.00812402); + ssigpTa->SetBinContent(868,0.00815045); + ssigpTa->SetBinContent(869,0.00817736); + ssigpTa->SetBinContent(870,0.00820478); + ssigpTa->SetBinContent(871,0.00823271); + ssigpTa->SetBinContent(872,0.00826106); + ssigpTa->SetBinContent(873,0.00828993); + ssigpTa->SetBinContent(874,0.00831931); + ssigpTa->SetBinContent(875,0.00834918); + ssigpTa->SetBinContent(876,0.00837952); + ssigpTa->SetBinContent(877,0.00841038); + ssigpTa->SetBinContent(878,0.00844172); + ssigpTa->SetBinContent(879,0.00847358); + ssigpTa->SetBinContent(880,0.0085059); + ssigpTa->SetBinContent(881,0.00853882); + ssigpTa->SetBinContent(882,0.00857221); + ssigpTa->SetBinContent(883,0.0086062); + ssigpTa->SetBinContent(884,0.00864065); + ssigpTa->SetBinContent(885,0.00867567); + ssigpTa->SetBinContent(886,0.00871122); + ssigpTa->SetBinContent(887,0.00874728); + ssigpTa->SetBinContent(888,0.00878391); + ssigpTa->SetBinContent(889,0.00882111); + ssigpTa->SetBinContent(890,0.00885887); + ssigpTa->SetBinContent(891,0.0088972); + ssigpTa->SetBinContent(892,0.00893613); + ssigpTa->SetBinContent(893,0.0089756); + ssigpTa->SetBinContent(894,0.00901571); + ssigpTa->SetBinContent(895,0.00905637); + ssigpTa->SetBinContent(896,0.00909764); + ssigpTa->SetBinContent(897,0.00913952); + ssigpTa->SetBinContent(898,0.00918204); + ssigpTa->SetBinContent(899,0.00922514); + ssigpTa->SetBinContent(900,0.00926896); + ssigpTa->SetBinContent(901,0.00931336); + ssigpTa->SetBinContent(902,0.00935846); + ssigpTa->SetBinContent(903,0.00940421); + ssigpTa->SetBinContent(904,0.00945063); + ssigpTa->SetBinContent(905,0.00949777); + ssigpTa->SetBinContent(906,0.00954561); + ssigpTa->SetBinContent(907,0.0095941); + ssigpTa->SetBinContent(908,0.00964337); + ssigpTa->SetBinContent(909,0.00969332); + ssigpTa->SetBinContent(910,0.00976247); + ssigpTa->SetBinContent(911,0.00988758); + ssigpTa->SetBinContent(912,0.0101304); + ssigpTa->SetBinContent(913,0.0104308); + ssigpTa->SetBinContent(914,0.0108503); + ssigpTa->SetBinContent(915,0.0110796); + ssigpTa->SetBinContent(916,0.0111801); + ssigpTa->SetBinContent(917,0.0112383); + ssigpTa->SetBinContent(918,0.0112973); + ssigpTa->SetBinContent(919,0.011357); + ssigpTa->SetBinContent(920,0.0114176); + ssigpTa->SetBinContent(921,0.011479); + ssigpTa->SetBinContent(922,0.0115413); + ssigpTa->SetBinContent(923,0.0115733); + ssigpTa->SetBinContent(924,0.0115053); + ssigpTa->SetBinContent(925,0.0112966); + ssigpTa->SetBinContent(926,0.0112057); + ssigpTa->SetBinContent(927,0.0112798); + ssigpTa->SetBinContent(928,0.0114275); + ssigpTa->SetBinContent(929,0.0115866); + ssigpTa->SetBinContent(930,0.0117444); + ssigpTa->SetBinContent(931,0.0119006); + ssigpTa->SetBinContent(932,0.0120048); + ssigpTa->SetBinContent(933,0.011959); + ssigpTa->SetBinContent(934,0.0116566); + ssigpTa->SetBinContent(935,0.0113809); + ssigpTa->SetBinContent(936,0.0110022); + ssigpTa->SetBinContent(937,0.0109487); + ssigpTa->SetBinContent(938,0.0111003); + ssigpTa->SetBinContent(939,0.0113216); + ssigpTa->SetBinContent(940,0.0115457); + ssigpTa->SetBinContent(941,0.0117729); + ssigpTa->SetBinContent(942,0.0120027); + ssigpTa->SetBinContent(943,0.0121845); + ssigpTa->SetBinContent(944,0.0122148); + ssigpTa->SetBinContent(945,0.0120384); + ssigpTa->SetBinContent(946,0.0120522); + ssigpTa->SetBinContent(947,0.0122125); + ssigpTa->SetBinContent(948,0.0124218); + ssigpTa->SetBinContent(949,0.012631); + ssigpTa->SetBinContent(950,0.0128404); + ssigpTa->SetBinContent(951,0.0129721); + ssigpTa->SetBinContent(952,0.0128708); + ssigpTa->SetBinContent(953,0.0124623); + ssigpTa->SetBinContent(954,0.0123308); + ssigpTa->SetBinContent(955,0.0123067); + ssigpTa->SetBinContent(956,0.0121865); + ssigpTa->SetBinContent(957,0.0122302); + ssigpTa->SetBinContent(958,0.0124027); + ssigpTa->SetBinContent(959,0.0126177); + ssigpTa->SetBinContent(960,0.0128333); + ssigpTa->SetBinContent(961,0.013051); + ssigpTa->SetBinContent(962,0.0132716); + ssigpTa->SetBinContent(963,0.0134922); + ssigpTa->SetBinContent(964,0.0137126); + ssigpTa->SetBinContent(965,0.0139354); + ssigpTa->SetBinContent(966,0.014128); + ssigpTa->SetBinContent(967,0.0142151); + ssigpTa->SetBinContent(968,0.0141657); + ssigpTa->SetBinContent(969,0.014157); + ssigpTa->SetBinContent(970,0.0139838); + ssigpTa->SetBinContent(971,0.0134866); + ssigpTa->SetBinContent(972,0.0133548); + ssigpTa->SetBinContent(973,0.0134993); + ssigpTa->SetBinContent(974,0.0137399); + ssigpTa->SetBinContent(975,0.0139821); + ssigpTa->SetBinContent(976,0.0142267); + ssigpTa->SetBinContent(977,0.0144711); + ssigpTa->SetBinContent(978,0.0147071); + ssigpTa->SetBinContent(979,0.0149302); + ssigpTa->SetBinContent(980,0.0151791); + ssigpTa->SetBinContent(981,0.0154773); + ssigpTa->SetBinContent(982,0.0158245); + ssigpTa->SetBinContent(983,0.0161228); + ssigpTa->SetBinContent(984,0.0162527); + ssigpTa->SetBinContent(985,0.0159832); + ssigpTa->SetBinContent(986,0.0151781); + ssigpTa->SetBinContent(987,0.0148593); + ssigpTa->SetBinContent(988,0.0149109); + ssigpTa->SetBinContent(989,0.0150858); + ssigpTa->SetBinContent(990,0.0152449); + ssigpTa->SetBinContent(991,0.0153822); + ssigpTa->SetBinContent(992,0.0153467); + ssigpTa->SetBinContent(993,0.0149358); + ssigpTa->SetBinContent(994,0.0139943); + ssigpTa->SetBinContent(995,0.0136246); + ssigpTa->SetBinContent(996,0.013674); + ssigpTa->SetBinContent(997,0.0138693); + ssigpTa->SetBinContent(998,0.0141965); + ssigpTa->SetBinContent(999,0.0149021); + ssigpTa->SetBinContent(1000,0.0161123); + ssigpTa->SetBinContent(1001,0.016835); + ssigpTa->SetBinContent(1002,0.0171945); + ssigpTa->SetBinContent(1003,0.0174405); + ssigpTa->SetBinContent(1004,0.0176913); + ssigpTa->SetBinContent(1005,0.0179418); + ssigpTa->SetBinContent(1006,0.0181907); + ssigpTa->SetBinContent(1007,0.0183463); + ssigpTa->SetBinContent(1008,0.0182254); + ssigpTa->SetBinContent(1009,0.0177376); + ssigpTa->SetBinContent(1010,0.0176124); + ssigpTa->SetBinContent(1011,0.0178717); + ssigpTa->SetBinContent(1012,0.0185643); + ssigpTa->SetBinContent(1013,0.0197249); + ssigpTa->SetBinContent(1014,0.0204536); + ssigpTa->SetBinContent(1015,0.0208625); + ssigpTa->SetBinContent(1016,0.0211591); + ssigpTa->SetBinContent(1017,0.0214572); + ssigpTa->SetBinContent(1018,0.0216443); + ssigpTa->SetBinContent(1019,0.0214899); + ssigpTa->SetBinContent(1020,0.0208765); + ssigpTa->SetBinContent(1021,0.0207069); + ssigpTa->SetBinContent(1022,0.0210183); + ssigpTa->SetBinContent(1023,0.0218411); + ssigpTa->SetBinContent(1024,0.0231881); + ssigpTa->SetBinContent(1025,0.0240215); + ssigpTa->SetBinContent(1026,0.0244649); + ssigpTa->SetBinContent(1027,0.0248007); + ssigpTa->SetBinContent(1028,0.0251539); + ssigpTa->SetBinContent(1029,0.0255097); + ssigpTa->SetBinContent(1030,0.0255722); + ssigpTa->SetBinContent(1031,0.0247407); + ssigpTa->SetBinContent(1032,0.0227126); + ssigpTa->SetBinContent(1033,0.0219251); + ssigpTa->SetBinContent(1034,0.0223175); + ssigpTa->SetBinContent(1035,0.0234186); + ssigpTa->SetBinContent(1036,0.0241426); + ssigpTa->SetBinContent(1037,0.0245835); + ssigpTa->SetBinContent(1038,0.0249361); + ssigpTa->SetBinContent(1039,0.0252883); + ssigpTa->SetBinContent(1040,0.0256263); + ssigpTa->SetBinContent(1041,0.025949); + ssigpTa->SetBinContent(1042,0.0262267); + ssigpTa->SetBinContent(1043,0.0264657); + ssigpTa->SetBinContent(1044,0.0268434); + ssigpTa->SetBinContent(1045,0.0278719); + ssigpTa->SetBinContent(1046,0.0286451); + ssigpTa->SetBinContent(1047,0.0291418); + ssigpTa->SetBinContent(1048,0.0295433); + ssigpTa->SetBinContent(1049,0.0299621); + ssigpTa->SetBinContent(1050,0.0303786); + ssigpTa->SetBinContent(1051,0.0307876); + ssigpTa->SetBinContent(1052,0.0312071); + ssigpTa->SetBinContent(1053,0.0316529); + ssigpTa->SetBinContent(1054,0.0322225); + ssigpTa->SetBinContent(1055,0.0331176); + ssigpTa->SetBinContent(1056,0.034394); + ssigpTa->SetBinContent(1057,0.0352343); + ssigpTa->SetBinContent(1058,0.0357963); + ssigpTa->SetBinContent(1059,0.0362891); + ssigpTa->SetBinContent(1060,0.0367818); + ssigpTa->SetBinContent(1061,0.0372847); + ssigpTa->SetBinContent(1062,0.0378478); + ssigpTa->SetBinContent(1063,0.038444); + ssigpTa->SetBinContent(1064,0.03911); + ssigpTa->SetBinContent(1065,0.0399866); + ssigpTa->SetBinContent(1066,0.0411268); + ssigpTa->SetBinContent(1067,0.0419998); + ssigpTa->SetBinContent(1068,0.0426737); + ssigpTa->SetBinContent(1069,0.0433464); + ssigpTa->SetBinContent(1070,0.0440285); + ssigpTa->SetBinContent(1071,0.0447164); + ssigpTa->SetBinContent(1072,0.0454109); + ssigpTa->SetBinContent(1073,0.0461452); + ssigpTa->SetBinContent(1074,0.0469523); + ssigpTa->SetBinContent(1075,0.0478554); + ssigpTa->SetBinContent(1076,0.0486778); + ssigpTa->SetBinContent(1077,0.0494767); + ssigpTa->SetBinContent(1078,0.050295); + ssigpTa->SetBinContent(1079,0.051119); + ssigpTa->SetBinContent(1080,0.0519212); + ssigpTa->SetBinContent(1081,0.052696); + ssigpTa->SetBinContent(1082,0.0534757); + ssigpTa->SetBinContent(1083,0.0542451); + ssigpTa->SetBinContent(1084,0.0549304); + ssigpTa->SetBinContent(1085,0.0557362); + ssigpTa->SetBinContent(1086,0.0566873); + ssigpTa->SetBinContent(1087,0.0576764); + ssigpTa->SetBinContent(1088,0.0586567); + ssigpTa->SetBinContent(1089,0.0596193); + ssigpTa->SetBinContent(1090,0.0605657); + ssigpTa->SetBinContent(1091,0.0614942); + ssigpTa->SetBinContent(1092,0.0623987); + ssigpTa->SetBinContent(1093,0.0632757); + ssigpTa->SetBinContent(1094,0.0641508); + ssigpTa->SetBinContent(1095,0.065086); + ssigpTa->SetBinContent(1096,0.0661113); + ssigpTa->SetBinContent(1097,0.0672141); + ssigpTa->SetBinContent(1098,0.0684009); + ssigpTa->SetBinContent(1099,0.069604); + ssigpTa->SetBinContent(1100,0.0707615); + ssigpTa->SetBinContent(1101,0.0709471); + ssigpTa->SetBinContent(1102,0.06833); + ssigpTa->SetBinContent(1103,0.0620588); + ssigpTa->SetBinContent(1104,0.0592317); + ssigpTa->SetBinContent(1105,0.0590566); + ssigpTa->SetBinContent(1106,0.0598805); + ssigpTa->SetBinContent(1107,0.0607726); + ssigpTa->SetBinContent(1108,0.0616674); + ssigpTa->SetBinContent(1109,0.0625505); + ssigpTa->SetBinContent(1110,0.0634107); + ssigpTa->SetBinContent(1111,0.0642479); + ssigpTa->SetBinContent(1112,0.0650916); + ssigpTa->SetBinContent(1113,0.0659991); + ssigpTa->SetBinContent(1114,0.0669086); + ssigpTa->SetBinContent(1115,0.0677697); + ssigpTa->SetBinContent(1116,0.0686376); + ssigpTa->SetBinContent(1117,0.0696172); + ssigpTa->SetBinContent(1118,0.0707627); + ssigpTa->SetBinContent(1119,0.0719706); + ssigpTa->SetBinContent(1120,0.0731864); + ssigpTa->SetBinContent(1121,0.0755972); + ssigpTa->SetBinContent(1122,0.081666); + ssigpTa->SetBinContent(1123,0.0926192); + ssigpTa->SetBinContent(1124,0.0986478); + ssigpTa->SetBinContent(1125,0.10115); + ssigpTa->SetBinContent(1126,0.10254); + ssigpTa->SetBinContent(1127,0.103964); + ssigpTa->SetBinContent(1128,0.105339); + ssigpTa->SetBinContent(1129,0.106593); + ssigpTa->SetBinContent(1130,0.107676); + ssigpTa->SetBinContent(1131,0.108605); + ssigpTa->SetBinContent(1132,0.109546); + ssigpTa->SetBinContent(1133,0.110464); + ssigpTa->SetBinContent(1134,0.111409); + ssigpTa->SetBinContent(1135,0.112453); + ssigpTa->SetBinContent(1136,0.113844); + ssigpTa->SetBinContent(1137,0.115589); + ssigpTa->SetBinContent(1138,0.117481); + ssigpTa->SetBinContent(1139,0.119316); + ssigpTa->SetBinContent(1140,0.12108); + ssigpTa->SetBinContent(1141,0.122824); + ssigpTa->SetBinContent(1142,0.124559); + ssigpTa->SetBinContent(1143,0.126209); + ssigpTa->SetBinContent(1144,0.127727); + ssigpTa->SetBinContent(1145,0.129057); + ssigpTa->SetBinContent(1146,0.129884); + ssigpTa->SetBinContent(1147,0.130269); + ssigpTa->SetBinContent(1148,0.130526); + ssigpTa->SetBinContent(1149,0.131031); + ssigpTa->SetBinContent(1150,0.132076); + ssigpTa->SetBinContent(1151,0.133411); + ssigpTa->SetBinContent(1152,0.134866); + ssigpTa->SetBinContent(1153,0.136572); + ssigpTa->SetBinContent(1154,0.138666); + ssigpTa->SetBinContent(1155,0.140954); + ssigpTa->SetBinContent(1156,0.143292); + ssigpTa->SetBinContent(1157,0.145616); + ssigpTa->SetBinContent(1158,0.147862); + ssigpTa->SetBinContent(1159,0.149986); + ssigpTa->SetBinContent(1160,0.152007); + ssigpTa->SetBinContent(1161,0.153995); + ssigpTa->SetBinContent(1162,0.156014); + ssigpTa->SetBinContent(1163,0.158052); + ssigpTa->SetBinContent(1164,0.159803); + ssigpTa->SetBinContent(1165,0.16164); + ssigpTa->SetBinContent(1166,0.163589); + ssigpTa->SetBinContent(1167,0.165539); + ssigpTa->SetBinContent(1168,0.16741); + ssigpTa->SetBinContent(1169,0.169234); + ssigpTa->SetBinContent(1170,0.171031); + ssigpTa->SetBinContent(1171,0.172747); + ssigpTa->SetBinContent(1172,0.17435); + ssigpTa->SetBinContent(1173,0.175706); + ssigpTa->SetBinContent(1174,0.176958); + ssigpTa->SetBinContent(1175,0.178175); + ssigpTa->SetBinContent(1176,0.179197); + ssigpTa->SetBinContent(1177,0.180054); + ssigpTa->SetBinContent(1178,0.181087); + ssigpTa->SetBinContent(1179,0.182208); + ssigpTa->SetBinContent(1180,0.183121); + ssigpTa->SetBinContent(1181,0.184082); + ssigpTa->SetBinContent(1182,0.186048); + ssigpTa->SetBinContent(1183,0.190066); + ssigpTa->SetBinContent(1184,0.195455); + ssigpTa->SetBinContent(1185,0.201339); + ssigpTa->SetBinContent(1186,0.207801); + ssigpTa->SetBinContent(1187,0.21687); + ssigpTa->SetBinContent(1188,0.230652); + ssigpTa->SetBinContent(1189,0.238229); + ssigpTa->SetBinContent(1190,0.242875); + ssigpTa->SetBinContent(1191,0.246347); + ssigpTa->SetBinContent(1192,0.249116); + ssigpTa->SetBinContent(1193,0.250839); + ssigpTa->SetBinContent(1194,0.251928); + ssigpTa->SetBinContent(1195,0.253783); + ssigpTa->SetBinContent(1196,0.258289); + ssigpTa->SetBinContent(1197,0.265386); + ssigpTa->SetBinContent(1198,0.273046); + ssigpTa->SetBinContent(1199,0.280644); + ssigpTa->SetBinContent(1200,0.289033); + ssigpTa->SetBinContent(1201,0.298321); + ssigpTa->SetBinContent(1202,0.306891); + ssigpTa->SetBinContent(1203,0.313539); + ssigpTa->SetBinContent(1204,0.317133); + ssigpTa->SetBinContent(1205,0.317289); + ssigpTa->SetBinContent(1206,0.314123); + ssigpTa->SetBinContent(1207,0.329276); + ssigpTa->SetBinContent(1210,0.00926623); + ssigpTa->SetBinContent(1211,0.00940212); + ssigpTa->SetBinContent(1212,0.009419); + ssigpTa->SetBinContent(1213,0.0094204); + ssigpTa->SetBinContent(1214,0.00942232); + ssigpTa->SetBinContent(1215,0.00942475); + ssigpTa->SetBinContent(1216,0.00942778); + ssigpTa->SetBinContent(1217,0.00943126); + ssigpTa->SetBinContent(1218,0.00943521); + ssigpTa->SetBinContent(1219,0.00943974); + ssigpTa->SetBinContent(1220,0.0094449); + ssigpTa->SetBinContent(1221,0.00945055); + ssigpTa->SetBinContent(1222,0.0094567); + ssigpTa->SetBinContent(1223,0.0094634); + ssigpTa->SetBinContent(1224,0.00947078); + ssigpTa->SetBinContent(1225,0.00947864); + ssigpTa->SetBinContent(1226,0.00948703); + ssigpTa->SetBinContent(1227,0.00949592); + ssigpTa->SetBinContent(1228,0.00950534); + ssigpTa->SetBinContent(1229,0.00951524); + ssigpTa->SetBinContent(1230,0.00952582); + ssigpTa->SetBinContent(1231,0.00953687); + ssigpTa->SetBinContent(1232,0.00954854); + ssigpTa->SetBinContent(1233,0.00956076); + ssigpTa->SetBinContent(1234,0.00957342); + ssigpTa->SetBinContent(1235,0.00958671); + ssigpTa->SetBinContent(1236,0.0096006); + ssigpTa->SetBinContent(1237,0.00961496); + ssigpTa->SetBinContent(1238,0.00962996); + ssigpTa->SetBinContent(1239,0.00964548); + ssigpTa->SetBinContent(1240,0.00966155); + ssigpTa->SetBinContent(1241,0.00967812); + ssigpTa->SetBinContent(1242,0.00969526); + ssigpTa->SetBinContent(1243,0.00971293); + ssigpTa->SetBinContent(1244,0.00973117); + ssigpTa->SetBinContent(1245,0.00975007); + ssigpTa->SetBinContent(1246,0.00976938); + ssigpTa->SetBinContent(1247,0.00978931); + ssigpTa->SetBinContent(1248,0.00980985); + ssigpTa->SetBinContent(1249,0.00983095); + ssigpTa->SetBinContent(1250,0.00985254); + ssigpTa->SetBinContent(1251,0.00987481); + ssigpTa->SetBinContent(1252,0.00989757); + ssigpTa->SetBinContent(1253,0.00992091); + ssigpTa->SetBinContent(1254,0.00994472); + ssigpTa->SetBinContent(1255,0.00996924); + ssigpTa->SetBinContent(1256,0.00999424); + ssigpTa->SetBinContent(1257,0.0100198); + ssigpTa->SetBinContent(1258,0.0100459); + ssigpTa->SetBinContent(1259,0.0100727); + ssigpTa->SetBinContent(1260,0.0101001); + ssigpTa->SetBinContent(1261,0.010128); + ssigpTa->SetBinContent(1262,0.0101565); + ssigpTa->SetBinContent(1263,0.0101856); + ssigpTa->SetBinContent(1264,0.0102153); + ssigpTa->SetBinContent(1265,0.0102455); + ssigpTa->SetBinContent(1266,0.0102763); + ssigpTa->SetBinContent(1267,0.0103079); + ssigpTa->SetBinContent(1268,0.0103399); + ssigpTa->SetBinContent(1269,0.0103725); + ssigpTa->SetBinContent(1270,0.0104057); + ssigpTa->SetBinContent(1271,0.0104396); + ssigpTa->SetBinContent(1272,0.010474); + ssigpTa->SetBinContent(1273,0.0105091); + ssigpTa->SetBinContent(1274,0.0105448); + ssigpTa->SetBinContent(1275,0.010581); + ssigpTa->SetBinContent(1276,0.010618); + ssigpTa->SetBinContent(1277,0.0106556); + ssigpTa->SetBinContent(1278,0.0106938); + ssigpTa->SetBinContent(1279,0.0107326); + ssigpTa->SetBinContent(1280,0.0107721); + ssigpTa->SetBinContent(1281,0.0108121); + ssigpTa->SetBinContent(1282,0.0108529); + ssigpTa->SetBinContent(1283,0.0108942); + ssigpTa->SetBinContent(1284,0.0109362); + ssigpTa->SetBinContent(1285,0.010979); + ssigpTa->SetBinContent(1286,0.0110225); + ssigpTa->SetBinContent(1287,0.0110665); + ssigpTa->SetBinContent(1288,0.0111113); + ssigpTa->SetBinContent(1289,0.0111567); + ssigpTa->SetBinContent(1290,0.0112028); + ssigpTa->SetBinContent(1291,0.0112498); + ssigpTa->SetBinContent(1292,0.0112973); + ssigpTa->SetBinContent(1293,0.0113456); + ssigpTa->SetBinContent(1294,0.0113947); + ssigpTa->SetBinContent(1295,0.0114445); + ssigpTa->SetBinContent(1296,0.011495); + ssigpTa->SetBinContent(1297,0.0115463); + ssigpTa->SetBinContent(1298,0.0115983); + ssigpTa->SetBinContent(1299,0.011651); + ssigpTa->SetBinContent(1300,0.0117046); + ssigpTa->SetBinContent(1301,0.0117589); + ssigpTa->SetBinContent(1302,0.0118141); + ssigpTa->SetBinContent(1303,0.0118701); + ssigpTa->SetBinContent(1304,0.0119269); + ssigpTa->SetBinContent(1305,0.0119845); + ssigpTa->SetBinContent(1306,0.0120431); + ssigpTa->SetBinContent(1307,0.0121023); + ssigpTa->SetBinContent(1308,0.0121627); + ssigpTa->SetBinContent(1309,0.0122237); + ssigpTa->SetBinContent(1310,0.0122858); + ssigpTa->SetBinContent(1311,0.0123487); + ssigpTa->SetBinContent(1312,0.0124126); + ssigpTa->SetBinContent(1313,0.0124951); + ssigpTa->SetBinContent(1314,0.0126668); + ssigpTa->SetBinContent(1315,0.0129516); + ssigpTa->SetBinContent(1316,0.0133761); + ssigpTa->SetBinContent(1317,0.0138816); + ssigpTa->SetBinContent(1318,0.0142034); + ssigpTa->SetBinContent(1319,0.0143184); + ssigpTa->SetBinContent(1320,0.0143928); + ssigpTa->SetBinContent(1321,0.0144682); + ssigpTa->SetBinContent(1322,0.0145447); + ssigpTa->SetBinContent(1323,0.0146222); + ssigpTa->SetBinContent(1324,0.0147007); + ssigpTa->SetBinContent(1325,0.0147802); + ssigpTa->SetBinContent(1326,0.014831); + ssigpTa->SetBinContent(1327,0.0147255); + ssigpTa->SetBinContent(1328,0.0144704); + ssigpTa->SetBinContent(1329,0.01434); + ssigpTa->SetBinContent(1330,0.0144386); + ssigpTa->SetBinContent(1331,0.0146317); + ssigpTa->SetBinContent(1332,0.0148357); + ssigpTa->SetBinContent(1333,0.0150379); + ssigpTa->SetBinContent(1334,0.0152381); + ssigpTa->SetBinContent(1335,0.0153875); + ssigpTa->SetBinContent(1336,0.0152955); + ssigpTa->SetBinContent(1337,0.0149627); + ssigpTa->SetBinContent(1338,0.0145336); + ssigpTa->SetBinContent(1339,0.0141103); + ssigpTa->SetBinContent(1340,0.0139995); + ssigpTa->SetBinContent(1341,0.0142153); + ssigpTa->SetBinContent(1342,0.0144993); + ssigpTa->SetBinContent(1343,0.0147867); + ssigpTa->SetBinContent(1344,0.0150783); + ssigpTa->SetBinContent(1345,0.0153729); + ssigpTa->SetBinContent(1346,0.0156213); + ssigpTa->SetBinContent(1347,0.0156262); + ssigpTa->SetBinContent(1348,0.0154244); + ssigpTa->SetBinContent(1349,0.0154083); + ssigpTa->SetBinContent(1350,0.0156288); + ssigpTa->SetBinContent(1351,0.0158974); + ssigpTa->SetBinContent(1352,0.016166); + ssigpTa->SetBinContent(1353,0.0164349); + ssigpTa->SetBinContent(1354,0.0166287); + ssigpTa->SetBinContent(1355,0.0164486); + ssigpTa->SetBinContent(1356,0.0159721); + ssigpTa->SetBinContent(1357,0.0157648); + ssigpTa->SetBinContent(1358,0.0157297); + ssigpTa->SetBinContent(1359,0.0155958); + ssigpTa->SetBinContent(1360,0.0156228); + ssigpTa->SetBinContent(1361,0.0158554); + ssigpTa->SetBinContent(1362,0.016131); + ssigpTa->SetBinContent(1363,0.0164073); + ssigpTa->SetBinContent(1364,0.0166865); + ssigpTa->SetBinContent(1365,0.0169691); + ssigpTa->SetBinContent(1366,0.0172519); + ssigpTa->SetBinContent(1367,0.0175347); + ssigpTa->SetBinContent(1368,0.0178205); + ssigpTa->SetBinContent(1369,0.0180741); + ssigpTa->SetBinContent(1370,0.0181589); + ssigpTa->SetBinContent(1371,0.0180987); + ssigpTa->SetBinContent(1372,0.0180895); + ssigpTa->SetBinContent(1373,0.0178173); + ssigpTa->SetBinContent(1374,0.0172394); + ssigpTa->SetBinContent(1375,0.0170134); + ssigpTa->SetBinContent(1376,0.0172275); + ssigpTa->SetBinContent(1377,0.0175349); + ssigpTa->SetBinContent(1378,0.0178454); + ssigpTa->SetBinContent(1379,0.0181577); + ssigpTa->SetBinContent(1380,0.0184687); + ssigpTa->SetBinContent(1381,0.0187627); + ssigpTa->SetBinContent(1382,0.0190353); + ssigpTa->SetBinContent(1383,0.0193426); + ssigpTa->SetBinContent(1384,0.0197308); + ssigpTa->SetBinContent(1385,0.0201734); + ssigpTa->SetBinContent(1386,0.0205647); + ssigpTa->SetBinContent(1387,0.0207737); + ssigpTa->SetBinContent(1388,0.0203506); + ssigpTa->SetBinContent(1389,0.0194133); + ssigpTa->SetBinContent(1390,0.0189273); + ssigpTa->SetBinContent(1391,0.019037); + ssigpTa->SetBinContent(1392,0.0192613); + ssigpTa->SetBinContent(1393,0.019474); + ssigpTa->SetBinContent(1394,0.0196509); + ssigpTa->SetBinContent(1395,0.0196779); + ssigpTa->SetBinContent(1396,0.019061); + ssigpTa->SetBinContent(1397,0.0179459); + ssigpTa->SetBinContent(1398,0.0173804); + ssigpTa->SetBinContent(1399,0.0174883); + ssigpTa->SetBinContent(1400,0.0177378); + ssigpTa->SetBinContent(1401,0.018116); + ssigpTa->SetBinContent(1402,0.0190968); + ssigpTa->SetBinContent(1403,0.0205606); + ssigpTa->SetBinContent(1404,0.0215624); + ssigpTa->SetBinContent(1405,0.0219823); + ssigpTa->SetBinContent(1406,0.0222962); + ssigpTa->SetBinContent(1407,0.0226166); + ssigpTa->SetBinContent(1408,0.0229367); + ssigpTa->SetBinContent(1409,0.0232549); + ssigpTa->SetBinContent(1410,0.0234825); + ssigpTa->SetBinContent(1411,0.0232684); + ssigpTa->SetBinContent(1412,0.0226996); + ssigpTa->SetBinContent(1413,0.0224796); + ssigpTa->SetBinContent(1414,0.0228036); + ssigpTa->SetBinContent(1415,0.0237645); + ssigpTa->SetBinContent(1416,0.025181); + ssigpTa->SetBinContent(1417,0.0261891); + ssigpTa->SetBinContent(1418,0.0266744); + ssigpTa->SetBinContent(1419,0.0270551); + ssigpTa->SetBinContent(1420,0.0274354); + ssigpTa->SetBinContent(1421,0.0277097); + ssigpTa->SetBinContent(1422,0.0274401); + ssigpTa->SetBinContent(1423,0.0267259); + ssigpTa->SetBinContent(1424,0.0264383); + ssigpTa->SetBinContent(1425,0.0268281); + ssigpTa->SetBinContent(1426,0.027963); + ssigpTa->SetBinContent(1427,0.0296059); + ssigpTa->SetBinContent(1428,0.0307536); + ssigpTa->SetBinContent(1429,0.0312839); + ssigpTa->SetBinContent(1430,0.0317126); + ssigpTa->SetBinContent(1431,0.0321643); + ssigpTa->SetBinContent(1432,0.0326215); + ssigpTa->SetBinContent(1433,0.0327944); + ssigpTa->SetBinContent(1434,0.0315476); + ssigpTa->SetBinContent(1435,0.0291472); + ssigpTa->SetBinContent(1436,0.0279268); + ssigpTa->SetBinContent(1437,0.0285862); + ssigpTa->SetBinContent(1438,0.0299353); + ssigpTa->SetBinContent(1439,0.0309275); + ssigpTa->SetBinContent(1440,0.0314625); + ssigpTa->SetBinContent(1441,0.0319147); + ssigpTa->SetBinContent(1442,0.0323662); + ssigpTa->SetBinContent(1443,0.0328); + ssigpTa->SetBinContent(1444,0.0332152); + ssigpTa->SetBinContent(1445,0.0335816); + ssigpTa->SetBinContent(1446,0.0338197); + ssigpTa->SetBinContent(1447,0.0343884); + ssigpTa->SetBinContent(1448,0.035609); + ssigpTa->SetBinContent(1449,0.0366805); + ssigpTa->SetBinContent(1450,0.0372898); + ssigpTa->SetBinContent(1451,0.0378067); + ssigpTa->SetBinContent(1452,0.0383419); + ssigpTa->SetBinContent(1453,0.038877); + ssigpTa->SetBinContent(1454,0.0394037); + ssigpTa->SetBinContent(1455,0.0399437); + ssigpTa->SetBinContent(1456,0.0405142); + ssigpTa->SetBinContent(1457,0.0412179); + ssigpTa->SetBinContent(1458,0.042427); + ssigpTa->SetBinContent(1459,0.0439948); + ssigpTa->SetBinContent(1460,0.0451135); + ssigpTa->SetBinContent(1461,0.0457928); + ssigpTa->SetBinContent(1462,0.0464203); + ssigpTa->SetBinContent(1463,0.0470489); + ssigpTa->SetBinContent(1464,0.047699); + ssigpTa->SetBinContent(1465,0.048417); + ssigpTa->SetBinContent(1466,0.049181); + ssigpTa->SetBinContent(1467,0.0500195); + ssigpTa->SetBinContent(1468,0.0511928); + ssigpTa->SetBinContent(1469,0.0526438); + ssigpTa->SetBinContent(1470,0.0538067); + ssigpTa->SetBinContent(1471,0.0546584); + ssigpTa->SetBinContent(1472,0.0554828); + ssigpTa->SetBinContent(1473,0.0563468); + ssigpTa->SetBinContent(1474,0.0572129); + ssigpTa->SetBinContent(1475,0.0581004); + ssigpTa->SetBinContent(1476,0.0590382); + ssigpTa->SetBinContent(1477,0.0601073); + ssigpTa->SetBinContent(1478,0.0612885); + ssigpTa->SetBinContent(1479,0.0623777); + ssigpTa->SetBinContent(1480,0.0633994); + ssigpTa->SetBinContent(1481,0.0644449); + ssigpTa->SetBinContent(1482,0.0654971); + ssigpTa->SetBinContent(1483,0.0665219); + ssigpTa->SetBinContent(1484,0.0675234); + ssigpTa->SetBinContent(1485,0.0685506); + ssigpTa->SetBinContent(1486,0.0695546); + ssigpTa->SetBinContent(1487,0.0704452); + ssigpTa->SetBinContent(1488,0.0714675); + ssigpTa->SetBinContent(1489,0.0726801); + ssigpTa->SetBinContent(1490,0.0739463); + ssigpTa->SetBinContent(1491,0.0752014); + ssigpTa->SetBinContent(1492,0.0764408); + ssigpTa->SetBinContent(1493,0.0776617); + ssigpTa->SetBinContent(1494,0.0788611); + ssigpTa->SetBinContent(1495,0.0800293); + ssigpTa->SetBinContent(1496,0.0811599); + ssigpTa->SetBinContent(1497,0.0822857); + ssigpTa->SetBinContent(1498,0.0834875); + ssigpTa->SetBinContent(1499,0.0847991); + ssigpTa->SetBinContent(1500,0.0862207); + ssigpTa->SetBinContent(1501,0.0877417); + ssigpTa->SetBinContent(1502,0.0892895); + ssigpTa->SetBinContent(1503,0.0907922); + ssigpTa->SetBinContent(1504,0.0913416); + ssigpTa->SetBinContent(1505,0.0875179); + ssigpTa->SetBinContent(1506,0.0802004); + ssigpTa->SetBinContent(1507,0.0760845); + ssigpTa->SetBinContent(1508,0.0761889); + ssigpTa->SetBinContent(1509,0.0772601); + ssigpTa->SetBinContent(1510,0.0784209); + ssigpTa->SetBinContent(1511,0.0795823); + ssigpTa->SetBinContent(1512,0.0807149); + ssigpTa->SetBinContent(1513,0.0818168); + ssigpTa->SetBinContent(1514,0.0828857); + ssigpTa->SetBinContent(1515,0.083976); + ssigpTa->SetBinContent(1516,0.0851418); + ssigpTa->SetBinContent(1517,0.0863386); + ssigpTa->SetBinContent(1518,0.0874943); + ssigpTa->SetBinContent(1519,0.0886557); + ssigpTa->SetBinContent(1520,0.089954); + ssigpTa->SetBinContent(1521,0.0914241); + ssigpTa->SetBinContent(1522,0.092975); + ssigpTa->SetBinContent(1523,0.0945216); + ssigpTa->SetBinContent(1524,0.0972385); + ssigpTa->SetBinContent(1525,0.105923); + ssigpTa->SetBinContent(1526,0.119443); + ssigpTa->SetBinContent(1527,0.12808); + ssigpTa->SetBinContent(1528,0.130852); + ssigpTa->SetBinContent(1529,0.132569); + ssigpTa->SetBinContent(1530,0.134336); + ssigpTa->SetBinContent(1531,0.136081); + ssigpTa->SetBinContent(1532,0.137709); + ssigpTa->SetBinContent(1533,0.139137); + ssigpTa->SetBinContent(1534,0.140429); + ssigpTa->SetBinContent(1535,0.141733); + ssigpTa->SetBinContent(1536,0.143061); + ssigpTa->SetBinContent(1537,0.14437); + ssigpTa->SetBinContent(1538,0.145797); + ssigpTa->SetBinContent(1539,0.147565); + ssigpTa->SetBinContent(1540,0.149741); + ssigpTa->SetBinContent(1541,0.152126); + ssigpTa->SetBinContent(1542,0.154491); + ssigpTa->SetBinContent(1543,0.156786); + ssigpTa->SetBinContent(1544,0.159061); + ssigpTa->SetBinContent(1545,0.161307); + ssigpTa->SetBinContent(1546,0.163443); + ssigpTa->SetBinContent(1547,0.165446); + ssigpTa->SetBinContent(1548,0.167168); + ssigpTa->SetBinContent(1549,0.168325); + ssigpTa->SetBinContent(1550,0.168932); + ssigpTa->SetBinContent(1551,0.169381); + ssigpTa->SetBinContent(1552,0.170182); + ssigpTa->SetBinContent(1553,0.17158); + ssigpTa->SetBinContent(1554,0.173333); + ssigpTa->SetBinContent(1555,0.175203); + ssigpTa->SetBinContent(1556,0.177391); + ssigpTa->SetBinContent(1557,0.180081); + ssigpTa->SetBinContent(1558,0.183046); + ssigpTa->SetBinContent(1559,0.186055); + ssigpTa->SetBinContent(1560,0.189028); + ssigpTa->SetBinContent(1561,0.191895); + ssigpTa->SetBinContent(1562,0.194621); + ssigpTa->SetBinContent(1563,0.197268); + ssigpTa->SetBinContent(1564,0.199935); + ssigpTa->SetBinContent(1565,0.202773); + ssigpTa->SetBinContent(1566,0.205629); + ssigpTa->SetBinContent(1567,0.208249); + ssigpTa->SetBinContent(1568,0.210746); + ssigpTa->SetBinContent(1569,0.213313); + ssigpTa->SetBinContent(1570,0.215809); + ssigpTa->SetBinContent(1571,0.218181); + ssigpTa->SetBinContent(1572,0.220476); + ssigpTa->SetBinContent(1573,0.222719); + ssigpTa->SetBinContent(1574,0.224908); + ssigpTa->SetBinContent(1575,0.226929); + ssigpTa->SetBinContent(1576,0.22872); + ssigpTa->SetBinContent(1577,0.230409); + ssigpTa->SetBinContent(1578,0.232086); + ssigpTa->SetBinContent(1579,0.233595); + ssigpTa->SetBinContent(1580,0.235008); + ssigpTa->SetBinContent(1581,0.236641); + ssigpTa->SetBinContent(1582,0.238432); + ssigpTa->SetBinContent(1583,0.240039); + ssigpTa->SetBinContent(1584,0.241712); + ssigpTa->SetBinContent(1585,0.24471); + ssigpTa->SetBinContent(1586,0.249843); + ssigpTa->SetBinContent(1587,0.256571); + ssigpTa->SetBinContent(1588,0.263639); + ssigpTa->SetBinContent(1589,0.271163); + ssigpTa->SetBinContent(1590,0.284302); + ssigpTa->SetBinContent(1591,0.302377); + ssigpTa->SetBinContent(1592,0.314386); + ssigpTa->SetBinContent(1593,0.320295); + ssigpTa->SetBinContent(1594,0.325441); + ssigpTa->SetBinContent(1595,0.32994); + ssigpTa->SetBinContent(1596,0.333535); + ssigpTa->SetBinContent(1597,0.336573); + ssigpTa->SetBinContent(1598,0.340434); + ssigpTa->SetBinContent(1599,0.346794); + ssigpTa->SetBinContent(1600,0.355384); + ssigpTa->SetBinContent(1601,0.364393); + ssigpTa->SetBinContent(1602,0.373203); + ssigpTa->SetBinContent(1603,0.382866); + ssigpTa->SetBinContent(1604,0.393451); + ssigpTa->SetBinContent(1605,0.403647); + ssigpTa->SetBinContent(1606,0.412129); + ssigpTa->SetBinContent(1607,0.417719); + ssigpTa->SetBinContent(1608,0.420657); + ssigpTa->SetBinContent(1609,0.426304); + ssigpTa->SetBinContent(1610,0.434609); + ssigpTa->SetBinContent(1613,0.00984496); + ssigpTa->SetBinContent(1614,0.0098424); + ssigpTa->SetBinContent(1615,0.00984234); + ssigpTa->SetBinContent(1616,0.00984363); + ssigpTa->SetBinContent(1617,0.00984575); + ssigpTa->SetBinContent(1618,0.0098483); + ssigpTa->SetBinContent(1619,0.00985154); + ssigpTa->SetBinContent(1620,0.00985513); + ssigpTa->SetBinContent(1621,0.00985926); + ssigpTa->SetBinContent(1622,0.00986392); + ssigpTa->SetBinContent(1623,0.0098693); + ssigpTa->SetBinContent(1624,0.00987518); + ssigpTa->SetBinContent(1625,0.00988159); + ssigpTa->SetBinContent(1626,0.00988847); + ssigpTa->SetBinContent(1627,0.00989618); + ssigpTa->SetBinContent(1628,0.00990434); + ssigpTa->SetBinContent(1629,0.00991313); + ssigpTa->SetBinContent(1630,0.00992242); + ssigpTa->SetBinContent(1631,0.00993214); + ssigpTa->SetBinContent(1632,0.00994251); + ssigpTa->SetBinContent(1633,0.00995335); + ssigpTa->SetBinContent(1634,0.00996486); + ssigpTa->SetBinContent(1635,0.00997706); + ssigpTa->SetBinContent(1636,0.00998957); + ssigpTa->SetBinContent(1637,0.0100029); + ssigpTa->SetBinContent(1638,0.0100166); + ssigpTa->SetBinContent(1639,0.0100311); + ssigpTa->SetBinContent(1640,0.0100462); + ssigpTa->SetBinContent(1641,0.0100617); + ssigpTa->SetBinContent(1642,0.010078); + ssigpTa->SetBinContent(1643,0.0100946); + ssigpTa->SetBinContent(1644,0.0101119); + ssigpTa->SetBinContent(1645,0.0101297); + ssigpTa->SetBinContent(1646,0.010148); + ssigpTa->SetBinContent(1647,0.010167); + ssigpTa->SetBinContent(1648,0.0101865); + ssigpTa->SetBinContent(1649,0.0102067); + ssigpTa->SetBinContent(1650,0.0102273); + ssigpTa->SetBinContent(1651,0.0102487); + ssigpTa->SetBinContent(1652,0.0102708); + ssigpTa->SetBinContent(1653,0.0102932); + ssigpTa->SetBinContent(1654,0.0103164); + ssigpTa->SetBinContent(1655,0.0103401); + ssigpTa->SetBinContent(1656,0.0103643); + ssigpTa->SetBinContent(1657,0.0103891); + ssigpTa->SetBinContent(1658,0.0104146); + ssigpTa->SetBinContent(1659,0.0104406); + ssigpTa->SetBinContent(1660,0.0104673); + ssigpTa->SetBinContent(1661,0.0104944); + ssigpTa->SetBinContent(1662,0.0105224); + ssigpTa->SetBinContent(1663,0.0105507); + ssigpTa->SetBinContent(1664,0.0105797); + ssigpTa->SetBinContent(1665,0.0106093); + ssigpTa->SetBinContent(1666,0.0106397); + ssigpTa->SetBinContent(1667,0.0106705); + ssigpTa->SetBinContent(1668,0.0107019); + ssigpTa->SetBinContent(1669,0.0107341); + ssigpTa->SetBinContent(1670,0.0107667); + ssigpTa->SetBinContent(1671,0.0108001); + ssigpTa->SetBinContent(1672,0.0108338); + ssigpTa->SetBinContent(1673,0.0108684); + ssigpTa->SetBinContent(1674,0.0109037); + ssigpTa->SetBinContent(1675,0.0109395); + ssigpTa->SetBinContent(1676,0.0109762); + ssigpTa->SetBinContent(1677,0.0110132); + ssigpTa->SetBinContent(1678,0.0110509); + ssigpTa->SetBinContent(1679,0.0110894); + ssigpTa->SetBinContent(1680,0.0111286); + ssigpTa->SetBinContent(1681,0.0111683); + ssigpTa->SetBinContent(1682,0.0112087); + ssigpTa->SetBinContent(1683,0.0112496); + ssigpTa->SetBinContent(1684,0.0112914); + ssigpTa->SetBinContent(1685,0.0113337); + ssigpTa->SetBinContent(1686,0.0113767); + ssigpTa->SetBinContent(1687,0.0114205); + ssigpTa->SetBinContent(1688,0.011465); + ssigpTa->SetBinContent(1689,0.0115101); + ssigpTa->SetBinContent(1690,0.0115559); + ssigpTa->SetBinContent(1691,0.0116024); + ssigpTa->SetBinContent(1692,0.0116495); + ssigpTa->SetBinContent(1693,0.0116977); + ssigpTa->SetBinContent(1694,0.0117465); + ssigpTa->SetBinContent(1695,0.0117959); + ssigpTa->SetBinContent(1696,0.0118461); + ssigpTa->SetBinContent(1697,0.0118972); + ssigpTa->SetBinContent(1698,0.0119492); + ssigpTa->SetBinContent(1699,0.0120016); + ssigpTa->SetBinContent(1700,0.0120552); + ssigpTa->SetBinContent(1701,0.0121091); + ssigpTa->SetBinContent(1702,0.012164); + ssigpTa->SetBinContent(1703,0.0122195); + ssigpTa->SetBinContent(1704,0.0122763); + ssigpTa->SetBinContent(1705,0.0123335); + ssigpTa->SetBinContent(1706,0.0123919); + ssigpTa->SetBinContent(1707,0.0124508); + ssigpTa->SetBinContent(1708,0.0125108); + ssigpTa->SetBinContent(1709,0.0125716); + ssigpTa->SetBinContent(1710,0.0126335); + ssigpTa->SetBinContent(1711,0.012696); + ssigpTa->SetBinContent(1712,0.0127598); + ssigpTa->SetBinContent(1713,0.0128242); + ssigpTa->SetBinContent(1714,0.0128897); + ssigpTa->SetBinContent(1715,0.012956); + ssigpTa->SetBinContent(1716,0.013041); + ssigpTa->SetBinContent(1717,0.0132146); + ssigpTa->SetBinContent(1718,0.0135174); + ssigpTa->SetBinContent(1719,0.013947); + ssigpTa->SetBinContent(1720,0.0145052); + ssigpTa->SetBinContent(1721,0.0148327); + ssigpTa->SetBinContent(1722,0.0149509); + ssigpTa->SetBinContent(1723,0.0150282); + ssigpTa->SetBinContent(1724,0.0151067); + ssigpTa->SetBinContent(1725,0.0151862); + ssigpTa->SetBinContent(1726,0.0152669); + ssigpTa->SetBinContent(1727,0.0153485); + ssigpTa->SetBinContent(1728,0.0154311); + ssigpTa->SetBinContent(1729,0.0154849); + ssigpTa->SetBinContent(1730,0.0153806); + ssigpTa->SetBinContent(1731,0.0150929); + ssigpTa->SetBinContent(1732,0.0149587); + ssigpTa->SetBinContent(1733,0.0150665); + ssigpTa->SetBinContent(1734,0.0152689); + ssigpTa->SetBinContent(1735,0.0154821); + ssigpTa->SetBinContent(1736,0.0156936); + ssigpTa->SetBinContent(1737,0.0159029); + ssigpTa->SetBinContent(1738,0.0160615); + ssigpTa->SetBinContent(1739,0.015979); + ssigpTa->SetBinContent(1740,0.015608); + ssigpTa->SetBinContent(1741,0.0151937); + ssigpTa->SetBinContent(1742,0.0147323); + ssigpTa->SetBinContent(1743,0.0146374); + ssigpTa->SetBinContent(1744,0.0148666); + ssigpTa->SetBinContent(1745,0.0151636); + ssigpTa->SetBinContent(1746,0.0154644); + ssigpTa->SetBinContent(1747,0.0157693); + ssigpTa->SetBinContent(1748,0.0160773); + ssigpTa->SetBinContent(1749,0.0163381); + ssigpTa->SetBinContent(1750,0.0163471); + ssigpTa->SetBinContent(1751,0.0160883); + ssigpTa->SetBinContent(1752,0.0160757); + ssigpTa->SetBinContent(1753,0.0163087); + ssigpTa->SetBinContent(1754,0.0165907); + ssigpTa->SetBinContent(1755,0.0168733); + ssigpTa->SetBinContent(1756,0.017156); + ssigpTa->SetBinContent(1757,0.0173639); + ssigpTa->SetBinContent(1758,0.0171932); + ssigpTa->SetBinContent(1759,0.0166457); + ssigpTa->SetBinContent(1760,0.0164477); + ssigpTa->SetBinContent(1761,0.0164218); + ssigpTa->SetBinContent(1762,0.0162518); + ssigpTa->SetBinContent(1763,0.0162868); + ssigpTa->SetBinContent(1764,0.0165317); + ssigpTa->SetBinContent(1765,0.0168202); + ssigpTa->SetBinContent(1766,0.0171093); + ssigpTa->SetBinContent(1767,0.0174018); + ssigpTa->SetBinContent(1768,0.0176978); + ssigpTa->SetBinContent(1769,0.017994); + ssigpTa->SetBinContent(1770,0.0182904); + ssigpTa->SetBinContent(1771,0.0185902); + ssigpTa->SetBinContent(1772,0.018857); + ssigpTa->SetBinContent(1773,0.0189439); + ssigpTa->SetBinContent(1774,0.0188456); + ssigpTa->SetBinContent(1775,0.0188378); + ssigpTa->SetBinContent(1776,0.0185782); + ssigpTa->SetBinContent(1777,0.0179245); + ssigpTa->SetBinContent(1778,0.0177116); + ssigpTa->SetBinContent(1779,0.0179385); + ssigpTa->SetBinContent(1780,0.0182594); + ssigpTa->SetBinContent(1781,0.0185832); + ssigpTa->SetBinContent(1782,0.0189088); + ssigpTa->SetBinContent(1783,0.0192324); + ssigpTa->SetBinContent(1784,0.0195313); + ssigpTa->SetBinContent(1785,0.0198003); + ssigpTa->SetBinContent(1786,0.0201128); + ssigpTa->SetBinContent(1787,0.0205226); + ssigpTa->SetBinContent(1788,0.0210126); + ssigpTa->SetBinContent(1789,0.0214296); + ssigpTa->SetBinContent(1790,0.0216567); + ssigpTa->SetBinContent(1791,0.0212552); + ssigpTa->SetBinContent(1792,0.0202162); + ssigpTa->SetBinContent(1793,0.0197454); + ssigpTa->SetBinContent(1794,0.0198668); + ssigpTa->SetBinContent(1795,0.0201024); + ssigpTa->SetBinContent(1796,0.0203269); + ssigpTa->SetBinContent(1797,0.0205275); + ssigpTa->SetBinContent(1798,0.020572); + ssigpTa->SetBinContent(1799,0.0199684); + ssigpTa->SetBinContent(1800,0.0186981); + ssigpTa->SetBinContent(1801,0.0181338); + ssigpTa->SetBinContent(1802,0.0182523); + ssigpTa->SetBinContent(1803,0.0185143); + ssigpTa->SetBinContent(1804,0.0189047); + ssigpTa->SetBinContent(1805,0.019892); + ssigpTa->SetBinContent(1806,0.0214715); + ssigpTa->SetBinContent(1807,0.0224801); + ssigpTa->SetBinContent(1808,0.0229122); + ssigpTa->SetBinContent(1809,0.0232398); + ssigpTa->SetBinContent(1810,0.0235737); + ssigpTa->SetBinContent(1811,0.0239074); + ssigpTa->SetBinContent(1812,0.0242398); + ssigpTa->SetBinContent(1813,0.0244821); + ssigpTa->SetBinContent(1814,0.0242815); + ssigpTa->SetBinContent(1815,0.0236411); + ssigpTa->SetBinContent(1816,0.0234345); + ssigpTa->SetBinContent(1817,0.0237737); + ssigpTa->SetBinContent(1818,0.0247547); + ssigpTa->SetBinContent(1819,0.0263036); + ssigpTa->SetBinContent(1820,0.0273328); + ssigpTa->SetBinContent(1821,0.0278361); + ssigpTa->SetBinContent(1822,0.0282337); + ssigpTa->SetBinContent(1823,0.0286315); + ssigpTa->SetBinContent(1824,0.0289236); + ssigpTa->SetBinContent(1825,0.028677); + ssigpTa->SetBinContent(1826,0.0278908); + ssigpTa->SetBinContent(1827,0.027626); + ssigpTa->SetBinContent(1828,0.0280339); + ssigpTa->SetBinContent(1829,0.0291848); + ssigpTa->SetBinContent(1830,0.030967); + ssigpTa->SetBinContent(1831,0.032136); + ssigpTa->SetBinContent(1832,0.0326863); + ssigpTa->SetBinContent(1833,0.033136); + ssigpTa->SetBinContent(1834,0.0336091); + ssigpTa->SetBinContent(1835,0.0340891); + ssigpTa->SetBinContent(1836,0.0342884); + ssigpTa->SetBinContent(1837,0.0330836); + ssigpTa->SetBinContent(1838,0.0304712); + ssigpTa->SetBinContent(1839,0.0292881); + ssigpTa->SetBinContent(1840,0.0299644); + ssigpTa->SetBinContent(1841,0.0314253); + ssigpTa->SetBinContent(1842,0.0324354); + ssigpTa->SetBinContent(1843,0.0329927); + ssigpTa->SetBinContent(1844,0.0334675); + ssigpTa->SetBinContent(1845,0.0339417); + ssigpTa->SetBinContent(1846,0.0343994); + ssigpTa->SetBinContent(1847,0.0348398); + ssigpTa->SetBinContent(1848,0.035233); + ssigpTa->SetBinContent(1849,0.0354984); + ssigpTa->SetBinContent(1850,0.0360555); + ssigpTa->SetBinContent(1851,0.0373906); + ssigpTa->SetBinContent(1852,0.0384872); + ssigpTa->SetBinContent(1853,0.039126); + ssigpTa->SetBinContent(1854,0.039671); + ssigpTa->SetBinContent(1855,0.0402334); + ssigpTa->SetBinContent(1856,0.0407966); + ssigpTa->SetBinContent(1857,0.0413553); + ssigpTa->SetBinContent(1858,0.0419276); + ssigpTa->SetBinContent(1859,0.0425292); + ssigpTa->SetBinContent(1860,0.0432604); + ssigpTa->SetBinContent(1861,0.0444919); + ssigpTa->SetBinContent(1862,0.0461416); + ssigpTa->SetBinContent(1863,0.0472516); + ssigpTa->SetBinContent(1864,0.0479404); + ssigpTa->SetBinContent(1865,0.0485981); + ssigpTa->SetBinContent(1866,0.0492595); + ssigpTa->SetBinContent(1867,0.0499422); + ssigpTa->SetBinContent(1868,0.0506978); + ssigpTa->SetBinContent(1869,0.0514963); + ssigpTa->SetBinContent(1870,0.0523682); + ssigpTa->SetBinContent(1871,0.053589); + ssigpTa->SetBinContent(1872,0.0551468); + ssigpTa->SetBinContent(1873,0.0563652); + ssigpTa->SetBinContent(1874,0.0572425); + ssigpTa->SetBinContent(1875,0.0580921); + ssigpTa->SetBinContent(1876,0.0589711); + ssigpTa->SetBinContent(1877,0.0598661); + ssigpTa->SetBinContent(1878,0.0607857); + ssigpTa->SetBinContent(1879,0.0617682); + ssigpTa->SetBinContent(1880,0.0629108); + ssigpTa->SetBinContent(1881,0.0642003); + ssigpTa->SetBinContent(1882,0.0653649); + ssigpTa->SetBinContent(1883,0.0664351); + ssigpTa->SetBinContent(1884,0.0675187); + ssigpTa->SetBinContent(1885,0.0686076); + ssigpTa->SetBinContent(1886,0.0696775); + ssigpTa->SetBinContent(1887,0.0707364); + ssigpTa->SetBinContent(1888,0.0718594); + ssigpTa->SetBinContent(1889,0.072993); + ssigpTa->SetBinContent(1890,0.0739043); + ssigpTa->SetBinContent(1891,0.0749599); + ssigpTa->SetBinContent(1892,0.0762225); + ssigpTa->SetBinContent(1893,0.077537); + ssigpTa->SetBinContent(1894,0.0788514); + ssigpTa->SetBinContent(1895,0.0801582); + ssigpTa->SetBinContent(1896,0.0814498); + ssigpTa->SetBinContent(1897,0.0827211); + ssigpTa->SetBinContent(1898,0.0839623); + ssigpTa->SetBinContent(1899,0.0851629); + ssigpTa->SetBinContent(1900,0.0863378); + ssigpTa->SetBinContent(1901,0.0876002); + ssigpTa->SetBinContent(1902,0.0889739); + ssigpTa->SetBinContent(1903,0.0904557); + ssigpTa->SetBinContent(1904,0.0920494); + ssigpTa->SetBinContent(1905,0.0936751); + ssigpTa->SetBinContent(1906,0.095265); + ssigpTa->SetBinContent(1907,0.095949); + ssigpTa->SetBinContent(1908,0.0924006); + ssigpTa->SetBinContent(1909,0.0846968); + ssigpTa->SetBinContent(1910,0.0808381); + ssigpTa->SetBinContent(1911,0.0810569); + ssigpTa->SetBinContent(1912,0.0822202); + ssigpTa->SetBinContent(1913,0.0834596); + ssigpTa->SetBinContent(1914,0.0846907); + ssigpTa->SetBinContent(1915,0.0858883); + ssigpTa->SetBinContent(1916,0.087051); + ssigpTa->SetBinContent(1917,0.0881843); + ssigpTa->SetBinContent(1918,0.0893384); + ssigpTa->SetBinContent(1919,0.0905905); + ssigpTa->SetBinContent(1920,0.0919066); + ssigpTa->SetBinContent(1921,0.093211); + ssigpTa->SetBinContent(1922,0.0945261); + ssigpTa->SetBinContent(1923,0.0959497); + ssigpTa->SetBinContent(1924,0.0975209); + ssigpTa->SetBinContent(1925,0.099148); + ssigpTa->SetBinContent(1926,0.100762); + ssigpTa->SetBinContent(1927,0.103593); + ssigpTa->SetBinContent(1928,0.112662); + ssigpTa->SetBinContent(1929,0.12816); + ssigpTa->SetBinContent(1930,0.137177); + ssigpTa->SetBinContent(1931,0.140023); + ssigpTa->SetBinContent(1932,0.14172); + ssigpTa->SetBinContent(1933,0.143487); + ssigpTa->SetBinContent(1934,0.145271); + ssigpTa->SetBinContent(1935,0.146988); + ssigpTa->SetBinContent(1936,0.148568); + ssigpTa->SetBinContent(1937,0.150075); + ssigpTa->SetBinContent(1938,0.151681); + ssigpTa->SetBinContent(1939,0.15333); + ssigpTa->SetBinContent(1940,0.154963); + ssigpTa->SetBinContent(1941,0.156632); + ssigpTa->SetBinContent(1942,0.158526); + ssigpTa->SetBinContent(1943,0.160733); + ssigpTa->SetBinContent(1944,0.16316); + ssigpTa->SetBinContent(1945,0.165646); + ssigpTa->SetBinContent(1946,0.168125); + ssigpTa->SetBinContent(1947,0.170594); + ssigpTa->SetBinContent(1948,0.173031); + ssigpTa->SetBinContent(1949,0.175352); + ssigpTa->SetBinContent(1950,0.177532); + ssigpTa->SetBinContent(1951,0.179466); + ssigpTa->SetBinContent(1952,0.180847); + ssigpTa->SetBinContent(1953,0.181725); + ssigpTa->SetBinContent(1954,0.182474); + ssigpTa->SetBinContent(1955,0.183549); + ssigpTa->SetBinContent(1956,0.185187); + ssigpTa->SetBinContent(1957,0.187105); + ssigpTa->SetBinContent(1958,0.189093); + ssigpTa->SetBinContent(1959,0.191408); + ssigpTa->SetBinContent(1960,0.194291); + ssigpTa->SetBinContent(1961,0.197464); + ssigpTa->SetBinContent(1962,0.200662); + ssigpTa->SetBinContent(1963,0.203798); + ssigpTa->SetBinContent(1964,0.206818); + ssigpTa->SetBinContent(1965,0.209756); + ssigpTa->SetBinContent(1966,0.21274); + ssigpTa->SetBinContent(1967,0.215878); + ssigpTa->SetBinContent(1968,0.219282); + ssigpTa->SetBinContent(1969,0.222812); + ssigpTa->SetBinContent(1970,0.22601); + ssigpTa->SetBinContent(1971,0.228936); + ssigpTa->SetBinContent(1972,0.231736); + ssigpTa->SetBinContent(1973,0.234378); + ssigpTa->SetBinContent(1974,0.236857); + ssigpTa->SetBinContent(1975,0.239236); + ssigpTa->SetBinContent(1976,0.241582); + ssigpTa->SetBinContent(1977,0.243933); + ssigpTa->SetBinContent(1978,0.246224); + ssigpTa->SetBinContent(1979,0.24834); + ssigpTa->SetBinContent(1980,0.25042); + ssigpTa->SetBinContent(1981,0.25257); + ssigpTa->SetBinContent(1982,0.254631); + ssigpTa->SetBinContent(1983,0.256634); + ssigpTa->SetBinContent(1984,0.258862); + ssigpTa->SetBinContent(1985,0.261224); + ssigpTa->SetBinContent(1986,0.263439); + ssigpTa->SetBinContent(1987,0.265791); + ssigpTa->SetBinContent(1988,0.269343); + ssigpTa->SetBinContent(1989,0.274799); + ssigpTa->SetBinContent(1990,0.28142); + ssigpTa->SetBinContent(1991,0.288299); + ssigpTa->SetBinContent(1992,0.296029); + ssigpTa->SetBinContent(1993,0.311052); + ssigpTa->SetBinContent(1994,0.33519); + ssigpTa->SetBinContent(1995,0.349779); + ssigpTa->SetBinContent(1996,0.357023); + ssigpTa->SetBinContent(1997,0.363173); + ssigpTa->SetBinContent(1998,0.369111); + ssigpTa->SetBinContent(1999,0.374721); + ssigpTa->SetBinContent(2000,0.380173); + ssigpTa->SetBinContent(2001,0.386214); + ssigpTa->SetBinContent(2002,0.39381); + ssigpTa->SetBinContent(2003,0.402635); + ssigpTa->SetBinContent(2004,0.411409); + ssigpTa->SetBinContent(2005,0.419981); + ssigpTa->SetBinContent(2006,0.429375); + ssigpTa->SetBinContent(2007,0.439719); + ssigpTa->SetBinContent(2008,0.449918); + ssigpTa->SetBinContent(2009,0.459215); + ssigpTa->SetBinContent(2010,0.466655); + ssigpTa->SetBinContent(2011,0.473327); + ssigpTa->SetBinContent(2012,0.489316); + ssigpTa->SetBinContent(2013,0.519691); + ssigpTa->SetBinContent(2016,0.00995367); + ssigpTa->SetBinContent(2017,0.00995019); + ssigpTa->SetBinContent(2018,0.00994766); + ssigpTa->SetBinContent(2019,0.00994908); + ssigpTa->SetBinContent(2020,0.00995092); + ssigpTa->SetBinContent(2021,0.00995398); + ssigpTa->SetBinContent(2022,0.00995682); + ssigpTa->SetBinContent(2023,0.00996032); + ssigpTa->SetBinContent(2024,0.00996448); + ssigpTa->SetBinContent(2025,0.009969); + ssigpTa->SetBinContent(2026,0.0099745); + ssigpTa->SetBinContent(2027,0.00998032); + ssigpTa->SetBinContent(2028,0.00998682); + ssigpTa->SetBinContent(2029,0.00999406); + ssigpTa->SetBinContent(2030,0.0100012); + ssigpTa->SetBinContent(2031,0.0100095); + ssigpTa->SetBinContent(2032,0.0100183); + ssigpTa->SetBinContent(2033,0.0100277); + ssigpTa->SetBinContent(2034,0.0100375); + ssigpTa->SetBinContent(2035,0.0100477); + ssigpTa->SetBinContent(2036,0.0100584); + ssigpTa->SetBinContent(2037,0.0100698); + ssigpTa->SetBinContent(2038,0.0100816); + ssigpTa->SetBinContent(2039,0.0100948); + ssigpTa->SetBinContent(2040,0.0101075); + ssigpTa->SetBinContent(2041,0.0101211); + ssigpTa->SetBinContent(2042,0.0101357); + ssigpTa->SetBinContent(2043,0.0101505); + ssigpTa->SetBinContent(2044,0.0101665); + ssigpTa->SetBinContent(2045,0.0101825); + ssigpTa->SetBinContent(2046,0.0101993); + ssigpTa->SetBinContent(2047,0.0102165); + ssigpTa->SetBinContent(2048,0.0102338); + ssigpTa->SetBinContent(2049,0.0102521); + ssigpTa->SetBinContent(2050,0.0102708); + ssigpTa->SetBinContent(2051,0.0102905); + ssigpTa->SetBinContent(2052,0.0103105); + ssigpTa->SetBinContent(2053,0.010331); + ssigpTa->SetBinContent(2054,0.0103524); + ssigpTa->SetBinContent(2055,0.0103743); + ssigpTa->SetBinContent(2056,0.0103972); + ssigpTa->SetBinContent(2057,0.01042); + ssigpTa->SetBinContent(2058,0.0104435); + ssigpTa->SetBinContent(2059,0.0104678); + ssigpTa->SetBinContent(2060,0.0104924); + ssigpTa->SetBinContent(2061,0.0105179); + ssigpTa->SetBinContent(2062,0.0105439); + ssigpTa->SetBinContent(2063,0.0105705); + ssigpTa->SetBinContent(2064,0.0105982); + ssigpTa->SetBinContent(2065,0.0106255); + ssigpTa->SetBinContent(2066,0.0106539); + ssigpTa->SetBinContent(2067,0.0106826); + ssigpTa->SetBinContent(2068,0.0107123); + ssigpTa->SetBinContent(2069,0.0107425); + ssigpTa->SetBinContent(2070,0.0107732); + ssigpTa->SetBinContent(2071,0.0108045); + ssigpTa->SetBinContent(2072,0.0108363); + ssigpTa->SetBinContent(2073,0.0108696); + ssigpTa->SetBinContent(2074,0.0109022); + ssigpTa->SetBinContent(2075,0.0109358); + ssigpTa->SetBinContent(2076,0.0109702); + ssigpTa->SetBinContent(2077,0.0110053); + ssigpTa->SetBinContent(2078,0.0110415); + ssigpTa->SetBinContent(2079,0.0110778); + ssigpTa->SetBinContent(2080,0.011115); + ssigpTa->SetBinContent(2081,0.0111524); + ssigpTa->SetBinContent(2082,0.011191); + ssigpTa->SetBinContent(2083,0.0112302); + ssigpTa->SetBinContent(2084,0.0112697); + ssigpTa->SetBinContent(2085,0.0113098); + ssigpTa->SetBinContent(2086,0.0113511); + ssigpTa->SetBinContent(2087,0.0113925); + ssigpTa->SetBinContent(2088,0.0114348); + ssigpTa->SetBinContent(2089,0.0114776); + ssigpTa->SetBinContent(2090,0.0115211); + ssigpTa->SetBinContent(2091,0.0115659); + ssigpTa->SetBinContent(2092,0.0116108); + ssigpTa->SetBinContent(2093,0.0116564); + ssigpTa->SetBinContent(2094,0.0117027); + ssigpTa->SetBinContent(2095,0.0117494); + ssigpTa->SetBinContent(2096,0.0117976); + ssigpTa->SetBinContent(2097,0.0118464); + ssigpTa->SetBinContent(2098,0.0118955); + ssigpTa->SetBinContent(2099,0.0119453); + ssigpTa->SetBinContent(2100,0.0119965); + ssigpTa->SetBinContent(2101,0.0120483); + ssigpTa->SetBinContent(2102,0.012101); + ssigpTa->SetBinContent(2103,0.0121538); + ssigpTa->SetBinContent(2104,0.012208); + ssigpTa->SetBinContent(2105,0.0122621); + ssigpTa->SetBinContent(2106,0.0123182); + ssigpTa->SetBinContent(2107,0.0123744); + ssigpTa->SetBinContent(2108,0.0124322); + ssigpTa->SetBinContent(2109,0.01249); + ssigpTa->SetBinContent(2110,0.0125489); + ssigpTa->SetBinContent(2111,0.0126084); + ssigpTa->SetBinContent(2112,0.0126695); + ssigpTa->SetBinContent(2113,0.0127309); + ssigpTa->SetBinContent(2114,0.0127937); + ssigpTa->SetBinContent(2115,0.0128569); + ssigpTa->SetBinContent(2116,0.0129219); + ssigpTa->SetBinContent(2117,0.0129868); + ssigpTa->SetBinContent(2118,0.0130529); + ssigpTa->SetBinContent(2119,0.0131372); + ssigpTa->SetBinContent(2120,0.0133063); + ssigpTa->SetBinContent(2121,0.0136021); + ssigpTa->SetBinContent(2122,0.0140392); + ssigpTa->SetBinContent(2123,0.0146193); + ssigpTa->SetBinContent(2124,0.0149583); + ssigpTa->SetBinContent(2125,0.0150773); + ssigpTa->SetBinContent(2126,0.0151545); + ssigpTa->SetBinContent(2127,0.0152325); + ssigpTa->SetBinContent(2128,0.0153121); + ssigpTa->SetBinContent(2129,0.0153925); + ssigpTa->SetBinContent(2130,0.0154737); + ssigpTa->SetBinContent(2131,0.0155563); + ssigpTa->SetBinContent(2132,0.015609); + ssigpTa->SetBinContent(2133,0.0154955); + ssigpTa->SetBinContent(2134,0.0151938); + ssigpTa->SetBinContent(2135,0.0150567); + ssigpTa->SetBinContent(2136,0.0151678); + ssigpTa->SetBinContent(2137,0.0153724); + ssigpTa->SetBinContent(2138,0.0155882); + ssigpTa->SetBinContent(2139,0.0158023); + ssigpTa->SetBinContent(2140,0.016014); + ssigpTa->SetBinContent(2141,0.0161763); + ssigpTa->SetBinContent(2142,0.0160992); + ssigpTa->SetBinContent(2143,0.0157332); + ssigpTa->SetBinContent(2144,0.0153452); + ssigpTa->SetBinContent(2145,0.0149309); + ssigpTa->SetBinContent(2146,0.0148622); + ssigpTa->SetBinContent(2147,0.0150951); + ssigpTa->SetBinContent(2148,0.0153939); + ssigpTa->SetBinContent(2149,0.0156963); + ssigpTa->SetBinContent(2150,0.0160025); + ssigpTa->SetBinContent(2151,0.0163109); + ssigpTa->SetBinContent(2152,0.0165689); + ssigpTa->SetBinContent(2153,0.0165488); + ssigpTa->SetBinContent(2154,0.0162451); + ssigpTa->SetBinContent(2155,0.0162081); + ssigpTa->SetBinContent(2156,0.016444); + ssigpTa->SetBinContent(2157,0.0167331); + ssigpTa->SetBinContent(2158,0.0170228); + ssigpTa->SetBinContent(2159,0.0173137); + ssigpTa->SetBinContent(2160,0.0175282); + ssigpTa->SetBinContent(2161,0.0173533); + ssigpTa->SetBinContent(2162,0.0167961); + ssigpTa->SetBinContent(2163,0.0165918); + ssigpTa->SetBinContent(2164,0.0165613); + ssigpTa->SetBinContent(2165,0.0163727); + ssigpTa->SetBinContent(2166,0.0164027); + ssigpTa->SetBinContent(2167,0.0166519); + ssigpTa->SetBinContent(2168,0.0169449); + ssigpTa->SetBinContent(2169,0.0172393); + ssigpTa->SetBinContent(2170,0.0175376); + ssigpTa->SetBinContent(2171,0.0178393); + ssigpTa->SetBinContent(2172,0.0181417); + ssigpTa->SetBinContent(2173,0.0184452); + ssigpTa->SetBinContent(2174,0.0187522); + ssigpTa->SetBinContent(2175,0.0190253); + ssigpTa->SetBinContent(2176,0.0191029); + ssigpTa->SetBinContent(2177,0.0189768); + ssigpTa->SetBinContent(2178,0.0189588); + ssigpTa->SetBinContent(2179,0.0186979); + ssigpTa->SetBinContent(2180,0.0180311); + ssigpTa->SetBinContent(2181,0.0178149); + ssigpTa->SetBinContent(2182,0.0180445); + ssigpTa->SetBinContent(2183,0.0183676); + ssigpTa->SetBinContent(2184,0.0186939); + ssigpTa->SetBinContent(2185,0.0190222); + ssigpTa->SetBinContent(2186,0.019348); + ssigpTa->SetBinContent(2187,0.0196402); + ssigpTa->SetBinContent(2188,0.0198901); + ssigpTa->SetBinContent(2189,0.0201982); + ssigpTa->SetBinContent(2190,0.020638); + ssigpTa->SetBinContent(2191,0.0211785); + ssigpTa->SetBinContent(2192,0.0216326); + ssigpTa->SetBinContent(2193,0.0218735); + ssigpTa->SetBinContent(2194,0.0214878); + ssigpTa->SetBinContent(2195,0.0204775); + ssigpTa->SetBinContent(2196,0.0200193); + ssigpTa->SetBinContent(2197,0.0201466); + ssigpTa->SetBinContent(2198,0.0203895); + ssigpTa->SetBinContent(2199,0.0206219); + ssigpTa->SetBinContent(2200,0.0208384); + ssigpTa->SetBinContent(2201,0.0209032); + ssigpTa->SetBinContent(2202,0.0202657); + ssigpTa->SetBinContent(2203,0.0189091); + ssigpTa->SetBinContent(2204,0.0183014); + ssigpTa->SetBinContent(2205,0.0184225); + ssigpTa->SetBinContent(2206,0.0186913); + ssigpTa->SetBinContent(2207,0.0190867); + ssigpTa->SetBinContent(2208,0.0200586); + ssigpTa->SetBinContent(2209,0.0216031); + ssigpTa->SetBinContent(2210,0.0225935); + ssigpTa->SetBinContent(2211,0.0230268); + ssigpTa->SetBinContent(2212,0.0233568); + ssigpTa->SetBinContent(2213,0.0236937); + ssigpTa->SetBinContent(2214,0.02403); + ssigpTa->SetBinContent(2215,0.0243663); + ssigpTa->SetBinContent(2216,0.0246136); + ssigpTa->SetBinContent(2217,0.0244233); + ssigpTa->SetBinContent(2218,0.0237987); + ssigpTa->SetBinContent(2219,0.0236035); + ssigpTa->SetBinContent(2220,0.0239518); + ssigpTa->SetBinContent(2221,0.0249467); + ssigpTa->SetBinContent(2222,0.0265084); + ssigpTa->SetBinContent(2223,0.0275476); + ssigpTa->SetBinContent(2224,0.0280566); + ssigpTa->SetBinContent(2225,0.0284588); + ssigpTa->SetBinContent(2226,0.0288623); + ssigpTa->SetBinContent(2227,0.0291617); + ssigpTa->SetBinContent(2228,0.028946); + ssigpTa->SetBinContent(2229,0.0282141); + ssigpTa->SetBinContent(2230,0.0279852); + ssigpTa->SetBinContent(2231,0.0284037); + ssigpTa->SetBinContent(2232,0.029558); + ssigpTa->SetBinContent(2233,0.0313378); + ssigpTa->SetBinContent(2234,0.0325136); + ssigpTa->SetBinContent(2235,0.033075); + ssigpTa->SetBinContent(2236,0.0335326); + ssigpTa->SetBinContent(2237,0.0340132); + ssigpTa->SetBinContent(2238,0.034504); + ssigpTa->SetBinContent(2239,0.0347238); + ssigpTa->SetBinContent(2240,0.0335956); + ssigpTa->SetBinContent(2241,0.0310955); + ssigpTa->SetBinContent(2242,0.0299845); + ssigpTa->SetBinContent(2243,0.030677); + ssigpTa->SetBinContent(2244,0.0321505); + ssigpTa->SetBinContent(2245,0.0331706); + ssigpTa->SetBinContent(2246,0.0337359); + ssigpTa->SetBinContent(2247,0.0342187); + ssigpTa->SetBinContent(2248,0.0347014); + ssigpTa->SetBinContent(2249,0.0351713); + ssigpTa->SetBinContent(2250,0.0356283); + ssigpTa->SetBinContent(2251,0.0360453); + ssigpTa->SetBinContent(2252,0.0363542); + ssigpTa->SetBinContent(2253,0.0369454); + ssigpTa->SetBinContent(2254,0.0382947); + ssigpTa->SetBinContent(2255,0.0393859); + ssigpTa->SetBinContent(2256,0.0400368); + ssigpTa->SetBinContent(2257,0.0405964); + ssigpTa->SetBinContent(2258,0.0411686); + ssigpTa->SetBinContent(2259,0.041744); + ssigpTa->SetBinContent(2260,0.0423207); + ssigpTa->SetBinContent(2261,0.0429118); + ssigpTa->SetBinContent(2262,0.0435286); + ssigpTa->SetBinContent(2263,0.0442645); + ssigpTa->SetBinContent(2264,0.0454591); + ssigpTa->SetBinContent(2265,0.0470455); + ssigpTa->SetBinContent(2266,0.0480936); + ssigpTa->SetBinContent(2267,0.0487733); + ssigpTa->SetBinContent(2268,0.0494397); + ssigpTa->SetBinContent(2269,0.0501161); + ssigpTa->SetBinContent(2270,0.0508147); + ssigpTa->SetBinContent(2271,0.0515815); + ssigpTa->SetBinContent(2272,0.0523867); + ssigpTa->SetBinContent(2273,0.0532644); + ssigpTa->SetBinContent(2274,0.0544772); + ssigpTa->SetBinContent(2275,0.056032); + ssigpTa->SetBinContent(2276,0.0572514); + ssigpTa->SetBinContent(2277,0.0581413); + ssigpTa->SetBinContent(2278,0.058988); + ssigpTa->SetBinContent(2279,0.0598614); + ssigpTa->SetBinContent(2280,0.0607527); + ssigpTa->SetBinContent(2281,0.0616721); + ssigpTa->SetBinContent(2282,0.0626651); + ssigpTa->SetBinContent(2283,0.0638414); + ssigpTa->SetBinContent(2284,0.0651889); + ssigpTa->SetBinContent(2285,0.066392); + ssigpTa->SetBinContent(2286,0.0674748); + ssigpTa->SetBinContent(2287,0.0685536); + ssigpTa->SetBinContent(2288,0.0696357); + ssigpTa->SetBinContent(2289,0.0707115); + ssigpTa->SetBinContent(2290,0.0718047); + ssigpTa->SetBinContent(2291,0.073056); + ssigpTa->SetBinContent(2292,0.074372); + ssigpTa->SetBinContent(2293,0.0752661); + ssigpTa->SetBinContent(2294,0.0762826); + ssigpTa->SetBinContent(2295,0.0775476); + ssigpTa->SetBinContent(2296,0.0788724); + ssigpTa->SetBinContent(2297,0.0802072); + ssigpTa->SetBinContent(2298,0.0815415); + ssigpTa->SetBinContent(2299,0.0828642); + ssigpTa->SetBinContent(2300,0.0841724); + ssigpTa->SetBinContent(2301,0.0854574); + ssigpTa->SetBinContent(2302,0.0866754); + ssigpTa->SetBinContent(2303,0.0878127); + ssigpTa->SetBinContent(2304,0.0890695); + ssigpTa->SetBinContent(2305,0.0904523); + ssigpTa->SetBinContent(2306,0.0919381); + ssigpTa->SetBinContent(2307,0.0935447); + ssigpTa->SetBinContent(2308,0.0951956); + ssigpTa->SetBinContent(2309,0.096832); + ssigpTa->SetBinContent(2310,0.0976488); + ssigpTa->SetBinContent(2311,0.0946238); + ssigpTa->SetBinContent(2312,0.0877711); + ssigpTa->SetBinContent(2313,0.0844518); + ssigpTa->SetBinContent(2314,0.0848275); + ssigpTa->SetBinContent(2315,0.0860639); + ssigpTa->SetBinContent(2316,0.087352); + ssigpTa->SetBinContent(2317,0.0886306); + ssigpTa->SetBinContent(2318,0.0898799); + ssigpTa->SetBinContent(2319,0.0911018); + ssigpTa->SetBinContent(2320,0.0923013); + ssigpTa->SetBinContent(2321,0.0935292); + ssigpTa->SetBinContent(2322,0.0948705); + ssigpTa->SetBinContent(2323,0.0963118); + ssigpTa->SetBinContent(2324,0.0977761); + ssigpTa->SetBinContent(2325,0.0992527); + ssigpTa->SetBinContent(2326,0.100803); + ssigpTa->SetBinContent(2327,0.102455); + ssigpTa->SetBinContent(2328,0.104146); + ssigpTa->SetBinContent(2329,0.105822); + ssigpTa->SetBinContent(2330,0.10879); + ssigpTa->SetBinContent(2331,0.118703); + ssigpTa->SetBinContent(2332,0.13596); + ssigpTa->SetBinContent(2333,0.145884); + ssigpTa->SetBinContent(2334,0.148887); + ssigpTa->SetBinContent(2335,0.150618); + ssigpTa->SetBinContent(2336,0.152407); + ssigpTa->SetBinContent(2337,0.154222); + ssigpTa->SetBinContent(2338,0.156009); + ssigpTa->SetBinContent(2339,0.157747); + ssigpTa->SetBinContent(2340,0.159535); + ssigpTa->SetBinContent(2341,0.161522); + ssigpTa->SetBinContent(2342,0.163607); + ssigpTa->SetBinContent(2343,0.165694); + ssigpTa->SetBinContent(2344,0.16777); + ssigpTa->SetBinContent(2345,0.169914); + ssigpTa->SetBinContent(2346,0.172216); + ssigpTa->SetBinContent(2347,0.1747); + ssigpTa->SetBinContent(2348,0.17732); + ssigpTa->SetBinContent(2349,0.180022); + ssigpTa->SetBinContent(2350,0.182753); + ssigpTa->SetBinContent(2351,0.185461); + ssigpTa->SetBinContent(2352,0.188067); + ssigpTa->SetBinContent(2353,0.190549); + ssigpTa->SetBinContent(2354,0.192815); + ssigpTa->SetBinContent(2355,0.194599); + ssigpTa->SetBinContent(2356,0.195947); + ssigpTa->SetBinContent(2357,0.197189); + ssigpTa->SetBinContent(2358,0.198709); + ssigpTa->SetBinContent(2359,0.200675); + ssigpTa->SetBinContent(2360,0.202831); + ssigpTa->SetBinContent(2361,0.20502); + ssigpTa->SetBinContent(2362,0.207541); + ssigpTa->SetBinContent(2363,0.210692); + ssigpTa->SetBinContent(2364,0.214164); + ssigpTa->SetBinContent(2365,0.217647); + ssigpTa->SetBinContent(2366,0.221049); + ssigpTa->SetBinContent(2367,0.224355); + ssigpTa->SetBinContent(2368,0.227694); + ssigpTa->SetBinContent(2369,0.231283); + ssigpTa->SetBinContent(2370,0.23518); + ssigpTa->SetBinContent(2371,0.239391); + ssigpTa->SetBinContent(2372,0.243724); + ssigpTa->SetBinContent(2373,0.247675); + ssigpTa->SetBinContent(2374,0.251176); + ssigpTa->SetBinContent(2375,0.254389); + ssigpTa->SetBinContent(2376,0.257379); + ssigpTa->SetBinContent(2377,0.260173); + ssigpTa->SetBinContent(2378,0.262856); + ssigpTa->SetBinContent(2379,0.265583); + ssigpTa->SetBinContent(2380,0.268483); + ssigpTa->SetBinContent(2381,0.271485); + ssigpTa->SetBinContent(2382,0.274416); + ssigpTa->SetBinContent(2383,0.277345); + ssigpTa->SetBinContent(2384,0.280349); + ssigpTa->SetBinContent(2385,0.283297); + ssigpTa->SetBinContent(2386,0.286181); + ssigpTa->SetBinContent(2387,0.289165); + ssigpTa->SetBinContent(2388,0.292156); + ssigpTa->SetBinContent(2389,0.295001); + ssigpTa->SetBinContent(2390,0.298055); + ssigpTa->SetBinContent(2391,0.302246); + ssigpTa->SetBinContent(2392,0.308034); + ssigpTa->SetBinContent(2393,0.314742); + ssigpTa->SetBinContent(2394,0.321729); + ssigpTa->SetBinContent(2395,0.330316); + ssigpTa->SetBinContent(2396,0.350663); + ssigpTa->SetBinContent(2397,0.385197); + ssigpTa->SetBinContent(2398,0.405882); + ssigpTa->SetBinContent(2399,0.414919); + ssigpTa->SetBinContent(2400,0.422434); + ssigpTa->SetBinContent(2401,0.430267); + ssigpTa->SetBinContent(2402,0.438372); + ssigpTa->SetBinContent(2403,0.44679); + ssigpTa->SetBinContent(2404,0.455816); + ssigpTa->SetBinContent(2405,0.465648); + ssigpTa->SetBinContent(2406,0.475812); + ssigpTa->SetBinContent(2407,0.485728); + ssigpTa->SetBinContent(2408,0.49566); + ssigpTa->SetBinContent(2409,0.5065); + ssigpTa->SetBinContent(2410,0.518308); + ssigpTa->SetBinContent(2411,0.530263); + ssigpTa->SetBinContent(2412,0.541867); + ssigpTa->SetBinContent(2413,0.552325); + ssigpTa->SetBinContent(2414,0.564235); + ssigpTa->SetBinContent(2415,0.59819); + ssigpTa->SetBinContent(2416,0.655725); + ssigpTa->SetBinContent(2419,0.0102269); + ssigpTa->SetBinContent(2420,0.010219); + ssigpTa->SetBinContent(2421,0.0102155); + ssigpTa->SetBinContent(2422,0.0102162); + ssigpTa->SetBinContent(2423,0.0102188); + ssigpTa->SetBinContent(2424,0.010222); + ssigpTa->SetBinContent(2425,0.0102251); + ssigpTa->SetBinContent(2426,0.010228); + ssigpTa->SetBinContent(2427,0.0102317); + ssigpTa->SetBinContent(2428,0.0102366); + ssigpTa->SetBinContent(2429,0.0102421); + ssigpTa->SetBinContent(2430,0.010248); + ssigpTa->SetBinContent(2431,0.0102547); + ssigpTa->SetBinContent(2432,0.010262); + ssigpTa->SetBinContent(2433,0.0102692); + ssigpTa->SetBinContent(2434,0.0102764); + ssigpTa->SetBinContent(2435,0.0102861); + ssigpTa->SetBinContent(2436,0.0102953); + ssigpTa->SetBinContent(2437,0.0103055); + ssigpTa->SetBinContent(2438,0.0103153); + ssigpTa->SetBinContent(2439,0.0103261); + ssigpTa->SetBinContent(2440,0.0103365); + ssigpTa->SetBinContent(2441,0.0103494); + ssigpTa->SetBinContent(2442,0.0103622); + ssigpTa->SetBinContent(2443,0.0103749); + ssigpTa->SetBinContent(2444,0.0103882); + ssigpTa->SetBinContent(2445,0.0104025); + ssigpTa->SetBinContent(2446,0.0104182); + ssigpTa->SetBinContent(2447,0.0104327); + ssigpTa->SetBinContent(2448,0.0104496); + ssigpTa->SetBinContent(2449,0.0104662); + ssigpTa->SetBinContent(2450,0.0104831); + ssigpTa->SetBinContent(2451,0.0105007); + ssigpTa->SetBinContent(2452,0.0105182); + ssigpTa->SetBinContent(2453,0.0105374); + ssigpTa->SetBinContent(2454,0.010557); + ssigpTa->SetBinContent(2455,0.0105771); + ssigpTa->SetBinContent(2456,0.0105974); + ssigpTa->SetBinContent(2457,0.0106182); + ssigpTa->SetBinContent(2458,0.0106408); + ssigpTa->SetBinContent(2459,0.0106631); + ssigpTa->SetBinContent(2460,0.0106862); + ssigpTa->SetBinContent(2461,0.0107092); + ssigpTa->SetBinContent(2462,0.0107337); + ssigpTa->SetBinContent(2463,0.0107586); + ssigpTa->SetBinContent(2464,0.0107833); + ssigpTa->SetBinContent(2465,0.0108092); + ssigpTa->SetBinContent(2466,0.0108368); + ssigpTa->SetBinContent(2467,0.0108635); + ssigpTa->SetBinContent(2468,0.0108917); + ssigpTa->SetBinContent(2469,0.0109188); + ssigpTa->SetBinContent(2470,0.0109476); + ssigpTa->SetBinContent(2471,0.0109776); + ssigpTa->SetBinContent(2472,0.0110074); + ssigpTa->SetBinContent(2473,0.0110382); + ssigpTa->SetBinContent(2474,0.0110694); + ssigpTa->SetBinContent(2475,0.0111016); + ssigpTa->SetBinContent(2476,0.0111343); + ssigpTa->SetBinContent(2477,0.0111678); + ssigpTa->SetBinContent(2478,0.0112002); + ssigpTa->SetBinContent(2479,0.0112345); + ssigpTa->SetBinContent(2480,0.0112702); + ssigpTa->SetBinContent(2481,0.0113057); + ssigpTa->SetBinContent(2482,0.0113419); + ssigpTa->SetBinContent(2483,0.0113786); + ssigpTa->SetBinContent(2484,0.0114166); + ssigpTa->SetBinContent(2485,0.0114555); + ssigpTa->SetBinContent(2486,0.0114943); + ssigpTa->SetBinContent(2487,0.0115334); + ssigpTa->SetBinContent(2488,0.0115735); + ssigpTa->SetBinContent(2489,0.0116147); + ssigpTa->SetBinContent(2490,0.0116565); + ssigpTa->SetBinContent(2491,0.0116982); + ssigpTa->SetBinContent(2492,0.011741); + ssigpTa->SetBinContent(2493,0.0117845); + ssigpTa->SetBinContent(2494,0.0118286); + ssigpTa->SetBinContent(2495,0.0118738); + ssigpTa->SetBinContent(2496,0.01192); + ssigpTa->SetBinContent(2497,0.0119657); + ssigpTa->SetBinContent(2498,0.0120122); + ssigpTa->SetBinContent(2499,0.0120604); + ssigpTa->SetBinContent(2500,0.012109); + ssigpTa->SetBinContent(2501,0.0121583); + ssigpTa->SetBinContent(2502,0.0122077); + ssigpTa->SetBinContent(2503,0.0122586); + ssigpTa->SetBinContent(2504,0.01231); + ssigpTa->SetBinContent(2505,0.0123619); + ssigpTa->SetBinContent(2506,0.0124155); + ssigpTa->SetBinContent(2507,0.012468); + ssigpTa->SetBinContent(2508,0.0125233); + ssigpTa->SetBinContent(2509,0.0125784); + ssigpTa->SetBinContent(2510,0.0126357); + ssigpTa->SetBinContent(2511,0.0126927); + ssigpTa->SetBinContent(2512,0.0127514); + ssigpTa->SetBinContent(2513,0.0128098); + ssigpTa->SetBinContent(2514,0.0128696); + ssigpTa->SetBinContent(2515,0.01293); + ssigpTa->SetBinContent(2516,0.0129918); + ssigpTa->SetBinContent(2517,0.0130534); + ssigpTa->SetBinContent(2518,0.0131171); + ssigpTa->SetBinContent(2519,0.0131818); + ssigpTa->SetBinContent(2520,0.0132471); + ssigpTa->SetBinContent(2521,0.013312); + ssigpTa->SetBinContent(2522,0.0133947); + ssigpTa->SetBinContent(2523,0.0135528); + ssigpTa->SetBinContent(2524,0.0138347); + ssigpTa->SetBinContent(2525,0.0142876); + ssigpTa->SetBinContent(2526,0.0149154); + ssigpTa->SetBinContent(2527,0.0152802); + ssigpTa->SetBinContent(2528,0.0154038); + ssigpTa->SetBinContent(2529,0.0154798); + ssigpTa->SetBinContent(2530,0.0155579); + ssigpTa->SetBinContent(2531,0.0156367); + ssigpTa->SetBinContent(2532,0.0157169); + ssigpTa->SetBinContent(2533,0.0157983); + ssigpTa->SetBinContent(2534,0.0158812); + ssigpTa->SetBinContent(2535,0.0159301); + ssigpTa->SetBinContent(2536,0.0157978); + ssigpTa->SetBinContent(2537,0.0154648); + ssigpTa->SetBinContent(2538,0.0153233); + ssigpTa->SetBinContent(2539,0.0154415); + ssigpTa->SetBinContent(2540,0.0156517); + ssigpTa->SetBinContent(2541,0.0158738); + ssigpTa->SetBinContent(2542,0.0160935); + ssigpTa->SetBinContent(2543,0.0163116); + ssigpTa->SetBinContent(2544,0.0164812); + ssigpTa->SetBinContent(2545,0.0164118); + ssigpTa->SetBinContent(2546,0.0160571); + ssigpTa->SetBinContent(2547,0.0157273); + ssigpTa->SetBinContent(2548,0.0154178); + ssigpTa->SetBinContent(2549,0.0154096); + ssigpTa->SetBinContent(2550,0.015653); + ssigpTa->SetBinContent(2551,0.0159511); + ssigpTa->SetBinContent(2552,0.016252); + ssigpTa->SetBinContent(2553,0.016556); + ssigpTa->SetBinContent(2554,0.0168607); + ssigpTa->SetBinContent(2555,0.0171025); + ssigpTa->SetBinContent(2556,0.0170349); + ssigpTa->SetBinContent(2557,0.0166528); + ssigpTa->SetBinContent(2558,0.0165792); + ssigpTa->SetBinContent(2559,0.0168155); + ssigpTa->SetBinContent(2560,0.0171163); + ssigpTa->SetBinContent(2561,0.0174194); + ssigpTa->SetBinContent(2562,0.0177233); + ssigpTa->SetBinContent(2563,0.017947); + ssigpTa->SetBinContent(2564,0.0177735); + ssigpTa->SetBinContent(2565,0.017214); + ssigpTa->SetBinContent(2566,0.0170076); + ssigpTa->SetBinContent(2567,0.0169526); + ssigpTa->SetBinContent(2568,0.0167136); + ssigpTa->SetBinContent(2569,0.016723); + ssigpTa->SetBinContent(2570,0.0169805); + ssigpTa->SetBinContent(2571,0.0172864); + ssigpTa->SetBinContent(2572,0.0175954); + ssigpTa->SetBinContent(2573,0.0179076); + ssigpTa->SetBinContent(2574,0.0182248); + ssigpTa->SetBinContent(2575,0.0185433); + ssigpTa->SetBinContent(2576,0.018864); + ssigpTa->SetBinContent(2577,0.0191897); + ssigpTa->SetBinContent(2578,0.0194744); + ssigpTa->SetBinContent(2579,0.0195351); + ssigpTa->SetBinContent(2580,0.0193601); + ssigpTa->SetBinContent(2581,0.0193202); + ssigpTa->SetBinContent(2582,0.0190399); + ssigpTa->SetBinContent(2583,0.0183256); + ssigpTa->SetBinContent(2584,0.0180898); + ssigpTa->SetBinContent(2585,0.0183231); + ssigpTa->SetBinContent(2586,0.0186548); + ssigpTa->SetBinContent(2587,0.0189892); + ssigpTa->SetBinContent(2588,0.0193273); + ssigpTa->SetBinContent(2589,0.0196598); + ssigpTa->SetBinContent(2590,0.0199406); + ssigpTa->SetBinContent(2591,0.0201511); + ssigpTa->SetBinContent(2592,0.0204559); + ssigpTa->SetBinContent(2593,0.020942); + ssigpTa->SetBinContent(2594,0.0215694); + ssigpTa->SetBinContent(2595,0.022082); + ssigpTa->SetBinContent(2596,0.0223567); + ssigpTa->SetBinContent(2597,0.0220249); + ssigpTa->SetBinContent(2598,0.0210962); + ssigpTa->SetBinContent(2599,0.020691); + ssigpTa->SetBinContent(2600,0.0208412); + ssigpTa->SetBinContent(2601,0.0211032); + ssigpTa->SetBinContent(2602,0.0213592); + ssigpTa->SetBinContent(2603,0.021606); + ssigpTa->SetBinContent(2604,0.0216862); + ssigpTa->SetBinContent(2605,0.0209668); + ssigpTa->SetBinContent(2606,0.0194247); + ssigpTa->SetBinContent(2607,0.0187186); + ssigpTa->SetBinContent(2608,0.0188326); + ssigpTa->SetBinContent(2609,0.019115); + ssigpTa->SetBinContent(2610,0.0195145); + ssigpTa->SetBinContent(2611,0.0204539); + ssigpTa->SetBinContent(2612,0.021917); + ssigpTa->SetBinContent(2613,0.0228703); + ssigpTa->SetBinContent(2614,0.023301); + ssigpTa->SetBinContent(2615,0.0236382); + ssigpTa->SetBinContent(2616,0.0239814); + ssigpTa->SetBinContent(2617,0.0243255); + ssigpTa->SetBinContent(2618,0.0246698); + ssigpTa->SetBinContent(2619,0.0249284); + ssigpTa->SetBinContent(2620,0.024764); + ssigpTa->SetBinContent(2621,0.024184); + ssigpTa->SetBinContent(2622,0.024019); + ssigpTa->SetBinContent(2623,0.0243865); + ssigpTa->SetBinContent(2624,0.0253916); + ssigpTa->SetBinContent(2625,0.0269491); + ssigpTa->SetBinContent(2626,0.0279929); + ssigpTa->SetBinContent(2627,0.0285101); + ssigpTa->SetBinContent(2628,0.0289234); + ssigpTa->SetBinContent(2629,0.0293382); + ssigpTa->SetBinContent(2630,0.0296572); + ssigpTa->SetBinContent(2631,0.0295025); + ssigpTa->SetBinContent(2632,0.0288803); + ssigpTa->SetBinContent(2633,0.0287201); + ssigpTa->SetBinContent(2634,0.0291673); + ssigpTa->SetBinContent(2635,0.0303255); + ssigpTa->SetBinContent(2636,0.0320889); + ssigpTa->SetBinContent(2637,0.0332695); + ssigpTa->SetBinContent(2638,0.0338511); + ssigpTa->SetBinContent(2639,0.0343268); + ssigpTa->SetBinContent(2640,0.0348247); + ssigpTa->SetBinContent(2641,0.0353374); + ssigpTa->SetBinContent(2642,0.035603); + ssigpTa->SetBinContent(2643,0.0345846); + ssigpTa->SetBinContent(2644,0.0322799); + ssigpTa->SetBinContent(2645,0.0312771); + ssigpTa->SetBinContent(2646,0.0320322); + ssigpTa->SetBinContent(2647,0.0335518); + ssigpTa->SetBinContent(2648,0.0346142); + ssigpTa->SetBinContent(2649,0.0351992); + ssigpTa->SetBinContent(2650,0.0356959); + ssigpTa->SetBinContent(2651,0.0361918); + ssigpTa->SetBinContent(2652,0.0366801); + ssigpTa->SetBinContent(2653,0.0371614); + ssigpTa->SetBinContent(2654,0.0376106); + ssigpTa->SetBinContent(2655,0.037963); + ssigpTa->SetBinContent(2656,0.0386244); + ssigpTa->SetBinContent(2657,0.0399903); + ssigpTa->SetBinContent(2658,0.0411015); + ssigpTa->SetBinContent(2659,0.0417697); + ssigpTa->SetBinContent(2660,0.0423515); + ssigpTa->SetBinContent(2661,0.0429402); + ssigpTa->SetBinContent(2662,0.0435348); + ssigpTa->SetBinContent(2663,0.044134); + ssigpTa->SetBinContent(2664,0.0447508); + ssigpTa->SetBinContent(2665,0.0453913); + ssigpTa->SetBinContent(2666,0.0461352); + ssigpTa->SetBinContent(2667,0.0473057); + ssigpTa->SetBinContent(2668,0.0488183); + ssigpTa->SetBinContent(2669,0.049821); + ssigpTa->SetBinContent(2670,0.0504949); + ssigpTa->SetBinContent(2671,0.0511802); + ssigpTa->SetBinContent(2672,0.0518811); + ssigpTa->SetBinContent(2673,0.052606); + ssigpTa->SetBinContent(2674,0.053392); + ssigpTa->SetBinContent(2675,0.0542132); + ssigpTa->SetBinContent(2676,0.055103); + ssigpTa->SetBinContent(2677,0.0563196); + ssigpTa->SetBinContent(2678,0.057867); + ssigpTa->SetBinContent(2679,0.0590977); + ssigpTa->SetBinContent(2680,0.0600117); + ssigpTa->SetBinContent(2681,0.0608901); + ssigpTa->SetBinContent(2682,0.0617787); + ssigpTa->SetBinContent(2683,0.0626833); + ssigpTa->SetBinContent(2684,0.0636182); + ssigpTa->SetBinContent(2685,0.0646382); + ssigpTa->SetBinContent(2686,0.0658618); + ssigpTa->SetBinContent(2687,0.0672769); + ssigpTa->SetBinContent(2688,0.0685364); + ssigpTa->SetBinContent(2689,0.0696505); + ssigpTa->SetBinContent(2690,0.0707444); + ssigpTa->SetBinContent(2691,0.0718396); + ssigpTa->SetBinContent(2692,0.0729424); + ssigpTa->SetBinContent(2693,0.0741178); + ssigpTa->SetBinContent(2694,0.07566); + ssigpTa->SetBinContent(2695,0.0775339); + ssigpTa->SetBinContent(2696,0.0783313); + ssigpTa->SetBinContent(2697,0.0792776); + ssigpTa->SetBinContent(2698,0.0805759); + ssigpTa->SetBinContent(2699,0.0819631); + ssigpTa->SetBinContent(2700,0.0833659); + ssigpTa->SetBinContent(2701,0.0847693); + ssigpTa->SetBinContent(2702,0.0861658); + ssigpTa->SetBinContent(2703,0.0875588); + ssigpTa->SetBinContent(2704,0.088928); + ssigpTa->SetBinContent(2705,0.090127); + ssigpTa->SetBinContent(2706,0.0910299); + ssigpTa->SetBinContent(2707,0.0922331); + ssigpTa->SetBinContent(2708,0.0936484); + ssigpTa->SetBinContent(2709,0.0951828); + ssigpTa->SetBinContent(2710,0.0968521); + ssigpTa->SetBinContent(2711,0.0985865); + ssigpTa->SetBinContent(2712,0.100327); + ssigpTa->SetBinContent(2713,0.10139); + ssigpTa->SetBinContent(2714,0.0990741); + ssigpTa->SetBinContent(2715,0.0936635); + ssigpTa->SetBinContent(2716,0.0912171); + ssigpTa->SetBinContent(2717,0.0919151); + ssigpTa->SetBinContent(2718,0.093296); + ssigpTa->SetBinContent(2719,0.0947065); + ssigpTa->SetBinContent(2720,0.09611); + ssigpTa->SetBinContent(2721,0.0975018); + ssigpTa->SetBinContent(2722,0.0988774); + ssigpTa->SetBinContent(2723,0.100239); + ssigpTa->SetBinContent(2724,0.101643); + ssigpTa->SetBinContent(2725,0.103187); + ssigpTa->SetBinContent(2726,0.104865); + ssigpTa->SetBinContent(2727,0.106592); + ssigpTa->SetBinContent(2728,0.108335); + ssigpTa->SetBinContent(2729,0.110125); + ssigpTa->SetBinContent(2730,0.111983); + ssigpTa->SetBinContent(2731,0.113874); + ssigpTa->SetBinContent(2732,0.115759); + ssigpTa->SetBinContent(2733,0.119208); + ssigpTa->SetBinContent(2734,0.131271); + ssigpTa->SetBinContent(2735,0.153198); + ssigpTa->SetBinContent(2736,0.165438); + ssigpTa->SetBinContent(2737,0.169098); + ssigpTa->SetBinContent(2738,0.171201); + ssigpTa->SetBinContent(2739,0.173337); + ssigpTa->SetBinContent(2740,0.175469); + ssigpTa->SetBinContent(2741,0.17758); + ssigpTa->SetBinContent(2742,0.179711); + ssigpTa->SetBinContent(2743,0.182024); + ssigpTa->SetBinContent(2744,0.184662); + ssigpTa->SetBinContent(2745,0.187471); + ssigpTa->SetBinContent(2746,0.190339); + ssigpTa->SetBinContent(2747,0.193202); + ssigpTa->SetBinContent(2748,0.196031); + ssigpTa->SetBinContent(2749,0.198886); + ssigpTa->SetBinContent(2750,0.201868); + ssigpTa->SetBinContent(2751,0.205028); + ssigpTa->SetBinContent(2752,0.208358); + ssigpTa->SetBinContent(2753,0.211777); + ssigpTa->SetBinContent(2754,0.215207); + ssigpTa->SetBinContent(2755,0.218559); + ssigpTa->SetBinContent(2756,0.221829); + ssigpTa->SetBinContent(2757,0.224929); + ssigpTa->SetBinContent(2758,0.227594); + ssigpTa->SetBinContent(2759,0.229856); + ssigpTa->SetBinContent(2760,0.232009); + ssigpTa->SetBinContent(2761,0.234384); + ssigpTa->SetBinContent(2762,0.23709); + ssigpTa->SetBinContent(2763,0.239907); + ssigpTa->SetBinContent(2764,0.242721); + ssigpTa->SetBinContent(2765,0.245911); + ssigpTa->SetBinContent(2766,0.249875); + ssigpTa->SetBinContent(2767,0.254247); + ssigpTa->SetBinContent(2768,0.258654); + ssigpTa->SetBinContent(2769,0.262992); + ssigpTa->SetBinContent(2770,0.26728); + ssigpTa->SetBinContent(2771,0.271743); + ssigpTa->SetBinContent(2772,0.27669); + ssigpTa->SetBinContent(2773,0.282099); + ssigpTa->SetBinContent(2774,0.287864); + ssigpTa->SetBinContent(2775,0.29372); + ssigpTa->SetBinContent(2776,0.299151); + ssigpTa->SetBinContent(2777,0.304015); + ssigpTa->SetBinContent(2778,0.308492); + ssigpTa->SetBinContent(2779,0.312689); + ssigpTa->SetBinContent(2780,0.316652); + ssigpTa->SetBinContent(2781,0.320507); + ssigpTa->SetBinContent(2782,0.32453); + ssigpTa->SetBinContent(2783,0.328999); + ssigpTa->SetBinContent(2784,0.333796); + ssigpTa->SetBinContent(2785,0.33859); + ssigpTa->SetBinContent(2786,0.343343); + ssigpTa->SetBinContent(2787,0.3481); + ssigpTa->SetBinContent(2788,0.352753); + ssigpTa->SetBinContent(2789,0.357277); + ssigpTa->SetBinContent(2790,0.361753); + ssigpTa->SetBinContent(2791,0.366075); + ssigpTa->SetBinContent(2792,0.370208); + ssigpTa->SetBinContent(2793,0.374663); + ssigpTa->SetBinContent(2794,0.380387); + ssigpTa->SetBinContent(2795,0.387694); + ssigpTa->SetBinContent(2796,0.395944); + ssigpTa->SetBinContent(2797,0.404649); + ssigpTa->SetBinContent(2798,0.41672); + ssigpTa->SetBinContent(2799,0.449447); + ssigpTa->SetBinContent(2800,0.508355); + ssigpTa->SetBinContent(2801,0.54229); + ssigpTa->SetBinContent(2802,0.555966); + ssigpTa->SetBinContent(2803,0.566882); + ssigpTa->SetBinContent(2804,0.578878); + ssigpTa->SetBinContent(2805,0.591841); + ssigpTa->SetBinContent(2806,0.605648); + ssigpTa->SetBinContent(2807,0.6203); + ssigpTa->SetBinContent(2808,0.635481); + ssigpTa->SetBinContent(2809,0.650504); + ssigpTa->SetBinContent(2810,0.665191); + ssigpTa->SetBinContent(2811,0.680152); + ssigpTa->SetBinContent(2812,0.696438); + ssigpTa->SetBinContent(2813,0.714032); + ssigpTa->SetBinContent(2814,0.732083); + ssigpTa->SetBinContent(2815,0.750199); + ssigpTa->SetBinContent(2816,0.767553); + ssigpTa->SetBinContent(2817,0.790576); + ssigpTa->SetBinContent(2818,0.856068); + ssigpTa->SetBinContent(2819,0.974092); + ssigpTa->SetBinContent(2822,0.0107314); + ssigpTa->SetBinContent(2823,0.0107278); + ssigpTa->SetBinContent(2824,0.0107222); + ssigpTa->SetBinContent(2825,0.0107231); + ssigpTa->SetBinContent(2826,0.010726); + ssigpTa->SetBinContent(2827,0.0107305); + ssigpTa->SetBinContent(2828,0.010735); + ssigpTa->SetBinContent(2829,0.0107372); + ssigpTa->SetBinContent(2830,0.0107406); + ssigpTa->SetBinContent(2831,0.0107451); + ssigpTa->SetBinContent(2832,0.010751); + ssigpTa->SetBinContent(2833,0.0107564); + ssigpTa->SetBinContent(2834,0.0107642); + ssigpTa->SetBinContent(2835,0.0107713); + ssigpTa->SetBinContent(2836,0.0107772); + ssigpTa->SetBinContent(2837,0.0107847); + ssigpTa->SetBinContent(2838,0.0107939); + ssigpTa->SetBinContent(2839,0.0108042); + ssigpTa->SetBinContent(2840,0.010813); + ssigpTa->SetBinContent(2841,0.0108246); + ssigpTa->SetBinContent(2842,0.0108335); + ssigpTa->SetBinContent(2843,0.0108447); + ssigpTa->SetBinContent(2844,0.0108576); + ssigpTa->SetBinContent(2845,0.010871); + ssigpTa->SetBinContent(2846,0.0108842); + ssigpTa->SetBinContent(2847,0.0108968); + ssigpTa->SetBinContent(2848,0.0109122); + ssigpTa->SetBinContent(2849,0.0109268); + ssigpTa->SetBinContent(2850,0.0109418); + ssigpTa->SetBinContent(2851,0.0109573); + ssigpTa->SetBinContent(2852,0.0109755); + ssigpTa->SetBinContent(2853,0.0109926); + ssigpTa->SetBinContent(2854,0.0110102); + ssigpTa->SetBinContent(2855,0.0110281); + ssigpTa->SetBinContent(2856,0.0110476); + ssigpTa->SetBinContent(2857,0.011068); + ssigpTa->SetBinContent(2858,0.0110872); + ssigpTa->SetBinContent(2859,0.0111076); + ssigpTa->SetBinContent(2860,0.0111289); + ssigpTa->SetBinContent(2861,0.0111494); + ssigpTa->SetBinContent(2862,0.0111726); + ssigpTa->SetBinContent(2863,0.0111948); + ssigpTa->SetBinContent(2864,0.011219); + ssigpTa->SetBinContent(2865,0.0112431); + ssigpTa->SetBinContent(2866,0.0112681); + ssigpTa->SetBinContent(2867,0.0112927); + ssigpTa->SetBinContent(2868,0.0113186); + ssigpTa->SetBinContent(2869,0.0113456); + ssigpTa->SetBinContent(2870,0.0113747); + ssigpTa->SetBinContent(2871,0.011401); + ssigpTa->SetBinContent(2872,0.011429); + ssigpTa->SetBinContent(2873,0.0114573); + ssigpTa->SetBinContent(2874,0.0114865); + ssigpTa->SetBinContent(2875,0.0115173); + ssigpTa->SetBinContent(2876,0.0115482); + ssigpTa->SetBinContent(2877,0.0115798); + ssigpTa->SetBinContent(2878,0.0116118); + ssigpTa->SetBinContent(2879,0.0116456); + ssigpTa->SetBinContent(2880,0.0116781); + ssigpTa->SetBinContent(2881,0.011711); + ssigpTa->SetBinContent(2882,0.0117452); + ssigpTa->SetBinContent(2883,0.0117806); + ssigpTa->SetBinContent(2884,0.0118161); + ssigpTa->SetBinContent(2885,0.0118519); + ssigpTa->SetBinContent(2886,0.0118882); + ssigpTa->SetBinContent(2887,0.0119265); + ssigpTa->SetBinContent(2888,0.0119653); + ssigpTa->SetBinContent(2889,0.0120052); + ssigpTa->SetBinContent(2890,0.0120432); + ssigpTa->SetBinContent(2891,0.0120828); + ssigpTa->SetBinContent(2892,0.0121253); + ssigpTa->SetBinContent(2893,0.0121661); + ssigpTa->SetBinContent(2894,0.0122094); + ssigpTa->SetBinContent(2895,0.0122519); + ssigpTa->SetBinContent(2896,0.0122949); + ssigpTa->SetBinContent(2897,0.0123394); + ssigpTa->SetBinContent(2898,0.0123841); + ssigpTa->SetBinContent(2899,0.012431); + ssigpTa->SetBinContent(2900,0.0124782); + ssigpTa->SetBinContent(2901,0.0125236); + ssigpTa->SetBinContent(2902,0.0125719); + ssigpTa->SetBinContent(2903,0.0126211); + ssigpTa->SetBinContent(2904,0.0126702); + ssigpTa->SetBinContent(2905,0.012721); + ssigpTa->SetBinContent(2906,0.0127699); + ssigpTa->SetBinContent(2907,0.0128216); + ssigpTa->SetBinContent(2908,0.0128741); + ssigpTa->SetBinContent(2909,0.0129266); + ssigpTa->SetBinContent(2910,0.0129812); + ssigpTa->SetBinContent(2911,0.0130338); + ssigpTa->SetBinContent(2912,0.0130912); + ssigpTa->SetBinContent(2913,0.0131478); + ssigpTa->SetBinContent(2914,0.0132066); + ssigpTa->SetBinContent(2915,0.0132653); + ssigpTa->SetBinContent(2916,0.0133248); + ssigpTa->SetBinContent(2917,0.0133844); + ssigpTa->SetBinContent(2918,0.0134449); + ssigpTa->SetBinContent(2919,0.0135053); + ssigpTa->SetBinContent(2920,0.0135666); + ssigpTa->SetBinContent(2921,0.0136299); + ssigpTa->SetBinContent(2922,0.0136966); + ssigpTa->SetBinContent(2923,0.0137611); + ssigpTa->SetBinContent(2924,0.013827); + ssigpTa->SetBinContent(2925,0.0139049); + ssigpTa->SetBinContent(2926,0.01405); + ssigpTa->SetBinContent(2927,0.0143141); + ssigpTa->SetBinContent(2928,0.0147958); + ssigpTa->SetBinContent(2929,0.0155048); + ssigpTa->SetBinContent(2930,0.0159146); + ssigpTa->SetBinContent(2931,0.0160441); + ssigpTa->SetBinContent(2932,0.0161207); + ssigpTa->SetBinContent(2933,0.0161958); + ssigpTa->SetBinContent(2934,0.0162754); + ssigpTa->SetBinContent(2935,0.0163558); + ssigpTa->SetBinContent(2936,0.0164375); + ssigpTa->SetBinContent(2937,0.016522); + ssigpTa->SetBinContent(2938,0.0165662); + ssigpTa->SetBinContent(2939,0.0164012); + ssigpTa->SetBinContent(2940,0.0160168); + ssigpTa->SetBinContent(2941,0.015866); + ssigpTa->SetBinContent(2942,0.0159974); + ssigpTa->SetBinContent(2943,0.0162204); + ssigpTa->SetBinContent(2944,0.0164522); + ssigpTa->SetBinContent(2945,0.0166835); + ssigpTa->SetBinContent(2946,0.0169115); + ssigpTa->SetBinContent(2947,0.0170942); + ssigpTa->SetBinContent(2948,0.0170257); + ssigpTa->SetBinContent(2949,0.0166731); + ssigpTa->SetBinContent(2950,0.0164178); + ssigpTa->SetBinContent(2951,0.0162482); + ssigpTa->SetBinContent(2952,0.0163226); + ssigpTa->SetBinContent(2953,0.0165809); + ssigpTa->SetBinContent(2954,0.0168744); + ssigpTa->SetBinContent(2955,0.0171693); + ssigpTa->SetBinContent(2956,0.017466); + ssigpTa->SetBinContent(2957,0.0177632); + ssigpTa->SetBinContent(2958,0.0179869); + ssigpTa->SetBinContent(2959,0.0178695); + ssigpTa->SetBinContent(2960,0.0174067); + ssigpTa->SetBinContent(2961,0.017298); + ssigpTa->SetBinContent(2962,0.0175382); + ssigpTa->SetBinContent(2963,0.0178516); + ssigpTa->SetBinContent(2964,0.0181662); + ssigpTa->SetBinContent(2965,0.018482); + ssigpTa->SetBinContent(2966,0.0187179); + ssigpTa->SetBinContent(2967,0.0185674); + ssigpTa->SetBinContent(2968,0.0180401); + ssigpTa->SetBinContent(2969,0.0178478); + ssigpTa->SetBinContent(2970,0.0177446); + ssigpTa->SetBinContent(2971,0.0174062); + ssigpTa->SetBinContent(2972,0.017369); + ssigpTa->SetBinContent(2973,0.017637); + ssigpTa->SetBinContent(2974,0.0179682); + ssigpTa->SetBinContent(2975,0.0183006); + ssigpTa->SetBinContent(2976,0.0186391); + ssigpTa->SetBinContent(2977,0.0189803); + ssigpTa->SetBinContent(2978,0.0193262); + ssigpTa->SetBinContent(2979,0.0196765); + ssigpTa->SetBinContent(2980,0.0200298); + ssigpTa->SetBinContent(2981,0.020334); + ssigpTa->SetBinContent(2982,0.0203666); + ssigpTa->SetBinContent(2983,0.0201205); + ssigpTa->SetBinContent(2984,0.0200433); + ssigpTa->SetBinContent(2985,0.0197086); + ssigpTa->SetBinContent(2986,0.0189059); + ssigpTa->SetBinContent(2987,0.0186165); + ssigpTa->SetBinContent(2988,0.0188566); + ssigpTa->SetBinContent(2989,0.0192045); + ssigpTa->SetBinContent(2990,0.0195597); + ssigpTa->SetBinContent(2991,0.0199185); + ssigpTa->SetBinContent(2992,0.0202678); + ssigpTa->SetBinContent(2993,0.0205188); + ssigpTa->SetBinContent(2994,0.020662); + ssigpTa->SetBinContent(2995,0.0209415); + ssigpTa->SetBinContent(2996,0.0214814); + ssigpTa->SetBinContent(2997,0.0221969); + ssigpTa->SetBinContent(2998,0.0227777); + ssigpTa->SetBinContent(2999,0.0231027); + ssigpTa->SetBinContent(3000,0.0228736); + ssigpTa->SetBinContent(3001,0.0221035); + ssigpTa->SetBinContent(3002,0.0218065); + ssigpTa->SetBinContent(3003,0.0220108); + ssigpTa->SetBinContent(3004,0.0223136); + ssigpTa->SetBinContent(3005,0.0226118); + ssigpTa->SetBinContent(3006,0.0229006); + ssigpTa->SetBinContent(3007,0.0229865); + ssigpTa->SetBinContent(3008,0.0221358); + ssigpTa->SetBinContent(3009,0.0203545); + ssigpTa->SetBinContent(3010,0.0195012); + ssigpTa->SetBinContent(3011,0.0196028); + ssigpTa->SetBinContent(3012,0.019903); + ssigpTa->SetBinContent(3013,0.0203102); + ssigpTa->SetBinContent(3014,0.0211826); + ssigpTa->SetBinContent(3015,0.022523); + ssigpTa->SetBinContent(3016,0.0234051); + ssigpTa->SetBinContent(3017,0.0238363); + ssigpTa->SetBinContent(3018,0.0241846); + ssigpTa->SetBinContent(3019,0.0245429); + ssigpTa->SetBinContent(3020,0.0249014); + ssigpTa->SetBinContent(3021,0.0252604); + ssigpTa->SetBinContent(3022,0.0255401); + ssigpTa->SetBinContent(3023,0.0254282); + ssigpTa->SetBinContent(3024,0.0249338); + ssigpTa->SetBinContent(3025,0.0248293); + ssigpTa->SetBinContent(3026,0.0252255); + ssigpTa->SetBinContent(3027,0.0262194); + ssigpTa->SetBinContent(3028,0.0277307); + ssigpTa->SetBinContent(3029,0.0287554); + ssigpTa->SetBinContent(3030,0.0292857); + ssigpTa->SetBinContent(3031,0.0297198); + ssigpTa->SetBinContent(3032,0.0301555); + ssigpTa->SetBinContent(3033,0.0305107); + ssigpTa->SetBinContent(3034,0.0304561); + ssigpTa->SetBinContent(3035,0.0299934); + ssigpTa->SetBinContent(3036,0.0299451); + ssigpTa->SetBinContent(3037,0.0304353); + ssigpTa->SetBinContent(3038,0.031583); + ssigpTa->SetBinContent(3039,0.033293); + ssigpTa->SetBinContent(3040,0.0344606); + ssigpTa->SetBinContent(3041,0.0350729); + ssigpTa->SetBinContent(3042,0.0355828); + ssigpTa->SetBinContent(3043,0.0361167); + ssigpTa->SetBinContent(3044,0.0366676); + ssigpTa->SetBinContent(3045,0.0369888); + ssigpTa->SetBinContent(3046,0.0361207); + ssigpTa->SetBinContent(3047,0.0340354); + ssigpTa->SetBinContent(3048,0.0331887); + ssigpTa->SetBinContent(3049,0.0340138); + ssigpTa->SetBinContent(3050,0.0356042); + ssigpTa->SetBinContent(3051,0.0367226); + ssigpTa->SetBinContent(3052,0.0373493); + ssigpTa->SetBinContent(3053,0.0378742); + ssigpTa->SetBinContent(3054,0.0383986); + ssigpTa->SetBinContent(3055,0.0389203); + ssigpTa->SetBinContent(3056,0.0394394); + ssigpTa->SetBinContent(3057,0.039925); + ssigpTa->SetBinContent(3058,0.0403406); + ssigpTa->SetBinContent(3059,0.0410678); + ssigpTa->SetBinContent(3060,0.0424874); + ssigpTa->SetBinContent(3061,0.0436342); + ssigpTa->SetBinContent(3062,0.0443495); + ssigpTa->SetBinContent(3063,0.044969); + ssigpTa->SetBinContent(3064,0.0455966); + ssigpTa->SetBinContent(3065,0.0462255); + ssigpTa->SetBinContent(3066,0.0468667); + ssigpTa->SetBinContent(3067,0.0475276); + ssigpTa->SetBinContent(3068,0.0482159); + ssigpTa->SetBinContent(3069,0.0490073); + ssigpTa->SetBinContent(3070,0.0502022); + ssigpTa->SetBinContent(3071,0.0517138); + ssigpTa->SetBinContent(3072,0.0527246); + ssigpTa->SetBinContent(3073,0.053434); + ssigpTa->SetBinContent(3074,0.0541658); + ssigpTa->SetBinContent(3075,0.0549186); + ssigpTa->SetBinContent(3076,0.0556975); + ssigpTa->SetBinContent(3077,0.0565338); + ssigpTa->SetBinContent(3078,0.0574068); + ssigpTa->SetBinContent(3079,0.0583516); + ssigpTa->SetBinContent(3080,0.0596267); + ssigpTa->SetBinContent(3081,0.0612326); + ssigpTa->SetBinContent(3082,0.0625301); + ssigpTa->SetBinContent(3083,0.0635406); + ssigpTa->SetBinContent(3084,0.0645386); + ssigpTa->SetBinContent(3085,0.0655195); + ssigpTa->SetBinContent(3086,0.0664926); + ssigpTa->SetBinContent(3087,0.0675); + ssigpTa->SetBinContent(3088,0.0685986); + ssigpTa->SetBinContent(3089,0.0699253); + ssigpTa->SetBinContent(3090,0.0714537); + ssigpTa->SetBinContent(3091,0.0728264); + ssigpTa->SetBinContent(3092,0.0740346); + ssigpTa->SetBinContent(3093,0.0752134); + ssigpTa->SetBinContent(3094,0.0763938); + ssigpTa->SetBinContent(3095,0.0775926); + ssigpTa->SetBinContent(3096,0.0789635); + ssigpTa->SetBinContent(3097,0.0814029); + ssigpTa->SetBinContent(3098,0.0843999); + ssigpTa->SetBinContent(3099,0.0853182); + ssigpTa->SetBinContent(3100,0.086038); + ssigpTa->SetBinContent(3101,0.0874769); + ssigpTa->SetBinContent(3102,0.0890662); + ssigpTa->SetBinContent(3103,0.0906743); + ssigpTa->SetBinContent(3104,0.0922857); + ssigpTa->SetBinContent(3105,0.0938945); + ssigpTa->SetBinContent(3106,0.0955178); + ssigpTa->SetBinContent(3107,0.0970862); + ssigpTa->SetBinContent(3108,0.0980948); + ssigpTa->SetBinContent(3109,0.0984488); + ssigpTa->SetBinContent(3110,0.0994123); + ssigpTa->SetBinContent(3111,0.100967); + ssigpTa->SetBinContent(3112,0.102695); + ssigpTa->SetBinContent(3113,0.104589); + ssigpTa->SetBinContent(3114,0.106568); + ssigpTa->SetBinContent(3115,0.108553); + ssigpTa->SetBinContent(3116,0.10978); + ssigpTa->SetBinContent(3117,0.108186); + ssigpTa->SetBinContent(3118,0.104321); + ssigpTa->SetBinContent(3119,0.10309); + ssigpTa->SetBinContent(3120,0.104266); + ssigpTa->SetBinContent(3121,0.105962); + ssigpTa->SetBinContent(3122,0.107677); + ssigpTa->SetBinContent(3123,0.109398); + ssigpTa->SetBinContent(3124,0.111125); + ssigpTa->SetBinContent(3125,0.112847); + ssigpTa->SetBinContent(3126,0.114563); + ssigpTa->SetBinContent(3127,0.116347); + ssigpTa->SetBinContent(3128,0.118314); + ssigpTa->SetBinContent(3129,0.120454); + ssigpTa->SetBinContent(3130,0.122669); + ssigpTa->SetBinContent(3131,0.124915); + ssigpTa->SetBinContent(3132,0.1272); + ssigpTa->SetBinContent(3133,0.129544); + ssigpTa->SetBinContent(3134,0.131931); + ssigpTa->SetBinContent(3135,0.134333); + ssigpTa->SetBinContent(3136,0.138939); + ssigpTa->SetBinContent(3137,0.156584); + ssigpTa->SetBinContent(3138,0.188003); + ssigpTa->SetBinContent(3139,0.206137); + ssigpTa->SetBinContent(3140,0.211382); + ssigpTa->SetBinContent(3141,0.214451); + ssigpTa->SetBinContent(3142,0.21754); + ssigpTa->SetBinContent(3143,0.220594); + ssigpTa->SetBinContent(3144,0.223602); + ssigpTa->SetBinContent(3145,0.226677); + ssigpTa->SetBinContent(3146,0.230074); + ssigpTa->SetBinContent(3147,0.233937); + ssigpTa->SetBinContent(3148,0.238074); + ssigpTa->SetBinContent(3149,0.242361); + ssigpTa->SetBinContent(3150,0.246702); + ssigpTa->SetBinContent(3151,0.250976); + ssigpTa->SetBinContent(3152,0.255212); + ssigpTa->SetBinContent(3153,0.259548); + ssigpTa->SetBinContent(3154,0.264105); + ssigpTa->SetBinContent(3155,0.268924); + ssigpTa->SetBinContent(3156,0.273912); + ssigpTa->SetBinContent(3157,0.278955); + ssigpTa->SetBinContent(3158,0.283956); + ssigpTa->SetBinContent(3159,0.288929); + ssigpTa->SetBinContent(3160,0.293778); + ssigpTa->SetBinContent(3161,0.298185); + ssigpTa->SetBinContent(3162,0.302157); + ssigpTa->SetBinContent(3163,0.306001); + ssigpTa->SetBinContent(3164,0.310033); + ssigpTa->SetBinContent(3165,0.314335); + ssigpTa->SetBinContent(3166,0.318681); + ssigpTa->SetBinContent(3167,0.323001); + ssigpTa->SetBinContent(3168,0.327827); + ssigpTa->SetBinContent(3169,0.3337); + ssigpTa->SetBinContent(3170,0.340184); + ssigpTa->SetBinContent(3171,0.346781); + ssigpTa->SetBinContent(3172,0.353353); + ssigpTa->SetBinContent(3173,0.359936); + ssigpTa->SetBinContent(3174,0.366874); + ssigpTa->SetBinContent(3175,0.37456); + ssigpTa->SetBinContent(3176,0.382925); + ssigpTa->SetBinContent(3177,0.391749); + ssigpTa->SetBinContent(3178,0.400692); + ssigpTa->SetBinContent(3179,0.409161); + ssigpTa->SetBinContent(3180,0.416955); + ssigpTa->SetBinContent(3181,0.424262); + ssigpTa->SetBinContent(3182,0.431216); + ssigpTa->SetBinContent(3183,0.437868); + ssigpTa->SetBinContent(3184,0.444401); + ssigpTa->SetBinContent(3185,0.451281); + ssigpTa->SetBinContent(3186,0.458979); + ssigpTa->SetBinContent(3187,0.46731); + ssigpTa->SetBinContent(3188,0.475692); + ssigpTa->SetBinContent(3189,0.483944); + ssigpTa->SetBinContent(3190,0.49209); + ssigpTa->SetBinContent(3191,0.500043); + ssigpTa->SetBinContent(3192,0.507787); + ssigpTa->SetBinContent(3193,0.515351); + ssigpTa->SetBinContent(3194,0.522594); + ssigpTa->SetBinContent(3195,0.52959); + ssigpTa->SetBinContent(3196,0.537127); + ssigpTa->SetBinContent(3197,0.546376); + ssigpTa->SetBinContent(3198,0.557611); + ssigpTa->SetBinContent(3199,0.570114); + ssigpTa->SetBinContent(3200,0.583378); + ssigpTa->SetBinContent(3201,0.603199); + ssigpTa->SetBinContent(3202,0.663285); + ssigpTa->SetBinContent(3203,0.766524); + ssigpTa->SetBinContent(3204,0.829198); + ssigpTa->SetBinContent(3205,0.852644); + ssigpTa->SetBinContent(3206,0.871004); + ssigpTa->SetBinContent(3207,0.891566); + ssigpTa->SetBinContent(3208,0.914096); + ssigpTa->SetBinContent(3209,0.938202); + ssigpTa->SetBinContent(3210,0.963662); + ssigpTa->SetBinContent(3211,0.9897); + ssigpTa->SetBinContent(3212,1.01529); + ssigpTa->SetBinContent(3213,1.04047); + ssigpTa->SetBinContent(3214,1.06632); + ssigpTa->SetBinContent(3215,1.09437); + ssigpTa->SetBinContent(3216,1.12452); + ssigpTa->SetBinContent(3217,1.15564); + ssigpTa->SetBinContent(3218,1.18726); + ssigpTa->SetBinContent(3219,1.2182); + ssigpTa->SetBinContent(3220,1.2617); + ssigpTa->SetBinContent(3221,1.3916); + ssigpTa->SetBinContent(3222,1.58658); + ssigpTa->SetBinContent(3225,0.0114844); + ssigpTa->SetBinContent(3226,0.0114767); + ssigpTa->SetBinContent(3227,0.0114752); + ssigpTa->SetBinContent(3228,0.011476); + ssigpTa->SetBinContent(3229,0.0114786); + ssigpTa->SetBinContent(3230,0.0114858); + ssigpTa->SetBinContent(3231,0.0114908); + ssigpTa->SetBinContent(3232,0.0114948); + ssigpTa->SetBinContent(3233,0.0114966); + ssigpTa->SetBinContent(3234,0.0115); + ssigpTa->SetBinContent(3235,0.011505); + ssigpTa->SetBinContent(3236,0.0115116); + ssigpTa->SetBinContent(3237,0.0115184); + ssigpTa->SetBinContent(3238,0.0115282); + ssigpTa->SetBinContent(3239,0.0115326); + ssigpTa->SetBinContent(3240,0.0115392); + ssigpTa->SetBinContent(3241,0.0115492); + ssigpTa->SetBinContent(3242,0.0115576); + ssigpTa->SetBinContent(3243,0.01157); + ssigpTa->SetBinContent(3244,0.0115784); + ssigpTa->SetBinContent(3245,0.0115892); + ssigpTa->SetBinContent(3246,0.0115984); + ssigpTa->SetBinContent(3247,0.0116126); + ssigpTa->SetBinContent(3248,0.0116274); + ssigpTa->SetBinContent(3249,0.0116384); + ssigpTa->SetBinContent(3250,0.0116532); + ssigpTa->SetBinContent(3251,0.0116666); + ssigpTa->SetBinContent(3252,0.0116808); + ssigpTa->SetBinContent(3253,0.0116958); + ssigpTa->SetBinContent(3254,0.0117126); + ssigpTa->SetBinContent(3255,0.01173); + ssigpTa->SetBinContent(3256,0.0117498); + ssigpTa->SetBinContent(3257,0.0117658); + ssigpTa->SetBinContent(3258,0.0117856); + ssigpTa->SetBinContent(3259,0.0118048); + ssigpTa->SetBinContent(3260,0.0118256); + ssigpTa->SetBinContent(3261,0.0118448); + ssigpTa->SetBinContent(3262,0.0118656); + ssigpTa->SetBinContent(3263,0.0118848); + ssigpTa->SetBinContent(3264,0.0119066); + ssigpTa->SetBinContent(3265,0.0119266); + ssigpTa->SetBinContent(3266,0.0119516); + ssigpTa->SetBinContent(3267,0.0119732); + ssigpTa->SetBinContent(3268,0.011999); + ssigpTa->SetBinContent(3269,0.0120216); + ssigpTa->SetBinContent(3270,0.0120474); + ssigpTa->SetBinContent(3271,0.012074); + ssigpTa->SetBinContent(3272,0.0121024); + ssigpTa->SetBinContent(3273,0.0121306); + ssigpTa->SetBinContent(3274,0.0121606); + ssigpTa->SetBinContent(3275,0.0121864); + ssigpTa->SetBinContent(3276,0.0122148); + ssigpTa->SetBinContent(3277,0.0122456); + ssigpTa->SetBinContent(3278,0.012274); + ssigpTa->SetBinContent(3279,0.0123064); + ssigpTa->SetBinContent(3280,0.0123388); + ssigpTa->SetBinContent(3281,0.0123706); + ssigpTa->SetBinContent(3282,0.0124022); + ssigpTa->SetBinContent(3283,0.0124356); + ssigpTa->SetBinContent(3284,0.0124672); + ssigpTa->SetBinContent(3285,0.0125014); + ssigpTa->SetBinContent(3286,0.0125364); + ssigpTa->SetBinContent(3287,0.012573); + ssigpTa->SetBinContent(3288,0.0126066); + ssigpTa->SetBinContent(3289,0.012644); + ssigpTa->SetBinContent(3290,0.0126806); + ssigpTa->SetBinContent(3291,0.0127206); + ssigpTa->SetBinContent(3292,0.0127598); + ssigpTa->SetBinContent(3293,0.012799); + ssigpTa->SetBinContent(3294,0.012839); + ssigpTa->SetBinContent(3295,0.0128798); + ssigpTa->SetBinContent(3296,0.0129238); + ssigpTa->SetBinContent(3297,0.0129656); + ssigpTa->SetBinContent(3298,0.0130096); + ssigpTa->SetBinContent(3299,0.0130522); + ssigpTa->SetBinContent(3300,0.0130948); + ssigpTa->SetBinContent(3301,0.0131406); + ssigpTa->SetBinContent(3302,0.0131904); + ssigpTa->SetBinContent(3303,0.013237); + ssigpTa->SetBinContent(3304,0.0132836); + ssigpTa->SetBinContent(3305,0.0133304); + ssigpTa->SetBinContent(3306,0.0133788); + ssigpTa->SetBinContent(3307,0.0134294); + ssigpTa->SetBinContent(3308,0.0134794); + ssigpTa->SetBinContent(3309,0.0135302); + ssigpTa->SetBinContent(3310,0.0135796); + ssigpTa->SetBinContent(3311,0.0136336); + ssigpTa->SetBinContent(3312,0.0136902); + ssigpTa->SetBinContent(3313,0.013741); + ssigpTa->SetBinContent(3314,0.0137952); + ssigpTa->SetBinContent(3315,0.013851); + ssigpTa->SetBinContent(3316,0.0139094); + ssigpTa->SetBinContent(3317,0.0139692); + ssigpTa->SetBinContent(3318,0.0140284); + ssigpTa->SetBinContent(3319,0.014089); + ssigpTa->SetBinContent(3320,0.0141482); + ssigpTa->SetBinContent(3321,0.014209); + ssigpTa->SetBinContent(3322,0.0142684); + ssigpTa->SetBinContent(3323,0.01433); + ssigpTa->SetBinContent(3324,0.0143942); + ssigpTa->SetBinContent(3325,0.0144624); + ssigpTa->SetBinContent(3326,0.0145282); + ssigpTa->SetBinContent(3327,0.0145924); + ssigpTa->SetBinContent(3328,0.0146718); + ssigpTa->SetBinContent(3329,0.0148042); + ssigpTa->SetBinContent(3330,0.0150576); + ssigpTa->SetBinContent(3331,0.0155934); + ssigpTa->SetBinContent(3332,0.0164262); + ssigpTa->SetBinContent(3333,0.0169036); + ssigpTa->SetBinContent(3334,0.0170442); + ssigpTa->SetBinContent(3335,0.0171168); + ssigpTa->SetBinContent(3336,0.0171944); + ssigpTa->SetBinContent(3337,0.0172728); + ssigpTa->SetBinContent(3338,0.0173536); + ssigpTa->SetBinContent(3339,0.017436); + ssigpTa->SetBinContent(3340,0.0175208); + ssigpTa->SetBinContent(3341,0.0175578); + ssigpTa->SetBinContent(3342,0.0173436); + ssigpTa->SetBinContent(3343,0.0168788); + ssigpTa->SetBinContent(3344,0.0167072); + ssigpTa->SetBinContent(3345,0.01686); + ssigpTa->SetBinContent(3346,0.0171); + ssigpTa->SetBinContent(3347,0.0173512); + ssigpTa->SetBinContent(3348,0.0175992); + ssigpTa->SetBinContent(3349,0.0178494); + ssigpTa->SetBinContent(3350,0.018046); + ssigpTa->SetBinContent(3351,0.0179676); + ssigpTa->SetBinContent(3352,0.0175804); + ssigpTa->SetBinContent(3353,0.0173698); + ssigpTa->SetBinContent(3354,0.0173212); + ssigpTa->SetBinContent(3355,0.0174668); + ssigpTa->SetBinContent(3356,0.017742); + ssigpTa->SetBinContent(3357,0.0180358); + ssigpTa->SetBinContent(3358,0.018332); + ssigpTa->SetBinContent(3359,0.0186308); + ssigpTa->SetBinContent(3360,0.0189272); + ssigpTa->SetBinContent(3361,0.0191516); + ssigpTa->SetBinContent(3362,0.0189946); + ssigpTa->SetBinContent(3363,0.0184638); + ssigpTa->SetBinContent(3364,0.0183252); + ssigpTa->SetBinContent(3365,0.0185748); + ssigpTa->SetBinContent(3366,0.0188996); + ssigpTa->SetBinContent(3367,0.019223); + ssigpTa->SetBinContent(3368,0.0195488); + ssigpTa->SetBinContent(3369,0.0198052); + ssigpTa->SetBinContent(3370,0.019703); + ssigpTa->SetBinContent(3371,0.0192548); + ssigpTa->SetBinContent(3372,0.0191004); + ssigpTa->SetBinContent(3373,0.0189358); + ssigpTa->SetBinContent(3374,0.018457); + ssigpTa->SetBinContent(3375,0.0183566); + ssigpTa->SetBinContent(3376,0.018635); + ssigpTa->SetBinContent(3377,0.0189942); + ssigpTa->SetBinContent(3378,0.0193598); + ssigpTa->SetBinContent(3379,0.0197242); + ssigpTa->SetBinContent(3380,0.0200976); + ssigpTa->SetBinContent(3381,0.0204756); + ssigpTa->SetBinContent(3382,0.0208586); + ssigpTa->SetBinContent(3383,0.0212482); + ssigpTa->SetBinContent(3384,0.0215708); + ssigpTa->SetBinContent(3385,0.021571); + ssigpTa->SetBinContent(3386,0.021235); + ssigpTa->SetBinContent(3387,0.0211048); + ssigpTa->SetBinContent(3388,0.020718); + ssigpTa->SetBinContent(3389,0.019802); + ssigpTa->SetBinContent(3390,0.019464); + ssigpTa->SetBinContent(3391,0.0197094); + ssigpTa->SetBinContent(3392,0.0200868); + ssigpTa->SetBinContent(3393,0.0204704); + ssigpTa->SetBinContent(3394,0.0208628); + ssigpTa->SetBinContent(3395,0.0212288); + ssigpTa->SetBinContent(3396,0.0214366); + ssigpTa->SetBinContent(3397,0.0214624); + ssigpTa->SetBinContent(3398,0.0216994); + ssigpTa->SetBinContent(3399,0.0222722); + ssigpTa->SetBinContent(3400,0.0230562); + ssigpTa->SetBinContent(3401,0.0236888); + ssigpTa->SetBinContent(3402,0.0240712); + ssigpTa->SetBinContent(3403,0.0239678); + ssigpTa->SetBinContent(3404,0.0233944); + ssigpTa->SetBinContent(3405,0.0232396); + ssigpTa->SetBinContent(3406,0.0235182); + ssigpTa->SetBinContent(3407,0.0238804); + ssigpTa->SetBinContent(3408,0.0242342); + ssigpTa->SetBinContent(3409,0.0245584); + ssigpTa->SetBinContent(3410,0.024619); + ssigpTa->SetBinContent(3411,0.0236654); + ssigpTa->SetBinContent(3412,0.0216766); + ssigpTa->SetBinContent(3413,0.0207194); + ssigpTa->SetBinContent(3414,0.0208132); + ssigpTa->SetBinContent(3415,0.021142); + ssigpTa->SetBinContent(3416,0.0215514); + ssigpTa->SetBinContent(3417,0.0223506); + ssigpTa->SetBinContent(3418,0.0235276); + ssigpTa->SetBinContent(3419,0.0243322); + ssigpTa->SetBinContent(3420,0.0247624); + ssigpTa->SetBinContent(3421,0.0251346); + ssigpTa->SetBinContent(3422,0.0255162); + ssigpTa->SetBinContent(3423,0.0259002); + ssigpTa->SetBinContent(3424,0.026286); + ssigpTa->SetBinContent(3425,0.0266022); + ssigpTa->SetBinContent(3426,0.026575); + ssigpTa->SetBinContent(3427,0.0262134); + ssigpTa->SetBinContent(3428,0.0262046); + ssigpTa->SetBinContent(3429,0.0266364); + ssigpTa->SetBinContent(3430,0.0275986); + ssigpTa->SetBinContent(3431,0.0290126); + ssigpTa->SetBinContent(3432,0.0299966); + ssigpTa->SetBinContent(3433,0.0305492); + ssigpTa->SetBinContent(3434,0.0310192); + ssigpTa->SetBinContent(3435,0.0314966); + ssigpTa->SetBinContent(3436,0.0319066); + ssigpTa->SetBinContent(3437,0.0319822); + ssigpTa->SetBinContent(3438,0.0317282); + ssigpTa->SetBinContent(3439,0.0318214); + ssigpTa->SetBinContent(3440,0.032371); + ssigpTa->SetBinContent(3441,0.0334902); + ssigpTa->SetBinContent(3442,0.0350986); + ssigpTa->SetBinContent(3443,0.0362348); + ssigpTa->SetBinContent(3444,0.0368886); + ssigpTa->SetBinContent(3445,0.0374574); + ssigpTa->SetBinContent(3446,0.0380478); + ssigpTa->SetBinContent(3447,0.0386626); + ssigpTa->SetBinContent(3448,0.0390658); + ssigpTa->SetBinContent(3449,0.0383794); + ssigpTa->SetBinContent(3450,0.0365782); + ssigpTa->SetBinContent(3451,0.0359084); + ssigpTa->SetBinContent(3452,0.0368016); + ssigpTa->SetBinContent(3453,0.0384056); + ssigpTa->SetBinContent(3454,0.0395686); + ssigpTa->SetBinContent(3455,0.0402556); + ssigpTa->SetBinContent(3456,0.0408436); + ssigpTa->SetBinContent(3457,0.0414338); + ssigpTa->SetBinContent(3458,0.0420238); + ssigpTa->SetBinContent(3459,0.0426172); + ssigpTa->SetBinContent(3460,0.0431788); + ssigpTa->SetBinContent(3461,0.0436822); + ssigpTa->SetBinContent(3462,0.0445044); + ssigpTa->SetBinContent(3463,0.0459632); + ssigpTa->SetBinContent(3464,0.047167); + ssigpTa->SetBinContent(3465,0.0479614); + ssigpTa->SetBinContent(3466,0.0486644); + ssigpTa->SetBinContent(3467,0.0493696); + ssigpTa->SetBinContent(3468,0.0500836); + ssigpTa->SetBinContent(3469,0.0508092); + ssigpTa->SetBinContent(3470,0.0515656); + ssigpTa->SetBinContent(3471,0.052352); + ssigpTa->SetBinContent(3472,0.0532504); + ssigpTa->SetBinContent(3473,0.0545352); + ssigpTa->SetBinContent(3474,0.0561132); + ssigpTa->SetBinContent(3475,0.0572032); + ssigpTa->SetBinContent(3476,0.058014); + ssigpTa->SetBinContent(3477,0.0588494); + ssigpTa->SetBinContent(3478,0.0597138); + ssigpTa->SetBinContent(3479,0.0606074); + ssigpTa->SetBinContent(3480,0.0615648); + ssigpTa->SetBinContent(3481,0.0625632); + ssigpTa->SetBinContent(3482,0.0636472); + ssigpTa->SetBinContent(3483,0.0650658); + ssigpTa->SetBinContent(3484,0.0668238); + ssigpTa->SetBinContent(3485,0.0682862); + ssigpTa->SetBinContent(3486,0.069521); + ssigpTa->SetBinContent(3487,0.0708054); + ssigpTa->SetBinContent(3488,0.0720164); + ssigpTa->SetBinContent(3489,0.0731652); + ssigpTa->SetBinContent(3490,0.0743426); + ssigpTa->SetBinContent(3491,0.0756302); + ssigpTa->SetBinContent(3492,0.0771498); + ssigpTa->SetBinContent(3493,0.0788904); + ssigpTa->SetBinContent(3494,0.0804748); + ssigpTa->SetBinContent(3495,0.0818954); + ssigpTa->SetBinContent(3496,0.0832824); + ssigpTa->SetBinContent(3497,0.0846752); + ssigpTa->SetBinContent(3498,0.0860968); + ssigpTa->SetBinContent(3499,0.0879954); + ssigpTa->SetBinContent(3500,0.092052); + ssigpTa->SetBinContent(3501,0.09734); + ssigpTa->SetBinContent(3502,0.0985192); + ssigpTa->SetBinContent(3503,0.0990506); + ssigpTa->SetBinContent(3504,0.100729); + ssigpTa->SetBinContent(3505,0.102737); + ssigpTa->SetBinContent(3506,0.104776); + ssigpTa->SetBinContent(3507,0.106821); + ssigpTa->SetBinContent(3508,0.108877); + ssigpTa->SetBinContent(3509,0.110962); + ssigpTa->SetBinContent(3510,0.112853); + ssigpTa->SetBinContent(3511,0.113528); + ssigpTa->SetBinContent(3512,0.112823); + ssigpTa->SetBinContent(3513,0.113394); + ssigpTa->SetBinContent(3514,0.115198); + ssigpTa->SetBinContent(3515,0.11736); + ssigpTa->SetBinContent(3516,0.119727); + ssigpTa->SetBinContent(3517,0.122208); + ssigpTa->SetBinContent(3518,0.124594); + ssigpTa->SetBinContent(3519,0.125908); + ssigpTa->SetBinContent(3520,0.124527); + ssigpTa->SetBinContent(3521,0.1221); + ssigpTa->SetBinContent(3522,0.122112); + ssigpTa->SetBinContent(3523,0.124018); + ssigpTa->SetBinContent(3524,0.126279); + ssigpTa->SetBinContent(3525,0.128575); + ssigpTa->SetBinContent(3526,0.130892); + ssigpTa->SetBinContent(3527,0.133233); + ssigpTa->SetBinContent(3528,0.13558); + ssigpTa->SetBinContent(3529,0.137931); + ssigpTa->SetBinContent(3530,0.140389); + ssigpTa->SetBinContent(3531,0.143092); + ssigpTa->SetBinContent(3532,0.146022); + ssigpTa->SetBinContent(3533,0.149064); + ssigpTa->SetBinContent(3534,0.152162); + ssigpTa->SetBinContent(3535,0.155315); + ssigpTa->SetBinContent(3536,0.158543); + ssigpTa->SetBinContent(3537,0.161841); + ssigpTa->SetBinContent(3538,0.165183); + ssigpTa->SetBinContent(3539,0.17238); + ssigpTa->SetBinContent(3540,0.19923); + ssigpTa->SetBinContent(3541,0.247066); + ssigpTa->SetBinContent(3542,0.274883); + ssigpTa->SetBinContent(3543,0.283391); + ssigpTa->SetBinContent(3544,0.28814); + ssigpTa->SetBinContent(3545,0.292917); + ssigpTa->SetBinContent(3546,0.29763); + ssigpTa->SetBinContent(3547,0.302274); + ssigpTa->SetBinContent(3548,0.307027); + ssigpTa->SetBinContent(3549,0.31226); + ssigpTa->SetBinContent(3550,0.318159); + ssigpTa->SetBinContent(3551,0.324462); + ssigpTa->SetBinContent(3552,0.331035); + ssigpTa->SetBinContent(3553,0.33775); + ssigpTa->SetBinContent(3554,0.344406); + ssigpTa->SetBinContent(3555,0.351006); + ssigpTa->SetBinContent(3556,0.357723); + ssigpTa->SetBinContent(3557,0.36474); + ssigpTa->SetBinContent(3558,0.372137); + ssigpTa->SetBinContent(3559,0.379808); + ssigpTa->SetBinContent(3560,0.387594); + ssigpTa->SetBinContent(3561,0.395369); + ssigpTa->SetBinContent(3562,0.40318); + ssigpTa->SetBinContent(3563,0.410891); + ssigpTa->SetBinContent(3564,0.418074); + ssigpTa->SetBinContent(3565,0.424722); + ssigpTa->SetBinContent(3566,0.431205); + ssigpTa->SetBinContent(3567,0.437897); + ssigpTa->SetBinContent(3568,0.444854); + ssigpTa->SetBinContent(3569,0.451829); + ssigpTa->SetBinContent(3570,0.45877); + ssigpTa->SetBinContent(3571,0.46643); + ssigpTa->SetBinContent(3572,0.4756); + ssigpTa->SetBinContent(3573,0.485691); + ssigpTa->SetBinContent(3574,0.496023); + ssigpTa->SetBinContent(3575,0.50639); + ssigpTa->SetBinContent(3576,0.516849); + ssigpTa->SetBinContent(3577,0.527884); + ssigpTa->SetBinContent(3578,0.540043); + ssigpTa->SetBinContent(3579,0.553186); + ssigpTa->SetBinContent(3580,0.56701); + ssigpTa->SetBinContent(3581,0.581027); + ssigpTa->SetBinContent(3582,0.59448); + ssigpTa->SetBinContent(3583,0.607066); + ssigpTa->SetBinContent(3584,0.619012); + ssigpTa->SetBinContent(3585,0.630477); + ssigpTa->SetBinContent(3586,0.641529); + ssigpTa->SetBinContent(3587,0.652444); + ssigpTa->SetBinContent(3588,0.663932); + ssigpTa->SetBinContent(3589,0.676733); + ssigpTa->SetBinContent(3590,0.690565); + ssigpTa->SetBinContent(3591,0.704518); + ssigpTa->SetBinContent(3592,0.718244); + ssigpTa->SetBinContent(3593,0.731743); + ssigpTa->SetBinContent(3594,0.744934); + ssigpTa->SetBinContent(3595,0.757822); + ssigpTa->SetBinContent(3596,0.770404); + ssigpTa->SetBinContent(3597,0.782475); + ssigpTa->SetBinContent(3598,0.794225); + ssigpTa->SetBinContent(3599,0.806854); + ssigpTa->SetBinContent(3600,0.821987); + ssigpTa->SetBinContent(3601,0.839953); + ssigpTa->SetBinContent(3602,0.85981); + ssigpTa->SetBinContent(3603,0.880892); + ssigpTa->SetBinContent(3604,0.915257); + ssigpTa->SetBinContent(3605,1.01616); + ssigpTa->SetBinContent(3606,1.18923); + ssigpTa->SetBinContent(3607,1.29473); + ssigpTa->SetBinContent(3608,1.33574); + ssigpTa->SetBinContent(3609,1.36614); + ssigpTa->SetBinContent(3610,1.40029); + ssigpTa->SetBinContent(3611,1.43777); + ssigpTa->SetBinContent(3612,1.47788); + ssigpTa->SetBinContent(3613,1.52014); + ssigpTa->SetBinContent(3614,1.56325); + ssigpTa->SetBinContent(3615,1.60568); + ssigpTa->SetBinContent(3616,1.64757); + ssigpTa->SetBinContent(3617,1.6907); + ssigpTa->SetBinContent(3618,1.73736); + ssigpTa->SetBinContent(3619,1.78743); + ssigpTa->SetBinContent(3620,1.83919); + ssigpTa->SetBinContent(3621,1.89195); + ssigpTa->SetBinContent(3622,1.94386); + ssigpTa->SetBinContent(3623,2.02259); + ssigpTa->SetBinContent(3624,2.22882); + ssigpTa->SetBinContent(3625,2.55969); + ssigpTa->SetBinContent(3628,0.0123994); + ssigpTa->SetBinContent(3629,0.0123971); + ssigpTa->SetBinContent(3630,0.0123944); + ssigpTa->SetBinContent(3631,0.0123944); + ssigpTa->SetBinContent(3632,0.0123972); + ssigpTa->SetBinContent(3633,0.0124016); + ssigpTa->SetBinContent(3634,0.0124092); + ssigpTa->SetBinContent(3635,0.0124116); + ssigpTa->SetBinContent(3636,0.0124132); + ssigpTa->SetBinContent(3637,0.0124148); + ssigpTa->SetBinContent(3638,0.012418); + ssigpTa->SetBinContent(3639,0.012422); + ssigpTa->SetBinContent(3640,0.0124332); + ssigpTa->SetBinContent(3641,0.0124408); + ssigpTa->SetBinContent(3642,0.01245); + ssigpTa->SetBinContent(3643,0.0124544); + ssigpTa->SetBinContent(3644,0.0124624); + ssigpTa->SetBinContent(3645,0.0124728); + ssigpTa->SetBinContent(3646,0.0124816); + ssigpTa->SetBinContent(3647,0.0124944); + ssigpTa->SetBinContent(3648,0.012502); + ssigpTa->SetBinContent(3649,0.0125124); + ssigpTa->SetBinContent(3650,0.0125264); + ssigpTa->SetBinContent(3651,0.0125384); + ssigpTa->SetBinContent(3652,0.0125524); + ssigpTa->SetBinContent(3653,0.0125648); + ssigpTa->SetBinContent(3654,0.0125772); + ssigpTa->SetBinContent(3655,0.0125912); + ssigpTa->SetBinContent(3656,0.0126044); + ssigpTa->SetBinContent(3657,0.0126228); + ssigpTa->SetBinContent(3658,0.0126412); + ssigpTa->SetBinContent(3659,0.012656); + ssigpTa->SetBinContent(3660,0.012678); + ssigpTa->SetBinContent(3661,0.0126928); + ssigpTa->SetBinContent(3662,0.0127144); + ssigpTa->SetBinContent(3663,0.0127348); + ssigpTa->SetBinContent(3664,0.012754); + ssigpTa->SetBinContent(3665,0.0127724); + ssigpTa->SetBinContent(3666,0.012796); + ssigpTa->SetBinContent(3667,0.012812); + ssigpTa->SetBinContent(3668,0.0128372); + ssigpTa->SetBinContent(3669,0.0128568); + ssigpTa->SetBinContent(3670,0.0128812); + ssigpTa->SetBinContent(3671,0.0129012); + ssigpTa->SetBinContent(3672,0.0129256); + ssigpTa->SetBinContent(3673,0.012952); + ssigpTa->SetBinContent(3674,0.0129788); + ssigpTa->SetBinContent(3675,0.013008); + ssigpTa->SetBinContent(3676,0.0130368); + ssigpTa->SetBinContent(3677,0.0130656); + ssigpTa->SetBinContent(3678,0.0130928); + ssigpTa->SetBinContent(3679,0.013122); + ssigpTa->SetBinContent(3680,0.0131492); + ssigpTa->SetBinContent(3681,0.01318); + ssigpTa->SetBinContent(3682,0.0132088); + ssigpTa->SetBinContent(3683,0.0132428); + ssigpTa->SetBinContent(3684,0.0132736); + ssigpTa->SetBinContent(3685,0.0133028); + ssigpTa->SetBinContent(3686,0.0133336); + ssigpTa->SetBinContent(3687,0.0133656); + ssigpTa->SetBinContent(3688,0.0134); + ssigpTa->SetBinContent(3689,0.0134368); + ssigpTa->SetBinContent(3690,0.0134684); + ssigpTa->SetBinContent(3691,0.0135052); + ssigpTa->SetBinContent(3692,0.0135388); + ssigpTa->SetBinContent(3693,0.0135752); + ssigpTa->SetBinContent(3694,0.0136136); + ssigpTa->SetBinContent(3695,0.0136556); + ssigpTa->SetBinContent(3696,0.0136948); + ssigpTa->SetBinContent(3697,0.0137324); + ssigpTa->SetBinContent(3698,0.013776); + ssigpTa->SetBinContent(3699,0.0138168); + ssigpTa->SetBinContent(3700,0.0138616); + ssigpTa->SetBinContent(3701,0.0139008); + ssigpTa->SetBinContent(3702,0.013942); + ssigpTa->SetBinContent(3703,0.0139856); + ssigpTa->SetBinContent(3704,0.0140324); + ssigpTa->SetBinContent(3705,0.0140832); + ssigpTa->SetBinContent(3706,0.014134); + ssigpTa->SetBinContent(3707,0.0141776); + ssigpTa->SetBinContent(3708,0.014224); + ssigpTa->SetBinContent(3709,0.0142676); + ssigpTa->SetBinContent(3710,0.0143184); + ssigpTa->SetBinContent(3711,0.0143708); + ssigpTa->SetBinContent(3712,0.0144192); + ssigpTa->SetBinContent(3713,0.0144696); + ssigpTa->SetBinContent(3714,0.0145244); + ssigpTa->SetBinContent(3715,0.0145792); + ssigpTa->SetBinContent(3716,0.0146332); + ssigpTa->SetBinContent(3717,0.0146832); + ssigpTa->SetBinContent(3718,0.0147388); + ssigpTa->SetBinContent(3719,0.0148004); + ssigpTa->SetBinContent(3720,0.0148584); + ssigpTa->SetBinContent(3721,0.0149196); + ssigpTa->SetBinContent(3722,0.0149776); + ssigpTa->SetBinContent(3723,0.0150388); + ssigpTa->SetBinContent(3724,0.0150968); + ssigpTa->SetBinContent(3725,0.015158); + ssigpTa->SetBinContent(3726,0.0152192); + ssigpTa->SetBinContent(3727,0.0152844); + ssigpTa->SetBinContent(3728,0.0153504); + ssigpTa->SetBinContent(3729,0.0154156); + ssigpTa->SetBinContent(3730,0.0154832); + ssigpTa->SetBinContent(3731,0.0155612); + ssigpTa->SetBinContent(3732,0.0156896); + ssigpTa->SetBinContent(3733,0.015944); + ssigpTa->SetBinContent(3734,0.016568); + ssigpTa->SetBinContent(3735,0.0175768); + ssigpTa->SetBinContent(3736,0.0181512); + ssigpTa->SetBinContent(3737,0.0183048); + ssigpTa->SetBinContent(3738,0.0183784); + ssigpTa->SetBinContent(3739,0.0184544); + ssigpTa->SetBinContent(3740,0.018534); + ssigpTa->SetBinContent(3741,0.0186156); + ssigpTa->SetBinContent(3742,0.0186944); + ssigpTa->SetBinContent(3743,0.0187792); + ssigpTa->SetBinContent(3744,0.0188016); + ssigpTa->SetBinContent(3745,0.0185172); + ssigpTa->SetBinContent(3746,0.0179308); + ssigpTa->SetBinContent(3747,0.0177244); + ssigpTa->SetBinContent(3748,0.0178968); + ssigpTa->SetBinContent(3749,0.0181668); + ssigpTa->SetBinContent(3750,0.0184416); + ssigpTa->SetBinContent(3751,0.0187228); + ssigpTa->SetBinContent(3752,0.0190012); + ssigpTa->SetBinContent(3753,0.0192236); + ssigpTa->SetBinContent(3754,0.0191096); + ssigpTa->SetBinContent(3755,0.0186392); + ssigpTa->SetBinContent(3756,0.0184216); + ssigpTa->SetBinContent(3757,0.0184432); + ssigpTa->SetBinContent(3758,0.0186404); + ssigpTa->SetBinContent(3759,0.0189332); + ssigpTa->SetBinContent(3760,0.0192492); + ssigpTa->SetBinContent(3761,0.0195644); + ssigpTa->SetBinContent(3762,0.0198832); + ssigpTa->SetBinContent(3763,0.0202052); + ssigpTa->SetBinContent(3764,0.0204404); + ssigpTa->SetBinContent(3765,0.0202544); + ssigpTa->SetBinContent(3766,0.0196292); + ssigpTa->SetBinContent(3767,0.0194532); + ssigpTa->SetBinContent(3768,0.01971); + ssigpTa->SetBinContent(3769,0.0200516); + ssigpTa->SetBinContent(3770,0.0203912); + ssigpTa->SetBinContent(3771,0.020734); + ssigpTa->SetBinContent(3772,0.021018); + ssigpTa->SetBinContent(3773,0.0209848); + ssigpTa->SetBinContent(3774,0.020642); + ssigpTa->SetBinContent(3775,0.0205408); + ssigpTa->SetBinContent(3776,0.0203096); + ssigpTa->SetBinContent(3777,0.0196736); + ssigpTa->SetBinContent(3778,0.0194984); + ssigpTa->SetBinContent(3779,0.0197864); + ssigpTa->SetBinContent(3780,0.0201752); + ssigpTa->SetBinContent(3781,0.0205648); + ssigpTa->SetBinContent(3782,0.0209632); + ssigpTa->SetBinContent(3783,0.021362); + ssigpTa->SetBinContent(3784,0.0217736); + ssigpTa->SetBinContent(3785,0.0221908); + ssigpTa->SetBinContent(3786,0.0226112); + ssigpTa->SetBinContent(3787,0.02296); + ssigpTa->SetBinContent(3788,0.022914); + ssigpTa->SetBinContent(3789,0.0224656); + ssigpTa->SetBinContent(3790,0.0222872); + ssigpTa->SetBinContent(3791,0.0218692); + ssigpTa->SetBinContent(3792,0.020914); + ssigpTa->SetBinContent(3793,0.0205548); + ssigpTa->SetBinContent(3794,0.0208288); + ssigpTa->SetBinContent(3795,0.0212388); + ssigpTa->SetBinContent(3796,0.021656); + ssigpTa->SetBinContent(3797,0.0220824); + ssigpTa->SetBinContent(3798,0.0224688); + ssigpTa->SetBinContent(3799,0.0226068); + ssigpTa->SetBinContent(3800,0.0224856); + ssigpTa->SetBinContent(3801,0.0226476); + ssigpTa->SetBinContent(3802,0.0232372); + ssigpTa->SetBinContent(3803,0.0240484); + ssigpTa->SetBinContent(3804,0.0247136); + ssigpTa->SetBinContent(3805,0.0251364); + ssigpTa->SetBinContent(3806,0.0251436); + ssigpTa->SetBinContent(3807,0.024748); + ssigpTa->SetBinContent(3808,0.0247172); + ssigpTa->SetBinContent(3809,0.0250676); + ssigpTa->SetBinContent(3810,0.0254904); + ssigpTa->SetBinContent(3811,0.025898); + ssigpTa->SetBinContent(3812,0.026224); + ssigpTa->SetBinContent(3813,0.0262448); + ssigpTa->SetBinContent(3814,0.0252344); + ssigpTa->SetBinContent(3815,0.0232052); + ssigpTa->SetBinContent(3816,0.0222296); + ssigpTa->SetBinContent(3817,0.0223532); + ssigpTa->SetBinContent(3818,0.0227132); + ssigpTa->SetBinContent(3819,0.0231436); + ssigpTa->SetBinContent(3820,0.0238684); + ssigpTa->SetBinContent(3821,0.0248992); + ssigpTa->SetBinContent(3822,0.0256304); + ssigpTa->SetBinContent(3823,0.0260784); + ssigpTa->SetBinContent(3824,0.0264832); + ssigpTa->SetBinContent(3825,0.0268988); + ssigpTa->SetBinContent(3826,0.0273196); + ssigpTa->SetBinContent(3827,0.0277436); + ssigpTa->SetBinContent(3828,0.0281136); + ssigpTa->SetBinContent(3829,0.028196); + ssigpTa->SetBinContent(3830,0.0280096); + ssigpTa->SetBinContent(3831,0.0281184); + ssigpTa->SetBinContent(3832,0.0286032); + ssigpTa->SetBinContent(3833,0.0295196); + ssigpTa->SetBinContent(3834,0.0308136); + ssigpTa->SetBinContent(3835,0.0317512); + ssigpTa->SetBinContent(3836,0.0323368); + ssigpTa->SetBinContent(3837,0.032868); + ssigpTa->SetBinContent(3838,0.0333976); + ssigpTa->SetBinContent(3839,0.0338828); + ssigpTa->SetBinContent(3840,0.0341096); + ssigpTa->SetBinContent(3841,0.0340872); + ssigpTa->SetBinContent(3842,0.0343468); + ssigpTa->SetBinContent(3843,0.0349704); + ssigpTa->SetBinContent(3844,0.0360548); + ssigpTa->SetBinContent(3845,0.0375308); + ssigpTa->SetBinContent(3846,0.0386268); + ssigpTa->SetBinContent(3847,0.0393372); + ssigpTa->SetBinContent(3848,0.0399812); + ssigpTa->SetBinContent(3849,0.0406532); + ssigpTa->SetBinContent(3850,0.0413464); + ssigpTa->SetBinContent(3851,0.0418644); + ssigpTa->SetBinContent(3852,0.0414028); + ssigpTa->SetBinContent(3853,0.0399536); + ssigpTa->SetBinContent(3854,0.0395068); + ssigpTa->SetBinContent(3855,0.0404308); + ssigpTa->SetBinContent(3856,0.0419732); + ssigpTa->SetBinContent(3857,0.04314); + ssigpTa->SetBinContent(3858,0.0439088); + ssigpTa->SetBinContent(3859,0.0446016); + ssigpTa->SetBinContent(3860,0.0452968); + ssigpTa->SetBinContent(3861,0.0459996); + ssigpTa->SetBinContent(3862,0.0467088); + ssigpTa->SetBinContent(3863,0.0473924); + ssigpTa->SetBinContent(3864,0.0480324); + ssigpTa->SetBinContent(3865,0.0489556); + ssigpTa->SetBinContent(3866,0.0504232); + ssigpTa->SetBinContent(3867,0.0516804); + ssigpTa->SetBinContent(3868,0.0525856); + ssigpTa->SetBinContent(3869,0.0534192); + ssigpTa->SetBinContent(3870,0.05426); + ssigpTa->SetBinContent(3871,0.0551048); + ssigpTa->SetBinContent(3872,0.055974); + ssigpTa->SetBinContent(3873,0.0568772); + ssigpTa->SetBinContent(3874,0.0578216); + ssigpTa->SetBinContent(3875,0.0588712); + ssigpTa->SetBinContent(3876,0.0602812); + ssigpTa->SetBinContent(3877,0.0619384); + ssigpTa->SetBinContent(3878,0.0631512); + ssigpTa->SetBinContent(3879,0.0641208); + ssigpTa->SetBinContent(3880,0.0651304); + ssigpTa->SetBinContent(3881,0.0661708); + ssigpTa->SetBinContent(3882,0.0672492); + ssigpTa->SetBinContent(3883,0.0683996); + ssigpTa->SetBinContent(3884,0.0696036); + ssigpTa->SetBinContent(3885,0.070896); + ssigpTa->SetBinContent(3886,0.072524); + ssigpTa->SetBinContent(3887,0.07448); + ssigpTa->SetBinContent(3888,0.0761796); + ssigpTa->SetBinContent(3889,0.0777616); + ssigpTa->SetBinContent(3890,0.0795004); + ssigpTa->SetBinContent(3891,0.0810756); + ssigpTa->SetBinContent(3892,0.0825036); + ssigpTa->SetBinContent(3893,0.0839488); + ssigpTa->SetBinContent(3894,0.0855148); + ssigpTa->SetBinContent(3895,0.0873228); + ssigpTa->SetBinContent(3896,0.0893416); + ssigpTa->SetBinContent(3897,0.091232); + ssigpTa->SetBinContent(3898,0.0929728); + ssigpTa->SetBinContent(3899,0.094684); + ssigpTa->SetBinContent(3900,0.0964072); + ssigpTa->SetBinContent(3901,0.0981704); + ssigpTa->SetBinContent(3902,0.100812); + ssigpTa->SetBinContent(3903,0.107234); + ssigpTa->SetBinContent(3904,0.115628); + ssigpTa->SetBinContent(3905,0.117405); + ssigpTa->SetBinContent(3906,0.117684); + ssigpTa->SetBinContent(3907,0.11973); + ssigpTa->SetBinContent(3908,0.12234); + ssigpTa->SetBinContent(3909,0.124986); + ssigpTa->SetBinContent(3910,0.127652); + ssigpTa->SetBinContent(3911,0.130335); + ssigpTa->SetBinContent(3912,0.133074); + ssigpTa->SetBinContent(3913,0.135428); + ssigpTa->SetBinContent(3914,0.13563); + ssigpTa->SetBinContent(3915,0.133558); + ssigpTa->SetBinContent(3916,0.133591); + ssigpTa->SetBinContent(3917,0.135787); + ssigpTa->SetBinContent(3918,0.138576); + ssigpTa->SetBinContent(3919,0.141618); + ssigpTa->SetBinContent(3920,0.14481); + ssigpTa->SetBinContent(3921,0.147756); + ssigpTa->SetBinContent(3922,0.14898); + ssigpTa->SetBinContent(3923,0.147357); + ssigpTa->SetBinContent(3924,0.145865); + ssigpTa->SetBinContent(3925,0.1471); + ssigpTa->SetBinContent(3926,0.149848); + ssigpTa->SetBinContent(3927,0.15288); + ssigpTa->SetBinContent(3928,0.155959); + ssigpTa->SetBinContent(3929,0.159085); + ssigpTa->SetBinContent(3930,0.162254); + ssigpTa->SetBinContent(3931,0.165436); + ssigpTa->SetBinContent(3932,0.168636); + ssigpTa->SetBinContent(3933,0.171989); + ssigpTa->SetBinContent(3934,0.175659); + ssigpTa->SetBinContent(3935,0.179626); + ssigpTa->SetBinContent(3936,0.183746); + ssigpTa->SetBinContent(3937,0.187957); + ssigpTa->SetBinContent(3938,0.192247); + ssigpTa->SetBinContent(3939,0.196645); + ssigpTa->SetBinContent(3940,0.201151); + ssigpTa->SetBinContent(3941,0.20573); + ssigpTa->SetBinContent(3942,0.216039); + ssigpTa->SetBinContent(3943,0.254943); + ssigpTa->SetBinContent(3944,0.323112); + ssigpTa->SetBinContent(3945,0.363534); + ssigpTa->SetBinContent(3946,0.375934); + ssigpTa->SetBinContent(3947,0.38278); + ssigpTa->SetBinContent(3948,0.389662); + ssigpTa->SetBinContent(3949,0.396468); + ssigpTa->SetBinContent(3950,0.403175); + ssigpTa->SetBinContent(3951,0.41004); + ssigpTa->SetBinContent(3952,0.417571); + ssigpTa->SetBinContent(3953,0.426001); + ssigpTa->SetBinContent(3954,0.434996); + ssigpTa->SetBinContent(3955,0.444389); + ssigpTa->SetBinContent(3956,0.454019); + ssigpTa->SetBinContent(3957,0.463592); + ssigpTa->SetBinContent(3958,0.473112); + ssigpTa->SetBinContent(3959,0.482789); + ssigpTa->SetBinContent(3960,0.49287); + ssigpTa->SetBinContent(3961,0.503476); + ssigpTa->SetBinContent(3962,0.51448); + ssigpTa->SetBinContent(3963,0.525655); + ssigpTa->SetBinContent(3964,0.536856); + ssigpTa->SetBinContent(3965,0.548144); + ssigpTa->SetBinContent(3966,0.559335); + ssigpTa->SetBinContent(3967,0.569857); + ssigpTa->SetBinContent(3968,0.579685); + ssigpTa->SetBinContent(3969,0.589309); + ssigpTa->SetBinContent(3970,0.599186); + ssigpTa->SetBinContent(3971,0.60939); + ssigpTa->SetBinContent(3972,0.619592); + ssigpTa->SetBinContent(3973,0.629757); + ssigpTa->SetBinContent(3974,0.640926); + ssigpTa->SetBinContent(3975,0.654161); + ssigpTa->SetBinContent(3976,0.668709); + ssigpTa->SetBinContent(3977,0.683635); + ssigpTa->SetBinContent(3978,0.698647); + ssigpTa->SetBinContent(3979,0.713829); + ssigpTa->SetBinContent(3980,0.729848); + ssigpTa->SetBinContent(3981,0.747426); + ssigpTa->SetBinContent(3982,0.766388); + ssigpTa->SetBinContent(3983,0.786303); + ssigpTa->SetBinContent(3984,0.806515); + ssigpTa->SetBinContent(3985,0.826011); + ssigpTa->SetBinContent(3986,0.844375); + ssigpTa->SetBinContent(3987,0.86188); + ssigpTa->SetBinContent(3988,0.878743); + ssigpTa->SetBinContent(3989,0.89505); + ssigpTa->SetBinContent(3990,0.911184); + ssigpTa->SetBinContent(3991,0.928152); + ssigpTa->SetBinContent(3992,0.946999); + ssigpTa->SetBinContent(3993,0.967335); + ssigpTa->SetBinContent(3994,0.987872); + ssigpTa->SetBinContent(3995,1.00808); + ssigpTa->SetBinContent(3996,1.02794); + ssigpTa->SetBinContent(3997,1.04737); + ssigpTa->SetBinContent(3998,1.06638); + ssigpTa->SetBinContent(3999,1.08496); + ssigpTa->SetBinContent(4000,1.10281); + ssigpTa->SetBinContent(4001,1.12024); + ssigpTa->SetBinContent(4002,1.13894); + ssigpTa->SetBinContent(4003,1.16115); + ssigpTa->SetBinContent(4004,1.18729); + ssigpTa->SetBinContent(4005,1.21614); + ssigpTa->SetBinContent(4006,1.24673); + ssigpTa->SetBinContent(4007,1.29738); + ssigpTa->SetBinContent(4008,1.44801); + ssigpTa->SetBinContent(4009,1.70161); + ssigpTa->SetBinContent(4010,1.85913); + ssigpTa->SetBinContent(4011,1.91984); + ssigpTa->SetBinContent(4012,1.96454); + ssigpTa->SetBinContent(4013,2.01475); + ssigpTa->SetBinContent(4014,2.06983); + ssigpTa->SetBinContent(4015,2.12877); + ssigpTa->SetBinContent(4016,2.19082); + ssigpTa->SetBinContent(4017,2.2541); + ssigpTa->SetBinContent(4018,2.31641); + ssigpTa->SetBinContent(4019,2.37802); + ssigpTa->SetBinContent(4020,2.44149); + ssigpTa->SetBinContent(4021,2.5101); + ssigpTa->SetBinContent(4022,2.58365); + ssigpTa->SetBinContent(4023,2.65974); + ssigpTa->SetBinContent(4024,2.73737); + ssigpTa->SetBinContent(4025,2.81384); + ssigpTa->SetBinContent(4026,2.93099); + ssigpTa->SetBinContent(4027,3.23793); + ssigpTa->SetBinContent(4028,3.70628); + ssigpTa->SetBinContent(4031,0.0134589); + ssigpTa->SetBinContent(4032,0.013455); + ssigpTa->SetBinContent(4033,0.0134528); + ssigpTa->SetBinContent(4034,0.0134528); + ssigpTa->SetBinContent(4035,0.0134528); + ssigpTa->SetBinContent(4036,0.013456); + ssigpTa->SetBinContent(4037,0.0134584); + ssigpTa->SetBinContent(4038,0.0134608); + ssigpTa->SetBinContent(4039,0.0134608); + ssigpTa->SetBinContent(4040,0.0134608); + ssigpTa->SetBinContent(4041,0.013464); + ssigpTa->SetBinContent(4042,0.013468); + ssigpTa->SetBinContent(4043,0.0134736); + ssigpTa->SetBinContent(4044,0.0134888); + ssigpTa->SetBinContent(4045,0.013496); + ssigpTa->SetBinContent(4046,0.013504); + ssigpTa->SetBinContent(4047,0.0135088); + ssigpTa->SetBinContent(4048,0.0135144); + ssigpTa->SetBinContent(4049,0.0135256); + ssigpTa->SetBinContent(4050,0.0135376); + ssigpTa->SetBinContent(4051,0.013548); + ssigpTa->SetBinContent(4052,0.0135576); + ssigpTa->SetBinContent(4053,0.0135688); + ssigpTa->SetBinContent(4054,0.0135792); + ssigpTa->SetBinContent(4055,0.0135904); + ssigpTa->SetBinContent(4056,0.013608); + ssigpTa->SetBinContent(4057,0.01362); + ssigpTa->SetBinContent(4058,0.013628); + ssigpTa->SetBinContent(4059,0.0136448); + ssigpTa->SetBinContent(4060,0.0136592); + ssigpTa->SetBinContent(4061,0.013676); + ssigpTa->SetBinContent(4062,0.0136952); + ssigpTa->SetBinContent(4063,0.0137088); + ssigpTa->SetBinContent(4064,0.0137296); + ssigpTa->SetBinContent(4065,0.013748); + ssigpTa->SetBinContent(4066,0.0137688); + ssigpTa->SetBinContent(4067,0.0137848); + ssigpTa->SetBinContent(4068,0.0138056); + ssigpTa->SetBinContent(4069,0.013824); + ssigpTa->SetBinContent(4070,0.0138488); + ssigpTa->SetBinContent(4071,0.0138648); + ssigpTa->SetBinContent(4072,0.0138904); + ssigpTa->SetBinContent(4073,0.0139064); + ssigpTa->SetBinContent(4074,0.013928); + ssigpTa->SetBinContent(4075,0.013952); + ssigpTa->SetBinContent(4076,0.0139768); + ssigpTa->SetBinContent(4077,0.014008); + ssigpTa->SetBinContent(4078,0.0140304); + ssigpTa->SetBinContent(4079,0.0140592); + ssigpTa->SetBinContent(4080,0.0140872); + ssigpTa->SetBinContent(4081,0.0141128); + ssigpTa->SetBinContent(4082,0.01414); + ssigpTa->SetBinContent(4083,0.0141696); + ssigpTa->SetBinContent(4084,0.0141912); + ssigpTa->SetBinContent(4085,0.0142248); + ssigpTa->SetBinContent(4086,0.014256); + ssigpTa->SetBinContent(4087,0.0142888); + ssigpTa->SetBinContent(4088,0.0143152); + ssigpTa->SetBinContent(4089,0.0143448); + ssigpTa->SetBinContent(4090,0.0143768); + ssigpTa->SetBinContent(4091,0.0144136); + ssigpTa->SetBinContent(4092,0.0144464); + ssigpTa->SetBinContent(4093,0.0144824); + ssigpTa->SetBinContent(4094,0.0145104); + ssigpTa->SetBinContent(4095,0.0145464); + ssigpTa->SetBinContent(4096,0.0145792); + ssigpTa->SetBinContent(4097,0.0146184); + ssigpTa->SetBinContent(4098,0.0146616); + ssigpTa->SetBinContent(4099,0.0146984); + ssigpTa->SetBinContent(4100,0.0147376); + ssigpTa->SetBinContent(4101,0.0147744); + ssigpTa->SetBinContent(4102,0.01482); + ssigpTa->SetBinContent(4103,0.0148592); + ssigpTa->SetBinContent(4104,0.0148968); + ssigpTa->SetBinContent(4105,0.014936); + ssigpTa->SetBinContent(4106,0.0149808); + ssigpTa->SetBinContent(4107,0.0150272); + ssigpTa->SetBinContent(4108,0.0150816); + ssigpTa->SetBinContent(4109,0.0151304); + ssigpTa->SetBinContent(4110,0.0151752); + ssigpTa->SetBinContent(4111,0.0152152); + ssigpTa->SetBinContent(4112,0.0152584); + ssigpTa->SetBinContent(4113,0.015304); + ssigpTa->SetBinContent(4114,0.0153552); + ssigpTa->SetBinContent(4115,0.0154048); + ssigpTa->SetBinContent(4116,0.0154536); + ssigpTa->SetBinContent(4117,0.0155056); + ssigpTa->SetBinContent(4118,0.01556); + ssigpTa->SetBinContent(4119,0.0156104); + ssigpTa->SetBinContent(4120,0.0156616); + ssigpTa->SetBinContent(4121,0.0157216); + ssigpTa->SetBinContent(4122,0.0157808); + ssigpTa->SetBinContent(4123,0.0158448); + ssigpTa->SetBinContent(4124,0.0159); + ssigpTa->SetBinContent(4125,0.01596); + ssigpTa->SetBinContent(4126,0.0160152); + ssigpTa->SetBinContent(4127,0.0160752); + ssigpTa->SetBinContent(4128,0.016132); + ssigpTa->SetBinContent(4129,0.016196); + ssigpTa->SetBinContent(4130,0.0162576); + ssigpTa->SetBinContent(4131,0.0163208); + ssigpTa->SetBinContent(4132,0.0163864); + ssigpTa->SetBinContent(4133,0.0164536); + ssigpTa->SetBinContent(4134,0.0165336); + ssigpTa->SetBinContent(4135,0.016656); + ssigpTa->SetBinContent(4136,0.0169224); + ssigpTa->SetBinContent(4137,0.017668); + ssigpTa->SetBinContent(4138,0.0189072); + ssigpTa->SetBinContent(4139,0.0196072); + ssigpTa->SetBinContent(4140,0.0197792); + ssigpTa->SetBinContent(4141,0.0198528); + ssigpTa->SetBinContent(4142,0.0199272); + ssigpTa->SetBinContent(4143,0.0200096); + ssigpTa->SetBinContent(4144,0.0200856); + ssigpTa->SetBinContent(4145,0.0201656); + ssigpTa->SetBinContent(4146,0.0202424); + ssigpTa->SetBinContent(4147,0.020248); + ssigpTa->SetBinContent(4148,0.0198656); + ssigpTa->SetBinContent(4149,0.0191216); + ssigpTa->SetBinContent(4150,0.0188568); + ssigpTa->SetBinContent(4151,0.0190576); + ssigpTa->SetBinContent(4152,0.0193608); + ssigpTa->SetBinContent(4153,0.0196784); + ssigpTa->SetBinContent(4154,0.0199968); + ssigpTa->SetBinContent(4155,0.0203256); + ssigpTa->SetBinContent(4156,0.020568); + ssigpTa->SetBinContent(4157,0.020404); + ssigpTa->SetBinContent(4158,0.0197984); + ssigpTa->SetBinContent(4159,0.0195344); + ssigpTa->SetBinContent(4160,0.0195992); + ssigpTa->SetBinContent(4161,0.019836); + ssigpTa->SetBinContent(4162,0.0201648); + ssigpTa->SetBinContent(4163,0.0205144); + ssigpTa->SetBinContent(4164,0.020868); + ssigpTa->SetBinContent(4165,0.0212264); + ssigpTa->SetBinContent(4166,0.0215856); + ssigpTa->SetBinContent(4167,0.021852); + ssigpTa->SetBinContent(4168,0.0216112); + ssigpTa->SetBinContent(4169,0.020856); + ssigpTa->SetBinContent(4170,0.0206112); + ssigpTa->SetBinContent(4171,0.02088); + ssigpTa->SetBinContent(4172,0.0212456); + ssigpTa->SetBinContent(4173,0.0216168); + ssigpTa->SetBinContent(4174,0.021988); + ssigpTa->SetBinContent(4175,0.0223096); + ssigpTa->SetBinContent(4176,0.0223552); + ssigpTa->SetBinContent(4177,0.022128); + ssigpTa->SetBinContent(4178,0.0220896); + ssigpTa->SetBinContent(4179,0.0217824); + ssigpTa->SetBinContent(4180,0.0209704); + ssigpTa->SetBinContent(4181,0.0207104); + ssigpTa->SetBinContent(4182,0.021008); + ssigpTa->SetBinContent(4183,0.0214184); + ssigpTa->SetBinContent(4184,0.021844); + ssigpTa->SetBinContent(4185,0.0222672); + ssigpTa->SetBinContent(4186,0.0227064); + ssigpTa->SetBinContent(4187,0.0231448); + ssigpTa->SetBinContent(4188,0.0235952); + ssigpTa->SetBinContent(4189,0.0240528); + ssigpTa->SetBinContent(4190,0.0244216); + ssigpTa->SetBinContent(4191,0.0243184); + ssigpTa->SetBinContent(4192,0.0237248); + ssigpTa->SetBinContent(4193,0.0234792); + ssigpTa->SetBinContent(4194,0.0230912); + ssigpTa->SetBinContent(4195,0.022172); + ssigpTa->SetBinContent(4196,0.0218576); + ssigpTa->SetBinContent(4197,0.0221688); + ssigpTa->SetBinContent(4198,0.0226152); + ssigpTa->SetBinContent(4199,0.0230672); + ssigpTa->SetBinContent(4200,0.023528); + ssigpTa->SetBinContent(4201,0.023932); + ssigpTa->SetBinContent(4202,0.0239904); + ssigpTa->SetBinContent(4203,0.0236824); + ssigpTa->SetBinContent(4204,0.02376); + ssigpTa->SetBinContent(4205,0.0243392); + ssigpTa->SetBinContent(4206,0.025156); + ssigpTa->SetBinContent(4207,0.0258264); + ssigpTa->SetBinContent(4208,0.0262856); + ssigpTa->SetBinContent(4209,0.0263816); + ssigpTa->SetBinContent(4210,0.026124); + ssigpTa->SetBinContent(4211,0.0261968); + ssigpTa->SetBinContent(4212,0.0266048); + ssigpTa->SetBinContent(4213,0.0270856); + ssigpTa->SetBinContent(4214,0.0275352); + ssigpTa->SetBinContent(4215,0.0278368); + ssigpTa->SetBinContent(4216,0.027768); + ssigpTa->SetBinContent(4217,0.0267744); + ssigpTa->SetBinContent(4218,0.024828); + ssigpTa->SetBinContent(4219,0.0239336); + ssigpTa->SetBinContent(4220,0.0241072); + ssigpTa->SetBinContent(4221,0.0245112); + ssigpTa->SetBinContent(4222,0.0249648); + ssigpTa->SetBinContent(4223,0.025648); + ssigpTa->SetBinContent(4224,0.0265552); + ssigpTa->SetBinContent(4225,0.0272408); + ssigpTa->SetBinContent(4226,0.0277184); + ssigpTa->SetBinContent(4227,0.0281688); + ssigpTa->SetBinContent(4228,0.0286272); + ssigpTa->SetBinContent(4229,0.0290928); + ssigpTa->SetBinContent(4230,0.0295688); + ssigpTa->SetBinContent(4231,0.0300016); + ssigpTa->SetBinContent(4232,0.0302216); + ssigpTa->SetBinContent(4233,0.0302352); + ssigpTa->SetBinContent(4234,0.0304912); + ssigpTa->SetBinContent(4235,0.0310336); + ssigpTa->SetBinContent(4236,0.0319136); + ssigpTa->SetBinContent(4237,0.0330816); + ssigpTa->SetBinContent(4238,0.0339744); + ssigpTa->SetBinContent(4239,0.0346144); + ssigpTa->SetBinContent(4240,0.0352072); + ssigpTa->SetBinContent(4241,0.0358128); + ssigpTa->SetBinContent(4242,0.0363808); + ssigpTa->SetBinContent(4243,0.0367768); + ssigpTa->SetBinContent(4244,0.0370056); + ssigpTa->SetBinContent(4245,0.0374496); + ssigpTa->SetBinContent(4246,0.0381616); + ssigpTa->SetBinContent(4247,0.0392128); + ssigpTa->SetBinContent(4248,0.0405504); + ssigpTa->SetBinContent(4249,0.0416032); + ssigpTa->SetBinContent(4250,0.0423832); + ssigpTa->SetBinContent(4251,0.0431232); + ssigpTa->SetBinContent(4252,0.0438856); + ssigpTa->SetBinContent(4253,0.044684); + ssigpTa->SetBinContent(4254,0.0453256); + ssigpTa->SetBinContent(4255,0.0451376); + ssigpTa->SetBinContent(4256,0.0440848); + ssigpTa->SetBinContent(4257,0.0438992); + ssigpTa->SetBinContent(4258,0.0448408); + ssigpTa->SetBinContent(4259,0.046256); + ssigpTa->SetBinContent(4260,0.047412); + ssigpTa->SetBinContent(4261,0.0482864); + ssigpTa->SetBinContent(4262,0.0491112); + ssigpTa->SetBinContent(4263,0.0499432); + ssigpTa->SetBinContent(4264,0.0507864); + ssigpTa->SetBinContent(4265,0.0516432); + ssigpTa->SetBinContent(4266,0.0524856); + ssigpTa->SetBinContent(4267,0.0532944); + ssigpTa->SetBinContent(4268,0.0543296); + ssigpTa->SetBinContent(4269,0.0557808); + ssigpTa->SetBinContent(4270,0.0570768); + ssigpTa->SetBinContent(4271,0.0581264); + ssigpTa->SetBinContent(4272,0.059128); + ssigpTa->SetBinContent(4273,0.0601392); + ssigpTa->SetBinContent(4274,0.0611624); + ssigpTa->SetBinContent(4275,0.0622104); + ssigpTa->SetBinContent(4276,0.0633024); + ssigpTa->SetBinContent(4277,0.0644408); + ssigpTa->SetBinContent(4278,0.0656824); + ssigpTa->SetBinContent(4279,0.06722); + ssigpTa->SetBinContent(4280,0.0689528); + ssigpTa->SetBinContent(4281,0.0703088); + ssigpTa->SetBinContent(4282,0.0714848); + ssigpTa->SetBinContent(4283,0.072716); + ssigpTa->SetBinContent(4284,0.073984); + ssigpTa->SetBinContent(4285,0.0752928); + ssigpTa->SetBinContent(4286,0.0766856); + ssigpTa->SetBinContent(4287,0.0781464); + ssigpTa->SetBinContent(4288,0.0796968); + ssigpTa->SetBinContent(4289,0.08156); + ssigpTa->SetBinContent(4290,0.083732); + ssigpTa->SetBinContent(4291,0.0857008); + ssigpTa->SetBinContent(4292,0.0877128); + ssigpTa->SetBinContent(4293,0.0900128); + ssigpTa->SetBinContent(4294,0.0920504); + ssigpTa->SetBinContent(4295,0.0938144); + ssigpTa->SetBinContent(4296,0.095592); + ssigpTa->SetBinContent(4297,0.0975048); + ssigpTa->SetBinContent(4298,0.0996424); + ssigpTa->SetBinContent(4299,0.101986); + ssigpTa->SetBinContent(4300,0.104234); + ssigpTa->SetBinContent(4301,0.10636); + ssigpTa->SetBinContent(4302,0.108471); + ssigpTa->SetBinContent(4303,0.110599); + ssigpTa->SetBinContent(4304,0.112778); + ssigpTa->SetBinContent(4305,0.116266); + ssigpTa->SetBinContent(4306,0.125378); + ssigpTa->SetBinContent(4307,0.137402); + ssigpTa->SetBinContent(4308,0.139882); + ssigpTa->SetBinContent(4309,0.139918); + ssigpTa->SetBinContent(4310,0.142419); + ssigpTa->SetBinContent(4311,0.145718); + ssigpTa->SetBinContent(4312,0.149071); + ssigpTa->SetBinContent(4313,0.152446); + ssigpTa->SetBinContent(4314,0.155858); + ssigpTa->SetBinContent(4315,0.159337); + ssigpTa->SetBinContent(4316,0.162244); + ssigpTa->SetBinContent(4317,0.161957); + ssigpTa->SetBinContent(4318,0.158375); + ssigpTa->SetBinContent(4319,0.157854); + ssigpTa->SetBinContent(4320,0.160534); + ssigpTa->SetBinContent(4321,0.164051); + ssigpTa->SetBinContent(4322,0.167876); + ssigpTa->SetBinContent(4323,0.171886); + ssigpTa->SetBinContent(4324,0.175498); + ssigpTa->SetBinContent(4325,0.176588); + ssigpTa->SetBinContent(4326,0.174355); + ssigpTa->SetBinContent(4327,0.173493); + ssigpTa->SetBinContent(4328,0.175815); + ssigpTa->SetBinContent(4329,0.179489); + ssigpTa->SetBinContent(4330,0.18338); + ssigpTa->SetBinContent(4331,0.187348); + ssigpTa->SetBinContent(4332,0.19138); + ssigpTa->SetBinContent(4333,0.19548); + ssigpTa->SetBinContent(4334,0.199602); + ssigpTa->SetBinContent(4335,0.203758); + ssigpTa->SetBinContent(4336,0.208102); + ssigpTa->SetBinContent(4337,0.212854); + ssigpTa->SetBinContent(4338,0.217966); + ssigpTa->SetBinContent(4339,0.223286); + ssigpTa->SetBinContent(4340,0.228725); + ssigpTa->SetBinContent(4341,0.234277); + ssigpTa->SetBinContent(4342,0.239971); + ssigpTa->SetBinContent(4343,0.245815); + ssigpTa->SetBinContent(4344,0.251763); + ssigpTa->SetBinContent(4345,0.265362); + ssigpTa->SetBinContent(4346,0.317021); + ssigpTa->SetBinContent(4347,0.407381); + ssigpTa->SetBinContent(4348,0.461103); + ssigpTa->SetBinContent(4349,0.477574); + ssigpTa->SetBinContent(4350,0.486631); + ssigpTa->SetBinContent(4351,0.495754); + ssigpTa->SetBinContent(4352,0.504769); + ssigpTa->SetBinContent(4353,0.513675); + ssigpTa->SetBinContent(4354,0.522776); + ssigpTa->SetBinContent(4355,0.532745); + ssigpTa->SetBinContent(4356,0.543862); + ssigpTa->SetBinContent(4357,0.555717); + ssigpTa->SetBinContent(4358,0.5681); + ssigpTa->SetBinContent(4359,0.580803); + ssigpTa->SetBinContent(4360,0.593455); + ssigpTa->SetBinContent(4361,0.606045); + ssigpTa->SetBinContent(4362,0.618846); + ssigpTa->SetBinContent(4363,0.632166); + ssigpTa->SetBinContent(4364,0.646167); + ssigpTa->SetBinContent(4365,0.660683); + ssigpTa->SetBinContent(4366,0.675445); + ssigpTa->SetBinContent(4367,0.690246); + ssigpTa->SetBinContent(4368,0.70519); + ssigpTa->SetBinContent(4369,0.720022); + ssigpTa->SetBinContent(4370,0.734016); + ssigpTa->SetBinContent(4371,0.747137); + ssigpTa->SetBinContent(4372,0.759998); + ssigpTa->SetBinContent(4373,0.773189); + ssigpTa->SetBinContent(4374,0.786774); + ssigpTa->SetBinContent(4375,0.800357); + ssigpTa->SetBinContent(4376,0.813893); + ssigpTa->SetBinContent(4377,0.828729); + ssigpTa->SetBinContent(4378,0.846247); + ssigpTa->SetBinContent(4379,0.865479); + ssigpTa->SetBinContent(4380,0.885224); + ssigpTa->SetBinContent(4381,0.905102); + ssigpTa->SetBinContent(4382,0.925219); + ssigpTa->SetBinContent(4383,0.946438); + ssigpTa->SetBinContent(4384,0.969694); + ssigpTa->SetBinContent(4385,0.994739); + ssigpTa->SetBinContent(4386,1.02104); + ssigpTa->SetBinContent(4387,1.04775); + ssigpTa->SetBinContent(4388,1.07356); + ssigpTa->SetBinContent(4389,1.09792); + ssigpTa->SetBinContent(4390,1.1212); + ssigpTa->SetBinContent(4391,1.14364); + ssigpTa->SetBinContent(4392,1.16538); + ssigpTa->SetBinContent(4393,1.18689); + ssigpTa->SetBinContent(4394,1.20951); + ssigpTa->SetBinContent(4395,1.2346); + ssigpTa->SetBinContent(4396,1.26165); + ssigpTa->SetBinContent(4397,1.28897); + ssigpTa->SetBinContent(4398,1.31587); + ssigpTa->SetBinContent(4399,1.3423); + ssigpTa->SetBinContent(4400,1.36817); + ssigpTa->SetBinContent(4401,1.39351); + ssigpTa->SetBinContent(4402,1.41827); + ssigpTa->SetBinContent(4403,1.44209); + ssigpTa->SetBinContent(4404,1.46537); + ssigpTa->SetBinContent(4405,1.49032); + ssigpTa->SetBinContent(4406,1.51986); + ssigpTa->SetBinContent(4407,1.55452); + ssigpTa->SetBinContent(4408,1.59272); + ssigpTa->SetBinContent(4409,1.63325); + ssigpTa->SetBinContent(4410,1.70056); + ssigpTa->SetBinContent(4411,1.90139); + ssigpTa->SetBinContent(4412,2.2396); + ssigpTa->SetBinContent(4413,2.44965); + ssigpTa->SetBinContent(4414,2.53048); + ssigpTa->SetBinContent(4415,2.5899); + ssigpTa->SetBinContent(4416,2.65664); + ssigpTa->SetBinContent(4417,2.72986); + ssigpTa->SetBinContent(4418,2.80819); + ssigpTa->SetBinContent(4419,2.89064); + ssigpTa->SetBinContent(4420,2.9747); + ssigpTa->SetBinContent(4421,3.05751); + ssigpTa->SetBinContent(4422,3.1394); + ssigpTa->SetBinContent(4423,3.2238); + ssigpTa->SetBinContent(4424,3.31501); + ssigpTa->SetBinContent(4425,3.41275); + ssigpTa->SetBinContent(4426,3.51389); + ssigpTa->SetBinContent(4427,3.61709); + ssigpTa->SetBinContent(4428,3.71882); + ssigpTa->SetBinContent(4429,3.87494); + ssigpTa->SetBinContent(4430,4.28408); + ssigpTa->SetBinContent(4431,4.90803); + ssigpTa->SetBinContent(4434,0.0146494); + ssigpTa->SetBinContent(4435,0.0146454); + ssigpTa->SetBinContent(4436,0.0146436); + ssigpTa->SetBinContent(4437,0.0146436); + ssigpTa->SetBinContent(4438,0.0146436); + ssigpTa->SetBinContent(4439,0.0146436); + ssigpTa->SetBinContent(4440,0.0146448); + ssigpTa->SetBinContent(4441,0.0146448); + ssigpTa->SetBinContent(4442,0.0146448); + ssigpTa->SetBinContent(4443,0.0146496); + ssigpTa->SetBinContent(4444,0.0146544); + ssigpTa->SetBinContent(4445,0.0146592); + ssigpTa->SetBinContent(4446,0.0146656); + ssigpTa->SetBinContent(4447,0.0146728); + ssigpTa->SetBinContent(4448,0.014686); + ssigpTa->SetBinContent(4449,0.01469); + ssigpTa->SetBinContent(4450,0.014696); + ssigpTa->SetBinContent(4451,0.0146992); + ssigpTa->SetBinContent(4452,0.0147092); + ssigpTa->SetBinContent(4453,0.0147224); + ssigpTa->SetBinContent(4454,0.0147372); + ssigpTa->SetBinContent(4455,0.0147444); + ssigpTa->SetBinContent(4456,0.0147508); + ssigpTa->SetBinContent(4457,0.014756); + ssigpTa->SetBinContent(4458,0.014772); + ssigpTa->SetBinContent(4459,0.01479); + ssigpTa->SetBinContent(4460,0.014802); + ssigpTa->SetBinContent(4461,0.0148104); + ssigpTa->SetBinContent(4462,0.0148176); + ssigpTa->SetBinContent(4463,0.0148368); + ssigpTa->SetBinContent(4464,0.0148548); + ssigpTa->SetBinContent(4465,0.0148688); + ssigpTa->SetBinContent(4466,0.0148864); + ssigpTa->SetBinContent(4467,0.0149004); + ssigpTa->SetBinContent(4468,0.0149188); + ssigpTa->SetBinContent(4469,0.0149408); + ssigpTa->SetBinContent(4470,0.0149532); + ssigpTa->SetBinContent(4471,0.0149684); + ssigpTa->SetBinContent(4472,0.0149928); + ssigpTa->SetBinContent(4473,0.0150116); + ssigpTa->SetBinContent(4474,0.015036); + ssigpTa->SetBinContent(4475,0.0150512); + ssigpTa->SetBinContent(4476,0.0150696); + ssigpTa->SetBinContent(4477,0.0150924); + ssigpTa->SetBinContent(4478,0.0151128); + ssigpTa->SetBinContent(4479,0.015144); + ssigpTa->SetBinContent(4480,0.0151672); + ssigpTa->SetBinContent(4481,0.0151936); + ssigpTa->SetBinContent(4482,0.015214); + ssigpTa->SetBinContent(4483,0.0152404); + ssigpTa->SetBinContent(4484,0.0152684); + ssigpTa->SetBinContent(4485,0.0152948); + ssigpTa->SetBinContent(4486,0.0153152); + ssigpTa->SetBinContent(4487,0.0153444); + ssigpTa->SetBinContent(4488,0.0153668); + ssigpTa->SetBinContent(4489,0.015406); + ssigpTa->SetBinContent(4490,0.0154344); + ssigpTa->SetBinContent(4491,0.0154616); + ssigpTa->SetBinContent(4492,0.0154908); + ssigpTa->SetBinContent(4493,0.0155212); + ssigpTa->SetBinContent(4494,0.0155556); + ssigpTa->SetBinContent(4495,0.015592); + ssigpTa->SetBinContent(4496,0.0156164); + ssigpTa->SetBinContent(4497,0.0156536); + ssigpTa->SetBinContent(4498,0.015682); + ssigpTa->SetBinContent(4499,0.0157172); + ssigpTa->SetBinContent(4500,0.0157556); + ssigpTa->SetBinContent(4501,0.015798); + ssigpTa->SetBinContent(4502,0.0158364); + ssigpTa->SetBinContent(4503,0.0158668); + ssigpTa->SetBinContent(4504,0.0159064); + ssigpTa->SetBinContent(4505,0.0159476); + ssigpTa->SetBinContent(4506,0.0159872); + ssigpTa->SetBinContent(4507,0.0160224); + ssigpTa->SetBinContent(4508,0.0160608); + ssigpTa->SetBinContent(4509,0.0161052); + ssigpTa->SetBinContent(4510,0.0161508); + ssigpTa->SetBinContent(4511,0.0162004); + ssigpTa->SetBinContent(4512,0.01625); + ssigpTa->SetBinContent(4513,0.0162904); + ssigpTa->SetBinContent(4514,0.0163328); + ssigpTa->SetBinContent(4515,0.01637); + ssigpTa->SetBinContent(4516,0.0164156); + ssigpTa->SetBinContent(4517,0.0164632); + ssigpTa->SetBinContent(4518,0.0165088); + ssigpTa->SetBinContent(4519,0.01656); + ssigpTa->SetBinContent(4520,0.0166096); + ssigpTa->SetBinContent(4521,0.0166564); + ssigpTa->SetBinContent(4522,0.016706); + ssigpTa->SetBinContent(4523,0.0167612); + ssigpTa->SetBinContent(4524,0.0168168); + ssigpTa->SetBinContent(4525,0.0168844); + ssigpTa->SetBinContent(4526,0.0169428); + ssigpTa->SetBinContent(4527,0.0170024); + ssigpTa->SetBinContent(4528,0.017054); + ssigpTa->SetBinContent(4529,0.0171116); + ssigpTa->SetBinContent(4530,0.0171632); + ssigpTa->SetBinContent(4531,0.01722); + ssigpTa->SetBinContent(4532,0.0172796); + ssigpTa->SetBinContent(4533,0.0173384); + ssigpTa->SetBinContent(4534,0.0174028); + ssigpTa->SetBinContent(4535,0.0174692); + ssigpTa->SetBinContent(4536,0.0175416); + ssigpTa->SetBinContent(4537,0.0176164); + ssigpTa->SetBinContent(4538,0.0177308); + ssigpTa->SetBinContent(4539,0.018014); + ssigpTa->SetBinContent(4540,0.0189068); + ssigpTa->SetBinContent(4541,0.0204204); + ssigpTa->SetBinContent(4542,0.021268); + ssigpTa->SetBinContent(4543,0.0214676); + ssigpTa->SetBinContent(4544,0.0215344); + ssigpTa->SetBinContent(4545,0.021614); + ssigpTa->SetBinContent(4546,0.0216888); + ssigpTa->SetBinContent(4547,0.0217696); + ssigpTa->SetBinContent(4548,0.0218384); + ssigpTa->SetBinContent(4549,0.0219144); + ssigpTa->SetBinContent(4550,0.0218932); + ssigpTa->SetBinContent(4551,0.0213964); + ssigpTa->SetBinContent(4552,0.0204572); + ssigpTa->SetBinContent(4553,0.0201252); + ssigpTa->SetBinContent(4554,0.0203548); + ssigpTa->SetBinContent(4555,0.0207088); + ssigpTa->SetBinContent(4556,0.0210716); + ssigpTa->SetBinContent(4557,0.0214504); + ssigpTa->SetBinContent(4558,0.0218252); + ssigpTa->SetBinContent(4559,0.0221052); + ssigpTa->SetBinContent(4560,0.0218616); + ssigpTa->SetBinContent(4561,0.02109); + ssigpTa->SetBinContent(4562,0.0207508); + ssigpTa->SetBinContent(4563,0.0208532); + ssigpTa->SetBinContent(4564,0.0211368); + ssigpTa->SetBinContent(4565,0.02151); + ssigpTa->SetBinContent(4566,0.0219056); + ssigpTa->SetBinContent(4567,0.0223068); + ssigpTa->SetBinContent(4568,0.022714); + ssigpTa->SetBinContent(4569,0.0231264); + ssigpTa->SetBinContent(4570,0.0234224); + ssigpTa->SetBinContent(4571,0.0231144); + ssigpTa->SetBinContent(4572,0.0221788); + ssigpTa->SetBinContent(4573,0.0218504); + ssigpTa->SetBinContent(4574,0.0221264); + ssigpTa->SetBinContent(4575,0.0225408); + ssigpTa->SetBinContent(4576,0.0229484); + ssigpTa->SetBinContent(4577,0.0233612); + ssigpTa->SetBinContent(4578,0.02373); + ssigpTa->SetBinContent(4579,0.0238612); + ssigpTa->SetBinContent(4580,0.0237612); + ssigpTa->SetBinContent(4581,0.0237864); + ssigpTa->SetBinContent(4582,0.023398); + ssigpTa->SetBinContent(4583,0.0223824); + ssigpTa->SetBinContent(4584,0.022028); + ssigpTa->SetBinContent(4585,0.0223332); + ssigpTa->SetBinContent(4586,0.0227788); + ssigpTa->SetBinContent(4587,0.0232312); + ssigpTa->SetBinContent(4588,0.0237016); + ssigpTa->SetBinContent(4589,0.024168); + ssigpTa->SetBinContent(4590,0.0246496); + ssigpTa->SetBinContent(4591,0.0251304); + ssigpTa->SetBinContent(4592,0.025626); + ssigpTa->SetBinContent(4593,0.0260204); + ssigpTa->SetBinContent(4594,0.0258396); + ssigpTa->SetBinContent(4595,0.0250552); + ssigpTa->SetBinContent(4596,0.024734); + ssigpTa->SetBinContent(4597,0.0244016); + ssigpTa->SetBinContent(4598,0.0236012); + ssigpTa->SetBinContent(4599,0.0233648); + ssigpTa->SetBinContent(4600,0.0237224); + ssigpTa->SetBinContent(4601,0.0242088); + ssigpTa->SetBinContent(4602,0.0246964); + ssigpTa->SetBinContent(4603,0.0251952); + ssigpTa->SetBinContent(4604,0.0256168); + ssigpTa->SetBinContent(4605,0.0255796); + ssigpTa->SetBinContent(4606,0.0250656); + ssigpTa->SetBinContent(4607,0.0250344); + ssigpTa->SetBinContent(4608,0.0256044); + ssigpTa->SetBinContent(4609,0.0263992); + ssigpTa->SetBinContent(4610,0.0270768); + ssigpTa->SetBinContent(4611,0.0275688); + ssigpTa->SetBinContent(4612,0.027742); + ssigpTa->SetBinContent(4613,0.02761); + ssigpTa->SetBinContent(4614,0.0277656); + ssigpTa->SetBinContent(4615,0.0282312); + ssigpTa->SetBinContent(4616,0.0287664); + ssigpTa->SetBinContent(4617,0.0292556); + ssigpTa->SetBinContent(4618,0.0295048); + ssigpTa->SetBinContent(4619,0.0293192); + ssigpTa->SetBinContent(4620,0.0283508); + ssigpTa->SetBinContent(4621,0.0265756); + ssigpTa->SetBinContent(4622,0.0258088); + ssigpTa->SetBinContent(4623,0.0260452); + ssigpTa->SetBinContent(4624,0.026496); + ssigpTa->SetBinContent(4625,0.0269928); + ssigpTa->SetBinContent(4626,0.0276472); + ssigpTa->SetBinContent(4627,0.028462); + ssigpTa->SetBinContent(4628,0.0291188); + ssigpTa->SetBinContent(4629,0.0296376); + ssigpTa->SetBinContent(4630,0.0301396); + ssigpTa->SetBinContent(4631,0.0306516); + ssigpTa->SetBinContent(4632,0.0311708); + ssigpTa->SetBinContent(4633,0.0317056); + ssigpTa->SetBinContent(4634,0.0322176); + ssigpTa->SetBinContent(4635,0.0325832); + ssigpTa->SetBinContent(4636,0.0328308); + ssigpTa->SetBinContent(4637,0.033246); + ssigpTa->SetBinContent(4638,0.0338612); + ssigpTa->SetBinContent(4639,0.0347084); + ssigpTa->SetBinContent(4640,0.035754); + ssigpTa->SetBinContent(4641,0.0366184); + ssigpTa->SetBinContent(4642,0.0373068); + ssigpTa->SetBinContent(4643,0.0379844); + ssigpTa->SetBinContent(4644,0.0386608); + ssigpTa->SetBinContent(4645,0.039334); + ssigpTa->SetBinContent(4646,0.0399128); + ssigpTa->SetBinContent(4647,0.040414); + ssigpTa->SetBinContent(4648,0.0410528); + ssigpTa->SetBinContent(4649,0.041868); + ssigpTa->SetBinContent(4650,0.0428916); + ssigpTa->SetBinContent(4651,0.044086); + ssigpTa->SetBinContent(4652,0.045106); + ssigpTa->SetBinContent(4653,0.0459684); + ssigpTa->SetBinContent(4654,0.04681); + ssigpTa->SetBinContent(4655,0.0476868); + ssigpTa->SetBinContent(4656,0.0485916); + ssigpTa->SetBinContent(4657,0.0493856); + ssigpTa->SetBinContent(4658,0.0494728); + ssigpTa->SetBinContent(4659,0.0488544); + ssigpTa->SetBinContent(4660,0.0489452); + ssigpTa->SetBinContent(4661,0.0498964); + ssigpTa->SetBinContent(4662,0.0511796); + ssigpTa->SetBinContent(4663,0.052322); + ssigpTa->SetBinContent(4664,0.0533216); + ssigpTa->SetBinContent(4665,0.0543012); + ssigpTa->SetBinContent(4666,0.055284); + ssigpTa->SetBinContent(4667,0.0562848); + ssigpTa->SetBinContent(4668,0.0573064); + ssigpTa->SetBinContent(4669,0.0583208); + ssigpTa->SetBinContent(4670,0.059332); + ssigpTa->SetBinContent(4671,0.0604828); + ssigpTa->SetBinContent(4672,0.0619092); + ssigpTa->SetBinContent(4673,0.0632528); + ssigpTa->SetBinContent(4674,0.0644588); + ssigpTa->SetBinContent(4675,0.0656536); + ssigpTa->SetBinContent(4676,0.0668604); + ssigpTa->SetBinContent(4677,0.068082); + ssigpTa->SetBinContent(4678,0.0693348); + ssigpTa->SetBinContent(4679,0.0706368); + ssigpTa->SetBinContent(4680,0.0719996); + ssigpTa->SetBinContent(4681,0.0734544); + ssigpTa->SetBinContent(4682,0.07513); + ssigpTa->SetBinContent(4683,0.0769436); + ssigpTa->SetBinContent(4684,0.078458); + ssigpTa->SetBinContent(4685,0.0798748); + ssigpTa->SetBinContent(4686,0.0813568); + ssigpTa->SetBinContent(4687,0.0828748); + ssigpTa->SetBinContent(4688,0.0844456); + ssigpTa->SetBinContent(4689,0.086112); + ssigpTa->SetBinContent(4690,0.0878556); + ssigpTa->SetBinContent(4691,0.089694); + ssigpTa->SetBinContent(4692,0.091814); + ssigpTa->SetBinContent(4693,0.0942144); + ssigpTa->SetBinContent(4694,0.0964728); + ssigpTa->SetBinContent(4695,0.0989504); + ssigpTa->SetBinContent(4696,0.101876); + ssigpTa->SetBinContent(4697,0.104408); + ssigpTa->SetBinContent(4698,0.106556); + ssigpTa->SetBinContent(4699,0.108697); + ssigpTa->SetBinContent(4700,0.110992); + ssigpTa->SetBinContent(4701,0.113498); + ssigpTa->SetBinContent(4702,0.116186); + ssigpTa->SetBinContent(4703,0.11882); + ssigpTa->SetBinContent(4704,0.121374); + ssigpTa->SetBinContent(4705,0.123919); + ssigpTa->SetBinContent(4706,0.126492); + ssigpTa->SetBinContent(4707,0.12913); + ssigpTa->SetBinContent(4708,0.133507); + ssigpTa->SetBinContent(4709,0.145406); + ssigpTa->SetBinContent(4710,0.161247); + ssigpTa->SetBinContent(4711,0.16447); + ssigpTa->SetBinContent(4712,0.164298); + ssigpTa->SetBinContent(4713,0.167289); + ssigpTa->SetBinContent(4714,0.171324); + ssigpTa->SetBinContent(4715,0.175418); + ssigpTa->SetBinContent(4716,0.179551); + ssigpTa->SetBinContent(4717,0.183722); + ssigpTa->SetBinContent(4718,0.187986); + ssigpTa->SetBinContent(4719,0.191481); + ssigpTa->SetBinContent(4720,0.190737); + ssigpTa->SetBinContent(4721,0.185625); + ssigpTa->SetBinContent(4722,0.184584); + ssigpTa->SetBinContent(4723,0.18779); + ssigpTa->SetBinContent(4724,0.192079); + ssigpTa->SetBinContent(4725,0.19674); + ssigpTa->SetBinContent(4726,0.201623); + ssigpTa->SetBinContent(4727,0.205948); + ssigpTa->SetBinContent(4728,0.20692); + ssigpTa->SetBinContent(4729,0.20396); + ssigpTa->SetBinContent(4730,0.203535); + ssigpTa->SetBinContent(4731,0.206904); + ssigpTa->SetBinContent(4732,0.211519); + ssigpTa->SetBinContent(4733,0.216323); + ssigpTa->SetBinContent(4734,0.221214); + ssigpTa->SetBinContent(4735,0.226196); + ssigpTa->SetBinContent(4736,0.231264); + ssigpTa->SetBinContent(4737,0.23637); + ssigpTa->SetBinContent(4738,0.241514); + ssigpTa->SetBinContent(4739,0.246906); + ssigpTa->SetBinContent(4740,0.252772); + ssigpTa->SetBinContent(4741,0.259088); + ssigpTa->SetBinContent(4742,0.265648); + ssigpTa->SetBinContent(4743,0.272368); + ssigpTa->SetBinContent(4744,0.27923); + ssigpTa->SetBinContent(4745,0.286275); + ssigpTa->SetBinContent(4746,0.293502); + ssigpTa->SetBinContent(4747,0.300866); + ssigpTa->SetBinContent(4748,0.317818); + ssigpTa->SetBinContent(4749,0.382412); + ssigpTa->SetBinContent(4750,0.495398); + ssigpTa->SetBinContent(4751,0.562604); + ssigpTa->SetBinContent(4752,0.583174); + ssigpTa->SetBinContent(4753,0.594482); + ssigpTa->SetBinContent(4754,0.605856); + ssigpTa->SetBinContent(4755,0.617126); + ssigpTa->SetBinContent(4756,0.628242); + ssigpTa->SetBinContent(4757,0.63962); + ssigpTa->SetBinContent(4758,0.652045); + ssigpTa->SetBinContent(4759,0.665894); + ssigpTa->SetBinContent(4760,0.680649); + ssigpTa->SetBinContent(4761,0.696061); + ssigpTa->SetBinContent(4762,0.711881); + ssigpTa->SetBinContent(4763,0.727643); + ssigpTa->SetBinContent(4764,0.743336); + ssigpTa->SetBinContent(4765,0.7593); + ssigpTa->SetBinContent(4766,0.775901); + ssigpTa->SetBinContent(4767,0.79333); + ssigpTa->SetBinContent(4768,0.811413); + ssigpTa->SetBinContent(4769,0.829789); + ssigpTa->SetBinContent(4770,0.848243); + ssigpTa->SetBinContent(4771,0.866869); + ssigpTa->SetBinContent(4772,0.885374); + ssigpTa->SetBinContent(4773,0.902857); + ssigpTa->SetBinContent(4774,0.919277); + ssigpTa->SetBinContent(4775,0.935387); + ssigpTa->SetBinContent(4776,0.951893); + ssigpTa->SetBinContent(4777,0.968888); + ssigpTa->SetBinContent(4778,0.985871); + ssigpTa->SetBinContent(4779,1.00279); + ssigpTa->SetBinContent(4780,1.02133); + ssigpTa->SetBinContent(4781,1.04317); + ssigpTa->SetBinContent(4782,1.06713); + ssigpTa->SetBinContent(4783,1.09174); + ssigpTa->SetBinContent(4784,1.11652); + ssigpTa->SetBinContent(4785,1.14161); + ssigpTa->SetBinContent(4786,1.16808); + ssigpTa->SetBinContent(4787,1.19705); + ssigpTa->SetBinContent(4788,1.22825); + ssigpTa->SetBinContent(4789,1.26099); + ssigpTa->SetBinContent(4790,1.29425); + ssigpTa->SetBinContent(4791,1.32642); + ssigpTa->SetBinContent(4792,1.35683); + ssigpTa->SetBinContent(4793,1.38589); + ssigpTa->SetBinContent(4794,1.41394); + ssigpTa->SetBinContent(4795,1.44111); + ssigpTa->SetBinContent(4796,1.46802); + ssigpTa->SetBinContent(4797,1.4963); + ssigpTa->SetBinContent(4798,1.52765); + ssigpTa->SetBinContent(4799,1.56144); + ssigpTa->SetBinContent(4800,1.59558); + ssigpTa->SetBinContent(4801,1.62917); + ssigpTa->SetBinContent(4802,1.6622); + ssigpTa->SetBinContent(4803,1.69453); + ssigpTa->SetBinContent(4804,1.72621); + ssigpTa->SetBinContent(4805,1.75717); + ssigpTa->SetBinContent(4806,1.78697); + ssigpTa->SetBinContent(4807,1.81609); + ssigpTa->SetBinContent(4808,1.84732); + ssigpTa->SetBinContent(4809,1.88421); + ssigpTa->SetBinContent(4810,1.92744); + ssigpTa->SetBinContent(4811,1.97507); + ssigpTa->SetBinContent(4812,2.02558); + ssigpTa->SetBinContent(4813,2.10961); + ssigpTa->SetBinContent(4814,2.36069); + ssigpTa->SetBinContent(4815,2.78359); + ssigpTa->SetBinContent(4816,3.04622); + ssigpTa->SetBinContent(4817,3.1472); + ssigpTa->SetBinContent(4818,3.22139); + ssigpTa->SetBinContent(4819,3.30471); + ssigpTa->SetBinContent(4820,3.39611); + ssigpTa->SetBinContent(4821,3.49388); + ssigpTa->SetBinContent(4822,3.59681); + ssigpTa->SetBinContent(4823,3.70174); + ssigpTa->SetBinContent(4824,3.80509); + ssigpTa->SetBinContent(4825,3.90734); + ssigpTa->SetBinContent(4826,4.01272); + ssigpTa->SetBinContent(4827,4.12658); + ssigpTa->SetBinContent(4828,4.2486); + ssigpTa->SetBinContent(4829,4.37485); + ssigpTa->SetBinContent(4830,4.5037); + ssigpTa->SetBinContent(4831,4.63074); + ssigpTa->SetBinContent(4832,4.82585); + ssigpTa->SetBinContent(4833,5.3373); + ssigpTa->SetBinContent(4834,6.11719); + ssigpTa->SetBinContent(4837,0.0159622); + ssigpTa->SetBinContent(4838,0.01596); + ssigpTa->SetBinContent(4839,0.0159576); + ssigpTa->SetBinContent(4840,0.0159576); + ssigpTa->SetBinContent(4841,0.0159576); + ssigpTa->SetBinContent(4842,0.0159576); + ssigpTa->SetBinContent(4843,0.0159576); + ssigpTa->SetBinContent(4844,0.0159576); + ssigpTa->SetBinContent(4845,0.01596); + ssigpTa->SetBinContent(4846,0.0159648); + ssigpTa->SetBinContent(4847,0.0159768); + ssigpTa->SetBinContent(4848,0.0159816); + ssigpTa->SetBinContent(4849,0.015984); + ssigpTa->SetBinContent(4850,0.0159896); + ssigpTa->SetBinContent(4851,0.0159936); + ssigpTa->SetBinContent(4852,0.0160032); + ssigpTa->SetBinContent(4853,0.0160088); + ssigpTa->SetBinContent(4854,0.0160168); + ssigpTa->SetBinContent(4855,0.0160264); + ssigpTa->SetBinContent(4856,0.0160424); + ssigpTa->SetBinContent(4857,0.0160512); + ssigpTa->SetBinContent(4858,0.0160576); + ssigpTa->SetBinContent(4859,0.0160592); + ssigpTa->SetBinContent(4860,0.0160672); + ssigpTa->SetBinContent(4861,0.0160816); + ssigpTa->SetBinContent(4862,0.0161048); + ssigpTa->SetBinContent(4863,0.0161136); + ssigpTa->SetBinContent(4864,0.0161192); + ssigpTa->SetBinContent(4865,0.0161272); + ssigpTa->SetBinContent(4866,0.0161416); + ssigpTa->SetBinContent(4867,0.0161632); + ssigpTa->SetBinContent(4868,0.0161792); + ssigpTa->SetBinContent(4869,0.016188); + ssigpTa->SetBinContent(4870,0.0162016); + ssigpTa->SetBinContent(4871,0.0162232); + ssigpTa->SetBinContent(4872,0.0162392); + ssigpTa->SetBinContent(4873,0.0162536); + ssigpTa->SetBinContent(4874,0.016264); + ssigpTa->SetBinContent(4875,0.0162856); + ssigpTa->SetBinContent(4876,0.0163112); + ssigpTa->SetBinContent(4877,0.016328); + ssigpTa->SetBinContent(4878,0.0163456); + ssigpTa->SetBinContent(4879,0.0163624); + ssigpTa->SetBinContent(4880,0.016384); + ssigpTa->SetBinContent(4881,0.016412); + ssigpTa->SetBinContent(4882,0.0164328); + ssigpTa->SetBinContent(4883,0.0164624); + ssigpTa->SetBinContent(4884,0.0164824); + ssigpTa->SetBinContent(4885,0.0164992); + ssigpTa->SetBinContent(4886,0.0165248); + ssigpTa->SetBinContent(4887,0.016548); + ssigpTa->SetBinContent(4888,0.0165768); + ssigpTa->SetBinContent(4889,0.0165992); + ssigpTa->SetBinContent(4890,0.016616); + ssigpTa->SetBinContent(4891,0.0166544); + ssigpTa->SetBinContent(4892,0.0166792); + ssigpTa->SetBinContent(4893,0.0167112); + ssigpTa->SetBinContent(4894,0.0167376); + ssigpTa->SetBinContent(4895,0.0167656); + ssigpTa->SetBinContent(4896,0.016796); + ssigpTa->SetBinContent(4897,0.0168312); + ssigpTa->SetBinContent(4898,0.016856); + ssigpTa->SetBinContent(4899,0.016888); + ssigpTa->SetBinContent(4900,0.0169144); + ssigpTa->SetBinContent(4901,0.016952); + ssigpTa->SetBinContent(4902,0.0169792); + ssigpTa->SetBinContent(4903,0.0170224); + ssigpTa->SetBinContent(4904,0.0170608); + ssigpTa->SetBinContent(4905,0.0170968); + ssigpTa->SetBinContent(4906,0.0171288); + ssigpTa->SetBinContent(4907,0.0171616); + ssigpTa->SetBinContent(4908,0.0172032); + ssigpTa->SetBinContent(4909,0.0172432); + ssigpTa->SetBinContent(4910,0.017276); + ssigpTa->SetBinContent(4911,0.017316); + ssigpTa->SetBinContent(4912,0.0173576); + ssigpTa->SetBinContent(4913,0.0173968); + ssigpTa->SetBinContent(4914,0.0174456); + ssigpTa->SetBinContent(4915,0.0174896); + ssigpTa->SetBinContent(4916,0.017532); + ssigpTa->SetBinContent(4917,0.0175688); + ssigpTa->SetBinContent(4918,0.0176144); + ssigpTa->SetBinContent(4919,0.0176568); + ssigpTa->SetBinContent(4920,0.0177008); + ssigpTa->SetBinContent(4921,0.0177472); + ssigpTa->SetBinContent(4922,0.0177968); + ssigpTa->SetBinContent(4923,0.0178432); + ssigpTa->SetBinContent(4924,0.0178872); + ssigpTa->SetBinContent(4925,0.0179336); + ssigpTa->SetBinContent(4926,0.0179856); + ssigpTa->SetBinContent(4927,0.0180456); + ssigpTa->SetBinContent(4928,0.0181008); + ssigpTa->SetBinContent(4929,0.0181664); + ssigpTa->SetBinContent(4930,0.0182208); + ssigpTa->SetBinContent(4931,0.0182736); + ssigpTa->SetBinContent(4932,0.0183256); + ssigpTa->SetBinContent(4933,0.0183824); + ssigpTa->SetBinContent(4934,0.0184312); + ssigpTa->SetBinContent(4935,0.0184864); + ssigpTa->SetBinContent(4936,0.0185448); + ssigpTa->SetBinContent(4937,0.0186024); + ssigpTa->SetBinContent(4938,0.0186784); + ssigpTa->SetBinContent(4939,0.0187488); + ssigpTa->SetBinContent(4940,0.018824); + ssigpTa->SetBinContent(4941,0.018928); + ssigpTa->SetBinContent(4942,0.0192296); + ssigpTa->SetBinContent(4943,0.020284); + ssigpTa->SetBinContent(4944,0.0221048); + ssigpTa->SetBinContent(4945,0.0231224); + ssigpTa->SetBinContent(4946,0.0233448); + ssigpTa->SetBinContent(4947,0.0234136); + ssigpTa->SetBinContent(4948,0.023484); + ssigpTa->SetBinContent(4949,0.0235656); + ssigpTa->SetBinContent(4950,0.023636); + ssigpTa->SetBinContent(4951,0.023708); + ssigpTa->SetBinContent(4952,0.023776); + ssigpTa->SetBinContent(4953,0.0237304); + ssigpTa->SetBinContent(4954,0.0230992); + ssigpTa->SetBinContent(4955,0.0219368); + ssigpTa->SetBinContent(4956,0.0215264); + ssigpTa->SetBinContent(4957,0.0217976); + ssigpTa->SetBinContent(4958,0.0222072); + ssigpTa->SetBinContent(4959,0.0226296); + ssigpTa->SetBinContent(4960,0.02306); + ssigpTa->SetBinContent(4961,0.0235016); + ssigpTa->SetBinContent(4962,0.0238072); + ssigpTa->SetBinContent(4963,0.0234888); + ssigpTa->SetBinContent(4964,0.0225136); + ssigpTa->SetBinContent(4965,0.0220984); + ssigpTa->SetBinContent(4966,0.0222296); + ssigpTa->SetBinContent(4967,0.0225728); + ssigpTa->SetBinContent(4968,0.0229944); + ssigpTa->SetBinContent(4969,0.0234424); + ssigpTa->SetBinContent(4970,0.0238952); + ssigpTa->SetBinContent(4971,0.0243576); + ssigpTa->SetBinContent(4972,0.0248312); + ssigpTa->SetBinContent(4973,0.0251648); + ssigpTa->SetBinContent(4974,0.0247736); + ssigpTa->SetBinContent(4975,0.0236288); + ssigpTa->SetBinContent(4976,0.0231944); + ssigpTa->SetBinContent(4977,0.0235); + ssigpTa->SetBinContent(4978,0.0239528); + ssigpTa->SetBinContent(4979,0.0244168); + ssigpTa->SetBinContent(4980,0.0248768); + ssigpTa->SetBinContent(4981,0.0252968); + ssigpTa->SetBinContent(4982,0.0255272); + ssigpTa->SetBinContent(4983,0.0255592); + ssigpTa->SetBinContent(4984,0.025656); + ssigpTa->SetBinContent(4985,0.0251736); + ssigpTa->SetBinContent(4986,0.0239344); + ssigpTa->SetBinContent(4987,0.0234736); + ssigpTa->SetBinContent(4988,0.0237944); + ssigpTa->SetBinContent(4989,0.0242768); + ssigpTa->SetBinContent(4990,0.0247712); + ssigpTa->SetBinContent(4991,0.025272); + ssigpTa->SetBinContent(4992,0.0257912); + ssigpTa->SetBinContent(4993,0.026304); + ssigpTa->SetBinContent(4994,0.0268304); + ssigpTa->SetBinContent(4995,0.0273688); + ssigpTa->SetBinContent(4996,0.0277848); + ssigpTa->SetBinContent(4997,0.0275056); + ssigpTa->SetBinContent(4998,0.0265072); + ssigpTa->SetBinContent(4999,0.0260832); + ssigpTa->SetBinContent(5000,0.0258376); + ssigpTa->SetBinContent(5001,0.0251928); + ssigpTa->SetBinContent(5002,0.0250624); + ssigpTa->SetBinContent(5003,0.025468); + ssigpTa->SetBinContent(5004,0.0259976); + ssigpTa->SetBinContent(5005,0.026532); + ssigpTa->SetBinContent(5006,0.0270728); + ssigpTa->SetBinContent(5007,0.027512); + ssigpTa->SetBinContent(5008,0.0273744); + ssigpTa->SetBinContent(5009,0.0266248); + ssigpTa->SetBinContent(5010,0.0264808); + ssigpTa->SetBinContent(5011,0.0270272); + ssigpTa->SetBinContent(5012,0.0278); + ssigpTa->SetBinContent(5013,0.0284776); + ssigpTa->SetBinContent(5014,0.0290072); + ssigpTa->SetBinContent(5015,0.0292616); + ssigpTa->SetBinContent(5016,0.0292368); + ssigpTa->SetBinContent(5017,0.0294808); + ssigpTa->SetBinContent(5018,0.0299992); + ssigpTa->SetBinContent(5019,0.0305912); + ssigpTa->SetBinContent(5020,0.0311184); + ssigpTa->SetBinContent(5021,0.031308); + ssigpTa->SetBinContent(5022,0.0309744); + ssigpTa->SetBinContent(5023,0.0300384); + ssigpTa->SetBinContent(5024,0.0284696); + ssigpTa->SetBinContent(5025,0.0278536); + ssigpTa->SetBinContent(5026,0.0281592); + ssigpTa->SetBinContent(5027,0.0286688); + ssigpTa->SetBinContent(5028,0.0292048); + ssigpTa->SetBinContent(5029,0.029848); + ssigpTa->SetBinContent(5030,0.0305864); + ssigpTa->SetBinContent(5031,0.0312272); + ssigpTa->SetBinContent(5032,0.0317888); + ssigpTa->SetBinContent(5033,0.032356); + ssigpTa->SetBinContent(5034,0.0329248); + ssigpTa->SetBinContent(5035,0.0335112); + ssigpTa->SetBinContent(5036,0.0341144); + ssigpTa->SetBinContent(5037,0.0347048); + ssigpTa->SetBinContent(5038,0.0352384); + ssigpTa->SetBinContent(5039,0.0357208); + ssigpTa->SetBinContent(5040,0.0363096); + ssigpTa->SetBinContent(5041,0.0370064); + ssigpTa->SetBinContent(5042,0.0378272); + ssigpTa->SetBinContent(5043,0.0387656); + ssigpTa->SetBinContent(5044,0.0396016); + ssigpTa->SetBinContent(5045,0.040364); + ssigpTa->SetBinContent(5046,0.0411144); + ssigpTa->SetBinContent(5047,0.0418864); + ssigpTa->SetBinContent(5048,0.042664); + ssigpTa->SetBinContent(5049,0.0434384); + ssigpTa->SetBinContent(5050,0.04422); + ssigpTa->SetBinContent(5051,0.0450688); + ssigpTa->SetBinContent(5052,0.0459848); + ssigpTa->SetBinContent(5053,0.0469928); + ssigpTa->SetBinContent(5054,0.048052); + ssigpTa->SetBinContent(5055,0.0490472); + ssigpTa->SetBinContent(5056,0.0499936); + ssigpTa->SetBinContent(5057,0.0509544); + ssigpTa->SetBinContent(5058,0.0519416); + ssigpTa->SetBinContent(5059,0.0529736); + ssigpTa->SetBinContent(5060,0.053916); + ssigpTa->SetBinContent(5061,0.0543024); + ssigpTa->SetBinContent(5062,0.0541056); + ssigpTa->SetBinContent(5063,0.0544816); + ssigpTa->SetBinContent(5064,0.0554584); + ssigpTa->SetBinContent(5065,0.0566008); + ssigpTa->SetBinContent(5066,0.0577472); + ssigpTa->SetBinContent(5067,0.0588808); + ssigpTa->SetBinContent(5068,0.0600224); + ssigpTa->SetBinContent(5069,0.0611744); + ssigpTa->SetBinContent(5070,0.0623424); + ssigpTa->SetBinContent(5071,0.0635336); + ssigpTa->SetBinContent(5072,0.0647408); + ssigpTa->SetBinContent(5073,0.065952); + ssigpTa->SetBinContent(5074,0.0672408); + ssigpTa->SetBinContent(5075,0.0686424); + ssigpTa->SetBinContent(5076,0.0700448); + ssigpTa->SetBinContent(5077,0.071428); + ssigpTa->SetBinContent(5078,0.072824); + ssigpTa->SetBinContent(5079,0.0742384); + ssigpTa->SetBinContent(5080,0.0756696); + ssigpTa->SetBinContent(5081,0.0771368); + ssigpTa->SetBinContent(5082,0.0786672); + ssigpTa->SetBinContent(5083,0.0802736); + ssigpTa->SetBinContent(5084,0.0819568); + ssigpTa->SetBinContent(5085,0.0837888); + ssigpTa->SetBinContent(5086,0.0856792); + ssigpTa->SetBinContent(5087,0.0873808); + ssigpTa->SetBinContent(5088,0.0890512); + ssigpTa->SetBinContent(5089,0.0907936); + ssigpTa->SetBinContent(5090,0.0925856); + ssigpTa->SetBinContent(5091,0.0944328); + ssigpTa->SetBinContent(5092,0.0963928); + ssigpTa->SetBinContent(5093,0.098436); + ssigpTa->SetBinContent(5094,0.100577); + ssigpTa->SetBinContent(5095,0.102972); + ssigpTa->SetBinContent(5096,0.105611); + ssigpTa->SetBinContent(5097,0.108176); + ssigpTa->SetBinContent(5098,0.111142); + ssigpTa->SetBinContent(5099,0.114705); + ssigpTa->SetBinContent(5100,0.117766); + ssigpTa->SetBinContent(5101,0.120306); + ssigpTa->SetBinContent(5102,0.122839); + ssigpTa->SetBinContent(5103,0.125537); + ssigpTa->SetBinContent(5104,0.128422); + ssigpTa->SetBinContent(5105,0.131481); + ssigpTa->SetBinContent(5106,0.134518); + ssigpTa->SetBinContent(5107,0.137518); + ssigpTa->SetBinContent(5108,0.140522); + ssigpTa->SetBinContent(5109,0.143561); + ssigpTa->SetBinContent(5110,0.146673); + ssigpTa->SetBinContent(5111,0.151962); + ssigpTa->SetBinContent(5112,0.166661); + ssigpTa->SetBinContent(5113,0.186357); + ssigpTa->SetBinContent(5114,0.190339); + ssigpTa->SetBinContent(5115,0.189981); + ssigpTa->SetBinContent(5116,0.193486); + ssigpTa->SetBinContent(5117,0.198265); + ssigpTa->SetBinContent(5118,0.203129); + ssigpTa->SetBinContent(5119,0.208029); + ssigpTa->SetBinContent(5120,0.212984); + ssigpTa->SetBinContent(5121,0.218047); + ssigpTa->SetBinContent(5122,0.222147); + ssigpTa->SetBinContent(5123,0.220974); + ssigpTa->SetBinContent(5124,0.214367); + ssigpTa->SetBinContent(5125,0.212834); + ssigpTa->SetBinContent(5126,0.21659); + ssigpTa->SetBinContent(5127,0.221684); + ssigpTa->SetBinContent(5128,0.227198); + ssigpTa->SetBinContent(5129,0.232984); + ssigpTa->SetBinContent(5130,0.238046); + ssigpTa->SetBinContent(5131,0.238921); + ssigpTa->SetBinContent(5132,0.235202); + ssigpTa->SetBinContent(5133,0.235136); + ssigpTa->SetBinContent(5134,0.239504); + ssigpTa->SetBinContent(5135,0.245077); + ssigpTa->SetBinContent(5136,0.250806); + ssigpTa->SetBinContent(5137,0.25665); + ssigpTa->SetBinContent(5138,0.262597); + ssigpTa->SetBinContent(5139,0.268648); + ssigpTa->SetBinContent(5140,0.274746); + ssigpTa->SetBinContent(5141,0.280905); + ssigpTa->SetBinContent(5142,0.287346); + ssigpTa->SetBinContent(5143,0.294365); + ssigpTa->SetBinContent(5144,0.301891); + ssigpTa->SetBinContent(5145,0.309719); + ssigpTa->SetBinContent(5146,0.317742); + ssigpTa->SetBinContent(5147,0.325938); + ssigpTa->SetBinContent(5148,0.334351); + ssigpTa->SetBinContent(5149,0.342987); + ssigpTa->SetBinContent(5150,0.351785); + ssigpTa->SetBinContent(5151,0.372103); + ssigpTa->SetBinContent(5152,0.449686); + ssigpTa->SetBinContent(5153,0.585411); + ssigpTa->SetBinContent(5154,0.666133); + ssigpTa->SetBinContent(5155,0.690834); + ssigpTa->SetBinContent(5156,0.704382); + ssigpTa->SetBinContent(5157,0.718037); + ssigpTa->SetBinContent(5158,0.73155); + ssigpTa->SetBinContent(5159,0.744903); + ssigpTa->SetBinContent(5160,0.758546); + ssigpTa->SetBinContent(5161,0.773454); + ssigpTa->SetBinContent(5162,0.790037); + ssigpTa->SetBinContent(5163,0.807706); + ssigpTa->SetBinContent(5164,0.826166); + ssigpTa->SetBinContent(5165,0.845109); + ssigpTa->SetBinContent(5166,0.863991); + ssigpTa->SetBinContent(5167,0.882805); + ssigpTa->SetBinContent(5168,0.901938); + ssigpTa->SetBinContent(5169,0.921829); + ssigpTa->SetBinContent(5170,0.942714); + ssigpTa->SetBinContent(5171,0.964363); + ssigpTa->SetBinContent(5172,0.986386); + ssigpTa->SetBinContent(5173,1.00849); + ssigpTa->SetBinContent(5174,1.03082); + ssigpTa->SetBinContent(5175,1.053); + ssigpTa->SetBinContent(5176,1.07399); + ssigpTa->SetBinContent(5177,1.09371); + ssigpTa->SetBinContent(5178,1.11306); + ssigpTa->SetBinContent(5179,1.13288); + ssigpTa->SetBinContent(5180,1.15328); + ssigpTa->SetBinContent(5181,1.17367); + ssigpTa->SetBinContent(5182,1.19399); + ssigpTa->SetBinContent(5183,1.21622); + ssigpTa->SetBinContent(5184,1.2424); + ssigpTa->SetBinContent(5185,1.2711); + ssigpTa->SetBinContent(5186,1.30059); + ssigpTa->SetBinContent(5187,1.33029); + ssigpTa->SetBinContent(5188,1.36037); + ssigpTa->SetBinContent(5189,1.39208); + ssigpTa->SetBinContent(5190,1.4268); + ssigpTa->SetBinContent(5191,1.46417); + ssigpTa->SetBinContent(5192,1.50339); + ssigpTa->SetBinContent(5193,1.54322); + ssigpTa->SetBinContent(5194,1.58177); + ssigpTa->SetBinContent(5195,1.61822); + ssigpTa->SetBinContent(5196,1.65309); + ssigpTa->SetBinContent(5197,1.68674); + ssigpTa->SetBinContent(5198,1.71936); + ssigpTa->SetBinContent(5199,1.75165); + ssigpTa->SetBinContent(5200,1.78559); + ssigpTa->SetBinContent(5201,1.82321); + ssigpTa->SetBinContent(5202,1.86375); + ssigpTa->SetBinContent(5203,1.9047); + ssigpTa->SetBinContent(5204,1.94502); + ssigpTa->SetBinContent(5205,1.98464); + ssigpTa->SetBinContent(5206,2.02344); + ssigpTa->SetBinContent(5207,2.06145); + ssigpTa->SetBinContent(5208,2.09862); + ssigpTa->SetBinContent(5209,2.13438); + ssigpTa->SetBinContent(5210,2.16935); + ssigpTa->SetBinContent(5211,2.20684); + ssigpTa->SetBinContent(5212,2.2511); + ssigpTa->SetBinContent(5213,2.30292); + ssigpTa->SetBinContent(5214,2.35999); + ssigpTa->SetBinContent(5215,2.42052); + ssigpTa->SetBinContent(5216,2.52131); + ssigpTa->SetBinContent(5217,2.82263); + ssigpTa->SetBinContent(5218,3.33022); + ssigpTa->SetBinContent(5219,3.6454); + ssigpTa->SetBinContent(5220,3.76654); + ssigpTa->SetBinContent(5221,3.85552); + ssigpTa->SetBinContent(5222,3.95545); + ssigpTa->SetBinContent(5223,4.06505); + ssigpTa->SetBinContent(5224,4.18231); + ssigpTa->SetBinContent(5225,4.30572); + ssigpTa->SetBinContent(5226,4.43154); + ssigpTa->SetBinContent(5227,4.55548); + ssigpTa->SetBinContent(5228,4.67809); + ssigpTa->SetBinContent(5229,4.80447); + ssigpTa->SetBinContent(5230,4.94102); + ssigpTa->SetBinContent(5231,5.08734); + ssigpTa->SetBinContent(5232,5.23873); + ssigpTa->SetBinContent(5233,5.39326); + ssigpTa->SetBinContent(5234,5.54563); + ssigpTa->SetBinContent(5235,5.77974); + ssigpTa->SetBinContent(5236,6.39351); + ssigpTa->SetBinContent(5237,7.32941); + ssigpTa->SetBinContent(5240,0.0173906); + ssigpTa->SetBinContent(5241,0.0173879); + ssigpTa->SetBinContent(5242,0.0173868); + ssigpTa->SetBinContent(5243,0.0173868); + ssigpTa->SetBinContent(5244,0.0173868); + ssigpTa->SetBinContent(5245,0.0173868); + ssigpTa->SetBinContent(5246,0.0173868); + ssigpTa->SetBinContent(5247,0.0173868); + ssigpTa->SetBinContent(5248,0.0173868); + ssigpTa->SetBinContent(5249,0.0173916); + ssigpTa->SetBinContent(5250,0.0173964); + ssigpTa->SetBinContent(5251,0.0174012); + ssigpTa->SetBinContent(5252,0.0174012); + ssigpTa->SetBinContent(5253,0.0174012); + ssigpTa->SetBinContent(5254,0.017406); + ssigpTa->SetBinContent(5255,0.0174152); + ssigpTa->SetBinContent(5256,0.0174292); + ssigpTa->SetBinContent(5257,0.0174412); + ssigpTa->SetBinContent(5258,0.0174552); + ssigpTa->SetBinContent(5259,0.0174664); + ssigpTa->SetBinContent(5260,0.0174732); + ssigpTa->SetBinContent(5261,0.0174732); + ssigpTa->SetBinContent(5262,0.017476); + ssigpTa->SetBinContent(5263,0.0174816); + ssigpTa->SetBinContent(5264,0.0175004); + ssigpTa->SetBinContent(5265,0.0175128); + ssigpTa->SetBinContent(5266,0.0175304); + ssigpTa->SetBinContent(5267,0.0175368); + ssigpTa->SetBinContent(5268,0.017546); + ssigpTa->SetBinContent(5269,0.0175584); + ssigpTa->SetBinContent(5270,0.0175772); + ssigpTa->SetBinContent(5271,0.0175876); + ssigpTa->SetBinContent(5272,0.0175988); + ssigpTa->SetBinContent(5273,0.0176128); + ssigpTa->SetBinContent(5274,0.0176332); + ssigpTa->SetBinContent(5275,0.017654); + ssigpTa->SetBinContent(5276,0.0176596); + ssigpTa->SetBinContent(5277,0.01767); + ssigpTa->SetBinContent(5278,0.0176888); + ssigpTa->SetBinContent(5279,0.017714); + ssigpTa->SetBinContent(5280,0.0177364); + ssigpTa->SetBinContent(5281,0.0177468); + ssigpTa->SetBinContent(5282,0.0177636); + ssigpTa->SetBinContent(5283,0.0177908); + ssigpTa->SetBinContent(5284,0.0178104); + ssigpTa->SetBinContent(5285,0.017834); + ssigpTa->SetBinContent(5286,0.0178592); + ssigpTa->SetBinContent(5287,0.017878); + ssigpTa->SetBinContent(5288,0.0178948); + ssigpTa->SetBinContent(5289,0.0179108); + ssigpTa->SetBinContent(5290,0.0179408); + ssigpTa->SetBinContent(5291,0.0179624); + ssigpTa->SetBinContent(5292,0.017982); + ssigpTa->SetBinContent(5293,0.018012); + ssigpTa->SetBinContent(5294,0.018038); + ssigpTa->SetBinContent(5295,0.0180728); + ssigpTa->SetBinContent(5296,0.0180944); + ssigpTa->SetBinContent(5297,0.0181224); + ssigpTa->SetBinContent(5298,0.0181524); + ssigpTa->SetBinContent(5299,0.0181796); + ssigpTa->SetBinContent(5300,0.0182096); + ssigpTa->SetBinContent(5301,0.0182396); + ssigpTa->SetBinContent(5302,0.0182592); + ssigpTa->SetBinContent(5303,0.018294); + ssigpTa->SetBinContent(5304,0.018322); + ssigpTa->SetBinContent(5305,0.0183576); + ssigpTa->SetBinContent(5306,0.0183868); + ssigpTa->SetBinContent(5307,0.0184344); + ssigpTa->SetBinContent(5308,0.0184636); + ssigpTa->SetBinContent(5309,0.0184944); + ssigpTa->SetBinContent(5310,0.0185272); + ssigpTa->SetBinContent(5311,0.0185648); + ssigpTa->SetBinContent(5312,0.0186004); + ssigpTa->SetBinContent(5313,0.0186396); + ssigpTa->SetBinContent(5314,0.0186752); + ssigpTa->SetBinContent(5315,0.0187164); + ssigpTa->SetBinContent(5316,0.0187548); + ssigpTa->SetBinContent(5317,0.0187952); + ssigpTa->SetBinContent(5318,0.0188456); + ssigpTa->SetBinContent(5319,0.0188776); + ssigpTa->SetBinContent(5320,0.0189252); + ssigpTa->SetBinContent(5321,0.01896); + ssigpTa->SetBinContent(5322,0.0190104); + ssigpTa->SetBinContent(5323,0.0190508); + ssigpTa->SetBinContent(5324,0.0190956); + ssigpTa->SetBinContent(5325,0.0191408); + ssigpTa->SetBinContent(5326,0.0191912); + ssigpTa->SetBinContent(5327,0.019226); + ssigpTa->SetBinContent(5328,0.0192764); + ssigpTa->SetBinContent(5329,0.019328); + ssigpTa->SetBinContent(5330,0.0193776); + ssigpTa->SetBinContent(5331,0.019434); + ssigpTa->SetBinContent(5332,0.019492); + ssigpTa->SetBinContent(5333,0.0195464); + ssigpTa->SetBinContent(5334,0.019596); + ssigpTa->SetBinContent(5335,0.0196504); + ssigpTa->SetBinContent(5336,0.0197064); + ssigpTa->SetBinContent(5337,0.0197624); + ssigpTa->SetBinContent(5338,0.019814); + ssigpTa->SetBinContent(5339,0.0198636); + ssigpTa->SetBinContent(5340,0.0199228); + ssigpTa->SetBinContent(5341,0.0199884); + ssigpTa->SetBinContent(5342,0.0200652); + ssigpTa->SetBinContent(5343,0.0201308); + ssigpTa->SetBinContent(5344,0.0202328); + ssigpTa->SetBinContent(5345,0.0205464); + ssigpTa->SetBinContent(5346,0.0217784); + ssigpTa->SetBinContent(5347,0.023926); + ssigpTa->SetBinContent(5348,0.0251296); + ssigpTa->SetBinContent(5349,0.0253792); + ssigpTa->SetBinContent(5350,0.0254428); + ssigpTa->SetBinContent(5351,0.0255132); + ssigpTa->SetBinContent(5352,0.025588); + ssigpTa->SetBinContent(5353,0.0256612); + ssigpTa->SetBinContent(5354,0.0257312); + ssigpTa->SetBinContent(5355,0.0258032); + ssigpTa->SetBinContent(5356,0.0257324); + ssigpTa->SetBinContent(5357,0.024952); + ssigpTa->SetBinContent(5358,0.023546); + ssigpTa->SetBinContent(5359,0.0230532); + ssigpTa->SetBinContent(5360,0.023374); + ssigpTa->SetBinContent(5361,0.02385); + ssigpTa->SetBinContent(5362,0.0243272); + ssigpTa->SetBinContent(5363,0.0248176); + ssigpTa->SetBinContent(5364,0.0253124); + ssigpTa->SetBinContent(5365,0.0256608); + ssigpTa->SetBinContent(5366,0.0252496); + ssigpTa->SetBinContent(5367,0.0240748); + ssigpTa->SetBinContent(5368,0.02356); + ssigpTa->SetBinContent(5369,0.0237404); + ssigpTa->SetBinContent(5370,0.0241352); + ssigpTa->SetBinContent(5371,0.024618); + ssigpTa->SetBinContent(5372,0.0251176); + ssigpTa->SetBinContent(5373,0.0256248); + ssigpTa->SetBinContent(5374,0.0261496); + ssigpTa->SetBinContent(5375,0.0266864); + ssigpTa->SetBinContent(5376,0.0270664); + ssigpTa->SetBinContent(5377,0.0265824); + ssigpTa->SetBinContent(5378,0.0252104); + ssigpTa->SetBinContent(5379,0.024668); + ssigpTa->SetBinContent(5380,0.0249884); + ssigpTa->SetBinContent(5381,0.0255032); + ssigpTa->SetBinContent(5382,0.0260132); + ssigpTa->SetBinContent(5383,0.0265232); + ssigpTa->SetBinContent(5384,0.0270144); + ssigpTa->SetBinContent(5385,0.0273384); + ssigpTa->SetBinContent(5386,0.027516); + ssigpTa->SetBinContent(5387,0.0276824); + ssigpTa->SetBinContent(5388,0.0270988); + ssigpTa->SetBinContent(5389,0.0256156); + ssigpTa->SetBinContent(5390,0.0250404); + ssigpTa->SetBinContent(5391,0.025378); + ssigpTa->SetBinContent(5392,0.0259004); + ssigpTa->SetBinContent(5393,0.026434); + ssigpTa->SetBinContent(5394,0.0269836); + ssigpTa->SetBinContent(5395,0.0275404); + ssigpTa->SetBinContent(5396,0.028114); + ssigpTa->SetBinContent(5397,0.0286848); + ssigpTa->SetBinContent(5398,0.0292716); + ssigpTa->SetBinContent(5399,0.0297092); + ssigpTa->SetBinContent(5400,0.0293212); + ssigpTa->SetBinContent(5401,0.028074); + ssigpTa->SetBinContent(5402,0.0275552); + ssigpTa->SetBinContent(5403,0.0273948); + ssigpTa->SetBinContent(5404,0.0269348); + ssigpTa->SetBinContent(5405,0.026918); + ssigpTa->SetBinContent(5406,0.0273816); + ssigpTa->SetBinContent(5407,0.0279564); + ssigpTa->SetBinContent(5408,0.0285412); + ssigpTa->SetBinContent(5409,0.0291272); + ssigpTa->SetBinContent(5410,0.0295936); + ssigpTa->SetBinContent(5411,0.0293384); + ssigpTa->SetBinContent(5412,0.0283516); + ssigpTa->SetBinContent(5413,0.0280796); + ssigpTa->SetBinContent(5414,0.0286048); + ssigpTa->SetBinContent(5415,0.0293484); + ssigpTa->SetBinContent(5416,0.0300268); + ssigpTa->SetBinContent(5417,0.0306016); + ssigpTa->SetBinContent(5418,0.0309244); + ssigpTa->SetBinContent(5419,0.0310184); + ssigpTa->SetBinContent(5420,0.0313408); + ssigpTa->SetBinContent(5421,0.0319256); + ssigpTa->SetBinContent(5422,0.0325668); + ssigpTa->SetBinContent(5423,0.033134); + ssigpTa->SetBinContent(5424,0.033254); + ssigpTa->SetBinContent(5425,0.0327556); + ssigpTa->SetBinContent(5426,0.0318452); + ssigpTa->SetBinContent(5427,0.0305048); + ssigpTa->SetBinContent(5428,0.0300512); + ssigpTa->SetBinContent(5429,0.0304352); + ssigpTa->SetBinContent(5430,0.031002); + ssigpTa->SetBinContent(5431,0.0315896); + ssigpTa->SetBinContent(5432,0.032224); + ssigpTa->SetBinContent(5433,0.0328956); + ssigpTa->SetBinContent(5434,0.0335272); + ssigpTa->SetBinContent(5435,0.0341428); + ssigpTa->SetBinContent(5436,0.0347704); + ssigpTa->SetBinContent(5437,0.0354148); + ssigpTa->SetBinContent(5438,0.0360712); + ssigpTa->SetBinContent(5439,0.0367456); + ssigpTa->SetBinContent(5440,0.037432); + ssigpTa->SetBinContent(5441,0.0381216); + ssigpTa->SetBinContent(5442,0.038854); + ssigpTa->SetBinContent(5443,0.039612); + ssigpTa->SetBinContent(5444,0.0403944); + ssigpTa->SetBinContent(5445,0.0412048); + ssigpTa->SetBinContent(5446,0.0420376); + ssigpTa->SetBinContent(5447,0.0428676); + ssigpTa->SetBinContent(5448,0.0437004); + ssigpTa->SetBinContent(5449,0.0445504); + ssigpTa->SetBinContent(5450,0.0454104); + ssigpTa->SetBinContent(5451,0.0463024); + ssigpTa->SetBinContent(5452,0.0472768); + ssigpTa->SetBinContent(5453,0.0483416); + ssigpTa->SetBinContent(5454,0.0493936); + ssigpTa->SetBinContent(5455,0.0504256); + ssigpTa->SetBinContent(5456,0.0514156); + ssigpTa->SetBinContent(5457,0.0523584); + ssigpTa->SetBinContent(5458,0.0533344); + ssigpTa->SetBinContent(5459,0.0543768); + ssigpTa->SetBinContent(5460,0.0554516); + ssigpTa->SetBinContent(5461,0.056564); + ssigpTa->SetBinContent(5462,0.057722); + ssigpTa->SetBinContent(5463,0.058826); + ssigpTa->SetBinContent(5464,0.0595004); + ssigpTa->SetBinContent(5465,0.0597332); + ssigpTa->SetBinContent(5466,0.060386); + ssigpTa->SetBinContent(5467,0.061388); + ssigpTa->SetBinContent(5468,0.0624108); + ssigpTa->SetBinContent(5469,0.0635568); + ssigpTa->SetBinContent(5470,0.0648284); + ssigpTa->SetBinContent(5471,0.0661456); + ssigpTa->SetBinContent(5472,0.067472); + ssigpTa->SetBinContent(5473,0.0688172); + ssigpTa->SetBinContent(5474,0.0701932); + ssigpTa->SetBinContent(5475,0.071586); + ssigpTa->SetBinContent(5476,0.0730164); + ssigpTa->SetBinContent(5477,0.0744416); + ssigpTa->SetBinContent(5478,0.0758392); + ssigpTa->SetBinContent(5479,0.0773152); + ssigpTa->SetBinContent(5480,0.0788816); + ssigpTa->SetBinContent(5481,0.0804892); + ssigpTa->SetBinContent(5482,0.0821136); + ssigpTa->SetBinContent(5483,0.0837576); + ssigpTa->SetBinContent(5484,0.08545); + ssigpTa->SetBinContent(5485,0.0872216); + ssigpTa->SetBinContent(5486,0.0890764); + ssigpTa->SetBinContent(5487,0.0910068); + ssigpTa->SetBinContent(5488,0.092994); + ssigpTa->SetBinContent(5489,0.0949892); + ssigpTa->SetBinContent(5490,0.0968752); + ssigpTa->SetBinContent(5491,0.0988064); + ssigpTa->SetBinContent(5492,0.100829); + ssigpTa->SetBinContent(5493,0.102888); + ssigpTa->SetBinContent(5494,0.105034); + ssigpTa->SetBinContent(5495,0.107288); + ssigpTa->SetBinContent(5496,0.10965); + ssigpTa->SetBinContent(5497,0.112099); + ssigpTa->SetBinContent(5498,0.114778); + ssigpTa->SetBinContent(5499,0.11767); + ssigpTa->SetBinContent(5500,0.120552); + ssigpTa->SetBinContent(5501,0.124015); + ssigpTa->SetBinContent(5502,0.128236); + ssigpTa->SetBinContent(5503,0.131825); + ssigpTa->SetBinContent(5504,0.134783); + ssigpTa->SetBinContent(5505,0.137716); + ssigpTa->SetBinContent(5506,0.140821); + ssigpTa->SetBinContent(5507,0.144106); + ssigpTa->SetBinContent(5508,0.147533); + ssigpTa->SetBinContent(5509,0.150994); + ssigpTa->SetBinContent(5510,0.154449); + ssigpTa->SetBinContent(5511,0.157924); + ssigpTa->SetBinContent(5512,0.161435); + ssigpTa->SetBinContent(5513,0.165038); + ssigpTa->SetBinContent(5514,0.171241); + ssigpTa->SetBinContent(5515,0.18874); + ssigpTa->SetBinContent(5516,0.212265); + ssigpTa->SetBinContent(5517,0.217018); + ssigpTa->SetBinContent(5518,0.216478); + ssigpTa->SetBinContent(5519,0.2205); + ssigpTa->SetBinContent(5520,0.226047); + ssigpTa->SetBinContent(5521,0.231677); + ssigpTa->SetBinContent(5522,0.23737); + ssigpTa->SetBinContent(5523,0.243119); + ssigpTa->SetBinContent(5524,0.248987); + ssigpTa->SetBinContent(5525,0.25371); + ssigpTa->SetBinContent(5526,0.252124); + ssigpTa->SetBinContent(5527,0.244057); + ssigpTa->SetBinContent(5528,0.24206); + ssigpTa->SetBinContent(5529,0.246383); + ssigpTa->SetBinContent(5530,0.252286); + ssigpTa->SetBinContent(5531,0.258682); + ssigpTa->SetBinContent(5532,0.265372); + ssigpTa->SetBinContent(5533,0.271188); + ssigpTa->SetBinContent(5534,0.271982); + ssigpTa->SetBinContent(5535,0.267502); + ssigpTa->SetBinContent(5536,0.267741); + ssigpTa->SetBinContent(5537,0.273079); + ssigpTa->SetBinContent(5538,0.27961); + ssigpTa->SetBinContent(5539,0.286278); + ssigpTa->SetBinContent(5540,0.293085); + ssigpTa->SetBinContent(5541,0.300008); + ssigpTa->SetBinContent(5542,0.307054); + ssigpTa->SetBinContent(5543,0.31415); + ssigpTa->SetBinContent(5544,0.321321); + ssigpTa->SetBinContent(5545,0.328835); + ssigpTa->SetBinContent(5546,0.336992); + ssigpTa->SetBinContent(5547,0.34575); + ssigpTa->SetBinContent(5548,0.354857); + ssigpTa->SetBinContent(5549,0.364193); + ssigpTa->SetBinContent(5550,0.373733); + ssigpTa->SetBinContent(5551,0.383522); + ssigpTa->SetBinContent(5552,0.393575); + ssigpTa->SetBinContent(5553,0.403816); + ssigpTa->SetBinContent(5554,0.427522); + ssigpTa->SetBinContent(5555,0.518092); + ssigpTa->SetBinContent(5556,0.676583); + ssigpTa->SetBinContent(5557,0.770843); + ssigpTa->SetBinContent(5558,0.79966); + ssigpTa->SetBinContent(5559,0.815468); + ssigpTa->SetBinContent(5560,0.831396); + ssigpTa->SetBinContent(5561,0.847167); + ssigpTa->SetBinContent(5562,0.862745); + ssigpTa->SetBinContent(5563,0.878671); + ssigpTa->SetBinContent(5564,0.896048); + ssigpTa->SetBinContent(5565,0.915383); + ssigpTa->SetBinContent(5566,0.935974); + ssigpTa->SetBinContent(5567,0.957479); + ssigpTa->SetBinContent(5568,0.979554); + ssigpTa->SetBinContent(5569,1.00156); + ssigpTa->SetBinContent(5570,1.02349); + ssigpTa->SetBinContent(5571,1.0458); + ssigpTa->SetBinContent(5572,1.06899); + ssigpTa->SetBinContent(5573,1.09333); + ssigpTa->SetBinContent(5574,1.11857); + ssigpTa->SetBinContent(5575,1.14423); + ssigpTa->SetBinContent(5576,1.17001); + ssigpTa->SetBinContent(5577,1.19604); + ssigpTa->SetBinContent(5578,1.22191); + ssigpTa->SetBinContent(5579,1.24639); + ssigpTa->SetBinContent(5580,1.26941); + ssigpTa->SetBinContent(5581,1.29201); + ssigpTa->SetBinContent(5582,1.31514); + ssigpTa->SetBinContent(5583,1.33895); + ssigpTa->SetBinContent(5584,1.36273); + ssigpTa->SetBinContent(5585,1.38644); + ssigpTa->SetBinContent(5586,1.41238); + ssigpTa->SetBinContent(5587,1.4429); + ssigpTa->SetBinContent(5588,1.47636); + ssigpTa->SetBinContent(5589,1.51073); + ssigpTa->SetBinContent(5590,1.54536); + ssigpTa->SetBinContent(5591,1.58043); + ssigpTa->SetBinContent(5592,1.61741); + ssigpTa->SetBinContent(5593,1.65788); + ssigpTa->SetBinContent(5594,1.70143); + ssigpTa->SetBinContent(5595,1.74714); + ssigpTa->SetBinContent(5596,1.79355); + ssigpTa->SetBinContent(5597,1.83848); + ssigpTa->SetBinContent(5598,1.88099); + ssigpTa->SetBinContent(5599,1.92165); + ssigpTa->SetBinContent(5600,1.96092); + ssigpTa->SetBinContent(5601,1.99897); + ssigpTa->SetBinContent(5602,2.03665); + ssigpTa->SetBinContent(5603,2.07626); + ssigpTa->SetBinContent(5604,2.12015); + ssigpTa->SetBinContent(5605,2.16743); + ssigpTa->SetBinContent(5606,2.21521); + ssigpTa->SetBinContent(5607,2.26223); + ssigpTa->SetBinContent(5608,2.30847); + ssigpTa->SetBinContent(5609,2.35373); + ssigpTa->SetBinContent(5610,2.39808); + ssigpTa->SetBinContent(5611,2.44145); + ssigpTa->SetBinContent(5612,2.48318); + ssigpTa->SetBinContent(5613,2.52399); + ssigpTa->SetBinContent(5614,2.56774); + ssigpTa->SetBinContent(5615,2.61937); + ssigpTa->SetBinContent(5616,2.67979); + ssigpTa->SetBinContent(5617,2.74633); + ssigpTa->SetBinContent(5618,2.81688); + ssigpTa->SetBinContent(5619,2.93443); + ssigpTa->SetBinContent(5620,3.28599); + ssigpTa->SetBinContent(5621,3.87826); + ssigpTa->SetBinContent(5622,4.24599); + ssigpTa->SetBinContent(5623,4.38731); + ssigpTa->SetBinContent(5624,4.49108); + ssigpTa->SetBinContent(5625,4.60762); + ssigpTa->SetBinContent(5626,4.73545); + ssigpTa->SetBinContent(5627,4.87218); + ssigpTa->SetBinContent(5628,5.0161); + ssigpTa->SetBinContent(5629,5.16282); + ssigpTa->SetBinContent(5630,5.30736); + ssigpTa->SetBinContent(5631,5.45036); + ssigpTa->SetBinContent(5632,5.59774); + ssigpTa->SetBinContent(5633,5.75698); + ssigpTa->SetBinContent(5634,5.92761); + ssigpTa->SetBinContent(5635,6.10417); + ssigpTa->SetBinContent(5636,6.28438); + ssigpTa->SetBinContent(5637,6.4621); + ssigpTa->SetBinContent(5638,6.73522); + ssigpTa->SetBinContent(5639,7.45131); + ssigpTa->SetBinContent(5640,8.54323); + ssigpTa->SetBinContent(5643,0.0189); + ssigpTa->SetBinContent(5644,0.0188975); + ssigpTa->SetBinContent(5645,0.0188968); + ssigpTa->SetBinContent(5646,0.0188968); + ssigpTa->SetBinContent(5647,0.0188968); + ssigpTa->SetBinContent(5648,0.0188968); + ssigpTa->SetBinContent(5649,0.0188968); + ssigpTa->SetBinContent(5650,0.0188968); + ssigpTa->SetBinContent(5651,0.0188968); + ssigpTa->SetBinContent(5652,0.0188968); + ssigpTa->SetBinContent(5653,0.0188992); + ssigpTa->SetBinContent(5654,0.0188992); + ssigpTa->SetBinContent(5655,0.0188992); + ssigpTa->SetBinContent(5656,0.0188992); + ssigpTa->SetBinContent(5657,0.0189064); + ssigpTa->SetBinContent(5658,0.0189192); + ssigpTa->SetBinContent(5659,0.0189352); + ssigpTa->SetBinContent(5660,0.0189472); + ssigpTa->SetBinContent(5661,0.0189632); + ssigpTa->SetBinContent(5662,0.018972); + ssigpTa->SetBinContent(5663,0.0189752); + ssigpTa->SetBinContent(5664,0.0189792); + ssigpTa->SetBinContent(5665,0.0189792); + ssigpTa->SetBinContent(5666,0.0189848); + ssigpTa->SetBinContent(5667,0.0189904); + ssigpTa->SetBinContent(5668,0.0190088); + ssigpTa->SetBinContent(5669,0.0190224); + ssigpTa->SetBinContent(5670,0.0190456); + ssigpTa->SetBinContent(5671,0.019052); + ssigpTa->SetBinContent(5672,0.0190608); + ssigpTa->SetBinContent(5673,0.0190688); + ssigpTa->SetBinContent(5674,0.0190816); + ssigpTa->SetBinContent(5675,0.019088); + ssigpTa->SetBinContent(5676,0.0191112); + ssigpTa->SetBinContent(5677,0.0191328); + ssigpTa->SetBinContent(5678,0.0191488); + ssigpTa->SetBinContent(5679,0.0191544); + ssigpTa->SetBinContent(5680,0.0191576); + ssigpTa->SetBinContent(5681,0.019172); + ssigpTa->SetBinContent(5682,0.0192048); + ssigpTa->SetBinContent(5683,0.019224); + ssigpTa->SetBinContent(5684,0.01924); + ssigpTa->SetBinContent(5685,0.019252); + ssigpTa->SetBinContent(5686,0.0192736); + ssigpTa->SetBinContent(5687,0.0192952); + ssigpTa->SetBinContent(5688,0.0193184); + ssigpTa->SetBinContent(5689,0.01934); + ssigpTa->SetBinContent(5690,0.0193616); + ssigpTa->SetBinContent(5691,0.0193752); + ssigpTa->SetBinContent(5692,0.0193968); + ssigpTa->SetBinContent(5693,0.01942); + ssigpTa->SetBinContent(5694,0.019444); + ssigpTa->SetBinContent(5695,0.0194592); + ssigpTa->SetBinContent(5696,0.0194816); + ssigpTa->SetBinContent(5697,0.0195184); + ssigpTa->SetBinContent(5698,0.0195448); + ssigpTa->SetBinContent(5699,0.0195696); + ssigpTa->SetBinContent(5700,0.0195984); + ssigpTa->SetBinContent(5701,0.0196232); + ssigpTa->SetBinContent(5702,0.019648); + ssigpTa->SetBinContent(5703,0.0196792); + ssigpTa->SetBinContent(5704,0.0197016); + ssigpTa->SetBinContent(5705,0.0197264); + ssigpTa->SetBinContent(5706,0.0197592); + ssigpTa->SetBinContent(5707,0.0197896); + ssigpTa->SetBinContent(5708,0.019812); + ssigpTa->SetBinContent(5709,0.019856); + ssigpTa->SetBinContent(5710,0.019884); + ssigpTa->SetBinContent(5711,0.0199216); + ssigpTa->SetBinContent(5712,0.0199464); + ssigpTa->SetBinContent(5713,0.0199784); + ssigpTa->SetBinContent(5714,0.0200128); + ssigpTa->SetBinContent(5715,0.0200464); + ssigpTa->SetBinContent(5716,0.0200856); + ssigpTa->SetBinContent(5717,0.0201264); + ssigpTa->SetBinContent(5718,0.020164); + ssigpTa->SetBinContent(5719,0.0201992); + ssigpTa->SetBinContent(5720,0.0202424); + ssigpTa->SetBinContent(5721,0.02028); + ssigpTa->SetBinContent(5722,0.020328); + ssigpTa->SetBinContent(5723,0.020356); + ssigpTa->SetBinContent(5724,0.0204104); + ssigpTa->SetBinContent(5725,0.020444); + ssigpTa->SetBinContent(5726,0.020496); + ssigpTa->SetBinContent(5727,0.0205296); + ssigpTa->SetBinContent(5728,0.02058); + ssigpTa->SetBinContent(5729,0.0206176); + ssigpTa->SetBinContent(5730,0.0206656); + ssigpTa->SetBinContent(5731,0.0207064); + ssigpTa->SetBinContent(5732,0.02076); + ssigpTa->SetBinContent(5733,0.0208104); + ssigpTa->SetBinContent(5734,0.0208576); + ssigpTa->SetBinContent(5735,0.0209136); + ssigpTa->SetBinContent(5736,0.0209672); + ssigpTa->SetBinContent(5737,0.0210112); + ssigpTa->SetBinContent(5738,0.0210648); + ssigpTa->SetBinContent(5739,0.021128); + ssigpTa->SetBinContent(5740,0.0211784); + ssigpTa->SetBinContent(5741,0.021236); + ssigpTa->SetBinContent(5742,0.0212824); + ssigpTa->SetBinContent(5743,0.0213336); + ssigpTa->SetBinContent(5744,0.0213984); + ssigpTa->SetBinContent(5745,0.0214648); + ssigpTa->SetBinContent(5746,0.0215336); + ssigpTa->SetBinContent(5747,0.0216184); + ssigpTa->SetBinContent(5748,0.0219568); + ssigpTa->SetBinContent(5749,0.0233624); + ssigpTa->SetBinContent(5750,0.0258608); + ssigpTa->SetBinContent(5751,0.027244); + ssigpTa->SetBinContent(5752,0.0275312); + ssigpTa->SetBinContent(5753,0.027584); + ssigpTa->SetBinContent(5754,0.0276576); + ssigpTa->SetBinContent(5755,0.0277296); + ssigpTa->SetBinContent(5756,0.0277984); + ssigpTa->SetBinContent(5757,0.0278712); + ssigpTa->SetBinContent(5758,0.0279512); + ssigpTa->SetBinContent(5759,0.0278544); + ssigpTa->SetBinContent(5760,0.0269264); + ssigpTa->SetBinContent(5761,0.0252688); + ssigpTa->SetBinContent(5762,0.0246888); + ssigpTa->SetBinContent(5763,0.0250648); + ssigpTa->SetBinContent(5764,0.0256048); + ssigpTa->SetBinContent(5765,0.0261416); + ssigpTa->SetBinContent(5766,0.026688); + ssigpTa->SetBinContent(5767,0.0272472); + ssigpTa->SetBinContent(5768,0.0276312); + ssigpTa->SetBinContent(5769,0.0271352); + ssigpTa->SetBinContent(5770,0.0257336); + ssigpTa->SetBinContent(5771,0.0251472); + ssigpTa->SetBinContent(5772,0.0253552); + ssigpTa->SetBinContent(5773,0.0258224); + ssigpTa->SetBinContent(5774,0.0263592); + ssigpTa->SetBinContent(5775,0.0269216); + ssigpTa->SetBinContent(5776,0.0274904); + ssigpTa->SetBinContent(5777,0.0280752); + ssigpTa->SetBinContent(5778,0.0286816); + ssigpTa->SetBinContent(5779,0.029104); + ssigpTa->SetBinContent(5780,0.0285248); + ssigpTa->SetBinContent(5781,0.0269064); + ssigpTa->SetBinContent(5782,0.0262504); + ssigpTa->SetBinContent(5783,0.0266008); + ssigpTa->SetBinContent(5784,0.0271592); + ssigpTa->SetBinContent(5785,0.0277272); + ssigpTa->SetBinContent(5786,0.0282984); + ssigpTa->SetBinContent(5787,0.0288448); + ssigpTa->SetBinContent(5788,0.0292832); + ssigpTa->SetBinContent(5789,0.0295928); + ssigpTa->SetBinContent(5790,0.02984); + ssigpTa->SetBinContent(5791,0.0291488); + ssigpTa->SetBinContent(5792,0.0274168); + ssigpTa->SetBinContent(5793,0.0267224); + ssigpTa->SetBinContent(5794,0.0270712); + ssigpTa->SetBinContent(5795,0.0276376); + ssigpTa->SetBinContent(5796,0.0282104); + ssigpTa->SetBinContent(5797,0.0287992); + ssigpTa->SetBinContent(5798,0.0294136); + ssigpTa->SetBinContent(5799,0.030036); + ssigpTa->SetBinContent(5800,0.0306672); + ssigpTa->SetBinContent(5801,0.031308); + ssigpTa->SetBinContent(5802,0.0317656); + ssigpTa->SetBinContent(5803,0.0312576); + ssigpTa->SetBinContent(5804,0.02976); + ssigpTa->SetBinContent(5805,0.0291248); + ssigpTa->SetBinContent(5806,0.0290656); + ssigpTa->SetBinContent(5807,0.028792); + ssigpTa->SetBinContent(5808,0.0289112); + ssigpTa->SetBinContent(5809,0.0294304); + ssigpTa->SetBinContent(5810,0.0300576); + ssigpTa->SetBinContent(5811,0.030688); + ssigpTa->SetBinContent(5812,0.031328); + ssigpTa->SetBinContent(5813,0.031808); + ssigpTa->SetBinContent(5814,0.0314528); + ssigpTa->SetBinContent(5815,0.0302088); + ssigpTa->SetBinContent(5816,0.0298224); + ssigpTa->SetBinContent(5817,0.03032); + ssigpTa->SetBinContent(5818,0.0310304); + ssigpTa->SetBinContent(5819,0.0317176); + ssigpTa->SetBinContent(5820,0.0323248); + ssigpTa->SetBinContent(5821,0.032732); + ssigpTa->SetBinContent(5822,0.0329248); + ssigpTa->SetBinContent(5823,0.0333504); + ssigpTa->SetBinContent(5824,0.033988); + ssigpTa->SetBinContent(5825,0.0346952); + ssigpTa->SetBinContent(5826,0.0352896); + ssigpTa->SetBinContent(5827,0.0353296); + ssigpTa->SetBinContent(5828,0.034652); + ssigpTa->SetBinContent(5829,0.0337664); + ssigpTa->SetBinContent(5830,0.0326616); + ssigpTa->SetBinContent(5831,0.0323776); + ssigpTa->SetBinContent(5832,0.03284); + ssigpTa->SetBinContent(5833,0.033472); + ssigpTa->SetBinContent(5834,0.0341144); + ssigpTa->SetBinContent(5835,0.034744); + ssigpTa->SetBinContent(5836,0.0353552); + ssigpTa->SetBinContent(5837,0.0359856); + ssigpTa->SetBinContent(5838,0.0366528); + ssigpTa->SetBinContent(5839,0.0373584); + ssigpTa->SetBinContent(5840,0.0380784); + ssigpTa->SetBinContent(5841,0.0388128); + ssigpTa->SetBinContent(5842,0.0395656); + ssigpTa->SetBinContent(5843,0.0403352); + ssigpTa->SetBinContent(5844,0.041204); + ssigpTa->SetBinContent(5845,0.0421696); + ssigpTa->SetBinContent(5846,0.0431048); + ssigpTa->SetBinContent(5847,0.0439768); + ssigpTa->SetBinContent(5848,0.0447776); + ssigpTa->SetBinContent(5849,0.0455192); + ssigpTa->SetBinContent(5850,0.0463424); + ssigpTa->SetBinContent(5851,0.0472584); + ssigpTa->SetBinContent(5852,0.048208); + ssigpTa->SetBinContent(5853,0.0491648); + ssigpTa->SetBinContent(5854,0.0501776); + ssigpTa->SetBinContent(5855,0.0513504); + ssigpTa->SetBinContent(5856,0.0527064); + ssigpTa->SetBinContent(5857,0.0539672); + ssigpTa->SetBinContent(5858,0.055104); + ssigpTa->SetBinContent(5859,0.0560976); + ssigpTa->SetBinContent(5860,0.0569264); + ssigpTa->SetBinContent(5861,0.0578976); + ssigpTa->SetBinContent(5862,0.0590376); + ssigpTa->SetBinContent(5863,0.0602344); + ssigpTa->SetBinContent(5864,0.0614736); + ssigpTa->SetBinContent(5865,0.06276); + ssigpTa->SetBinContent(5866,0.0640272); + ssigpTa->SetBinContent(5867,0.0649872); + ssigpTa->SetBinContent(5868,0.0656304); + ssigpTa->SetBinContent(5869,0.06656); + ssigpTa->SetBinContent(5870,0.0676032); + ssigpTa->SetBinContent(5871,0.0685064); + ssigpTa->SetBinContent(5872,0.0696656); + ssigpTa->SetBinContent(5873,0.0710864); + ssigpTa->SetBinContent(5874,0.0725728); + ssigpTa->SetBinContent(5875,0.0740824); + ssigpTa->SetBinContent(5876,0.0756112); + ssigpTa->SetBinContent(5877,0.0771616); + ssigpTa->SetBinContent(5878,0.0787576); + ssigpTa->SetBinContent(5879,0.0803984); + ssigpTa->SetBinContent(5880,0.081972); + ssigpTa->SetBinContent(5881,0.0833816); + ssigpTa->SetBinContent(5882,0.0849392); + ssigpTa->SetBinContent(5883,0.0866984); + ssigpTa->SetBinContent(5884,0.0885176); + ssigpTa->SetBinContent(5885,0.09036); + ssigpTa->SetBinContent(5886,0.092232); + ssigpTa->SetBinContent(5887,0.0941544); + ssigpTa->SetBinContent(5888,0.0961664); + ssigpTa->SetBinContent(5889,0.098276); + ssigpTa->SetBinContent(5890,0.100441); + ssigpTa->SetBinContent(5891,0.102612); + ssigpTa->SetBinContent(5892,0.104709); + ssigpTa->SetBinContent(5893,0.106791); + ssigpTa->SetBinContent(5894,0.108993); + ssigpTa->SetBinContent(5895,0.11128); + ssigpTa->SetBinContent(5896,0.113638); + ssigpTa->SetBinContent(5897,0.116058); + ssigpTa->SetBinContent(5898,0.118637); + ssigpTa->SetBinContent(5899,0.121304); + ssigpTa->SetBinContent(5900,0.124084); + ssigpTa->SetBinContent(5901,0.12705); + ssigpTa->SetBinContent(5902,0.130203); + ssigpTa->SetBinContent(5903,0.133412); + ssigpTa->SetBinContent(5904,0.137382); + ssigpTa->SetBinContent(5905,0.142264); + ssigpTa->SetBinContent(5906,0.146397); + ssigpTa->SetBinContent(5907,0.149772); + ssigpTa->SetBinContent(5908,0.153116); + ssigpTa->SetBinContent(5909,0.156644); + ssigpTa->SetBinContent(5910,0.160322); + ssigpTa->SetBinContent(5911,0.16414); + ssigpTa->SetBinContent(5912,0.16802); + ssigpTa->SetBinContent(5913,0.171941); + ssigpTa->SetBinContent(5914,0.175888); + ssigpTa->SetBinContent(5915,0.179879); + ssigpTa->SetBinContent(5916,0.18397); + ssigpTa->SetBinContent(5917,0.191098); + ssigpTa->SetBinContent(5918,0.211366); + ssigpTa->SetBinContent(5919,0.23871); + ssigpTa->SetBinContent(5920,0.244216); + ssigpTa->SetBinContent(5921,0.243518); + ssigpTa->SetBinContent(5922,0.248069); + ssigpTa->SetBinContent(5923,0.254374); + ssigpTa->SetBinContent(5924,0.260798); + ssigpTa->SetBinContent(5925,0.267276); + ssigpTa->SetBinContent(5926,0.273828); + ssigpTa->SetBinContent(5927,0.280518); + ssigpTa->SetBinContent(5928,0.285856); + ssigpTa->SetBinContent(5929,0.283882); + ssigpTa->SetBinContent(5930,0.27438); + ssigpTa->SetBinContent(5931,0.271933); + ssigpTa->SetBinContent(5932,0.276826); + ssigpTa->SetBinContent(5933,0.28355); + ssigpTa->SetBinContent(5934,0.290826); + ssigpTa->SetBinContent(5935,0.298442); + ssigpTa->SetBinContent(5936,0.305014); + ssigpTa->SetBinContent(5937,0.305754); + ssigpTa->SetBinContent(5938,0.300517); + ssigpTa->SetBinContent(5939,0.301021); + ssigpTa->SetBinContent(5940,0.30731); + ssigpTa->SetBinContent(5941,0.314794); + ssigpTa->SetBinContent(5942,0.32241); + ssigpTa->SetBinContent(5943,0.330178); + ssigpTa->SetBinContent(5944,0.338092); + ssigpTa->SetBinContent(5945,0.346126); + ssigpTa->SetBinContent(5946,0.354238); + ssigpTa->SetBinContent(5947,0.36243); + ssigpTa->SetBinContent(5948,0.370999); + ssigpTa->SetBinContent(5949,0.380316); + ssigpTa->SetBinContent(5950,0.390302); + ssigpTa->SetBinContent(5951,0.400694); + ssigpTa->SetBinContent(5952,0.411356); + ssigpTa->SetBinContent(5953,0.422238); + ssigpTa->SetBinContent(5954,0.433403); + ssigpTa->SetBinContent(5955,0.444874); + ssigpTa->SetBinContent(5956,0.456572); + ssigpTa->SetBinContent(5957,0.483653); + ssigpTa->SetBinContent(5958,0.587238); + ssigpTa->SetBinContent(5959,0.768486); + ssigpTa->SetBinContent(5960,0.87628); + ssigpTa->SetBinContent(5961,0.909226); + ssigpTa->SetBinContent(5962,0.927287); + ssigpTa->SetBinContent(5963,0.945489); + ssigpTa->SetBinContent(5964,0.963521); + ssigpTa->SetBinContent(5965,0.981322); + ssigpTa->SetBinContent(5966,0.999525); + ssigpTa->SetBinContent(5967,1.01938); + ssigpTa->SetBinContent(5968,1.04147); + ssigpTa->SetBinContent(5969,1.06498); + ssigpTa->SetBinContent(5970,1.08954); + ssigpTa->SetBinContent(5971,1.11474); + ssigpTa->SetBinContent(5972,1.13989); + ssigpTa->SetBinContent(5973,1.16494); + ssigpTa->SetBinContent(5974,1.19042); + ssigpTa->SetBinContent(5975,1.21691); + ssigpTa->SetBinContent(5976,1.24471); + ssigpTa->SetBinContent(5977,1.27354); + ssigpTa->SetBinContent(5978,1.30286); + ssigpTa->SetBinContent(5979,1.3323); + ssigpTa->SetBinContent(5980,1.36203); + ssigpTa->SetBinContent(5981,1.39159); + ssigpTa->SetBinContent(5982,1.41958); + ssigpTa->SetBinContent(5983,1.4459); + ssigpTa->SetBinContent(5984,1.47173); + ssigpTa->SetBinContent(5985,1.49819); + ssigpTa->SetBinContent(5986,1.52539); + ssigpTa->SetBinContent(5987,1.55258); + ssigpTa->SetBinContent(5988,1.57968); + ssigpTa->SetBinContent(5989,1.60933); + ssigpTa->SetBinContent(5990,1.64419); + ssigpTa->SetBinContent(5991,1.68241); + ssigpTa->SetBinContent(5992,1.72166); + ssigpTa->SetBinContent(5993,1.76123); + ssigpTa->SetBinContent(5994,1.80129); + ssigpTa->SetBinContent(5995,1.84355); + ssigpTa->SetBinContent(5996,1.88976); + ssigpTa->SetBinContent(5997,1.93951); + ssigpTa->SetBinContent(5998,1.9917); + ssigpTa->SetBinContent(5999,2.04471); + ssigpTa->SetBinContent(6000,2.09602); + ssigpTa->SetBinContent(6001,2.14458); + ssigpTa->SetBinContent(6002,2.19105); + ssigpTa->SetBinContent(6003,2.23593); + ssigpTa->SetBinContent(6004,2.27942); + ssigpTa->SetBinContent(6005,2.32249); + ssigpTa->SetBinContent(6006,2.36777); + ssigpTa->SetBinContent(6007,2.41792); + ssigpTa->SetBinContent(6008,2.47196); + ssigpTa->SetBinContent(6009,2.52655); + ssigpTa->SetBinContent(6010,2.5803); + ssigpTa->SetBinContent(6011,2.63312); + ssigpTa->SetBinContent(6012,2.68486); + ssigpTa->SetBinContent(6013,2.73555); + ssigpTa->SetBinContent(6014,2.78512); + ssigpTa->SetBinContent(6015,2.83282); + ssigpTa->SetBinContent(6016,2.87948); + ssigpTa->SetBinContent(6017,2.92948); + ssigpTa->SetBinContent(6018,2.98848); + ssigpTa->SetBinContent(6019,3.05751); + ssigpTa->SetBinContent(6020,3.13352); + ssigpTa->SetBinContent(6021,3.21411); + ssigpTa->SetBinContent(6022,3.34841); + ssigpTa->SetBinContent(6023,3.75021); + ssigpTa->SetBinContent(6024,4.42715); + ssigpTa->SetBinContent(6025,4.84744); + ssigpTa->SetBinContent(6026,5.00894); + ssigpTa->SetBinContent(6027,5.12751); + ssigpTa->SetBinContent(6028,5.26066); + ssigpTa->SetBinContent(6029,5.4067); + ssigpTa->SetBinContent(6030,5.56293); + ssigpTa->SetBinContent(6031,5.72735); + ssigpTa->SetBinContent(6032,5.89499); + ssigpTa->SetBinContent(6033,6.06014); + ssigpTa->SetBinContent(6034,6.22352); + ssigpTa->SetBinContent(6035,6.39193); + ssigpTa->SetBinContent(6036,6.57387); + ssigpTa->SetBinContent(6037,6.76883); + ssigpTa->SetBinContent(6038,6.97055); + ssigpTa->SetBinContent(6039,7.17647); + ssigpTa->SetBinContent(6040,7.37953); + ssigpTa->SetBinContent(6041,7.69166); + ssigpTa->SetBinContent(6042,8.51006); + ssigpTa->SetBinContent(6043,9.75801); + ssigpTa->SetBinContent(6046,0.0213622); + ssigpTa->SetBinContent(6047,0.0211392); + ssigpTa->SetBinContent(6048,0.0211108); + ssigpTa->SetBinContent(6049,0.0211108); + ssigpTa->SetBinContent(6050,0.0211108); + ssigpTa->SetBinContent(6051,0.0211108); + ssigpTa->SetBinContent(6052,0.0211108); + ssigpTa->SetBinContent(6053,0.0211108); + ssigpTa->SetBinContent(6054,0.0211108); + ssigpTa->SetBinContent(6055,0.0211108); + ssigpTa->SetBinContent(6056,0.0211108); + ssigpTa->SetBinContent(6057,0.0211108); + ssigpTa->SetBinContent(6058,0.0211108); + ssigpTa->SetBinContent(6059,0.0211144); + ssigpTa->SetBinContent(6060,0.0211216); + ssigpTa->SetBinContent(6061,0.0211396); + ssigpTa->SetBinContent(6062,0.0211496); + ssigpTa->SetBinContent(6063,0.0211596); + ssigpTa->SetBinContent(6064,0.021166); + ssigpTa->SetBinContent(6065,0.0211724); + ssigpTa->SetBinContent(6066,0.0211804); + ssigpTa->SetBinContent(6067,0.0211884); + ssigpTa->SetBinContent(6068,0.0211964); + ssigpTa->SetBinContent(6069,0.0211964); + ssigpTa->SetBinContent(6070,0.0212028); + ssigpTa->SetBinContent(6071,0.02121); + ssigpTa->SetBinContent(6072,0.0212344); + ssigpTa->SetBinContent(6073,0.021248); + ssigpTa->SetBinContent(6074,0.021258); + ssigpTa->SetBinContent(6075,0.021258); + ssigpTa->SetBinContent(6076,0.0212768); + ssigpTa->SetBinContent(6077,0.0212848); + ssigpTa->SetBinContent(6078,0.0213028); + ssigpTa->SetBinContent(6079,0.0213164); + ssigpTa->SetBinContent(6080,0.0213408); + ssigpTa->SetBinContent(6081,0.0213508); + ssigpTa->SetBinContent(6082,0.0213544); + ssigpTa->SetBinContent(6083,0.0213544); + ssigpTa->SetBinContent(6084,0.0213724); + ssigpTa->SetBinContent(6085,0.0213968); + ssigpTa->SetBinContent(6086,0.0214292); + ssigpTa->SetBinContent(6087,0.0214364); + ssigpTa->SetBinContent(6088,0.0214464); + ssigpTa->SetBinContent(6089,0.0214592); + ssigpTa->SetBinContent(6090,0.0214808); + ssigpTa->SetBinContent(6091,0.0215068); + ssigpTa->SetBinContent(6092,0.0215392); + ssigpTa->SetBinContent(6093,0.0215528); + ssigpTa->SetBinContent(6094,0.0215664); + ssigpTa->SetBinContent(6095,0.0215924); + ssigpTa->SetBinContent(6096,0.0216168); + ssigpTa->SetBinContent(6097,0.0216348); + ssigpTa->SetBinContent(6098,0.0216448); + ssigpTa->SetBinContent(6099,0.0216612); + ssigpTa->SetBinContent(6100,0.0216936); + ssigpTa->SetBinContent(6101,0.0217216); + ssigpTa->SetBinContent(6102,0.0217468); + ssigpTa->SetBinContent(6103,0.0217792); + ssigpTa->SetBinContent(6104,0.0218036); + ssigpTa->SetBinContent(6105,0.0218252); + ssigpTa->SetBinContent(6106,0.0218496); + ssigpTa->SetBinContent(6107,0.021874); + ssigpTa->SetBinContent(6108,0.0218992); + ssigpTa->SetBinContent(6109,0.0219272); + ssigpTa->SetBinContent(6110,0.0219596); + ssigpTa->SetBinContent(6111,0.0219956); + ssigpTa->SetBinContent(6112,0.0220208); + ssigpTa->SetBinContent(6113,0.0220624); + ssigpTa->SetBinContent(6114,0.0220796); + ssigpTa->SetBinContent(6115,0.0221076); + ssigpTa->SetBinContent(6116,0.02214); + ssigpTa->SetBinContent(6117,0.022168); + ssigpTa->SetBinContent(6118,0.0222076); + ssigpTa->SetBinContent(6119,0.0222464); + ssigpTa->SetBinContent(6120,0.0222816); + ssigpTa->SetBinContent(6121,0.0223204); + ssigpTa->SetBinContent(6122,0.022352); + ssigpTa->SetBinContent(6123,0.022388); + ssigpTa->SetBinContent(6124,0.0224332); + ssigpTa->SetBinContent(6125,0.02247); + ssigpTa->SetBinContent(6126,0.0225188); + ssigpTa->SetBinContent(6127,0.0225476); + ssigpTa->SetBinContent(6128,0.0226044); + ssigpTa->SetBinContent(6129,0.022636); + ssigpTa->SetBinContent(6130,0.02269); + ssigpTa->SetBinContent(6131,0.0227216); + ssigpTa->SetBinContent(6132,0.0227704); + ssigpTa->SetBinContent(6133,0.0228072); + ssigpTa->SetBinContent(6134,0.022856); + ssigpTa->SetBinContent(6135,0.02291); + ssigpTa->SetBinContent(6136,0.022956); + ssigpTa->SetBinContent(6137,0.023002); + ssigpTa->SetBinContent(6138,0.0230508); + ssigpTa->SetBinContent(6139,0.0231048); + ssigpTa->SetBinContent(6140,0.0231508); + ssigpTa->SetBinContent(6141,0.0232004); + ssigpTa->SetBinContent(6142,0.0232528); + ssigpTa->SetBinContent(6143,0.0233212); + ssigpTa->SetBinContent(6144,0.0233628); + ssigpTa->SetBinContent(6145,0.0234168); + ssigpTa->SetBinContent(6146,0.0234664); + ssigpTa->SetBinContent(6147,0.0235268); + ssigpTa->SetBinContent(6148,0.0235856); + ssigpTa->SetBinContent(6149,0.0236424); + ssigpTa->SetBinContent(6150,0.0237308); + ssigpTa->SetBinContent(6151,0.0240732); + ssigpTa->SetBinContent(6152,0.025668); + ssigpTa->SetBinContent(6153,0.0288052); + ssigpTa->SetBinContent(6154,0.0303856); + ssigpTa->SetBinContent(6155,0.0306828); + ssigpTa->SetBinContent(6156,0.0307548); + ssigpTa->SetBinContent(6157,0.0308188); + ssigpTa->SetBinContent(6158,0.0308972); + ssigpTa->SetBinContent(6159,0.0309568); + ssigpTa->SetBinContent(6160,0.0310272); + ssigpTa->SetBinContent(6161,0.0311092); + ssigpTa->SetBinContent(6162,0.0309888); + ssigpTa->SetBinContent(6163,0.02991); + ssigpTa->SetBinContent(6164,0.0277752); + ssigpTa->SetBinContent(6165,0.0271568); + ssigpTa->SetBinContent(6166,0.0275996); + ssigpTa->SetBinContent(6167,0.0282288); + ssigpTa->SetBinContent(6168,0.0288516); + ssigpTa->SetBinContent(6169,0.0294932); + ssigpTa->SetBinContent(6170,0.0301448); + ssigpTa->SetBinContent(6171,0.0305824); + ssigpTa->SetBinContent(6172,0.0300148); + ssigpTa->SetBinContent(6173,0.0281836); + ssigpTa->SetBinContent(6174,0.0275176); + ssigpTa->SetBinContent(6175,0.0278168); + ssigpTa->SetBinContent(6176,0.0283648); + ssigpTa->SetBinContent(6177,0.028986); + ssigpTa->SetBinContent(6178,0.0296376); + ssigpTa->SetBinContent(6179,0.0302964); + ssigpTa->SetBinContent(6180,0.030968); + ssigpTa->SetBinContent(6181,0.0316656); + ssigpTa->SetBinContent(6182,0.0321544); + ssigpTa->SetBinContent(6183,0.0315048); + ssigpTa->SetBinContent(6184,0.0293972); + ssigpTa->SetBinContent(6185,0.0286504); + ssigpTa->SetBinContent(6186,0.0290412); + ssigpTa->SetBinContent(6187,0.0296796); + ssigpTa->SetBinContent(6188,0.0303268); + ssigpTa->SetBinContent(6189,0.030982); + ssigpTa->SetBinContent(6190,0.0316284); + ssigpTa->SetBinContent(6191,0.0321824); + ssigpTa->SetBinContent(6192,0.0327096); + ssigpTa->SetBinContent(6193,0.0330512); + ssigpTa->SetBinContent(6194,0.0322856); + ssigpTa->SetBinContent(6195,0.0300588); + ssigpTa->SetBinContent(6196,0.0292556); + ssigpTa->SetBinContent(6197,0.029642); + ssigpTa->SetBinContent(6198,0.030266); + ssigpTa->SetBinContent(6199,0.0309044); + ssigpTa->SetBinContent(6200,0.0315564); + ssigpTa->SetBinContent(6201,0.0322424); + ssigpTa->SetBinContent(6202,0.0329412); + ssigpTa->SetBinContent(6203,0.0336524); + ssigpTa->SetBinContent(6204,0.03437); + ssigpTa->SetBinContent(6205,0.0348788); + ssigpTa->SetBinContent(6206,0.0342684); + ssigpTa->SetBinContent(6207,0.0322468); + ssigpTa->SetBinContent(6208,0.0315212); + ssigpTa->SetBinContent(6209,0.0315708); + ssigpTa->SetBinContent(6210,0.0316208); + ssigpTa->SetBinContent(6211,0.031896); + ssigpTa->SetBinContent(6212,0.0325092); + ssigpTa->SetBinContent(6213,0.0331972); + ssigpTa->SetBinContent(6214,0.0339076); + ssigpTa->SetBinContent(6215,0.0346108); + ssigpTa->SetBinContent(6216,0.0351476); + ssigpTa->SetBinContent(6217,0.0346928); + ssigpTa->SetBinContent(6218,0.0329864); + ssigpTa->SetBinContent(6219,0.032484); + ssigpTa->SetBinContent(6220,0.0329772); + ssigpTa->SetBinContent(6221,0.033614); + ssigpTa->SetBinContent(6222,0.0343248); + ssigpTa->SetBinContent(6223,0.0350056); + ssigpTa->SetBinContent(6224,0.035496); + ssigpTa->SetBinContent(6225,0.0358756); + ssigpTa->SetBinContent(6226,0.0363992); + ssigpTa->SetBinContent(6227,0.0371376); + ssigpTa->SetBinContent(6228,0.0379128); + ssigpTa->SetBinContent(6229,0.038572); + ssigpTa->SetBinContent(6230,0.0385424); + ssigpTa->SetBinContent(6231,0.0374796); + ssigpTa->SetBinContent(6232,0.0366336); + ssigpTa->SetBinContent(6233,0.0359164); + ssigpTa->SetBinContent(6234,0.0358292); + ssigpTa->SetBinContent(6235,0.0363928); + ssigpTa->SetBinContent(6236,0.0371228); + ssigpTa->SetBinContent(6237,0.0378536); + ssigpTa->SetBinContent(6238,0.038506); + ssigpTa->SetBinContent(6239,0.0390088); + ssigpTa->SetBinContent(6240,0.03967); + ssigpTa->SetBinContent(6241,0.0404324); + ssigpTa->SetBinContent(6242,0.0412416); + ssigpTa->SetBinContent(6243,0.0420804); + ssigpTa->SetBinContent(6244,0.0429212); + ssigpTa->SetBinContent(6245,0.0437764); + ssigpTa->SetBinContent(6246,0.044674); + ssigpTa->SetBinContent(6247,0.0457372); + ssigpTa->SetBinContent(6248,0.047092); + ssigpTa->SetBinContent(6249,0.0482416); + ssigpTa->SetBinContent(6250,0.0492408); + ssigpTa->SetBinContent(6251,0.0500804); + ssigpTa->SetBinContent(6252,0.0506436); + ssigpTa->SetBinContent(6253,0.0514924); + ssigpTa->SetBinContent(6254,0.0525348); + ssigpTa->SetBinContent(6255,0.0536124); + ssigpTa->SetBinContent(6256,0.054716); + ssigpTa->SetBinContent(6257,0.0558844); + ssigpTa->SetBinContent(6258,0.0573176); + ssigpTa->SetBinContent(6259,0.0591152); + ssigpTa->SetBinContent(6260,0.060634); + ssigpTa->SetBinContent(6261,0.0619428); + ssigpTa->SetBinContent(6262,0.0629744); + ssigpTa->SetBinContent(6263,0.0635992); + ssigpTa->SetBinContent(6264,0.0646128); + ssigpTa->SetBinContent(6265,0.0658992); + ssigpTa->SetBinContent(6266,0.067272); + ssigpTa->SetBinContent(6267,0.0686844); + ssigpTa->SetBinContent(6268,0.0701696); + ssigpTa->SetBinContent(6269,0.0716388); + ssigpTa->SetBinContent(6270,0.0729328); + ssigpTa->SetBinContent(6271,0.0741616); + ssigpTa->SetBinContent(6272,0.075422); + ssigpTa->SetBinContent(6273,0.0765792); + ssigpTa->SetBinContent(6274,0.0772672); + ssigpTa->SetBinContent(6275,0.078512); + ssigpTa->SetBinContent(6276,0.0801464); + ssigpTa->SetBinContent(6277,0.0818844); + ssigpTa->SetBinContent(6278,0.0836368); + ssigpTa->SetBinContent(6279,0.0854072); + ssigpTa->SetBinContent(6280,0.0872288); + ssigpTa->SetBinContent(6281,0.0890784); + ssigpTa->SetBinContent(6282,0.0910096); + ssigpTa->SetBinContent(6283,0.092866); + ssigpTa->SetBinContent(6284,0.0941952); + ssigpTa->SetBinContent(6285,0.0959348); + ssigpTa->SetBinContent(6286,0.0979564); + ssigpTa->SetBinContent(6287,0.100084); + ssigpTa->SetBinContent(6288,0.102237); + ssigpTa->SetBinContent(6289,0.104418); + ssigpTa->SetBinContent(6290,0.10666); + ssigpTa->SetBinContent(6291,0.108999); + ssigpTa->SetBinContent(6292,0.111442); + ssigpTa->SetBinContent(6293,0.113953); + ssigpTa->SetBinContent(6294,0.116403); + ssigpTa->SetBinContent(6295,0.118624); + ssigpTa->SetBinContent(6296,0.121017); + ssigpTa->SetBinContent(6297,0.123581); + ssigpTa->SetBinContent(6298,0.126261); + ssigpTa->SetBinContent(6299,0.12899); + ssigpTa->SetBinContent(6300,0.131837); + ssigpTa->SetBinContent(6301,0.134817); + ssigpTa->SetBinContent(6302,0.137944); + ssigpTa->SetBinContent(6303,0.141158); + ssigpTa->SetBinContent(6304,0.144551); + ssigpTa->SetBinContent(6305,0.14807); + ssigpTa->SetBinContent(6306,0.15174); + ssigpTa->SetBinContent(6307,0.15635); + ssigpTa->SetBinContent(6308,0.162267); + ssigpTa->SetBinContent(6309,0.167074); + ssigpTa->SetBinContent(6310,0.171015); + ssigpTa->SetBinContent(6311,0.174909); + ssigpTa->SetBinContent(6312,0.179016); + ssigpTa->SetBinContent(6313,0.183267); + ssigpTa->SetBinContent(6314,0.187612); + ssigpTa->SetBinContent(6315,0.19209); + ssigpTa->SetBinContent(6316,0.196654); + ssigpTa->SetBinContent(6317,0.201253); + ssigpTa->SetBinContent(6318,0.205895); + ssigpTa->SetBinContent(6319,0.210672); + ssigpTa->SetBinContent(6320,0.2189); + ssigpTa->SetBinContent(6321,0.242124); + ssigpTa->SetBinContent(6322,0.277006); + ssigpTa->SetBinContent(6323,0.281662); + ssigpTa->SetBinContent(6324,0.281069); + ssigpTa->SetBinContent(6325,0.286428); + ssigpTa->SetBinContent(6326,0.293788); + ssigpTa->SetBinContent(6327,0.301275); + ssigpTa->SetBinContent(6328,0.308832); + ssigpTa->SetBinContent(6329,0.316481); + ssigpTa->SetBinContent(6330,0.32428); + ssigpTa->SetBinContent(6331,0.330561); + ssigpTa->SetBinContent(6332,0.328503); + ssigpTa->SetBinContent(6333,0.31612); + ssigpTa->SetBinContent(6334,0.313504); + ssigpTa->SetBinContent(6335,0.319248); + ssigpTa->SetBinContent(6336,0.32708); + ssigpTa->SetBinContent(6337,0.335585); + ssigpTa->SetBinContent(6338,0.34446); + ssigpTa->SetBinContent(6339,0.352155); + ssigpTa->SetBinContent(6340,0.353198); + ssigpTa->SetBinContent(6341,0.346071); + ssigpTa->SetBinContent(6342,0.347354); + ssigpTa->SetBinContent(6343,0.354904); + ssigpTa->SetBinContent(6344,0.363684); + ssigpTa->SetBinContent(6345,0.372575); + ssigpTa->SetBinContent(6346,0.381668); + ssigpTa->SetBinContent(6347,0.390909); + ssigpTa->SetBinContent(6348,0.400322); + ssigpTa->SetBinContent(6349,0.409805); + ssigpTa->SetBinContent(6350,0.419385); + ssigpTa->SetBinContent(6351,0.429399); + ssigpTa->SetBinContent(6352,0.440278); + ssigpTa->SetBinContent(6353,0.451962); + ssigpTa->SetBinContent(6354,0.464107); + ssigpTa->SetBinContent(6355,0.47657); + ssigpTa->SetBinContent(6356,0.48928); + ssigpTa->SetBinContent(6357,0.502325); + ssigpTa->SetBinContent(6358,0.515734); + ssigpTa->SetBinContent(6359,0.529402); + ssigpTa->SetBinContent(6360,0.560419); + ssigpTa->SetBinContent(6361,0.677531); + ssigpTa->SetBinContent(6362,0.899293); + ssigpTa->SetBinContent(6363,1.02144); + ssigpTa->SetBinContent(6364,1.05931); + ssigpTa->SetBinContent(6365,1.08044); + ssigpTa->SetBinContent(6366,1.10175); + ssigpTa->SetBinContent(6367,1.12284); + ssigpTa->SetBinContent(6368,1.14367); + ssigpTa->SetBinContent(6369,1.16494); + ssigpTa->SetBinContent(6370,1.18814); + ssigpTa->SetBinContent(6371,1.21401); + ssigpTa->SetBinContent(6372,1.24149); + ssigpTa->SetBinContent(6373,1.27021); + ssigpTa->SetBinContent(6374,1.29972); + ssigpTa->SetBinContent(6375,1.32912); + ssigpTa->SetBinContent(6376,1.35842); + ssigpTa->SetBinContent(6377,1.38821); + ssigpTa->SetBinContent(6378,1.41918); + ssigpTa->SetBinContent(6379,1.4517); + ssigpTa->SetBinContent(6380,1.48542); + ssigpTa->SetBinContent(6381,1.51972); + ssigpTa->SetBinContent(6382,1.55412); + ssigpTa->SetBinContent(6383,1.5889); + ssigpTa->SetBinContent(6384,1.62355); + ssigpTa->SetBinContent(6385,1.65628); + ssigpTa->SetBinContent(6386,1.68706); + ssigpTa->SetBinContent(6387,1.71728); + ssigpTa->SetBinContent(6388,1.74824); + ssigpTa->SetBinContent(6389,1.7801); + ssigpTa->SetBinContent(6390,1.81193); + ssigpTa->SetBinContent(6391,1.84359); + ssigpTa->SetBinContent(6392,1.87814); + ssigpTa->SetBinContent(6393,1.91904); + ssigpTa->SetBinContent(6394,1.96376); + ssigpTa->SetBinContent(6395,2.00968); + ssigpTa->SetBinContent(6396,2.05595); + ssigpTa->SetBinContent(6397,2.10279); + ssigpTa->SetBinContent(6398,2.15212); + ssigpTa->SetBinContent(6399,2.20624); + ssigpTa->SetBinContent(6400,2.26439); + ssigpTa->SetBinContent(6401,2.32545); + ssigpTa->SetBinContent(6402,2.3875); + ssigpTa->SetBinContent(6403,2.44754); + ssigpTa->SetBinContent(6404,2.50431); + ssigpTa->SetBinContent(6405,2.55867); + ssigpTa->SetBinContent(6406,2.61118); + ssigpTa->SetBinContent(6407,2.66205); + ssigpTa->SetBinContent(6408,2.71242); + ssigpTa->SetBinContent(6409,2.7653); + ssigpTa->SetBinContent(6410,2.82401); + ssigpTa->SetBinContent(6411,2.88732); + ssigpTa->SetBinContent(6412,2.95119); + ssigpTa->SetBinContent(6413,3.01405); + ssigpTa->SetBinContent(6414,3.07589); + ssigpTa->SetBinContent(6415,3.1364); + ssigpTa->SetBinContent(6416,3.1957); + ssigpTa->SetBinContent(6417,3.25375); + ssigpTa->SetBinContent(6418,3.30959); + ssigpTa->SetBinContent(6419,3.36409); + ssigpTa->SetBinContent(6420,3.42245); + ssigpTa->SetBinContent(6421,3.49143); + ssigpTa->SetBinContent(6422,3.57233); + ssigpTa->SetBinContent(6423,3.66116); + ssigpTa->SetBinContent(6424,3.75557); + ssigpTa->SetBinContent(6425,3.91036); + ssigpTa->SetBinContent(6426,4.3657); + ssigpTa->SetBinContent(6427,5.19147); + ssigpTa->SetBinContent(6428,5.66894); + ssigpTa->SetBinContent(6429,5.8554); + ssigpTa->SetBinContent(6430,5.99392); + ssigpTa->SetBinContent(6431,6.14981); + ssigpTa->SetBinContent(6432,6.3207); + ssigpTa->SetBinContent(6433,6.50342); + ssigpTa->SetBinContent(6434,6.69586); + ssigpTa->SetBinContent(6435,6.89215); + ssigpTa->SetBinContent(6436,7.08524); + ssigpTa->SetBinContent(6437,7.2763); + ssigpTa->SetBinContent(6438,7.47298); + ssigpTa->SetBinContent(6439,7.68587); + ssigpTa->SetBinContent(6440,7.91415); + ssigpTa->SetBinContent(6441,8.15008); + ssigpTa->SetBinContent(6442,8.39097); + ssigpTa->SetBinContent(6443,8.62902); + ssigpTa->SetBinContent(6444,8.98864); + ssigpTa->SetBinContent(6445,9.93057); + ssigpTa->SetBinContent(6446,11.6634); + ssigpTa->SetBinContent(6449,0.0295889); + ssigpTa->SetBinContent(6450,0.0290525); + ssigpTa->SetBinContent(6451,0.0287744); + ssigpTa->SetBinContent(6452,0.0287744); + ssigpTa->SetBinContent(6453,0.0287744); + ssigpTa->SetBinContent(6454,0.0287744); + ssigpTa->SetBinContent(6455,0.0287744); + ssigpTa->SetBinContent(6456,0.0287744); + ssigpTa->SetBinContent(6457,0.0287744); + ssigpTa->SetBinContent(6458,0.0287744); + ssigpTa->SetBinContent(6459,0.0287744); + ssigpTa->SetBinContent(6460,0.0287744); + ssigpTa->SetBinContent(6461,0.0287744); + ssigpTa->SetBinContent(6462,0.0287744); + ssigpTa->SetBinContent(6463,0.0287816); + ssigpTa->SetBinContent(6464,0.0287888); + ssigpTa->SetBinContent(6465,0.028796); + ssigpTa->SetBinContent(6466,0.028796); + ssigpTa->SetBinContent(6467,0.0287992); + ssigpTa->SetBinContent(6468,0.0288032); + ssigpTa->SetBinContent(6469,0.0288112); + ssigpTa->SetBinContent(6470,0.0288312); + ssigpTa->SetBinContent(6471,0.0288392); + ssigpTa->SetBinContent(6472,0.0288432); + ssigpTa->SetBinContent(6473,0.0288432); + ssigpTa->SetBinContent(6474,0.0288504); + ssigpTa->SetBinContent(6475,0.0288776); + ssigpTa->SetBinContent(6476,0.028888); + ssigpTa->SetBinContent(6477,0.028888); + ssigpTa->SetBinContent(6478,0.028908); + ssigpTa->SetBinContent(6479,0.028932); + ssigpTa->SetBinContent(6480,0.028968); + ssigpTa->SetBinContent(6481,0.028976); + ssigpTa->SetBinContent(6482,0.0289904); + ssigpTa->SetBinContent(6483,0.0289976); + ssigpTa->SetBinContent(6484,0.0290048); + ssigpTa->SetBinContent(6485,0.0290048); + ssigpTa->SetBinContent(6486,0.0290088); + ssigpTa->SetBinContent(6487,0.0290168); + ssigpTa->SetBinContent(6488,0.0290472); + ssigpTa->SetBinContent(6489,0.0290624); + ssigpTa->SetBinContent(6490,0.0290736); + ssigpTa->SetBinContent(6491,0.0290736); + ssigpTa->SetBinContent(6492,0.0290808); + ssigpTa->SetBinContent(6493,0.029096); + ssigpTa->SetBinContent(6494,0.0291392); + ssigpTa->SetBinContent(6495,0.0291704); + ssigpTa->SetBinContent(6496,0.0291936); + ssigpTa->SetBinContent(6497,0.0292048); + ssigpTa->SetBinContent(6498,0.02922); + ssigpTa->SetBinContent(6499,0.0292472); + ssigpTa->SetBinContent(6500,0.0292584); + ssigpTa->SetBinContent(6501,0.0292624); + ssigpTa->SetBinContent(6502,0.0292936); + ssigpTa->SetBinContent(6503,0.029312); + ssigpTa->SetBinContent(6504,0.0293392); + ssigpTa->SetBinContent(6505,0.0293704); + ssigpTa->SetBinContent(6506,0.0294048); + ssigpTa->SetBinContent(6507,0.029436); + ssigpTa->SetBinContent(6508,0.029456); + ssigpTa->SetBinContent(6509,0.0294744); + ssigpTa->SetBinContent(6510,0.0294896); + ssigpTa->SetBinContent(6511,0.0295048); + ssigpTa->SetBinContent(6512,0.0295352); + ssigpTa->SetBinContent(6513,0.0295704); + ssigpTa->SetBinContent(6514,0.0296056); + ssigpTa->SetBinContent(6515,0.029652); + ssigpTa->SetBinContent(6516,0.0296872); + ssigpTa->SetBinContent(6517,0.0297056); + ssigpTa->SetBinContent(6518,0.0297208); + ssigpTa->SetBinContent(6519,0.029748); + ssigpTa->SetBinContent(6520,0.0297864); + ssigpTa->SetBinContent(6521,0.0298216); + ssigpTa->SetBinContent(6522,0.029868); + ssigpTa->SetBinContent(6523,0.0298944); + ssigpTa->SetBinContent(6524,0.0299168); + ssigpTa->SetBinContent(6525,0.029948); + ssigpTa->SetBinContent(6526,0.0299744); + ssigpTa->SetBinContent(6527,0.0300416); + ssigpTa->SetBinContent(6528,0.0300872); + ssigpTa->SetBinContent(6529,0.0301224); + ssigpTa->SetBinContent(6530,0.030164); + ssigpTa->SetBinContent(6531,0.0301872); + ssigpTa->SetBinContent(6532,0.0302448); + ssigpTa->SetBinContent(6533,0.03028); + ssigpTa->SetBinContent(6534,0.0303256); + ssigpTa->SetBinContent(6535,0.0303768); + ssigpTa->SetBinContent(6536,0.0304104); + ssigpTa->SetBinContent(6537,0.0304616); + ssigpTa->SetBinContent(6538,0.0305112); + ssigpTa->SetBinContent(6539,0.0305656); + ssigpTa->SetBinContent(6540,0.030596); + ssigpTa->SetBinContent(6541,0.0306504); + ssigpTa->SetBinContent(6542,0.03072); + ssigpTa->SetBinContent(6543,0.0307712); + ssigpTa->SetBinContent(6544,0.0308048); + ssigpTa->SetBinContent(6545,0.0308664); + ssigpTa->SetBinContent(6546,0.0309128); + ssigpTa->SetBinContent(6547,0.0309744); + ssigpTa->SetBinContent(6548,0.0310368); + ssigpTa->SetBinContent(6549,0.0310952); + ssigpTa->SetBinContent(6550,0.0311448); + ssigpTa->SetBinContent(6551,0.0311904); + ssigpTa->SetBinContent(6552,0.031244); + ssigpTa->SetBinContent(6553,0.0313216); + ssigpTa->SetBinContent(6554,0.0316368); + ssigpTa->SetBinContent(6555,0.0339864); + ssigpTa->SetBinContent(6556,0.0389968); + ssigpTa->SetBinContent(6557,0.0413384); + ssigpTa->SetBinContent(6558,0.041684); + ssigpTa->SetBinContent(6559,0.0417544); + ssigpTa->SetBinContent(6560,0.0418432); + ssigpTa->SetBinContent(6561,0.0419088); + ssigpTa->SetBinContent(6562,0.0419664); + ssigpTa->SetBinContent(6563,0.042052); + ssigpTa->SetBinContent(6564,0.0421248); + ssigpTa->SetBinContent(6565,0.0419696); + ssigpTa->SetBinContent(6566,0.0402984); + ssigpTa->SetBinContent(6567,0.0368008); + ssigpTa->SetBinContent(6568,0.0359056); + ssigpTa->SetBinContent(6569,0.0366584); + ssigpTa->SetBinContent(6570,0.0375568); + ssigpTa->SetBinContent(6571,0.03848); + ssigpTa->SetBinContent(6572,0.0394264); + ssigpTa->SetBinContent(6573,0.040344); + ssigpTa->SetBinContent(6574,0.0410496); + ssigpTa->SetBinContent(6575,0.04012); + ssigpTa->SetBinContent(6576,0.0370432); + ssigpTa->SetBinContent(6577,0.0360368); + ssigpTa->SetBinContent(6578,0.0366144); + ssigpTa->SetBinContent(6579,0.0374472); + ssigpTa->SetBinContent(6580,0.0383616); + ssigpTa->SetBinContent(6581,0.0392992); + ssigpTa->SetBinContent(6582,0.0402368); + ssigpTa->SetBinContent(6583,0.0412256); + ssigpTa->SetBinContent(6584,0.0422216); + ssigpTa->SetBinContent(6585,0.0430208); + ssigpTa->SetBinContent(6586,0.0419952); + ssigpTa->SetBinContent(6587,0.0385008); + ssigpTa->SetBinContent(6588,0.0373064); + ssigpTa->SetBinContent(6589,0.0379168); + ssigpTa->SetBinContent(6590,0.0387984); + ssigpTa->SetBinContent(6591,0.039712); + ssigpTa->SetBinContent(6592,0.0406656); + ssigpTa->SetBinContent(6593,0.0416112); + ssigpTa->SetBinContent(6594,0.042596); + ssigpTa->SetBinContent(6595,0.0436872); + ssigpTa->SetBinContent(6596,0.0444272); + ssigpTa->SetBinContent(6597,0.0432568); + ssigpTa->SetBinContent(6598,0.0395992); + ssigpTa->SetBinContent(6599,0.0383424); + ssigpTa->SetBinContent(6600,0.0388968); + ssigpTa->SetBinContent(6601,0.0397632); + ssigpTa->SetBinContent(6602,0.0406288); + ssigpTa->SetBinContent(6603,0.0415304); + ssigpTa->SetBinContent(6604,0.0424504); + ssigpTa->SetBinContent(6605,0.0434064); + ssigpTa->SetBinContent(6606,0.0443816); + ssigpTa->SetBinContent(6607,0.0453848); + ssigpTa->SetBinContent(6608,0.0461312); + ssigpTa->SetBinContent(6609,0.0450672); + ssigpTa->SetBinContent(6610,0.041536); + ssigpTa->SetBinContent(6611,0.0403304); + ssigpTa->SetBinContent(6612,0.0408456); + ssigpTa->SetBinContent(6613,0.0417528); + ssigpTa->SetBinContent(6614,0.04254); + ssigpTa->SetBinContent(6615,0.0434048); + ssigpTa->SetBinContent(6616,0.044356); + ssigpTa->SetBinContent(6617,0.045296); + ssigpTa->SetBinContent(6618,0.0462552); + ssigpTa->SetBinContent(6619,0.0470224); + ssigpTa->SetBinContent(6620,0.046164); + ssigpTa->SetBinContent(6621,0.0431184); + ssigpTa->SetBinContent(6622,0.0421856); + ssigpTa->SetBinContent(6623,0.0426856); + ssigpTa->SetBinContent(6624,0.0432192); + ssigpTa->SetBinContent(6625,0.0440064); + ssigpTa->SetBinContent(6626,0.0449096); + ssigpTa->SetBinContent(6627,0.0457608); + ssigpTa->SetBinContent(6628,0.0466104); + ssigpTa->SetBinContent(6629,0.0475072); + ssigpTa->SetBinContent(6630,0.0485088); + ssigpTa->SetBinContent(6631,0.0495976); + ssigpTa->SetBinContent(6632,0.0504984); + ssigpTa->SetBinContent(6633,0.0501688); + ssigpTa->SetBinContent(6634,0.0479792); + ssigpTa->SetBinContent(6635,0.04718); + ssigpTa->SetBinContent(6636,0.0474088); + ssigpTa->SetBinContent(6637,0.0479704); + ssigpTa->SetBinContent(6638,0.0488584); + ssigpTa->SetBinContent(6639,0.0499176); + ssigpTa->SetBinContent(6640,0.050944); + ssigpTa->SetBinContent(6641,0.0516976); + ssigpTa->SetBinContent(6642,0.052004); + ssigpTa->SetBinContent(6643,0.0527776); + ssigpTa->SetBinContent(6644,0.0538632); + ssigpTa->SetBinContent(6645,0.0550232); + ssigpTa->SetBinContent(6646,0.0561984); + ssigpTa->SetBinContent(6647,0.0574136); + ssigpTa->SetBinContent(6648,0.058612); + ssigpTa->SetBinContent(6649,0.0598984); + ssigpTa->SetBinContent(6650,0.0616408); + ssigpTa->SetBinContent(6651,0.0640912); + ssigpTa->SetBinContent(6652,0.0659592); + ssigpTa->SetBinContent(6653,0.0674248); + ssigpTa->SetBinContent(6654,0.0683448); + ssigpTa->SetBinContent(6655,0.068572); + ssigpTa->SetBinContent(6656,0.0695072); + ssigpTa->SetBinContent(6657,0.0709664); + ssigpTa->SetBinContent(6658,0.0725128); + ssigpTa->SetBinContent(6659,0.0740912); + ssigpTa->SetBinContent(6660,0.07576); + ssigpTa->SetBinContent(6661,0.0780144); + ssigpTa->SetBinContent(6662,0.081072); + ssigpTa->SetBinContent(6663,0.0834632); + ssigpTa->SetBinContent(6664,0.0853104); + ssigpTa->SetBinContent(6665,0.0864952); + ssigpTa->SetBinContent(6666,0.086688); + ssigpTa->SetBinContent(6667,0.0878304); + ssigpTa->SetBinContent(6668,0.089672); + ssigpTa->SetBinContent(6669,0.0916208); + ssigpTa->SetBinContent(6670,0.093644); + ssigpTa->SetBinContent(6671,0.0957416); + ssigpTa->SetBinContent(6672,0.0979008); + ssigpTa->SetBinContent(6673,0.100221); + ssigpTa->SetBinContent(6674,0.102952); + ssigpTa->SetBinContent(6675,0.105311); + ssigpTa->SetBinContent(6676,0.10672); + ssigpTa->SetBinContent(6677,0.107031); + ssigpTa->SetBinContent(6678,0.108518); + ssigpTa->SetBinContent(6679,0.110907); + ssigpTa->SetBinContent(6680,0.113448); + ssigpTa->SetBinContent(6681,0.11598); + ssigpTa->SetBinContent(6682,0.118579); + ssigpTa->SetBinContent(6683,0.121218); + ssigpTa->SetBinContent(6684,0.123922); + ssigpTa->SetBinContent(6685,0.12683); + ssigpTa->SetBinContent(6686,0.12943); + ssigpTa->SetBinContent(6687,0.130834); + ssigpTa->SetBinContent(6688,0.133052); + ssigpTa->SetBinContent(6689,0.136025); + ssigpTa->SetBinContent(6690,0.139124); + ssigpTa->SetBinContent(6691,0.14227); + ssigpTa->SetBinContent(6692,0.145448); + ssigpTa->SetBinContent(6693,0.148687); + ssigpTa->SetBinContent(6694,0.152087); + ssigpTa->SetBinContent(6695,0.155643); + ssigpTa->SetBinContent(6696,0.159297); + ssigpTa->SetBinContent(6697,0.162661); + ssigpTa->SetBinContent(6698,0.165476); + ssigpTa->SetBinContent(6699,0.168817); + ssigpTa->SetBinContent(6700,0.172596); + ssigpTa->SetBinContent(6701,0.176501); + ssigpTa->SetBinContent(6702,0.18049); + ssigpTa->SetBinContent(6703,0.184598); + ssigpTa->SetBinContent(6704,0.188963); + ssigpTa->SetBinContent(6705,0.193485); + ssigpTa->SetBinContent(6706,0.19815); + ssigpTa->SetBinContent(6707,0.202934); + ssigpTa->SetBinContent(6708,0.207754); + ssigpTa->SetBinContent(6709,0.21287); + ssigpTa->SetBinContent(6710,0.219658); + ssigpTa->SetBinContent(6711,0.22866); + ssigpTa->SetBinContent(6712,0.235764); + ssigpTa->SetBinContent(6713,0.2414); + ssigpTa->SetBinContent(6714,0.24705); + ssigpTa->SetBinContent(6715,0.253026); + ssigpTa->SetBinContent(6716,0.259128); + ssigpTa->SetBinContent(6717,0.265237); + ssigpTa->SetBinContent(6718,0.271683); + ssigpTa->SetBinContent(6719,0.278303); + ssigpTa->SetBinContent(6720,0.284998); + ssigpTa->SetBinContent(6721,0.291763); + ssigpTa->SetBinContent(6722,0.298708); + ssigpTa->SetBinContent(6723,0.30958); + ssigpTa->SetBinContent(6724,0.344438); + ssigpTa->SetBinContent(6725,0.399683); + ssigpTa->SetBinContent(6726,0.40471); + ssigpTa->SetBinContent(6727,0.402641); + ssigpTa->SetBinContent(6728,0.411064); + ssigpTa->SetBinContent(6729,0.421772); + ssigpTa->SetBinContent(6730,0.432655); + ssigpTa->SetBinContent(6731,0.443685); + ssigpTa->SetBinContent(6732,0.454799); + ssigpTa->SetBinContent(6733,0.46618); + ssigpTa->SetBinContent(6734,0.475884); + ssigpTa->SetBinContent(6735,0.472725); + ssigpTa->SetBinContent(6736,0.452478); + ssigpTa->SetBinContent(6737,0.448461); + ssigpTa->SetBinContent(6738,0.457354); + ssigpTa->SetBinContent(6739,0.468746); + ssigpTa->SetBinContent(6740,0.48113); + ssigpTa->SetBinContent(6741,0.494081); + ssigpTa->SetBinContent(6742,0.505703); + ssigpTa->SetBinContent(6743,0.506962); + ssigpTa->SetBinContent(6744,0.494994); + ssigpTa->SetBinContent(6745,0.49758); + ssigpTa->SetBinContent(6746,0.509527); + ssigpTa->SetBinContent(6747,0.52235); + ssigpTa->SetBinContent(6748,0.535325); + ssigpTa->SetBinContent(6749,0.548602); + ssigpTa->SetBinContent(6750,0.56211); + ssigpTa->SetBinContent(6751,0.575852); + ssigpTa->SetBinContent(6752,0.589711); + ssigpTa->SetBinContent(6753,0.60369); + ssigpTa->SetBinContent(6754,0.618282); + ssigpTa->SetBinContent(6755,0.634177); + ssigpTa->SetBinContent(6756,0.651248); + ssigpTa->SetBinContent(6757,0.668979); + ssigpTa->SetBinContent(6758,0.687149); + ssigpTa->SetBinContent(6759,0.705706); + ssigpTa->SetBinContent(6760,0.724745); + ssigpTa->SetBinContent(6761,0.744314); + ssigpTa->SetBinContent(6762,0.764286); + ssigpTa->SetBinContent(6763,0.803587); + ssigpTa->SetBinContent(6764,0.973075); + ssigpTa->SetBinContent(6765,1.31293); + ssigpTa->SetBinContent(6766,1.49002); + ssigpTa->SetBinContent(6767,1.53942); + ssigpTa->SetBinContent(6768,1.5703); + ssigpTa->SetBinContent(6769,1.60147); + ssigpTa->SetBinContent(6770,1.63231); + ssigpTa->SetBinContent(6771,1.66272); + ssigpTa->SetBinContent(6772,1.6937); + ssigpTa->SetBinContent(6773,1.72757); + ssigpTa->SetBinContent(6774,1.76543); + ssigpTa->SetBinContent(6775,1.80558); + ssigpTa->SetBinContent(6776,1.84753); + ssigpTa->SetBinContent(6777,1.89071); + ssigpTa->SetBinContent(6778,1.93366); + ssigpTa->SetBinContent(6779,1.97644); + ssigpTa->SetBinContent(6780,2.01993); + ssigpTa->SetBinContent(6781,2.06512); + ssigpTa->SetBinContent(6782,2.11263); + ssigpTa->SetBinContent(6783,2.16194); + ssigpTa->SetBinContent(6784,2.21205); + ssigpTa->SetBinContent(6785,2.26227); + ssigpTa->SetBinContent(6786,2.31309); + ssigpTa->SetBinContent(6787,2.36387); + ssigpTa->SetBinContent(6788,2.41171); + ssigpTa->SetBinContent(6789,2.45661); + ssigpTa->SetBinContent(6790,2.50072); + ssigpTa->SetBinContent(6791,2.54599); + ssigpTa->SetBinContent(6792,2.59264); + ssigpTa->SetBinContent(6793,2.63922); + ssigpTa->SetBinContent(6794,2.68529); + ssigpTa->SetBinContent(6795,2.73552); + ssigpTa->SetBinContent(6796,2.79544); + ssigpTa->SetBinContent(6797,2.86098); + ssigpTa->SetBinContent(6798,2.92805); + ssigpTa->SetBinContent(6799,2.99567); + ssigpTa->SetBinContent(6800,3.06394); + ssigpTa->SetBinContent(6801,3.13588); + ssigpTa->SetBinContent(6802,3.21496); + ssigpTa->SetBinContent(6803,3.29997); + ssigpTa->SetBinContent(6804,3.38924); + ssigpTa->SetBinContent(6805,3.48008); + ssigpTa->SetBinContent(6806,3.56786); + ssigpTa->SetBinContent(6807,3.65075); + ssigpTa->SetBinContent(6808,3.73015); + ssigpTa->SetBinContent(6809,3.80687); + ssigpTa->SetBinContent(6810,3.88119); + ssigpTa->SetBinContent(6811,3.95463); + ssigpTa->SetBinContent(6812,4.03167); + ssigpTa->SetBinContent(6813,4.11757); + ssigpTa->SetBinContent(6814,4.21037); + ssigpTa->SetBinContent(6815,4.30378); + ssigpTa->SetBinContent(6816,4.39564); + ssigpTa->SetBinContent(6817,4.48602); + ssigpTa->SetBinContent(6818,4.57447); + ssigpTa->SetBinContent(6819,4.66113); + ssigpTa->SetBinContent(6820,4.74607); + ssigpTa->SetBinContent(6821,4.82768); + ssigpTa->SetBinContent(6822,4.90706); + ssigpTa->SetBinContent(6823,4.99187); + ssigpTa->SetBinContent(6824,5.09262); + ssigpTa->SetBinContent(6825,5.2111); + ssigpTa->SetBinContent(6826,5.34095); + ssigpTa->SetBinContent(6827,5.47923); + ssigpTa->SetBinContent(6828,5.6844); + ssigpTa->SetBinContent(6829,6.34307); + ssigpTa->SetBinContent(6830,7.6044); + ssigpTa->SetBinContent(6831,8.29642); + ssigpTa->SetBinContent(6832,8.54768); + ssigpTa->SetBinContent(6833,8.74965); + ssigpTa->SetBinContent(6834,8.97765); + ssigpTa->SetBinContent(6835,9.22756); + ssigpTa->SetBinContent(6836,9.4946); + ssigpTa->SetBinContent(6837,9.77613); + ssigpTa->SetBinContent(6838,10.0634); + ssigpTa->SetBinContent(6839,10.3455); + ssigpTa->SetBinContent(6840,10.6241); + ssigpTa->SetBinContent(6841,10.9108); + ssigpTa->SetBinContent(6842,11.2219); + ssigpTa->SetBinContent(6843,11.5561); + ssigpTa->SetBinContent(6844,11.9008); + ssigpTa->SetBinContent(6845,12.2532); + ssigpTa->SetBinContent(6846,12.6024); + ssigpTa->SetBinContent(6847,13.0781); + ssigpTa->SetBinContent(6848,14.6201); + ssigpTa->SetBinContent(6849,17.4466); + ssigpTa->SetBinContent(6852,0.0556794); + ssigpTa->SetBinContent(6853,0.0549179); + ssigpTa->SetBinContent(6854,0.0543132); + ssigpTa->SetBinContent(6855,0.0543132); + ssigpTa->SetBinContent(6856,0.0543132); + ssigpTa->SetBinContent(6857,0.0543132); + ssigpTa->SetBinContent(6858,0.0543132); + ssigpTa->SetBinContent(6859,0.0543132); + ssigpTa->SetBinContent(6860,0.0543132); + ssigpTa->SetBinContent(6861,0.0543132); + ssigpTa->SetBinContent(6862,0.0543132); + ssigpTa->SetBinContent(6863,0.0543132); + ssigpTa->SetBinContent(6864,0.0543132); + ssigpTa->SetBinContent(6865,0.0543132); + ssigpTa->SetBinContent(6866,0.0543132); + ssigpTa->SetBinContent(6867,0.0543168); + ssigpTa->SetBinContent(6868,0.0543168); + ssigpTa->SetBinContent(6869,0.0543168); + ssigpTa->SetBinContent(6870,0.0543168); + ssigpTa->SetBinContent(6871,0.0543168); + ssigpTa->SetBinContent(6872,0.0543248); + ssigpTa->SetBinContent(6873,0.0543328); + ssigpTa->SetBinContent(6874,0.0543408); + ssigpTa->SetBinContent(6875,0.0543408); + ssigpTa->SetBinContent(6876,0.0543408); + ssigpTa->SetBinContent(6877,0.0543808); + ssigpTa->SetBinContent(6878,0.0544644); + ssigpTa->SetBinContent(6879,0.0545044); + ssigpTa->SetBinContent(6880,0.0545124); + ssigpTa->SetBinContent(6881,0.0545284); + ssigpTa->SetBinContent(6882,0.0545764); + ssigpTa->SetBinContent(6883,0.0546004); + ssigpTa->SetBinContent(6884,0.0546164); + ssigpTa->SetBinContent(6885,0.0546164); + ssigpTa->SetBinContent(6886,0.05462); + ssigpTa->SetBinContent(6887,0.05462); + ssigpTa->SetBinContent(6888,0.05462); + ssigpTa->SetBinContent(6889,0.05462); + ssigpTa->SetBinContent(6890,0.054628); + ssigpTa->SetBinContent(6891,0.054636); + ssigpTa->SetBinContent(6892,0.0546476); + ssigpTa->SetBinContent(6893,0.0546476); + ssigpTa->SetBinContent(6894,0.0546476); + ssigpTa->SetBinContent(6895,0.0546476); + ssigpTa->SetBinContent(6896,0.0546636); + ssigpTa->SetBinContent(6897,0.0546912); + ssigpTa->SetBinContent(6898,0.0547392); + ssigpTa->SetBinContent(6899,0.0547552); + ssigpTa->SetBinContent(6900,0.0547632); + ssigpTa->SetBinContent(6901,0.0547748); + ssigpTa->SetBinContent(6902,0.0547828); + ssigpTa->SetBinContent(6903,0.0547908); + ssigpTa->SetBinContent(6904,0.0548308); + ssigpTa->SetBinContent(6905,0.0548708); + ssigpTa->SetBinContent(6906,0.0549224); + ssigpTa->SetBinContent(6907,0.0549784); + ssigpTa->SetBinContent(6908,0.0550024); + ssigpTa->SetBinContent(6909,0.055046); + ssigpTa->SetBinContent(6910,0.05507); + ssigpTa->SetBinContent(6911,0.055086); + ssigpTa->SetBinContent(6912,0.055094); + ssigpTa->SetBinContent(6913,0.0550976); + ssigpTa->SetBinContent(6914,0.0551056); + ssigpTa->SetBinContent(6915,0.0551216); + ssigpTa->SetBinContent(6916,0.0551492); + ssigpTa->SetBinContent(6917,0.0551972); + ssigpTa->SetBinContent(6918,0.0552612); + ssigpTa->SetBinContent(6919,0.0553208); + ssigpTa->SetBinContent(6920,0.0553608); + ssigpTa->SetBinContent(6921,0.0553688); + ssigpTa->SetBinContent(6922,0.0554284); + ssigpTa->SetBinContent(6923,0.0554524); + ssigpTa->SetBinContent(6924,0.0555004); + ssigpTa->SetBinContent(6925,0.055528); + ssigpTa->SetBinContent(6926,0.055544); + ssigpTa->SetBinContent(6927,0.0555556); + ssigpTa->SetBinContent(6928,0.0555636); + ssigpTa->SetBinContent(6929,0.0556276); + ssigpTa->SetBinContent(6930,0.0556952); + ssigpTa->SetBinContent(6931,0.0557832); + ssigpTa->SetBinContent(6932,0.0558108); + ssigpTa->SetBinContent(6933,0.0558668); + ssigpTa->SetBinContent(6934,0.0558944); + ssigpTa->SetBinContent(6935,0.0559184); + ssigpTa->SetBinContent(6936,0.05597); + ssigpTa->SetBinContent(6937,0.056034); + ssigpTa->SetBinContent(6938,0.0560936); + ssigpTa->SetBinContent(6939,0.0561576); + ssigpTa->SetBinContent(6940,0.0561852); + ssigpTa->SetBinContent(6941,0.0562812); + ssigpTa->SetBinContent(6942,0.0563088); + ssigpTa->SetBinContent(6943,0.0563408); + ssigpTa->SetBinContent(6944,0.0564084); + ssigpTa->SetBinContent(6945,0.0565044); + ssigpTa->SetBinContent(6946,0.056572); + ssigpTa->SetBinContent(6947,0.056604); + ssigpTa->SetBinContent(6948,0.0566716); + ssigpTa->SetBinContent(6949,0.0567312); + ssigpTa->SetBinContent(6950,0.0568032); + ssigpTa->SetBinContent(6951,0.0568868); + ssigpTa->SetBinContent(6952,0.0569748); + ssigpTa->SetBinContent(6953,0.0570104); + ssigpTa->SetBinContent(6954,0.057078); + ssigpTa->SetBinContent(6955,0.057142); + ssigpTa->SetBinContent(6956,0.0571456); + ssigpTa->SetBinContent(6957,0.0576888); + ssigpTa->SetBinContent(6958,0.0625848); + ssigpTa->SetBinContent(6959,0.0727764); + ssigpTa->SetBinContent(6960,0.077804); + ssigpTa->SetBinContent(6961,0.078484); + ssigpTa->SetBinContent(6962,0.0785916); + ssigpTa->SetBinContent(6963,0.0786832); + ssigpTa->SetBinContent(6964,0.0787908); + ssigpTa->SetBinContent(6965,0.0788708); + ssigpTa->SetBinContent(6966,0.0789544); + ssigpTa->SetBinContent(6967,0.079054); + ssigpTa->SetBinContent(6968,0.0786976); + ssigpTa->SetBinContent(6969,0.0749812); + ssigpTa->SetBinContent(6970,0.0678028); + ssigpTa->SetBinContent(6971,0.0658156); + ssigpTa->SetBinContent(6972,0.0673688); + ssigpTa->SetBinContent(6973,0.069194); + ssigpTa->SetBinContent(6974,0.0710556); + ssigpTa->SetBinContent(6975,0.0729288); + ssigpTa->SetBinContent(6976,0.074802); + ssigpTa->SetBinContent(6977,0.0761472); + ssigpTa->SetBinContent(6978,0.0739964); + ssigpTa->SetBinContent(6979,0.067588); + ssigpTa->SetBinContent(6980,0.0653456); + ssigpTa->SetBinContent(6981,0.066592); + ssigpTa->SetBinContent(6982,0.0683656); + ssigpTa->SetBinContent(6983,0.0701988); + ssigpTa->SetBinContent(6984,0.072072); + ssigpTa->SetBinContent(6985,0.0739932); + ssigpTa->SetBinContent(6986,0.0759304); + ssigpTa->SetBinContent(6987,0.0779752); + ssigpTa->SetBinContent(6988,0.0795444); + ssigpTa->SetBinContent(6989,0.0772052); + ssigpTa->SetBinContent(6990,0.0699156); + ssigpTa->SetBinContent(6991,0.0672012); + ssigpTa->SetBinContent(6992,0.0683304); + ssigpTa->SetBinContent(6993,0.0700676); + ssigpTa->SetBinContent(6994,0.0718448); + ssigpTa->SetBinContent(6995,0.073726); + ssigpTa->SetBinContent(6996,0.0756952); + ssigpTa->SetBinContent(6997,0.0780004); + ssigpTa->SetBinContent(6998,0.0807356); + ssigpTa->SetBinContent(6999,0.0824924); + ssigpTa->SetBinContent(7000,0.0799176); + ssigpTa->SetBinContent(7001,0.0724332); + ssigpTa->SetBinContent(7002,0.0695144); + ssigpTa->SetBinContent(7003,0.070576); + ssigpTa->SetBinContent(7004,0.0721932); + ssigpTa->SetBinContent(7005,0.0738344); + ssigpTa->SetBinContent(7006,0.0755236); + ssigpTa->SetBinContent(7007,0.0773008); + ssigpTa->SetBinContent(7008,0.0790736); + ssigpTa->SetBinContent(7009,0.0809628); + ssigpTa->SetBinContent(7010,0.0828556); + ssigpTa->SetBinContent(7011,0.0842444); + ssigpTa->SetBinContent(7012,0.0815932); + ssigpTa->SetBinContent(7013,0.0740228); + ssigpTa->SetBinContent(7014,0.071208); + ssigpTa->SetBinContent(7015,0.0729692); + ssigpTa->SetBinContent(7016,0.0761376); + ssigpTa->SetBinContent(7017,0.0784828); + ssigpTa->SetBinContent(7018,0.0802556); + ssigpTa->SetBinContent(7019,0.0820488); + ssigpTa->SetBinContent(7020,0.0838296); + ssigpTa->SetBinContent(7021,0.0856068); + ssigpTa->SetBinContent(7022,0.0869556); + ssigpTa->SetBinContent(7023,0.0847124); + ssigpTa->SetBinContent(7024,0.0781032); + ssigpTa->SetBinContent(7025,0.0756004); + ssigpTa->SetBinContent(7026,0.0761572); + ssigpTa->SetBinContent(7027,0.0765264); + ssigpTa->SetBinContent(7028,0.0776592); + ssigpTa->SetBinContent(7029,0.079328); + ssigpTa->SetBinContent(7030,0.0812652); + ssigpTa->SetBinContent(7031,0.08349); + ssigpTa->SetBinContent(7032,0.0855588); + ssigpTa->SetBinContent(7033,0.0875432); + ssigpTa->SetBinContent(7034,0.089564); + ssigpTa->SetBinContent(7035,0.0912088); + ssigpTa->SetBinContent(7036,0.0898172); + ssigpTa->SetBinContent(7037,0.0848648); + ssigpTa->SetBinContent(7038,0.0838216); + ssigpTa->SetBinContent(7039,0.0864408); + ssigpTa->SetBinContent(7040,0.088818); + ssigpTa->SetBinContent(7041,0.0908512); + ssigpTa->SetBinContent(7042,0.092936); + ssigpTa->SetBinContent(7043,0.0949168); + ssigpTa->SetBinContent(7044,0.0960256); + ssigpTa->SetBinContent(7045,0.096104); + ssigpTa->SetBinContent(7046,0.0972448); + ssigpTa->SetBinContent(7047,0.0993456); + ssigpTa->SetBinContent(7048,0.101586); + ssigpTa->SetBinContent(7049,0.103946); + ssigpTa->SetBinContent(7050,0.106259); + ssigpTa->SetBinContent(7051,0.108683); + ssigpTa->SetBinContent(7052,0.111284); + ssigpTa->SetBinContent(7053,0.115216); + ssigpTa->SetBinContent(7054,0.120752); + ssigpTa->SetBinContent(7055,0.124964); + ssigpTa->SetBinContent(7056,0.127828); + ssigpTa->SetBinContent(7057,0.129156); + ssigpTa->SetBinContent(7058,0.128715); + ssigpTa->SetBinContent(7059,0.130066); + ssigpTa->SetBinContent(7060,0.132862); + ssigpTa->SetBinContent(7061,0.135941); + ssigpTa->SetBinContent(7062,0.139056); + ssigpTa->SetBinContent(7063,0.142444); + ssigpTa->SetBinContent(7064,0.147306); + ssigpTa->SetBinContent(7065,0.154028); + ssigpTa->SetBinContent(7066,0.159115); + ssigpTa->SetBinContent(7067,0.16279); + ssigpTa->SetBinContent(7068,0.164484); + ssigpTa->SetBinContent(7069,0.163924); + ssigpTa->SetBinContent(7070,0.165574); + ssigpTa->SetBinContent(7071,0.169128); + ssigpTa->SetBinContent(7072,0.173006); + ssigpTa->SetBinContent(7073,0.176972); + ssigpTa->SetBinContent(7074,0.18115); + ssigpTa->SetBinContent(7075,0.18552); + ssigpTa->SetBinContent(7076,0.191069); + ssigpTa->SetBinContent(7077,0.198015); + ssigpTa->SetBinContent(7078,0.203508); + ssigpTa->SetBinContent(7079,0.205977); + ssigpTa->SetBinContent(7080,0.205642); + ssigpTa->SetBinContent(7081,0.208019); + ssigpTa->SetBinContent(7082,0.212748); + ssigpTa->SetBinContent(7083,0.217792); + ssigpTa->SetBinContent(7084,0.222913); + ssigpTa->SetBinContent(7085,0.228117); + ssigpTa->SetBinContent(7086,0.233477); + ssigpTa->SetBinContent(7087,0.23893); + ssigpTa->SetBinContent(7088,0.244842); + ssigpTa->SetBinContent(7089,0.249799); + ssigpTa->SetBinContent(7090,0.251925); + ssigpTa->SetBinContent(7091,0.255908); + ssigpTa->SetBinContent(7092,0.261771); + ssigpTa->SetBinContent(7093,0.268038); + ssigpTa->SetBinContent(7094,0.274329); + ssigpTa->SetBinContent(7095,0.280732); + ssigpTa->SetBinContent(7096,0.287234); + ssigpTa->SetBinContent(7097,0.29406); + ssigpTa->SetBinContent(7098,0.301218); + ssigpTa->SetBinContent(7099,0.308499); + ssigpTa->SetBinContent(7100,0.31484); + ssigpTa->SetBinContent(7101,0.319919); + ssigpTa->SetBinContent(7102,0.326393); + ssigpTa->SetBinContent(7103,0.333998); + ssigpTa->SetBinContent(7104,0.341846); + ssigpTa->SetBinContent(7105,0.349854); + ssigpTa->SetBinContent(7106,0.358114); + ssigpTa->SetBinContent(7107,0.366862); + ssigpTa->SetBinContent(7108,0.375952); + ssigpTa->SetBinContent(7109,0.385282); + ssigpTa->SetBinContent(7110,0.394576); + ssigpTa->SetBinContent(7111,0.403788); + ssigpTa->SetBinContent(7112,0.413806); + ssigpTa->SetBinContent(7113,0.427631); + ssigpTa->SetBinContent(7114,0.445938); + ssigpTa->SetBinContent(7115,0.460431); + ssigpTa->SetBinContent(7116,0.471791); + ssigpTa->SetBinContent(7117,0.483146); + ssigpTa->SetBinContent(7118,0.495092); + ssigpTa->SetBinContent(7119,0.507166); + ssigpTa->SetBinContent(7120,0.519216); + ssigpTa->SetBinContent(7121,0.531892); + ssigpTa->SetBinContent(7122,0.545173); + ssigpTa->SetBinContent(7123,0.558621); + ssigpTa->SetBinContent(7124,0.572238); + ssigpTa->SetBinContent(7125,0.586221); + ssigpTa->SetBinContent(7126,0.608252); + ssigpTa->SetBinContent(7127,0.680611); + ssigpTa->SetBinContent(7128,0.790847); + ssigpTa->SetBinContent(7129,0.803502); + ssigpTa->SetBinContent(7130,0.798485); + ssigpTa->SetBinContent(7131,0.815362); + ssigpTa->SetBinContent(7132,0.836854); + ssigpTa->SetBinContent(7133,0.858726); + ssigpTa->SetBinContent(7134,0.88081); + ssigpTa->SetBinContent(7135,0.90323); + ssigpTa->SetBinContent(7136,0.92606); + ssigpTa->SetBinContent(7137,0.945454); + ssigpTa->SetBinContent(7138,0.937996); + ssigpTa->SetBinContent(7139,0.897247); + ssigpTa->SetBinContent(7140,0.888041); + ssigpTa->SetBinContent(7141,0.905826); + ssigpTa->SetBinContent(7142,0.928685); + ssigpTa->SetBinContent(7143,0.95356); + ssigpTa->SetBinContent(7144,0.979529); + ssigpTa->SetBinContent(7145,1.00277); + ssigpTa->SetBinContent(7146,1.00425); + ssigpTa->SetBinContent(7147,0.980635); + ssigpTa->SetBinContent(7148,0.986049); + ssigpTa->SetBinContent(7149,1.01085); + ssigpTa->SetBinContent(7150,1.03682); + ssigpTa->SetBinContent(7151,1.06294); + ssigpTa->SetBinContent(7152,1.08968); + ssigpTa->SetBinContent(7153,1.11688); + ssigpTa->SetBinContent(7154,1.14453); + ssigpTa->SetBinContent(7155,1.1724); + ssigpTa->SetBinContent(7156,1.20056); + ssigpTa->SetBinContent(7157,1.22999); + ssigpTa->SetBinContent(7158,1.26199); + ssigpTa->SetBinContent(7159,1.29635); + ssigpTa->SetBinContent(7160,1.33201); + ssigpTa->SetBinContent(7161,1.36857); + ssigpTa->SetBinContent(7162,1.40591); + ssigpTa->SetBinContent(7163,1.44424); + ssigpTa->SetBinContent(7164,1.48361); + ssigpTa->SetBinContent(7165,1.52378); + ssigpTa->SetBinContent(7166,1.60273); + ssigpTa->SetBinContent(7167,1.9499); + ssigpTa->SetBinContent(7168,2.62486); + ssigpTa->SetBinContent(7169,2.98724); + ssigpTa->SetBinContent(7170,3.08656); + ssigpTa->SetBinContent(7171,3.1488); + ssigpTa->SetBinContent(7172,3.21156); + ssigpTa->SetBinContent(7173,3.27373); + ssigpTa->SetBinContent(7174,3.335); + ssigpTa->SetBinContent(7175,3.39745); + ssigpTa->SetBinContent(7176,3.46568); + ssigpTa->SetBinContent(7177,3.5419); + ssigpTa->SetBinContent(7178,3.62273); + ssigpTa->SetBinContent(7179,3.70721); + ssigpTa->SetBinContent(7180,3.79412); + ssigpTa->SetBinContent(7181,3.88067); + ssigpTa->SetBinContent(7182,3.96681); + ssigpTa->SetBinContent(7183,4.05437); + ssigpTa->SetBinContent(7184,4.14538); + ssigpTa->SetBinContent(7185,4.24108); + ssigpTa->SetBinContent(7186,4.34029); + ssigpTa->SetBinContent(7187,4.44123); + ssigpTa->SetBinContent(7188,4.5423); + ssigpTa->SetBinContent(7189,4.64471); + ssigpTa->SetBinContent(7190,4.74694); + ssigpTa->SetBinContent(7191,4.84334); + ssigpTa->SetBinContent(7192,4.93382); + ssigpTa->SetBinContent(7193,5.02273); + ssigpTa->SetBinContent(7194,5.11399); + ssigpTa->SetBinContent(7195,5.20798); + ssigpTa->SetBinContent(7196,5.30182); + ssigpTa->SetBinContent(7197,5.39469); + ssigpTa->SetBinContent(7198,5.49603); + ssigpTa->SetBinContent(7199,5.61654); + ssigpTa->SetBinContent(7200,5.74847); + ssigpTa->SetBinContent(7201,5.88363); + ssigpTa->SetBinContent(7202,6.01971); + ssigpTa->SetBinContent(7203,6.15731); + ssigpTa->SetBinContent(7204,6.30218); + ssigpTa->SetBinContent(7205,6.46138); + ssigpTa->SetBinContent(7206,6.63256); + ssigpTa->SetBinContent(7207,6.81225); + ssigpTa->SetBinContent(7208,6.99508); + ssigpTa->SetBinContent(7209,7.17182); + ssigpTa->SetBinContent(7210,7.3388); + ssigpTa->SetBinContent(7211,7.49874); + ssigpTa->SetBinContent(7212,7.65334); + ssigpTa->SetBinContent(7213,7.80306); + ssigpTa->SetBinContent(7214,7.95107); + ssigpTa->SetBinContent(7215,8.10641); + ssigpTa->SetBinContent(7216,8.27939); + ssigpTa->SetBinContent(7217,8.4663); + ssigpTa->SetBinContent(7218,8.65446); + ssigpTa->SetBinContent(7219,8.83951); + ssigpTa->SetBinContent(7220,9.02162); + ssigpTa->SetBinContent(7221,9.19977); + ssigpTa->SetBinContent(7222,9.37442); + ssigpTa->SetBinContent(7223,9.54551); + ssigpTa->SetBinContent(7224,9.70995); + ssigpTa->SetBinContent(7225,9.86993); + ssigpTa->SetBinContent(7226,10.041); + ssigpTa->SetBinContent(7227,10.2439); + ssigpTa->SetBinContent(7228,10.4824); + ssigpTa->SetBinContent(7229,10.7439); + ssigpTa->SetBinContent(7230,11.0223); + ssigpTa->SetBinContent(7231,11.4345); + ssigpTa->SetBinContent(7232,12.7809); + ssigpTa->SetBinContent(7233,15.2859); + ssigpTa->SetBinContent(7234,16.6991); + ssigpTa->SetBinContent(7235,17.2043); + ssigpTa->SetBinContent(7236,17.6114); + ssigpTa->SetBinContent(7237,18.0704); + ssigpTa->SetBinContent(7238,18.5738); + ssigpTa->SetBinContent(7239,19.1117); + ssigpTa->SetBinContent(7240,19.6786); + ssigpTa->SetBinContent(7241,20.257); + ssigpTa->SetBinContent(7242,20.8253); + ssigpTa->SetBinContent(7243,21.3866); + ssigpTa->SetBinContent(7244,21.9642); + ssigpTa->SetBinContent(7245,22.5909); + ssigpTa->SetBinContent(7246,23.2636); + ssigpTa->SetBinContent(7247,23.9581); + ssigpTa->SetBinContent(7248,24.6679); + ssigpTa->SetBinContent(7249,25.3709); + ssigpTa->SetBinContent(7250,26.3268); + ssigpTa->SetBinContent(7251,29.49); + ssigpTa->SetBinContent(7252,34.8598); + ssigpTa->SetBinContent(7255,0.169461); + ssigpTa->SetBinContent(7256,0.154329); + ssigpTa->SetBinContent(7257,0.151996); + ssigpTa->SetBinContent(7258,0.151996); + ssigpTa->SetBinContent(7259,0.151996); + ssigpTa->SetBinContent(7260,0.151996); + ssigpTa->SetBinContent(7261,0.151996); + ssigpTa->SetBinContent(7262,0.151996); + ssigpTa->SetBinContent(7263,0.151996); + ssigpTa->SetBinContent(7264,0.151996); + ssigpTa->SetBinContent(7265,0.151996); + ssigpTa->SetBinContent(7266,0.151996); + ssigpTa->SetBinContent(7267,0.151996); + ssigpTa->SetBinContent(7268,0.151996); + ssigpTa->SetBinContent(7269,0.151996); + ssigpTa->SetBinContent(7270,0.151996); + ssigpTa->SetBinContent(7271,0.151996); + ssigpTa->SetBinContent(7272,0.151996); + ssigpTa->SetBinContent(7273,0.151996); + ssigpTa->SetBinContent(7274,0.151996); + ssigpTa->SetBinContent(7275,0.151996); + ssigpTa->SetBinContent(7276,0.152); + ssigpTa->SetBinContent(7277,0.152); + ssigpTa->SetBinContent(7278,0.152); + ssigpTa->SetBinContent(7279,0.15202); + ssigpTa->SetBinContent(7280,0.15214); + ssigpTa->SetBinContent(7281,0.15232); + ssigpTa->SetBinContent(7282,0.15244); + ssigpTa->SetBinContent(7283,0.15246); + ssigpTa->SetBinContent(7284,0.152476); + ssigpTa->SetBinContent(7285,0.152492); + ssigpTa->SetBinContent(7286,0.152512); + ssigpTa->SetBinContent(7287,0.152512); + ssigpTa->SetBinContent(7288,0.152512); + ssigpTa->SetBinContent(7289,0.152512); + ssigpTa->SetBinContent(7290,0.152512); + ssigpTa->SetBinContent(7291,0.152512); + ssigpTa->SetBinContent(7292,0.152512); + ssigpTa->SetBinContent(7293,0.152512); + ssigpTa->SetBinContent(7294,0.152796); + ssigpTa->SetBinContent(7295,0.152796); + ssigpTa->SetBinContent(7296,0.152796); + ssigpTa->SetBinContent(7297,0.152796); + ssigpTa->SetBinContent(7298,0.152796); + ssigpTa->SetBinContent(7299,0.152796); + ssigpTa->SetBinContent(7300,0.152816); + ssigpTa->SetBinContent(7301,0.152832); + ssigpTa->SetBinContent(7302,0.152848); + ssigpTa->SetBinContent(7303,0.152848); + ssigpTa->SetBinContent(7304,0.152848); + ssigpTa->SetBinContent(7305,0.152852); + ssigpTa->SetBinContent(7306,0.152872); + ssigpTa->SetBinContent(7307,0.152912); + ssigpTa->SetBinContent(7308,0.153012); + ssigpTa->SetBinContent(7309,0.153132); + ssigpTa->SetBinContent(7310,0.153236); + ssigpTa->SetBinContent(7311,0.153332); + ssigpTa->SetBinContent(7312,0.153348); + ssigpTa->SetBinContent(7313,0.153364); + ssigpTa->SetBinContent(7314,0.153368); + ssigpTa->SetBinContent(7315,0.153368); + ssigpTa->SetBinContent(7316,0.153368); + ssigpTa->SetBinContent(7317,0.153648); + ssigpTa->SetBinContent(7318,0.153652); + ssigpTa->SetBinContent(7319,0.153668); + ssigpTa->SetBinContent(7320,0.153704); + ssigpTa->SetBinContent(7321,0.153764); + ssigpTa->SetBinContent(7322,0.153864); + ssigpTa->SetBinContent(7323,0.153904); + ssigpTa->SetBinContent(7324,0.154004); + ssigpTa->SetBinContent(7325,0.154088); + ssigpTa->SetBinContent(7326,0.154184); + ssigpTa->SetBinContent(7327,0.1542); + ssigpTa->SetBinContent(7328,0.15422); + ssigpTa->SetBinContent(7329,0.15422); + ssigpTa->SetBinContent(7330,0.1545); + ssigpTa->SetBinContent(7331,0.154524); + ssigpTa->SetBinContent(7332,0.154564); + ssigpTa->SetBinContent(7333,0.154684); + ssigpTa->SetBinContent(7334,0.15474); + ssigpTa->SetBinContent(7335,0.154856); + ssigpTa->SetBinContent(7336,0.15494); + ssigpTa->SetBinContent(7337,0.15502); + ssigpTa->SetBinContent(7338,0.15504); + ssigpTa->SetBinContent(7339,0.155076); + ssigpTa->SetBinContent(7340,0.155412); + ssigpTa->SetBinContent(7341,0.155516); + ssigpTa->SetBinContent(7342,0.155556); + ssigpTa->SetBinContent(7343,0.155676); + ssigpTa->SetBinContent(7344,0.155772); + ssigpTa->SetBinContent(7345,0.155872); + ssigpTa->SetBinContent(7346,0.155892); + ssigpTa->SetBinContent(7347,0.155952); + ssigpTa->SetBinContent(7348,0.156348); + ssigpTa->SetBinContent(7349,0.156408); + ssigpTa->SetBinContent(7350,0.156508); + ssigpTa->SetBinContent(7351,0.156608); + ssigpTa->SetBinContent(7352,0.156724); + ssigpTa->SetBinContent(7353,0.156784); + ssigpTa->SetBinContent(7354,0.15718); + ssigpTa->SetBinContent(7355,0.15724); + ssigpTa->SetBinContent(7356,0.157356); + ssigpTa->SetBinContent(7357,0.15746); + ssigpTa->SetBinContent(7358,0.157556); + ssigpTa->SetBinContent(7359,0.15778); + ssigpTa->SetBinContent(7360,0.158564); + ssigpTa->SetBinContent(7361,0.169044); + ssigpTa->SetBinContent(7362,0.206864); + ssigpTa->SetBinContent(7363,0.217596); + ssigpTa->SetBinContent(7364,0.219316); + ssigpTa->SetBinContent(7365,0.219712); + ssigpTa->SetBinContent(7366,0.219868); + ssigpTa->SetBinContent(7367,0.220008); + ssigpTa->SetBinContent(7368,0.220144); + ssigpTa->SetBinContent(7369,0.220544); + ssigpTa->SetBinContent(7370,0.220704); + ssigpTa->SetBinContent(7371,0.21962); + ssigpTa->SetBinContent(7372,0.21164); + ssigpTa->SetBinContent(7373,0.1839); + ssigpTa->SetBinContent(7374,0.18186); + ssigpTa->SetBinContent(7375,0.186136); + ssigpTa->SetBinContent(7376,0.19156); + ssigpTa->SetBinContent(7377,0.196948); + ssigpTa->SetBinContent(7378,0.202152); + ssigpTa->SetBinContent(7379,0.20758); + ssigpTa->SetBinContent(7380,0.211708); + ssigpTa->SetBinContent(7381,0.20844); + ssigpTa->SetBinContent(7382,0.182828); + ssigpTa->SetBinContent(7383,0.179468); + ssigpTa->SetBinContent(7384,0.183168); + ssigpTa->SetBinContent(7385,0.188476); + ssigpTa->SetBinContent(7386,0.193584); + ssigpTa->SetBinContent(7387,0.199072); + ssigpTa->SetBinContent(7388,0.204556); + ssigpTa->SetBinContent(7389,0.21018); + ssigpTa->SetBinContent(7390,0.2159); + ssigpTa->SetBinContent(7391,0.22066); + ssigpTa->SetBinContent(7392,0.217096); + ssigpTa->SetBinContent(7393,0.18854); + ssigpTa->SetBinContent(7394,0.183764); + ssigpTa->SetBinContent(7395,0.1872); + ssigpTa->SetBinContent(7396,0.192068); + ssigpTa->SetBinContent(7397,0.197076); + ssigpTa->SetBinContent(7398,0.20248); + ssigpTa->SetBinContent(7399,0.208164); + ssigpTa->SetBinContent(7400,0.214748); + ssigpTa->SetBinContent(7401,0.22432); + ssigpTa->SetBinContent(7402,0.229468); + ssigpTa->SetBinContent(7403,0.225392); + ssigpTa->SetBinContent(7404,0.195876); + ssigpTa->SetBinContent(7405,0.190892); + ssigpTa->SetBinContent(7406,0.193748); + ssigpTa->SetBinContent(7407,0.198384); + ssigpTa->SetBinContent(7408,0.203036); + ssigpTa->SetBinContent(7409,0.207808); + ssigpTa->SetBinContent(7410,0.21268); + ssigpTa->SetBinContent(7411,0.217692); + ssigpTa->SetBinContent(7412,0.223); + ssigpTa->SetBinContent(7413,0.228168); + ssigpTa->SetBinContent(7414,0.232152); + ssigpTa->SetBinContent(7415,0.22768); + ssigpTa->SetBinContent(7416,0.197636); + ssigpTa->SetBinContent(7417,0.192768); + ssigpTa->SetBinContent(7418,0.197832); + ssigpTa->SetBinContent(7419,0.21062); + ssigpTa->SetBinContent(7420,0.21746); + ssigpTa->SetBinContent(7421,0.222572); + ssigpTa->SetBinContent(7422,0.227504); + ssigpTa->SetBinContent(7423,0.23242); + ssigpTa->SetBinContent(7424,0.237348); + ssigpTa->SetBinContent(7425,0.2413); + ssigpTa->SetBinContent(7426,0.2377); + ssigpTa->SetBinContent(7427,0.210996); + ssigpTa->SetBinContent(7428,0.20634); + ssigpTa->SetBinContent(7429,0.208072); + ssigpTa->SetBinContent(7430,0.207232); + ssigpTa->SetBinContent(7431,0.210444); + ssigpTa->SetBinContent(7432,0.215116); + ssigpTa->SetBinContent(7433,0.220644); + ssigpTa->SetBinContent(7434,0.228296); + ssigpTa->SetBinContent(7435,0.234372); + ssigpTa->SetBinContent(7436,0.24002); + ssigpTa->SetBinContent(7437,0.245668); + ssigpTa->SetBinContent(7438,0.250152); + ssigpTa->SetBinContent(7439,0.248216); + ssigpTa->SetBinContent(7440,0.226968); + ssigpTa->SetBinContent(7441,0.226924); + ssigpTa->SetBinContent(7442,0.238828); + ssigpTa->SetBinContent(7443,0.246416); + ssigpTa->SetBinContent(7444,0.252676); + ssigpTa->SetBinContent(7445,0.258456); + ssigpTa->SetBinContent(7446,0.264216); + ssigpTa->SetBinContent(7447,0.267736); + ssigpTa->SetBinContent(7448,0.265408); + ssigpTa->SetBinContent(7449,0.269264); + ssigpTa->SetBinContent(7450,0.27488); + ssigpTa->SetBinContent(7451,0.281616); + ssigpTa->SetBinContent(7452,0.288092); + ssigpTa->SetBinContent(7453,0.294744); + ssigpTa->SetBinContent(7454,0.301656); + ssigpTa->SetBinContent(7455,0.309244); + ssigpTa->SetBinContent(7456,0.319708); + ssigpTa->SetBinContent(7457,0.339192); + ssigpTa->SetBinContent(7458,0.350428); + ssigpTa->SetBinContent(7459,0.358504); + ssigpTa->SetBinContent(7460,0.362876); + ssigpTa->SetBinContent(7461,0.35802); + ssigpTa->SetBinContent(7462,0.362492); + ssigpTa->SetBinContent(7463,0.370608); + ssigpTa->SetBinContent(7464,0.379344); + ssigpTa->SetBinContent(7465,0.388192); + ssigpTa->SetBinContent(7466,0.39794); + ssigpTa->SetBinContent(7467,0.410768); + ssigpTa->SetBinContent(7468,0.433556); + ssigpTa->SetBinContent(7469,0.447436); + ssigpTa->SetBinContent(7470,0.457692); + ssigpTa->SetBinContent(7471,0.463792); + ssigpTa->SetBinContent(7472,0.45722); + ssigpTa->SetBinContent(7473,0.462936); + ssigpTa->SetBinContent(7474,0.473168); + ssigpTa->SetBinContent(7475,0.484256); + ssigpTa->SetBinContent(7476,0.49554); + ssigpTa->SetBinContent(7477,0.507324); + ssigpTa->SetBinContent(7478,0.5199); + ssigpTa->SetBinContent(7479,0.535528); + ssigpTa->SetBinContent(7480,0.559872); + ssigpTa->SetBinContent(7481,0.575572); + ssigpTa->SetBinContent(7482,0.583988); + ssigpTa->SetBinContent(7483,0.577664); + ssigpTa->SetBinContent(7484,0.585808); + ssigpTa->SetBinContent(7485,0.599508); + ssigpTa->SetBinContent(7486,0.613976); + ssigpTa->SetBinContent(7487,0.628732); + ssigpTa->SetBinContent(7488,0.6435); + ssigpTa->SetBinContent(7489,0.659008); + ssigpTa->SetBinContent(7490,0.674592); + ssigpTa->SetBinContent(7491,0.691212); + ssigpTa->SetBinContent(7492,0.708096); + ssigpTa->SetBinContent(7493,0.7092); + ssigpTa->SetBinContent(7494,0.721872); + ssigpTa->SetBinContent(7495,0.738716); + ssigpTa->SetBinContent(7496,0.756692); + ssigpTa->SetBinContent(7497,0.774608); + ssigpTa->SetBinContent(7498,0.793148); + ssigpTa->SetBinContent(7499,0.811776); + ssigpTa->SetBinContent(7500,0.83144); + ssigpTa->SetBinContent(7501,0.852012); + ssigpTa->SetBinContent(7502,0.872856); + ssigpTa->SetBinContent(7503,0.891552); + ssigpTa->SetBinContent(7504,0.903248); + ssigpTa->SetBinContent(7505,0.922572); + ssigpTa->SetBinContent(7506,0.944728); + ssigpTa->SetBinContent(7507,0.967164); + ssigpTa->SetBinContent(7508,0.990092); + ssigpTa->SetBinContent(7509,1.01364); + ssigpTa->SetBinContent(7510,1.03908); + ssigpTa->SetBinContent(7511,1.06525); + ssigpTa->SetBinContent(7512,1.09168); + ssigpTa->SetBinContent(7513,1.1185); + ssigpTa->SetBinContent(7514,1.14381); + ssigpTa->SetBinContent(7515,1.17232); + ssigpTa->SetBinContent(7516,1.20918); + ssigpTa->SetBinContent(7517,1.26833); + ssigpTa->SetBinContent(7518,1.30732); + ssigpTa->SetBinContent(7519,1.33975); + ssigpTa->SetBinContent(7520,1.37206); + ssigpTa->SetBinContent(7521,1.40676); + ssigpTa->SetBinContent(7522,1.44158); + ssigpTa->SetBinContent(7523,1.47486); + ssigpTa->SetBinContent(7524,1.51166); + ssigpTa->SetBinContent(7525,1.54958); + ssigpTa->SetBinContent(7526,1.58827); + ssigpTa->SetBinContent(7527,1.62737); + ssigpTa->SetBinContent(7528,1.66733); + ssigpTa->SetBinContent(7529,1.7282); + ssigpTa->SetBinContent(7530,1.89218); + ssigpTa->SetBinContent(7531,2.33352); + ssigpTa->SetBinContent(7532,2.27192); + ssigpTa->SetBinContent(7533,2.27902); + ssigpTa->SetBinContent(7534,2.32918); + ssigpTa->SetBinContent(7535,2.39092); + ssigpTa->SetBinContent(7536,2.45353); + ssigpTa->SetBinContent(7537,2.51699); + ssigpTa->SetBinContent(7538,2.58125); + ssigpTa->SetBinContent(7539,2.64687); + ssigpTa->SetBinContent(7540,2.70384); + ssigpTa->SetBinContent(7541,2.70523); + ssigpTa->SetBinContent(7542,2.53782); + ssigpTa->SetBinContent(7543,2.5336); + ssigpTa->SetBinContent(7544,2.58598); + ssigpTa->SetBinContent(7545,2.65105); + ssigpTa->SetBinContent(7546,2.72296); + ssigpTa->SetBinContent(7547,2.79742); + ssigpTa->SetBinContent(7548,2.86529); + ssigpTa->SetBinContent(7549,2.88808); + ssigpTa->SetBinContent(7550,2.77683); + ssigpTa->SetBinContent(7551,2.81699); + ssigpTa->SetBinContent(7552,2.88767); + ssigpTa->SetBinContent(7553,2.96257); + ssigpTa->SetBinContent(7554,3.03747); + ssigpTa->SetBinContent(7555,3.11422); + ssigpTa->SetBinContent(7556,3.1925); + ssigpTa->SetBinContent(7557,3.27204); + ssigpTa->SetBinContent(7558,3.35206); + ssigpTa->SetBinContent(7559,3.43278); + ssigpTa->SetBinContent(7560,3.51688); + ssigpTa->SetBinContent(7561,3.60905); + ssigpTa->SetBinContent(7562,3.7082); + ssigpTa->SetBinContent(7563,3.81054); + ssigpTa->SetBinContent(7564,3.91561); + ssigpTa->SetBinContent(7565,4.02284); + ssigpTa->SetBinContent(7566,4.13295); + ssigpTa->SetBinContent(7567,4.24603); + ssigpTa->SetBinContent(7568,4.36148); + ssigpTa->SetBinContent(7569,4.5741); + ssigpTa->SetBinContent(7570,5.34325); + ssigpTa->SetBinContent(7571,7.76535); + ssigpTa->SetBinContent(7572,8.58304); + ssigpTa->SetBinContent(7573,8.85348); + ssigpTa->SetBinContent(7574,9.03258); + ssigpTa->SetBinContent(7575,9.21342); + ssigpTa->SetBinContent(7576,9.39213); + ssigpTa->SetBinContent(7577,9.56779); + ssigpTa->SetBinContent(7578,9.74591); + ssigpTa->SetBinContent(7579,9.94078); + ssigpTa->SetBinContent(7580,10.1621); + ssigpTa->SetBinContent(7581,10.3937); + ssigpTa->SetBinContent(7582,10.6364); + ssigpTa->SetBinContent(7583,10.8877); + ssigpTa->SetBinContent(7584,11.1359); + ssigpTa->SetBinContent(7585,11.383); + ssigpTa->SetBinContent(7586,11.6341); + ssigpTa->SetBinContent(7587,11.8951); + ssigpTa->SetBinContent(7588,12.1705); + ssigpTa->SetBinContent(7589,12.456); + ssigpTa->SetBinContent(7590,12.7466); + ssigpTa->SetBinContent(7591,13.0364); + ssigpTa->SetBinContent(7592,13.3302); + ssigpTa->SetBinContent(7593,13.6271); + ssigpTa->SetBinContent(7594,13.9033); + ssigpTa->SetBinContent(7595,14.1623); + ssigpTa->SetBinContent(7596,14.4166); + ssigpTa->SetBinContent(7597,14.6789); + ssigpTa->SetBinContent(7598,14.9498); + ssigpTa->SetBinContent(7599,15.2206); + ssigpTa->SetBinContent(7600,15.4858); + ssigpTa->SetBinContent(7601,15.7702); + ssigpTa->SetBinContent(7602,16.1226); + ssigpTa->SetBinContent(7603,16.5028); + ssigpTa->SetBinContent(7604,16.8908); + ssigpTa->SetBinContent(7605,17.2828); + ssigpTa->SetBinContent(7606,17.6765); + ssigpTa->SetBinContent(7607,18.0894); + ssigpTa->SetBinContent(7608,18.5495); + ssigpTa->SetBinContent(7609,19.0411); + ssigpTa->SetBinContent(7610,19.5582); + ssigpTa->SetBinContent(7611,20.0866); + ssigpTa->SetBinContent(7612,20.5953); + ssigpTa->SetBinContent(7613,21.0734); + ssigpTa->SetBinContent(7614,21.5331); + ssigpTa->SetBinContent(7615,21.9773); + ssigpTa->SetBinContent(7616,22.4074); + ssigpTa->SetBinContent(7617,22.8311); + ssigpTa->SetBinContent(7618,23.2728); + ssigpTa->SetBinContent(7619,23.7716); + ssigpTa->SetBinContent(7620,24.3135); + ssigpTa->SetBinContent(7621,24.8542); + ssigpTa->SetBinContent(7622,25.3856); + ssigpTa->SetBinContent(7623,25.9094); + ssigpTa->SetBinContent(7624,26.4214); + ssigpTa->SetBinContent(7625,26.9225); + ssigpTa->SetBinContent(7626,27.4159); + ssigpTa->SetBinContent(7627,27.8885); + ssigpTa->SetBinContent(7628,28.3448); + ssigpTa->SetBinContent(7629,28.8294); + ssigpTa->SetBinContent(7630,29.4111); + ssigpTa->SetBinContent(7631,30.1041); + ssigpTa->SetBinContent(7632,30.8515); + ssigpTa->SetBinContent(7633,31.6582); + ssigpTa->SetBinContent(7634,32.7977); + ssigpTa->SetBinContent(7635,35.85); + ssigpTa->SetBinContent(7636,44.751); + ssigpTa->SetBinContent(7637,48.0176); + ssigpTa->SetBinContent(7638,49.4174); + ssigpTa->SetBinContent(7639,50.5774); + ssigpTa->SetBinContent(7640,51.9037); + ssigpTa->SetBinContent(7641,53.3516); + ssigpTa->SetBinContent(7642,54.8965); + ssigpTa->SetBinContent(7643,56.5292); + ssigpTa->SetBinContent(7644,58.2009); + ssigpTa->SetBinContent(7645,59.8292); + ssigpTa->SetBinContent(7646,61.4402); + ssigpTa->SetBinContent(7647,63.0855); + ssigpTa->SetBinContent(7648,64.8892); + ssigpTa->SetBinContent(7649,66.8338); + ssigpTa->SetBinContent(7650,68.8257); + ssigpTa->SetBinContent(7651,70.8651); + ssigpTa->SetBinContent(7652,72.9081); + ssigpTa->SetBinContent(7653,75.5443); + ssigpTa->SetBinContent(7654,83.0524); + ssigpTa->SetBinContent(7655,112.877); + ssigpTa->SetBinContent(7658,0.4294); + ssigpTa->SetBinContent(7659,0.4586); + ssigpTa->SetBinContent(7660,0.44745); + ssigpTa->SetBinContent(7661,0.44745); + ssigpTa->SetBinContent(7662,0.44745); + ssigpTa->SetBinContent(7663,0.44745); + ssigpTa->SetBinContent(7664,0.44745); + ssigpTa->SetBinContent(7665,0.44745); + ssigpTa->SetBinContent(7666,0.44745); + ssigpTa->SetBinContent(7667,0.44745); + ssigpTa->SetBinContent(7668,0.44745); + ssigpTa->SetBinContent(7669,0.44745); + ssigpTa->SetBinContent(7670,0.44745); + ssigpTa->SetBinContent(7671,0.44745); + ssigpTa->SetBinContent(7672,0.44745); + ssigpTa->SetBinContent(7673,0.44745); + ssigpTa->SetBinContent(7674,0.44745); + ssigpTa->SetBinContent(7675,0.44745); + ssigpTa->SetBinContent(7676,0.44745); + ssigpTa->SetBinContent(7677,0.44745); + ssigpTa->SetBinContent(7678,0.44745); + ssigpTa->SetBinContent(7679,0.44745); + ssigpTa->SetBinContent(7680,0.44745); + ssigpTa->SetBinContent(7681,0.44745); + ssigpTa->SetBinContent(7682,0.447492); + ssigpTa->SetBinContent(7683,0.447617); + ssigpTa->SetBinContent(7684,0.447867); + ssigpTa->SetBinContent(7685,0.447992); + ssigpTa->SetBinContent(7686,0.448033); + ssigpTa->SetBinContent(7687,0.448033); + ssigpTa->SetBinContent(7688,0.448042); + ssigpTa->SetBinContent(7689,0.448042); + ssigpTa->SetBinContent(7690,0.448042); + ssigpTa->SetBinContent(7691,0.448042); + ssigpTa->SetBinContent(7692,0.448042); + ssigpTa->SetBinContent(7693,0.448042); + ssigpTa->SetBinContent(7694,0.448042); + ssigpTa->SetBinContent(7695,0.448042); + ssigpTa->SetBinContent(7696,0.448625); + ssigpTa->SetBinContent(7697,0.449208); + ssigpTa->SetBinContent(7698,0.449792); + ssigpTa->SetBinContent(7699,0.449792); + ssigpTa->SetBinContent(7700,0.449792); + ssigpTa->SetBinContent(7701,0.449792); + ssigpTa->SetBinContent(7702,0.449792); + ssigpTa->SetBinContent(7703,0.449792); + ssigpTa->SetBinContent(7704,0.4498); + ssigpTa->SetBinContent(7705,0.4498); + ssigpTa->SetBinContent(7706,0.4498); + ssigpTa->SetBinContent(7707,0.4498); + ssigpTa->SetBinContent(7708,0.4498); + ssigpTa->SetBinContent(7709,0.4498); + ssigpTa->SetBinContent(7710,0.449842); + ssigpTa->SetBinContent(7711,0.449925); + ssigpTa->SetBinContent(7712,0.45005); + ssigpTa->SetBinContent(7713,0.450258); + ssigpTa->SetBinContent(7714,0.450342); + ssigpTa->SetBinContent(7715,0.450392); + ssigpTa->SetBinContent(7716,0.450392); + ssigpTa->SetBinContent(7717,0.450392); + ssigpTa->SetBinContent(7718,0.450392); + ssigpTa->SetBinContent(7719,0.450975); + ssigpTa->SetBinContent(7720,0.451558); + ssigpTa->SetBinContent(7721,0.452142); + ssigpTa->SetBinContent(7722,0.452142); + ssigpTa->SetBinContent(7723,0.45215); + ssigpTa->SetBinContent(7724,0.452192); + ssigpTa->SetBinContent(7725,0.452233); + ssigpTa->SetBinContent(7726,0.452317); + ssigpTa->SetBinContent(7727,0.4524); + ssigpTa->SetBinContent(7728,0.452608); + ssigpTa->SetBinContent(7729,0.452692); + ssigpTa->SetBinContent(7730,0.452742); + ssigpTa->SetBinContent(7731,0.452742); + ssigpTa->SetBinContent(7732,0.453325); + ssigpTa->SetBinContent(7733,0.453908); + ssigpTa->SetBinContent(7734,0.454492); + ssigpTa->SetBinContent(7735,0.454533); + ssigpTa->SetBinContent(7736,0.454575); + ssigpTa->SetBinContent(7737,0.454667); + ssigpTa->SetBinContent(7738,0.45475); + ssigpTa->SetBinContent(7739,0.454958); + ssigpTa->SetBinContent(7740,0.455042); + ssigpTa->SetBinContent(7741,0.455083); + ssigpTa->SetBinContent(7742,0.455675); + ssigpTa->SetBinContent(7743,0.4563); + ssigpTa->SetBinContent(7744,0.456925); + ssigpTa->SetBinContent(7745,0.457008); + ssigpTa->SetBinContent(7746,0.457092); + ssigpTa->SetBinContent(7747,0.457308); + ssigpTa->SetBinContent(7748,0.457392); + ssigpTa->SetBinContent(7749,0.457433); + ssigpTa->SetBinContent(7750,0.458058); + ssigpTa->SetBinContent(7751,0.458692); + ssigpTa->SetBinContent(7752,0.459358); + ssigpTa->SetBinContent(7753,0.459442); + ssigpTa->SetBinContent(7754,0.45965); + ssigpTa->SetBinContent(7755,0.459742); + ssigpTa->SetBinContent(7756,0.460408); + ssigpTa->SetBinContent(7757,0.461033); + ssigpTa->SetBinContent(7758,0.461708); + ssigpTa->SetBinContent(7759,0.461792); + ssigpTa->SetBinContent(7760,0.462); + ssigpTa->SetBinContent(7761,0.462667); + ssigpTa->SetBinContent(7762,0.462008); + ssigpTa->SetBinContent(7763,0.464417); + ssigpTa->SetBinContent(7764,0.519); + ssigpTa->SetBinContent(7765,0.585308); + ssigpTa->SetBinContent(7766,0.641392); + ssigpTa->SetBinContent(7767,0.64535); + ssigpTa->SetBinContent(7768,0.646067); + ssigpTa->SetBinContent(7769,0.646775); + ssigpTa->SetBinContent(7770,0.646992); + ssigpTa->SetBinContent(7771,0.6477); + ssigpTa->SetBinContent(7772,0.648408); + ssigpTa->SetBinContent(7773,0.649125); + ssigpTa->SetBinContent(7774,0.646792); + ssigpTa->SetBinContent(7775,0.604042); + ssigpTa->SetBinContent(7776,0.560633); + ssigpTa->SetBinContent(7777,0.531175); + ssigpTa->SetBinContent(7778,0.546817); + ssigpTa->SetBinContent(7779,0.562533); + ssigpTa->SetBinContent(7780,0.578217); + ssigpTa->SetBinContent(7781,0.593942); + ssigpTa->SetBinContent(7782,0.609667); + ssigpTa->SetBinContent(7783,0.623258); + ssigpTa->SetBinContent(7784,0.593483); + ssigpTa->SetBinContent(7785,0.555233); + ssigpTa->SetBinContent(7786,0.524783); + ssigpTa->SetBinContent(7787,0.537667); + ssigpTa->SetBinContent(7788,0.5526); + ssigpTa->SetBinContent(7789,0.568275); + ssigpTa->SetBinContent(7790,0.584); + ssigpTa->SetBinContent(7791,0.600392); + ssigpTa->SetBinContent(7792,0.616825); + ssigpTa->SetBinContent(7793,0.634008); + ssigpTa->SetBinContent(7794,0.64895); + ssigpTa->SetBinContent(7795,0.616475); + ssigpTa->SetBinContent(7796,0.572917); + ssigpTa->SetBinContent(7797,0.537425); + ssigpTa->SetBinContent(7798,0.5486); + ssigpTa->SetBinContent(7799,0.5629); + ssigpTa->SetBinContent(7800,0.577792); + ssigpTa->SetBinContent(7801,0.593475); + ssigpTa->SetBinContent(7802,0.610158); + ssigpTa->SetBinContent(7803,0.6328); + ssigpTa->SetBinContent(7804,0.656483); + ssigpTa->SetBinContent(7805,0.676125); + ssigpTa->SetBinContent(7806,0.641183); + ssigpTa->SetBinContent(7807,0.595575); + ssigpTa->SetBinContent(7808,0.55795); + ssigpTa->SetBinContent(7809,0.568292); + ssigpTa->SetBinContent(7810,0.581592); + ssigpTa->SetBinContent(7811,0.595475); + ssigpTa->SetBinContent(7812,0.609525); + ssigpTa->SetBinContent(7813,0.623792); + ssigpTa->SetBinContent(7814,0.638633); + ssigpTa->SetBinContent(7815,0.65365); + ssigpTa->SetBinContent(7816,0.669208); + ssigpTa->SetBinContent(7817,0.68185); + ssigpTa->SetBinContent(7818,0.645742); + ssigpTa->SetBinContent(7819,0.599092); + ssigpTa->SetBinContent(7820,0.561517); + ssigpTa->SetBinContent(7821,0.584358); + ssigpTa->SetBinContent(7822,0.6126); + ssigpTa->SetBinContent(7823,0.639117); + ssigpTa->SetBinContent(7824,0.653917); + ssigpTa->SetBinContent(7825,0.668175); + ssigpTa->SetBinContent(7826,0.6824); + ssigpTa->SetBinContent(7827,0.6972); + ssigpTa->SetBinContent(7828,0.709967); + ssigpTa->SetBinContent(7829,0.67865); + ssigpTa->SetBinContent(7830,0.637392); + ssigpTa->SetBinContent(7831,0.603483); + ssigpTa->SetBinContent(7832,0.605658); + ssigpTa->SetBinContent(7833,0.609592); + ssigpTa->SetBinContent(7834,0.615192); + ssigpTa->SetBinContent(7835,0.628992); + ssigpTa->SetBinContent(7836,0.647333); + ssigpTa->SetBinContent(7837,0.667117); + ssigpTa->SetBinContent(7838,0.686967); + ssigpTa->SetBinContent(7839,0.703567); + ssigpTa->SetBinContent(7840,0.72); + ssigpTa->SetBinContent(7841,0.734108); + ssigpTa->SetBinContent(7842,0.710208); + ssigpTa->SetBinContent(7843,0.679558); + ssigpTa->SetBinContent(7844,0.667442); + ssigpTa->SetBinContent(7845,0.695533); + ssigpTa->SetBinContent(7846,0.724467); + ssigpTa->SetBinContent(7847,0.742275); + ssigpTa->SetBinContent(7848,0.760133); + ssigpTa->SetBinContent(7849,0.776658); + ssigpTa->SetBinContent(7850,0.781883); + ssigpTa->SetBinContent(7851,0.784783); + ssigpTa->SetBinContent(7852,0.789975); + ssigpTa->SetBinContent(7853,0.807917); + ssigpTa->SetBinContent(7854,0.826692); + ssigpTa->SetBinContent(7855,0.846308); + ssigpTa->SetBinContent(7856,0.865875); + ssigpTa->SetBinContent(7857,0.886242); + ssigpTa->SetBinContent(7858,0.908275); + ssigpTa->SetBinContent(7859,0.947683); + ssigpTa->SetBinContent(7860,0.991142); + ssigpTa->SetBinContent(7861,1.03223); + ssigpTa->SetBinContent(7862,1.05573); + ssigpTa->SetBinContent(7863,1.06012); + ssigpTa->SetBinContent(7864,1.0608); + ssigpTa->SetBinContent(7865,1.06597); + ssigpTa->SetBinContent(7866,1.08989); + ssigpTa->SetBinContent(7867,1.11569); + ssigpTa->SetBinContent(7868,1.14212); + ssigpTa->SetBinContent(7869,1.16984); + ssigpTa->SetBinContent(7870,1.21698); + ssigpTa->SetBinContent(7871,1.26866); + ssigpTa->SetBinContent(7872,1.31806); + ssigpTa->SetBinContent(7873,1.34897); + ssigpTa->SetBinContent(7874,1.35482); + ssigpTa->SetBinContent(7875,1.35585); + ssigpTa->SetBinContent(7876,1.36162); + ssigpTa->SetBinContent(7877,1.39216); + ssigpTa->SetBinContent(7878,1.42494); + ssigpTa->SetBinContent(7879,1.45847); + ssigpTa->SetBinContent(7880,1.49294); + ssigpTa->SetBinContent(7881,1.52978); + ssigpTa->SetBinContent(7882,1.58412); + ssigpTa->SetBinContent(7883,1.64302); + ssigpTa->SetBinContent(7884,1.69798); + ssigpTa->SetBinContent(7885,1.70926); + ssigpTa->SetBinContent(7886,1.71397); + ssigpTa->SetBinContent(7887,1.72553); + ssigpTa->SetBinContent(7888,1.76602); + ssigpTa->SetBinContent(7889,1.80946); + ssigpTa->SetBinContent(7890,1.85249); + ssigpTa->SetBinContent(7891,1.89693); + ssigpTa->SetBinContent(7892,1.94168); + ssigpTa->SetBinContent(7893,1.98813); + ssigpTa->SetBinContent(7894,2.0413); + ssigpTa->SetBinContent(7895,2.07347); + ssigpTa->SetBinContent(7896,2.10088); + ssigpTa->SetBinContent(7897,2.12665); + ssigpTa->SetBinContent(7898,2.17733); + ssigpTa->SetBinContent(7899,2.22982); + ssigpTa->SetBinContent(7900,2.28351); + ssigpTa->SetBinContent(7901,2.33758); + ssigpTa->SetBinContent(7902,2.3936); + ssigpTa->SetBinContent(7903,2.45148); + ssigpTa->SetBinContent(7904,2.51227); + ssigpTa->SetBinContent(7905,2.57388); + ssigpTa->SetBinContent(7906,2.62232); + ssigpTa->SetBinContent(7907,2.66877); + ssigpTa->SetBinContent(7908,2.7195); + ssigpTa->SetBinContent(7909,2.7849); + ssigpTa->SetBinContent(7910,2.85188); + ssigpTa->SetBinContent(7911,2.91925); + ssigpTa->SetBinContent(7912,2.99008); + ssigpTa->SetBinContent(7913,3.06435); + ssigpTa->SetBinContent(7914,3.14158); + ssigpTa->SetBinContent(7915,3.22032); + ssigpTa->SetBinContent(7916,3.29715); + ssigpTa->SetBinContent(7917,3.37484); + ssigpTa->SetBinContent(7918,3.45659); + ssigpTa->SetBinContent(7919,3.58468); + ssigpTa->SetBinContent(7920,3.72421); + ssigpTa->SetBinContent(7921,3.85798); + ssigpTa->SetBinContent(7922,3.95282); + ssigpTa->SetBinContent(7923,4.04961); + ssigpTa->SetBinContent(7924,4.15085); + ssigpTa->SetBinContent(7925,4.25189); + ssigpTa->SetBinContent(7926,4.35458); + ssigpTa->SetBinContent(7927,4.46038); + ssigpTa->SetBinContent(7928,4.57313); + ssigpTa->SetBinContent(7929,4.68716); + ssigpTa->SetBinContent(7930,4.80281); + ssigpTa->SetBinContent(7931,4.92153); + ssigpTa->SetBinContent(7932,5.08375); + ssigpTa->SetBinContent(7933,5.87607); + ssigpTa->SetBinContent(7934,6.46704); + ssigpTa->SetBinContent(7935,6.87637); + ssigpTa->SetBinContent(7936,6.72314); + ssigpTa->SetBinContent(7937,6.87965); + ssigpTa->SetBinContent(7938,7.06218); + ssigpTa->SetBinContent(7939,7.24722); + ssigpTa->SetBinContent(7940,7.43459); + ssigpTa->SetBinContent(7941,7.62502); + ssigpTa->SetBinContent(7942,7.81867); + ssigpTa->SetBinContent(7943,7.99575); + ssigpTa->SetBinContent(7944,7.84962); + ssigpTa->SetBinContent(7945,7.63295); + ssigpTa->SetBinContent(7946,7.47424); + ssigpTa->SetBinContent(7947,7.63743); + ssigpTa->SetBinContent(7948,7.83298); + ssigpTa->SetBinContent(7949,8.04184); + ssigpTa->SetBinContent(7950,8.26237); + ssigpTa->SetBinContent(7951,8.46959); + ssigpTa->SetBinContent(7952,8.41224); + ssigpTa->SetBinContent(7953,8.32828); + ssigpTa->SetBinContent(7954,8.29907); + ssigpTa->SetBinContent(7955,8.53046); + ssigpTa->SetBinContent(7956,8.75023); + ssigpTa->SetBinContent(7957,8.97256); + ssigpTa->SetBinContent(7958,9.19912); + ssigpTa->SetBinContent(7959,9.43069); + ssigpTa->SetBinContent(7960,9.66553); + ssigpTa->SetBinContent(7961,9.90205); + ssigpTa->SetBinContent(7962,10.1414); + ssigpTa->SetBinContent(7963,10.3928); + ssigpTa->SetBinContent(7964,10.6645); + ssigpTa->SetBinContent(7965,10.9555); + ssigpTa->SetBinContent(7966,11.2587); + ssigpTa->SetBinContent(7967,11.5688); + ssigpTa->SetBinContent(7968,11.8864); + ssigpTa->SetBinContent(7969,12.2119); + ssigpTa->SetBinContent(7970,12.5459); + ssigpTa->SetBinContent(7971,12.887); + ssigpTa->SetBinContent(7972,13.4323); + ssigpTa->SetBinContent(7973,17.1662); + ssigpTa->SetBinContent(7974,21.5949); + ssigpTa->SetBinContent(7975,25.4473); + ssigpTa->SetBinContent(7976,26.1707); + ssigpTa->SetBinContent(7977,26.6988); + ssigpTa->SetBinContent(7978,27.2316); + ssigpTa->SetBinContent(7979,27.7593); + ssigpTa->SetBinContent(7980,28.2795); + ssigpTa->SetBinContent(7981,28.8118); + ssigpTa->SetBinContent(7982,29.3956); + ssigpTa->SetBinContent(7983,30.0367); + ssigpTa->SetBinContent(7984,30.7265); + ssigpTa->SetBinContent(7985,31.4441); + ssigpTa->SetBinContent(7986,32.1794); + ssigpTa->SetBinContent(7987,32.9163); + ssigpTa->SetBinContent(7988,33.6484); + ssigpTa->SetBinContent(7989,34.3924); + ssigpTa->SetBinContent(7990,35.1667); + ssigpTa->SetBinContent(7991,35.978); + ssigpTa->SetBinContent(7992,36.8214); + ssigpTa->SetBinContent(7993,37.6764); + ssigpTa->SetBinContent(7994,38.5372); + ssigpTa->SetBinContent(7995,39.4096); + ssigpTa->SetBinContent(7996,40.271); + ssigpTa->SetBinContent(7997,41.093); + ssigpTa->SetBinContent(7998,41.8629); + ssigpTa->SetBinContent(7999,42.6202); + ssigpTa->SetBinContent(8000,43.3956); + ssigpTa->SetBinContent(8001,44.1931); + ssigpTa->SetBinContent(8002,44.988); + ssigpTa->SetBinContent(8003,45.7773); + ssigpTa->SetBinContent(8004,46.6548); + ssigpTa->SetBinContent(8005,47.6627); + ssigpTa->SetBinContent(8006,48.7849); + ssigpTa->SetBinContent(8007,49.9337); + ssigpTa->SetBinContent(8008,51.0882); + ssigpTa->SetBinContent(8009,52.2578); + ssigpTa->SetBinContent(8010,53.4973); + ssigpTa->SetBinContent(8011,54.8416); + ssigpTa->SetBinContent(8012,56.2979); + ssigpTa->SetBinContent(8013,57.8245); + ssigpTa->SetBinContent(8014,59.3714); + ssigpTa->SetBinContent(8015,60.8718); + ssigpTa->SetBinContent(8016,62.2945); + ssigpTa->SetBinContent(8017,63.6524); + ssigpTa->SetBinContent(8018,64.9656); + ssigpTa->SetBinContent(8019,66.2381); + ssigpTa->SetBinContent(8020,67.4965); + ssigpTa->SetBinContent(8021,68.8259); + ssigpTa->SetBinContent(8022,70.2928); + ssigpTa->SetBinContent(8023,71.8709); + ssigpTa->SetBinContent(8024,73.4731); + ssigpTa->SetBinContent(8025,75.0466); + ssigpTa->SetBinContent(8026,76.5917); + ssigpTa->SetBinContent(8027,78.106); + ssigpTa->SetBinContent(8028,79.5926); + ssigpTa->SetBinContent(8029,81.0422); + ssigpTa->SetBinContent(8030,82.4381); + ssigpTa->SetBinContent(8031,83.8011); + ssigpTa->SetBinContent(8032,85.266); + ssigpTa->SetBinContent(8033,86.9948); + ssigpTa->SetBinContent(8034,88.9998); + ssigpTa->SetBinContent(8035,91.24); + ssigpTa->SetBinContent(8036,93.59); + ssigpTa->SetBinContent(8037,96.6358); + ssigpTa->SetBinContent(8038,110.863); + ssigpTa->SetBinContent(8039,127.52); + ssigpTa->SetBinContent(8040,142.265); + ssigpTa->SetBinContent(8041,146.12); + ssigpTa->SetBinContent(8042,149.602); + ssigpTa->SetBinContent(8043,153.482); + ssigpTa->SetBinContent(8044,157.759); + ssigpTa->SetBinContent(8045,162.333); + ssigpTa->SetBinContent(8046,167.147); + ssigpTa->SetBinContent(8047,172.039); + ssigpTa->SetBinContent(8048,176.882); + ssigpTa->SetBinContent(8049,181.642); + ssigpTa->SetBinContent(8050,186.582); + ssigpTa->SetBinContent(8051,191.898); + ssigpTa->SetBinContent(8052,197.59); + ssigpTa->SetBinContent(8053,203.503); + ssigpTa->SetBinContent(8054,209.544); + ssigpTa->SetBinContent(8055,215.474); + ssigpTa->SetBinContent(8056,222.529); + ssigpTa->SetBinContent(8057,260.533); + ssigpTa->SetBinContent(8058,265.985); + ssigpTa->SetBinContent(8061,0.888923); + ssigpTa->SetBinContent(8062,0.859529); + ssigpTa->SetBinContent(8063,0.886056); + ssigpTa->SetBinContent(8064,0.886056); + ssigpTa->SetBinContent(8065,0.886056); + ssigpTa->SetBinContent(8066,0.886056); + ssigpTa->SetBinContent(8067,0.886056); + ssigpTa->SetBinContent(8068,0.886056); + ssigpTa->SetBinContent(8069,0.886056); + ssigpTa->SetBinContent(8070,0.886056); + ssigpTa->SetBinContent(8071,0.886056); + ssigpTa->SetBinContent(8072,0.886056); + ssigpTa->SetBinContent(8073,0.886056); + ssigpTa->SetBinContent(8074,0.886056); + ssigpTa->SetBinContent(8075,0.886056); + ssigpTa->SetBinContent(8076,0.886056); + ssigpTa->SetBinContent(8077,0.886056); + ssigpTa->SetBinContent(8078,0.886056); + ssigpTa->SetBinContent(8079,0.886056); + ssigpTa->SetBinContent(8080,0.886056); + ssigpTa->SetBinContent(8081,0.886056); + ssigpTa->SetBinContent(8082,0.886056); + ssigpTa->SetBinContent(8083,0.886056); + ssigpTa->SetBinContent(8084,0.886056); + ssigpTa->SetBinContent(8085,0.886056); + ssigpTa->SetBinContent(8086,0.886167); + ssigpTa->SetBinContent(8087,0.886306); + ssigpTa->SetBinContent(8088,0.886417); + ssigpTa->SetBinContent(8089,0.886417); + ssigpTa->SetBinContent(8090,0.886417); + ssigpTa->SetBinContent(8091,0.886417); + ssigpTa->SetBinContent(8092,0.886417); + ssigpTa->SetBinContent(8093,0.886417); + ssigpTa->SetBinContent(8094,0.886417); + ssigpTa->SetBinContent(8095,0.886417); + ssigpTa->SetBinContent(8096,0.886417); + ssigpTa->SetBinContent(8097,0.886417); + ssigpTa->SetBinContent(8098,0.886806); + ssigpTa->SetBinContent(8099,0.887583); + ssigpTa->SetBinContent(8100,0.889528); + ssigpTa->SetBinContent(8101,0.890306); + ssigpTa->SetBinContent(8102,0.890694); + ssigpTa->SetBinContent(8103,0.890694); + ssigpTa->SetBinContent(8104,0.890694); + ssigpTa->SetBinContent(8105,0.890694); + ssigpTa->SetBinContent(8106,0.890694); + ssigpTa->SetBinContent(8107,0.890694); + ssigpTa->SetBinContent(8108,0.890694); + ssigpTa->SetBinContent(8109,0.890694); + ssigpTa->SetBinContent(8110,0.890694); + ssigpTa->SetBinContent(8111,0.890694); + ssigpTa->SetBinContent(8112,0.890694); + ssigpTa->SetBinContent(8113,0.890694); + ssigpTa->SetBinContent(8114,0.890722); + ssigpTa->SetBinContent(8115,0.890833); + ssigpTa->SetBinContent(8116,0.890944); + ssigpTa->SetBinContent(8117,0.891056); + ssigpTa->SetBinContent(8118,0.891056); + ssigpTa->SetBinContent(8119,0.891056); + ssigpTa->SetBinContent(8120,0.891056); + ssigpTa->SetBinContent(8121,0.891444); + ssigpTa->SetBinContent(8122,0.892222); + ssigpTa->SetBinContent(8123,0.894167); + ssigpTa->SetBinContent(8124,0.894944); + ssigpTa->SetBinContent(8125,0.895333); + ssigpTa->SetBinContent(8126,0.895333); + ssigpTa->SetBinContent(8127,0.895333); + ssigpTa->SetBinContent(8128,0.895361); + ssigpTa->SetBinContent(8129,0.895361); + ssigpTa->SetBinContent(8130,0.895472); + ssigpTa->SetBinContent(8131,0.895583); + ssigpTa->SetBinContent(8132,0.895694); + ssigpTa->SetBinContent(8133,0.895694); + ssigpTa->SetBinContent(8134,0.896083); + ssigpTa->SetBinContent(8135,0.896861); + ssigpTa->SetBinContent(8136,0.898806); + ssigpTa->SetBinContent(8137,0.899583); + ssigpTa->SetBinContent(8138,0.899972); + ssigpTa->SetBinContent(8139,0.9); + ssigpTa->SetBinContent(8140,0.9); + ssigpTa->SetBinContent(8141,0.900111); + ssigpTa->SetBinContent(8142,0.900222); + ssigpTa->SetBinContent(8143,0.900333); + ssigpTa->SetBinContent(8144,0.900722); + ssigpTa->SetBinContent(8145,0.9015); + ssigpTa->SetBinContent(8146,0.903444); + ssigpTa->SetBinContent(8147,0.90425); + ssigpTa->SetBinContent(8148,0.904639); + ssigpTa->SetBinContent(8149,0.90475); + ssigpTa->SetBinContent(8150,0.904861); + ssigpTa->SetBinContent(8151,0.904972); + ssigpTa->SetBinContent(8152,0.905361); + ssigpTa->SetBinContent(8153,0.906139); + ssigpTa->SetBinContent(8154,0.908111); + ssigpTa->SetBinContent(8155,0.908889); + ssigpTa->SetBinContent(8156,0.909389); + ssigpTa->SetBinContent(8157,0.9095); + ssigpTa->SetBinContent(8158,0.91); + ssigpTa->SetBinContent(8159,0.910778); + ssigpTa->SetBinContent(8160,0.91275); + ssigpTa->SetBinContent(8161,0.913528); + ssigpTa->SetBinContent(8162,0.914028); + ssigpTa->SetBinContent(8163,0.914528); + ssigpTa->SetBinContent(8164,0.914639); + ssigpTa->SetBinContent(8165,0.914944); + ssigpTa->SetBinContent(8166,0.942389); + ssigpTa->SetBinContent(8167,1.01122); + ssigpTa->SetBinContent(8168,1.17503); + ssigpTa->SetBinContent(8169,1.24564); + ssigpTa->SetBinContent(8170,1.27725); + ssigpTa->SetBinContent(8171,1.27922); + ssigpTa->SetBinContent(8172,1.28011); + ssigpTa->SetBinContent(8173,1.281); + ssigpTa->SetBinContent(8174,1.28189); + ssigpTa->SetBinContent(8175,1.28386); + ssigpTa->SetBinContent(8176,1.28475); + ssigpTa->SetBinContent(8177,1.26153); + ssigpTa->SetBinContent(8178,1.21161); + ssigpTa->SetBinContent(8179,1.0965); + ssigpTa->SetBinContent(8180,1.07325); + ssigpTa->SetBinContent(8181,1.08078); + ssigpTa->SetBinContent(8182,1.1135); + ssigpTa->SetBinContent(8183,1.14469); + ssigpTa->SetBinContent(8184,1.17522); + ssigpTa->SetBinContent(8185,1.20689); + ssigpTa->SetBinContent(8186,1.21358); + ssigpTa->SetBinContent(8187,1.18828); + ssigpTa->SetBinContent(8188,1.08486); + ssigpTa->SetBinContent(8189,1.05875); + ssigpTa->SetBinContent(8190,1.06339); + ssigpTa->SetBinContent(8191,1.09417); + ssigpTa->SetBinContent(8192,1.12419); + ssigpTa->SetBinContent(8193,1.15589); + ssigpTa->SetBinContent(8194,1.18794); + ssigpTa->SetBinContent(8195,1.22083); + ssigpTa->SetBinContent(8196,1.25458); + ssigpTa->SetBinContent(8197,1.26242); + ssigpTa->SetBinContent(8198,1.23425); + ssigpTa->SetBinContent(8199,1.11869); + ssigpTa->SetBinContent(8200,1.08497); + ssigpTa->SetBinContent(8201,1.08569); + ssigpTa->SetBinContent(8202,1.11403); + ssigpTa->SetBinContent(8203,1.14325); + ssigpTa->SetBinContent(8204,1.17444); + ssigpTa->SetBinContent(8205,1.21003); + ssigpTa->SetBinContent(8206,1.25039); + ssigpTa->SetBinContent(8207,1.30147); + ssigpTa->SetBinContent(8208,1.31344); + ssigpTa->SetBinContent(8209,1.28425); + ssigpTa->SetBinContent(8210,1.163); + ssigpTa->SetBinContent(8211,1.12644); + ssigpTa->SetBinContent(8212,1.12419); + ssigpTa->SetBinContent(8213,1.15114); + ssigpTa->SetBinContent(8214,1.17847); + ssigpTa->SetBinContent(8215,1.20631); + ssigpTa->SetBinContent(8216,1.23464); + ssigpTa->SetBinContent(8217,1.26347); + ssigpTa->SetBinContent(8218,1.29378); + ssigpTa->SetBinContent(8219,1.32381); + ssigpTa->SetBinContent(8220,1.32661); + ssigpTa->SetBinContent(8221,1.29253); + ssigpTa->SetBinContent(8222,1.16917); + ssigpTa->SetBinContent(8223,1.13861); + ssigpTa->SetBinContent(8224,1.15197); + ssigpTa->SetBinContent(8225,1.21628); + ssigpTa->SetBinContent(8226,1.25958); + ssigpTa->SetBinContent(8227,1.29442); + ssigpTa->SetBinContent(8228,1.32239); + ssigpTa->SetBinContent(8229,1.35072); + ssigpTa->SetBinContent(8230,1.37983); + ssigpTa->SetBinContent(8231,1.38486); + ssigpTa->SetBinContent(8232,1.35658); + ssigpTa->SetBinContent(8233,1.24733); + ssigpTa->SetBinContent(8234,1.21028); + ssigpTa->SetBinContent(8235,1.20086); + ssigpTa->SetBinContent(8236,1.20333); + ssigpTa->SetBinContent(8237,1.2205); + ssigpTa->SetBinContent(8238,1.246); + ssigpTa->SetBinContent(8239,1.27956); + ssigpTa->SetBinContent(8240,1.32117); + ssigpTa->SetBinContent(8241,1.35767); + ssigpTa->SetBinContent(8242,1.39208); + ssigpTa->SetBinContent(8243,1.42458); + ssigpTa->SetBinContent(8244,1.43489); + ssigpTa->SetBinContent(8245,1.41681); + ssigpTa->SetBinContent(8246,1.33717); + ssigpTa->SetBinContent(8247,1.33408); + ssigpTa->SetBinContent(8248,1.38003); + ssigpTa->SetBinContent(8249,1.42839); + ssigpTa->SetBinContent(8250,1.46992); + ssigpTa->SetBinContent(8251,1.50408); + ssigpTa->SetBinContent(8252,1.5325); + ssigpTa->SetBinContent(8253,1.55117); + ssigpTa->SetBinContent(8254,1.5495); + ssigpTa->SetBinContent(8255,1.56972); + ssigpTa->SetBinContent(8256,1.59856); + ssigpTa->SetBinContent(8257,1.63694); + ssigpTa->SetBinContent(8258,1.67494); + ssigpTa->SetBinContent(8259,1.71386); + ssigpTa->SetBinContent(8260,1.75431); + ssigpTa->SetBinContent(8261,1.80578); + ssigpTa->SetBinContent(8262,1.87092); + ssigpTa->SetBinContent(8263,1.96797); + ssigpTa->SetBinContent(8264,2.03619); + ssigpTa->SetBinContent(8265,2.08194); + ssigpTa->SetBinContent(8266,2.10433); + ssigpTa->SetBinContent(8267,2.09486); + ssigpTa->SetBinContent(8268,2.11853); + ssigpTa->SetBinContent(8269,2.15789); + ssigpTa->SetBinContent(8270,2.20892); + ssigpTa->SetBinContent(8271,2.26075); + ssigpTa->SetBinContent(8272,2.32511); + ssigpTa->SetBinContent(8273,2.40361); + ssigpTa->SetBinContent(8274,2.51797); + ssigpTa->SetBinContent(8275,2.60189); + ssigpTa->SetBinContent(8276,2.65958); + ssigpTa->SetBinContent(8277,2.69008); + ssigpTa->SetBinContent(8278,2.67669); + ssigpTa->SetBinContent(8279,2.70667); + ssigpTa->SetBinContent(8280,2.75633); + ssigpTa->SetBinContent(8281,2.82128); + ssigpTa->SetBinContent(8282,2.8875); + ssigpTa->SetBinContent(8283,2.95619); + ssigpTa->SetBinContent(8284,3.03642); + ssigpTa->SetBinContent(8285,3.13183); + ssigpTa->SetBinContent(8286,3.25889); + ssigpTa->SetBinContent(8287,3.34236); + ssigpTa->SetBinContent(8288,3.39333); + ssigpTa->SetBinContent(8289,3.38561); + ssigpTa->SetBinContent(8290,3.42931); + ssigpTa->SetBinContent(8291,3.49764); + ssigpTa->SetBinContent(8292,3.58244); + ssigpTa->SetBinContent(8293,3.66917); + ssigpTa->SetBinContent(8294,3.75575); + ssigpTa->SetBinContent(8295,3.84558); + ssigpTa->SetBinContent(8296,3.94017); + ssigpTa->SetBinContent(8297,4.02911); + ssigpTa->SetBinContent(8298,4.11617); + ssigpTa->SetBinContent(8299,4.14925); + ssigpTa->SetBinContent(8300,4.22269); + ssigpTa->SetBinContent(8301,4.31125); + ssigpTa->SetBinContent(8302,4.41617); + ssigpTa->SetBinContent(8303,4.52131); + ssigpTa->SetBinContent(8304,4.62994); + ssigpTa->SetBinContent(8305,4.74008); + ssigpTa->SetBinContent(8306,4.85556); + ssigpTa->SetBinContent(8307,4.97539); + ssigpTa->SetBinContent(8308,5.09081); + ssigpTa->SetBinContent(8309,5.19742); + ssigpTa->SetBinContent(8310,5.28069); + ssigpTa->SetBinContent(8311,5.39153); + ssigpTa->SetBinContent(8312,5.51531); + ssigpTa->SetBinContent(8313,5.64728); + ssigpTa->SetBinContent(8314,5.78247); + ssigpTa->SetBinContent(8315,5.92172); + ssigpTa->SetBinContent(8316,6.06967); + ssigpTa->SetBinContent(8317,6.22208); + ssigpTa->SetBinContent(8318,6.37581); + ssigpTa->SetBinContent(8319,6.53117); + ssigpTa->SetBinContent(8320,6.68261); + ssigpTa->SetBinContent(8321,6.86631); + ssigpTa->SetBinContent(8322,7.08725); + ssigpTa->SetBinContent(8323,7.38894); + ssigpTa->SetBinContent(8324,7.62242); + ssigpTa->SetBinContent(8325,7.83); + ssigpTa->SetBinContent(8326,8.02067); + ssigpTa->SetBinContent(8327,8.22031); + ssigpTa->SetBinContent(8328,8.42294); + ssigpTa->SetBinContent(8329,8.62303); + ssigpTa->SetBinContent(8330,8.83692); + ssigpTa->SetBinContent(8331,9.05725); + ssigpTa->SetBinContent(8332,9.28367); + ssigpTa->SetBinContent(8333,9.51314); + ssigpTa->SetBinContent(8334,9.74767); + ssigpTa->SetBinContent(8335,10.3677); + ssigpTa->SetBinContent(8336,11.2835); + ssigpTa->SetBinContent(8337,13.1215); + ssigpTa->SetBinContent(8338,13.2219); + ssigpTa->SetBinContent(8339,13.4762); + ssigpTa->SetBinContent(8340,13.6285); + ssigpTa->SetBinContent(8341,13.9891); + ssigpTa->SetBinContent(8342,14.3556); + ssigpTa->SetBinContent(8343,14.7271); + ssigpTa->SetBinContent(8344,15.1041); + ssigpTa->SetBinContent(8345,15.4883); + ssigpTa->SetBinContent(8346,15.6887); + ssigpTa->SetBinContent(8347,15.6471); + ssigpTa->SetBinContent(8348,15.0167); + ssigpTa->SetBinContent(8349,14.9515); + ssigpTa->SetBinContent(8350,15.1324); + ssigpTa->SetBinContent(8351,15.5172); + ssigpTa->SetBinContent(8352,15.9334); + ssigpTa->SetBinContent(8353,16.3661); + ssigpTa->SetBinContent(8354,16.6531); + ssigpTa->SetBinContent(8355,16.7584); + ssigpTa->SetBinContent(8356,16.4016); + ssigpTa->SetBinContent(8357,16.5702); + ssigpTa->SetBinContent(8358,16.8826); + ssigpTa->SetBinContent(8359,17.3338); + ssigpTa->SetBinContent(8360,17.7733); + ssigpTa->SetBinContent(8361,18.2228); + ssigpTa->SetBinContent(8362,18.6809); + ssigpTa->SetBinContent(8363,19.1459); + ssigpTa->SetBinContent(8364,19.6149); + ssigpTa->SetBinContent(8365,20.0923); + ssigpTa->SetBinContent(8366,20.5914); + ssigpTa->SetBinContent(8367,21.1299); + ssigpTa->SetBinContent(8368,21.7053); + ssigpTa->SetBinContent(8369,22.3032); + ssigpTa->SetBinContent(8370,22.9184); + ssigpTa->SetBinContent(8371,23.5472); + ssigpTa->SetBinContent(8372,24.1924); + ssigpTa->SetBinContent(8373,24.8537); + ssigpTa->SetBinContent(8374,25.5289); + ssigpTa->SetBinContent(8375,28.0705); + ssigpTa->SetBinContent(8376,33.0371); + ssigpTa->SetBinContent(8377,43.7748); + ssigpTa->SetBinContent(8378,48.9733); + ssigpTa->SetBinContent(8379,51.8406); + ssigpTa->SetBinContent(8380,52.8903); + ssigpTa->SetBinContent(8381,53.9429); + ssigpTa->SetBinContent(8382,54.9873); + ssigpTa->SetBinContent(8383,56.0245); + ssigpTa->SetBinContent(8384,57.0908); + ssigpTa->SetBinContent(8385,58.2426); + ssigpTa->SetBinContent(8386,59.5212); + ssigpTa->SetBinContent(8387,60.8744); + ssigpTa->SetBinContent(8388,62.2926); + ssigpTa->SetBinContent(8389,63.7491); + ssigpTa->SetBinContent(8390,65.2037); + ssigpTa->SetBinContent(8391,66.6596); + ssigpTa->SetBinContent(8392,68.1395); + ssigpTa->SetBinContent(8393,69.6733); + ssigpTa->SetBinContent(8394,71.2813); + ssigpTa->SetBinContent(8395,72.9439); + ssigpTa->SetBinContent(8396,74.6391); + ssigpTa->SetBinContent(8397,76.3444); + ssigpTa->SetBinContent(8398,78.0602); + ssigpTa->SetBinContent(8399,79.7693); + ssigpTa->SetBinContent(8400,81.3872); + ssigpTa->SetBinContent(8401,82.9257); + ssigpTa->SetBinContent(8402,84.4336); + ssigpTa->SetBinContent(8403,85.9714); + ssigpTa->SetBinContent(8404,87.5436); + ssigpTa->SetBinContent(8405,89.12); + ssigpTa->SetBinContent(8406,90.7194); + ssigpTa->SetBinContent(8407,92.4425); + ssigpTa->SetBinContent(8408,94.4628); + ssigpTa->SetBinContent(8409,96.6497); + ssigpTa->SetBinContent(8410,98.9172); + ssigpTa->SetBinContent(8411,101.211); + ssigpTa->SetBinContent(8412,103.547); + ssigpTa->SetBinContent(8413,105.999); + ssigpTa->SetBinContent(8414,108.68); + ssigpTa->SetBinContent(8415,111.545); + ssigpTa->SetBinContent(8416,114.552); + ssigpTa->SetBinContent(8417,117.602); + ssigpTa->SetBinContent(8418,120.565); + ssigpTa->SetBinContent(8419,123.382); + ssigpTa->SetBinContent(8420,126.081); + ssigpTa->SetBinContent(8421,128.684); + ssigpTa->SetBinContent(8422,131.213); + ssigpTa->SetBinContent(8423,133.736); + ssigpTa->SetBinContent(8424,136.378); + ssigpTa->SetBinContent(8425,139.279); + ssigpTa->SetBinContent(8426,142.39); + ssigpTa->SetBinContent(8427,145.54); + ssigpTa->SetBinContent(8428,148.656); + ssigpTa->SetBinContent(8429,151.719); + ssigpTa->SetBinContent(8430,154.72); + ssigpTa->SetBinContent(8431,157.657); + ssigpTa->SetBinContent(8432,160.529); + ssigpTa->SetBinContent(8433,163.302); + ssigpTa->SetBinContent(8434,166.045); + ssigpTa->SetBinContent(8435,168.987); + ssigpTa->SetBinContent(8436,172.406); + ssigpTa->SetBinContent(8437,176.401); + ssigpTa->SetBinContent(8438,180.761); + ssigpTa->SetBinContent(8439,185.401); + ssigpTa->SetBinContent(8440,196.598); + ssigpTa->SetBinContent(8441,216.18); + ssigpTa->SetBinContent(8442,256.185); + ssigpTa->SetBinContent(8443,276.793); + ssigpTa->SetBinContent(8444,289.575); + ssigpTa->SetBinContent(8445,296.458); + ssigpTa->SetBinContent(8446,304.181); + ssigpTa->SetBinContent(8447,312.614); + ssigpTa->SetBinContent(8448,321.651); + ssigpTa->SetBinContent(8449,331.132); + ssigpTa->SetBinContent(8450,340.817); + ssigpTa->SetBinContent(8451,350.367); + ssigpTa->SetBinContent(8452,359.912); + ssigpTa->SetBinContent(8453,369.712); + ssigpTa->SetBinContent(8454,380.257); + ssigpTa->SetBinContent(8455,391.516); + ssigpTa->SetBinContent(8456,403.178); + ssigpTa->SetBinContent(8457,415.043); + ssigpTa->SetBinContent(8458,426.708); + ssigpTa->SetBinContent(8459,452.886); + ssigpTa->SetBinContent(8460,469.388); + ssigpTa->SetBinContent(8461,567.76); + ssigpTa->SetEntries(7620); + + init = true; + } + + double percent = ssigpTa->Interpolate(eta, ptGeV); + return percent; // This is relative, so we don't convert it. +} + + +// Fractional resolution in % +double UpgradePerformance::ITKPercentageresol_LoIfix(double ptMeV, double eta){ + double ptGeV = ptMeV/1000.; + static TH2D *ssigpTa; + static bool init = false; + + if (fabs(eta)>2.7) return 0.; + + + if(!init){ + Double_t xAxis1[273] = {0, 0.005, 0.015, 0.025, 0.035, 0.045, 0.055, 0.065, 0.075, 0.085, 0.095, 0.105, 0.115, 0.125, 0.135, 0.145, 0.155, 0.165, 0.175, 0.185, 0.195, 0.205, 0.215, 0.225, 0.235, 0.245, 0.255, 0.265, 0.275, 0.285, 0.295, 0.305, 0.315, 0.325, 0.335, 0.345, 0.355, 0.365, 0.375, 0.385, 0.395, 0.405, 0.415, 0.425, 0.435, 0.445, 0.455, 0.465, 0.475, 0.485, 0.495, 0.505, 0.515, 0.525, 0.535, 0.545, 0.555, 0.565, 0.575, 0.585, 0.595, 0.605, 0.615, 0.625, 0.635, 0.645, 0.655, 0.665, 0.675, 0.685, 0.695, 0.705, 0.715, 0.725, 0.735, 0.745, 0.755, 0.765, 0.775, 0.785, 0.795, 0.805, 0.815, 0.825, 0.835, 0.845, 0.855, 0.865, 0.875, 0.885, 0.895, 0.905, 0.915, 0.925, 0.935, 0.945, 0.955, 0.965, 0.975, 0.985, 0.995, 1.005, 1.015, 1.025, 1.035, 1.045, 1.055, 1.065, 1.075, 1.085, 1.095, 1.105, 1.115, 1.125, 1.135, 1.145, 1.155, 1.165, 1.175, 1.185, 1.195, 1.205, 1.215, 1.225, 1.235, 1.245, 1.255, 1.265, 1.275, 1.285, 1.295, 1.305, 1.315, 1.325, 1.335, 1.345, 1.355, 1.365, 1.375, 1.385, 1.395, 1.405, 1.415, 1.425, 1.435, 1.445, 1.455, 1.465, 1.475, 1.485, 1.495, 1.505, 1.515, 1.525, 1.535, 1.545, 1.555, 1.565, 1.575, 1.585, 1.595, 1.605, 1.615, 1.625, 1.635, 1.645, 1.655, 1.665, 1.675, 1.685, 1.695, 1.705, 1.715, 1.725, 1.735, 1.745, 1.755, 1.765, 1.775, 1.785, 1.795, 1.805, 1.815, 1.825, 1.835, 1.845, 1.855, 1.865, 1.875, 1.885, 1.895, 1.905, 1.915, 1.925, 1.935, 1.945, 1.955, 1.965, 1.975, 1.985, 1.995, 2.005, 2.015, 2.025, 2.035, 2.045, 2.055, 2.065, 2.075, 2.085, 2.095, 2.105, 2.115, 2.125, 2.135, 2.145, 2.155, 2.165, 2.175, 2.185, 2.195, 2.205, 2.215, 2.225, 2.235, 2.245, 2.255, 2.265, 2.275, 2.285, 2.295, 2.305, 2.315, 2.325, 2.335, 2.345, 2.355, 2.365, 2.375, 2.385, 2.395, 2.405, 2.415, 2.425, 2.435, 2.445, 2.455, 2.465, 2.475, 2.485, 2.495, 2.505, 2.515, 2.525, 2.535, 2.545, 2.555, 2.565, 2.575, 2.585, 2.595, 2.605, 2.615, 2.625, 2.635, 2.645, 2.655, 2.665, 2.675, 2.685, 2.695, 2.705, 2.7371}; + Double_t yAxis1[21] = {0, 0.1, 0.35, 0.75, 1.5, 3.5, 7.5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 150, 350, 750, 4000, 7070}; + + ssigpTa = new TH2D("ssigpTa","ssigpTa",272, xAxis1,20, yAxis1); + ssigpTa->SetDirectory(0); + ssigpTa->SetBinContent(275,0.00382782); + ssigpTa->SetBinContent(276,0.00409805); + ssigpTa->SetBinContent(277,0.00387075); + ssigpTa->SetBinContent(278,0.00387132); + ssigpTa->SetBinContent(279,0.00387212); + ssigpTa->SetBinContent(280,0.00387313); + ssigpTa->SetBinContent(281,0.00387434); + ssigpTa->SetBinContent(282,0.00387581); + ssigpTa->SetBinContent(283,0.0038775); + ssigpTa->SetBinContent(284,0.00387939); + ssigpTa->SetBinContent(285,0.00388154); + ssigpTa->SetBinContent(286,0.00388393); + ssigpTa->SetBinContent(287,0.00388651); + ssigpTa->SetBinContent(288,0.0038893); + ssigpTa->SetBinContent(289,0.00389234); + ssigpTa->SetBinContent(290,0.00389562); + ssigpTa->SetBinContent(291,0.00389912); + ssigpTa->SetBinContent(292,0.00390284); + ssigpTa->SetBinContent(293,0.00390678); + ssigpTa->SetBinContent(294,0.00391094); + ssigpTa->SetBinContent(295,0.00391533); + ssigpTa->SetBinContent(296,0.00391996); + ssigpTa->SetBinContent(297,0.00392481); + ssigpTa->SetBinContent(298,0.00392988); + ssigpTa->SetBinContent(299,0.00393519); + ssigpTa->SetBinContent(300,0.0039407); + ssigpTa->SetBinContent(301,0.00394647); + ssigpTa->SetBinContent(302,0.00395244); + ssigpTa->SetBinContent(303,0.00395864); + ssigpTa->SetBinContent(304,0.00396507); + ssigpTa->SetBinContent(305,0.00397174); + ssigpTa->SetBinContent(306,0.00397863); + ssigpTa->SetBinContent(307,0.00398577); + ssigpTa->SetBinContent(308,0.00399311); + ssigpTa->SetBinContent(309,0.00400068); + ssigpTa->SetBinContent(310,0.00400848); + ssigpTa->SetBinContent(311,0.00401651); + ssigpTa->SetBinContent(312,0.00402479); + ssigpTa->SetBinContent(313,0.00403328); + ssigpTa->SetBinContent(314,0.00404202); + ssigpTa->SetBinContent(315,0.00405098); + ssigpTa->SetBinContent(316,0.00406018); + ssigpTa->SetBinContent(317,0.00406958); + ssigpTa->SetBinContent(318,0.00407926); + ssigpTa->SetBinContent(319,0.00408917); + ssigpTa->SetBinContent(320,0.0040993); + ssigpTa->SetBinContent(321,0.00410964); + ssigpTa->SetBinContent(322,0.00412023); + ssigpTa->SetBinContent(323,0.00413107); + ssigpTa->SetBinContent(324,0.00414214); + ssigpTa->SetBinContent(325,0.00415344); + ssigpTa->SetBinContent(326,0.00416497); + ssigpTa->SetBinContent(327,0.00417678); + ssigpTa->SetBinContent(328,0.00418881); + ssigpTa->SetBinContent(329,0.00420107); + ssigpTa->SetBinContent(330,0.00421356); + ssigpTa->SetBinContent(331,0.00422628); + ssigpTa->SetBinContent(332,0.00423927); + ssigpTa->SetBinContent(333,0.00425252); + ssigpTa->SetBinContent(334,0.00426599); + ssigpTa->SetBinContent(335,0.00427974); + ssigpTa->SetBinContent(336,0.00429372); + ssigpTa->SetBinContent(337,0.00430794); + ssigpTa->SetBinContent(338,0.0043224); + ssigpTa->SetBinContent(339,0.00433713); + ssigpTa->SetBinContent(340,0.00435212); + ssigpTa->SetBinContent(341,0.00436735); + ssigpTa->SetBinContent(342,0.00438286); + ssigpTa->SetBinContent(343,0.00439862); + ssigpTa->SetBinContent(344,0.00441463); + ssigpTa->SetBinContent(345,0.00443092); + ssigpTa->SetBinContent(346,0.00444746); + ssigpTa->SetBinContent(347,0.00446425); + ssigpTa->SetBinContent(348,0.00448132); + ssigpTa->SetBinContent(349,0.00449866); + ssigpTa->SetBinContent(350,0.00451627); + ssigpTa->SetBinContent(351,0.00453416); + ssigpTa->SetBinContent(352,0.00455234); + ssigpTa->SetBinContent(353,0.00457076); + ssigpTa->SetBinContent(354,0.00458952); + ssigpTa->SetBinContent(355,0.0046085); + ssigpTa->SetBinContent(356,0.00462781); + ssigpTa->SetBinContent(357,0.00464741); + ssigpTa->SetBinContent(358,0.00466729); + ssigpTa->SetBinContent(359,0.00468749); + ssigpTa->SetBinContent(360,0.00470796); + ssigpTa->SetBinContent(361,0.00472878); + ssigpTa->SetBinContent(362,0.00474987); + ssigpTa->SetBinContent(363,0.0047713); + ssigpTa->SetBinContent(364,0.00479303); + ssigpTa->SetBinContent(365,0.00481508); + ssigpTa->SetBinContent(366,0.00483746); + ssigpTa->SetBinContent(367,0.00486014); + ssigpTa->SetBinContent(368,0.00488321); + ssigpTa->SetBinContent(369,0.00490656); + ssigpTa->SetBinContent(370,0.00493028); + ssigpTa->SetBinContent(371,0.00495437); + ssigpTa->SetBinContent(372,0.00497882); + ssigpTa->SetBinContent(373,0.00500364); + ssigpTa->SetBinContent(374,0.0050288); + ssigpTa->SetBinContent(375,0.00505435); + ssigpTa->SetBinContent(376,0.00508027); + ssigpTa->SetBinContent(377,0.00510659); + ssigpTa->SetBinContent(378,0.00513331); + ssigpTa->SetBinContent(379,0.00521016); + ssigpTa->SetBinContent(380,0.00531242); + ssigpTa->SetBinContent(381,0.0055079); + ssigpTa->SetBinContent(382,0.00571333); + ssigpTa->SetBinContent(383,0.00586047); + ssigpTa->SetBinContent(384,0.00589078); + ssigpTa->SetBinContent(385,0.00592148); + ssigpTa->SetBinContent(386,0.00595259); + ssigpTa->SetBinContent(387,0.00598416); + ssigpTa->SetBinContent(388,0.00601613); + ssigpTa->SetBinContent(389,0.00604855); + ssigpTa->SetBinContent(390,0.00608142); + ssigpTa->SetBinContent(391,0.00611477); + ssigpTa->SetBinContent(392,0.00606422); + ssigpTa->SetBinContent(393,0.00595209); + ssigpTa->SetBinContent(394,0.00588726); + ssigpTa->SetBinContent(395,0.00593802); + ssigpTa->SetBinContent(396,0.00602229); + ssigpTa->SetBinContent(397,0.00610598); + ssigpTa->SetBinContent(398,0.00618897); + ssigpTa->SetBinContent(399,0.00627133); + ssigpTa->SetBinContent(400,0.00635307); + ssigpTa->SetBinContent(401,0.00629745); + ssigpTa->SetBinContent(402,0.00618147); + ssigpTa->SetBinContent(403,0.0059658); + ssigpTa->SetBinContent(404,0.00580556); + ssigpTa->SetBinContent(405,0.00573848); + ssigpTa->SetBinContent(406,0.00585468); + ssigpTa->SetBinContent(407,0.00597174); + ssigpTa->SetBinContent(408,0.00609028); + ssigpTa->SetBinContent(409,0.00621034); + ssigpTa->SetBinContent(410,0.00633098); + ssigpTa->SetBinContent(411,0.00645171); + ssigpTa->SetBinContent(412,0.00644008); + ssigpTa->SetBinContent(413,0.00635753); + ssigpTa->SetBinContent(414,0.00633787); + ssigpTa->SetBinContent(415,0.00644857); + ssigpTa->SetBinContent(416,0.00655986); + ssigpTa->SetBinContent(417,0.00667019); + ssigpTa->SetBinContent(418,0.00678004); + ssigpTa->SetBinContent(419,0.00689042); + ssigpTa->SetBinContent(420,0.00679079); + ssigpTa->SetBinContent(421,0.00658744); + ssigpTa->SetBinContent(422,0.00649454); + ssigpTa->SetBinContent(423,0.00650313); + ssigpTa->SetBinContent(424,0.00645118); + ssigpTa->SetBinContent(425,0.0064543); + ssigpTa->SetBinContent(426,0.00656751); + ssigpTa->SetBinContent(427,0.00668111); + ssigpTa->SetBinContent(428,0.00679511); + ssigpTa->SetBinContent(429,0.00691075); + ssigpTa->SetBinContent(430,0.00702742); + ssigpTa->SetBinContent(431,0.00714473); + ssigpTa->SetBinContent(432,0.0072624); + ssigpTa->SetBinContent(433,0.00738087); + ssigpTa->SetBinContent(434,0.00749966); + ssigpTa->SetBinContent(435,0.00753616); + ssigpTa->SetBinContent(436,0.00752502); + ssigpTa->SetBinContent(437,0.00755896); + ssigpTa->SetBinContent(438,0.00742836); + ssigpTa->SetBinContent(439,0.00717596); + ssigpTa->SetBinContent(440,0.00705018); + ssigpTa->SetBinContent(441,0.00717507); + ssigpTa->SetBinContent(442,0.00730402); + ssigpTa->SetBinContent(443,0.00743333); + ssigpTa->SetBinContent(444,0.00756337); + ssigpTa->SetBinContent(445,0.00769505); + ssigpTa->SetBinContent(446,0.00782649); + ssigpTa->SetBinContent(447,0.00795322); + ssigpTa->SetBinContent(448,0.00808562); + ssigpTa->SetBinContent(449,0.00825337); + ssigpTa->SetBinContent(450,0.00843649); + ssigpTa->SetBinContent(451,0.00860362); + ssigpTa->SetBinContent(452,0.00873772); + ssigpTa->SetBinContent(453,0.00850923); + ssigpTa->SetBinContent(454,0.00809174); + ssigpTa->SetBinContent(455,0.00783707); + ssigpTa->SetBinContent(456,0.0079325); + ssigpTa->SetBinContent(457,0.00802488); + ssigpTa->SetBinContent(458,0.0081143); + ssigpTa->SetBinContent(459,0.00816844); + ssigpTa->SetBinContent(460,0.00821514); + ssigpTa->SetBinContent(461,0.00789541); + ssigpTa->SetBinContent(462,0.00742346); + ssigpTa->SetBinContent(463,0.0071435); + ssigpTa->SetBinContent(464,0.00724445); + ssigpTa->SetBinContent(465,0.00734877); + ssigpTa->SetBinContent(466,0.0074562); + ssigpTa->SetBinContent(467,0.0079088); + ssigpTa->SetBinContent(468,0.00853573); + ssigpTa->SetBinContent(469,0.00899717); + ssigpTa->SetBinContent(470,0.00912217); + ssigpTa->SetBinContent(471,0.00925395); + ssigpTa->SetBinContent(472,0.00939054); + ssigpTa->SetBinContent(473,0.00952517); + ssigpTa->SetBinContent(474,0.00965713); + ssigpTa->SetBinContent(475,0.00978903); + ssigpTa->SetBinContent(476,0.00967237); + ssigpTa->SetBinContent(477,0.00942958); + ssigpTa->SetBinContent(478,0.00930904); + ssigpTa->SetBinContent(479,0.00943541); + ssigpTa->SetBinContent(480,0.00987267); + ssigpTa->SetBinContent(481,0.0104725); + ssigpTa->SetBinContent(482,0.0109316); + ssigpTa->SetBinContent(483,0.0110924); + ssigpTa->SetBinContent(484,0.0112563); + ssigpTa->SetBinContent(485,0.0114147); + ssigpTa->SetBinContent(486,0.0115712); + ssigpTa->SetBinContent(487,0.0114252); + ssigpTa->SetBinContent(488,0.0111246); + ssigpTa->SetBinContent(489,0.0109768); + ssigpTa->SetBinContent(490,0.0111285); + ssigpTa->SetBinContent(491,0.0116403); + ssigpTa->SetBinContent(492,0.0123414); + ssigpTa->SetBinContent(493,0.0128735); + ssigpTa->SetBinContent(494,0.0130474); + ssigpTa->SetBinContent(495,0.0132213); + ssigpTa->SetBinContent(496,0.0134029); + ssigpTa->SetBinContent(497,0.0135987); + ssigpTa->SetBinContent(498,0.0137991); + ssigpTa->SetBinContent(499,0.0131813); + ssigpTa->SetBinContent(500,0.0121344); + ssigpTa->SetBinContent(501,0.0114808); + ssigpTa->SetBinContent(502,0.0118932); + ssigpTa->SetBinContent(503,0.012456); + ssigpTa->SetBinContent(504,0.0129046); + ssigpTa->SetBinContent(505,0.0130985); + ssigpTa->SetBinContent(506,0.0132816); + ssigpTa->SetBinContent(507,0.0134633); + ssigpTa->SetBinContent(508,0.0136496); + ssigpTa->SetBinContent(509,0.0138305); + ssigpTa->SetBinContent(510,0.0140007); + ssigpTa->SetBinContent(511,0.0140496); + ssigpTa->SetBinContent(512,0.0143241); + ssigpTa->SetBinContent(513,0.0148419); + ssigpTa->SetBinContent(514,0.0153527); + ssigpTa->SetBinContent(515,0.015581); + ssigpTa->SetBinContent(516,0.015787); + ssigpTa->SetBinContent(517,0.015982); + ssigpTa->SetBinContent(518,0.0161925); + ssigpTa->SetBinContent(519,0.016424); + ssigpTa->SetBinContent(520,0.016666); + ssigpTa->SetBinContent(521,0.0166058); + ssigpTa->SetBinContent(522,0.0164177); + ssigpTa->SetBinContent(523,0.0163843); + ssigpTa->SetBinContent(524,0.0166434); + ssigpTa->SetBinContent(525,0.0168702); + ssigpTa->SetBinContent(526,0.0171106); + ssigpTa->SetBinContent(527,0.0173598); + ssigpTa->SetBinContent(528,0.0176061); + ssigpTa->SetBinContent(529,0.0178493); + ssigpTa->SetBinContent(530,0.0181099); + ssigpTa->SetBinContent(531,0.0183976); + ssigpTa->SetBinContent(532,0.018699); + ssigpTa->SetBinContent(533,0.0189965); + ssigpTa->SetBinContent(534,0.0192877); + ssigpTa->SetBinContent(535,0.0195609); + ssigpTa->SetBinContent(536,0.0197934); + ssigpTa->SetBinContent(537,0.020014); + ssigpTa->SetBinContent(538,0.0202832); + ssigpTa->SetBinContent(539,0.0205993); + ssigpTa->SetBinContent(540,0.0205291); + ssigpTa->SetBinContent(541,0.0202446); + ssigpTa->SetBinContent(542,0.0201367); + ssigpTa->SetBinContent(543,0.0204468); + ssigpTa->SetBinContent(544,0.0208142); + ssigpTa->SetBinContent(545,0.0224464); + ssigpTa->SetBinContent(546,0.0211893); + ssigpTa->SetBinContent(549,0.00761233); + ssigpTa->SetBinContent(550,0.00735792); + ssigpTa->SetBinContent(551,0.00746668); + ssigpTa->SetBinContent(552,0.00746783); + ssigpTa->SetBinContent(553,0.00746935); + ssigpTa->SetBinContent(554,0.00747125); + ssigpTa->SetBinContent(555,0.00747362); + ssigpTa->SetBinContent(556,0.00747644); + ssigpTa->SetBinContent(557,0.00747968); + ssigpTa->SetBinContent(558,0.00748337); + ssigpTa->SetBinContent(559,0.00748751); + ssigpTa->SetBinContent(560,0.0074921); + ssigpTa->SetBinContent(561,0.0074971); + ssigpTa->SetBinContent(562,0.00750249); + ssigpTa->SetBinContent(563,0.00750836); + ssigpTa->SetBinContent(564,0.00751467); + ssigpTa->SetBinContent(565,0.00752142); + ssigpTa->SetBinContent(566,0.00752856); + ssigpTa->SetBinContent(567,0.00753618); + ssigpTa->SetBinContent(568,0.00754416); + ssigpTa->SetBinContent(569,0.00755267); + ssigpTa->SetBinContent(570,0.00756157); + ssigpTa->SetBinContent(571,0.00757094); + ssigpTa->SetBinContent(572,0.00758073); + ssigpTa->SetBinContent(573,0.0075909); + ssigpTa->SetBinContent(574,0.00760158); + ssigpTa->SetBinContent(575,0.00761265); + ssigpTa->SetBinContent(576,0.00762423); + ssigpTa->SetBinContent(577,0.00763619); + ssigpTa->SetBinContent(578,0.00764857); + ssigpTa->SetBinContent(579,0.0076614); + ssigpTa->SetBinContent(580,0.00767471); + ssigpTa->SetBinContent(581,0.00768843); + ssigpTa->SetBinContent(582,0.00770263); + ssigpTa->SetBinContent(583,0.00771726); + ssigpTa->SetBinContent(584,0.00773228); + ssigpTa->SetBinContent(585,0.00774777); + ssigpTa->SetBinContent(586,0.00776372); + ssigpTa->SetBinContent(587,0.00778007); + ssigpTa->SetBinContent(588,0.00779692); + ssigpTa->SetBinContent(589,0.00781423); + ssigpTa->SetBinContent(590,0.00783193); + ssigpTa->SetBinContent(591,0.00785015); + ssigpTa->SetBinContent(592,0.00786874); + ssigpTa->SetBinContent(593,0.00788788); + ssigpTa->SetBinContent(594,0.0079074); + ssigpTa->SetBinContent(595,0.00792732); + ssigpTa->SetBinContent(596,0.00794776); + ssigpTa->SetBinContent(597,0.00796863); + ssigpTa->SetBinContent(598,0.00799); + ssigpTa->SetBinContent(599,0.00801178); + ssigpTa->SetBinContent(600,0.00803402); + ssigpTa->SetBinContent(601,0.00805678); + ssigpTa->SetBinContent(602,0.00808); + ssigpTa->SetBinContent(603,0.00810362); + ssigpTa->SetBinContent(604,0.00812768); + ssigpTa->SetBinContent(605,0.00815223); + ssigpTa->SetBinContent(606,0.00817725); + ssigpTa->SetBinContent(607,0.00820277); + ssigpTa->SetBinContent(608,0.0082288); + ssigpTa->SetBinContent(609,0.00825527); + ssigpTa->SetBinContent(610,0.00828225); + ssigpTa->SetBinContent(611,0.00830964); + ssigpTa->SetBinContent(612,0.00833758); + ssigpTa->SetBinContent(613,0.00836592); + ssigpTa->SetBinContent(614,0.00839484); + ssigpTa->SetBinContent(615,0.00842422); + ssigpTa->SetBinContent(616,0.00845412); + ssigpTa->SetBinContent(617,0.00848449); + ssigpTa->SetBinContent(618,0.00851538); + ssigpTa->SetBinContent(619,0.00854677); + ssigpTa->SetBinContent(620,0.00857864); + ssigpTa->SetBinContent(621,0.00861107); + ssigpTa->SetBinContent(622,0.00864393); + ssigpTa->SetBinContent(623,0.00867737); + ssigpTa->SetBinContent(624,0.00871131); + ssigpTa->SetBinContent(625,0.00874582); + ssigpTa->SetBinContent(626,0.00878084); + ssigpTa->SetBinContent(627,0.00881643); + ssigpTa->SetBinContent(628,0.00885249); + ssigpTa->SetBinContent(629,0.00888917); + ssigpTa->SetBinContent(630,0.00892633); + ssigpTa->SetBinContent(631,0.00896414); + ssigpTa->SetBinContent(632,0.00900251); + ssigpTa->SetBinContent(633,0.00904137); + ssigpTa->SetBinContent(634,0.00908092); + ssigpTa->SetBinContent(635,0.00912097); + ssigpTa->SetBinContent(636,0.00916166); + ssigpTa->SetBinContent(637,0.00920294); + ssigpTa->SetBinContent(638,0.00924487); + ssigpTa->SetBinContent(639,0.00928739); + ssigpTa->SetBinContent(640,0.00933048); + ssigpTa->SetBinContent(641,0.00937425); + ssigpTa->SetBinContent(642,0.00941865); + ssigpTa->SetBinContent(643,0.00946372); + ssigpTa->SetBinContent(644,0.00950942); + ssigpTa->SetBinContent(645,0.00955584); + ssigpTa->SetBinContent(646,0.00960299); + ssigpTa->SetBinContent(647,0.00965078); + ssigpTa->SetBinContent(648,0.00969934); + ssigpTa->SetBinContent(649,0.00974853); + ssigpTa->SetBinContent(650,0.00979853); + ssigpTa->SetBinContent(651,0.00984923); + ssigpTa->SetBinContent(652,0.00991942); + ssigpTa->SetBinContent(653,0.0100463); + ssigpTa->SetBinContent(654,0.0102927); + ssigpTa->SetBinContent(655,0.0105985); + ssigpTa->SetBinContent(656,0.0110262); + ssigpTa->SetBinContent(657,0.0112599); + ssigpTa->SetBinContent(658,0.0113623); + ssigpTa->SetBinContent(659,0.0114215); + ssigpTa->SetBinContent(660,0.0114815); + ssigpTa->SetBinContent(661,0.0115423); + ssigpTa->SetBinContent(662,0.0116039); + ssigpTa->SetBinContent(663,0.0116665); + ssigpTa->SetBinContent(664,0.0117298); + ssigpTa->SetBinContent(665,0.0117624); + ssigpTa->SetBinContent(666,0.0116934); + ssigpTa->SetBinContent(667,0.0114815); + ssigpTa->SetBinContent(668,0.0113893); + ssigpTa->SetBinContent(669,0.0114647); + ssigpTa->SetBinContent(670,0.0116145); + ssigpTa->SetBinContent(671,0.0117759); + ssigpTa->SetBinContent(672,0.011936); + ssigpTa->SetBinContent(673,0.0120949); + ssigpTa->SetBinContent(674,0.0122013); + ssigpTa->SetBinContent(675,0.0121555); + ssigpTa->SetBinContent(676,0.0118488); + ssigpTa->SetBinContent(677,0.0115691); + ssigpTa->SetBinContent(678,0.0111866); + ssigpTa->SetBinContent(679,0.0111347); + ssigpTa->SetBinContent(680,0.0112907); + ssigpTa->SetBinContent(681,0.0115168); + ssigpTa->SetBinContent(682,0.0117455); + ssigpTa->SetBinContent(683,0.0119772); + ssigpTa->SetBinContent(684,0.0122098); + ssigpTa->SetBinContent(685,0.012393); + ssigpTa->SetBinContent(686,0.0124245); + ssigpTa->SetBinContent(687,0.0122501); + ssigpTa->SetBinContent(688,0.0122673); + ssigpTa->SetBinContent(689,0.0124324); + ssigpTa->SetBinContent(690,0.0126468); + ssigpTa->SetBinContent(691,0.0128601); + ssigpTa->SetBinContent(692,0.0130722); + ssigpTa->SetBinContent(693,0.0132066); + ssigpTa->SetBinContent(694,0.0131045); + ssigpTa->SetBinContent(695,0.0126895); + ssigpTa->SetBinContent(696,0.0125575); + ssigpTa->SetBinContent(697,0.0125381); + ssigpTa->SetBinContent(698,0.012425); + ssigpTa->SetBinContent(699,0.0124756); + ssigpTa->SetBinContent(700,0.012653); + ssigpTa->SetBinContent(701,0.0128719); + ssigpTa->SetBinContent(702,0.0130926); + ssigpTa->SetBinContent(703,0.0133151); + ssigpTa->SetBinContent(704,0.0135406); + ssigpTa->SetBinContent(705,0.0137666); + ssigpTa->SetBinContent(706,0.0139939); + ssigpTa->SetBinContent(707,0.0142225); + ssigpTa->SetBinContent(708,0.0144206); + ssigpTa->SetBinContent(709,0.0145181); + ssigpTa->SetBinContent(710,0.0144852); + ssigpTa->SetBinContent(711,0.0144857); + ssigpTa->SetBinContent(712,0.0143098); + ssigpTa->SetBinContent(713,0.0137976); + ssigpTa->SetBinContent(714,0.0136608); + ssigpTa->SetBinContent(715,0.0138098); + ssigpTa->SetBinContent(716,0.0140564); + ssigpTa->SetBinContent(717,0.0143067); + ssigpTa->SetBinContent(718,0.0145568); + ssigpTa->SetBinContent(719,0.0148102); + ssigpTa->SetBinContent(720,0.0150588); + ssigpTa->SetBinContent(721,0.0153007); + ssigpTa->SetBinContent(722,0.0155633); + ssigpTa->SetBinContent(723,0.0158719); + ssigpTa->SetBinContent(724,0.0162297); + ssigpTa->SetBinContent(725,0.0165377); + ssigpTa->SetBinContent(726,0.0166738); + ssigpTa->SetBinContent(727,0.0163887); + ssigpTa->SetBinContent(728,0.0155485); + ssigpTa->SetBinContent(729,0.0152158); + ssigpTa->SetBinContent(730,0.0152684); + ssigpTa->SetBinContent(731,0.0154466); + ssigpTa->SetBinContent(732,0.0156064); + ssigpTa->SetBinContent(733,0.0157384); + ssigpTa->SetBinContent(734,0.0156846); + ssigpTa->SetBinContent(735,0.0152559); + ssigpTa->SetBinContent(736,0.014289); + ssigpTa->SetBinContent(737,0.0139107); + ssigpTa->SetBinContent(738,0.0139637); + ssigpTa->SetBinContent(739,0.0141638); + ssigpTa->SetBinContent(740,0.0145002); + ssigpTa->SetBinContent(741,0.0152245); + ssigpTa->SetBinContent(742,0.0164696); + ssigpTa->SetBinContent(743,0.0172128); + ssigpTa->SetBinContent(744,0.0175811); + ssigpTa->SetBinContent(745,0.0178349); + ssigpTa->SetBinContent(746,0.0180956); + ssigpTa->SetBinContent(747,0.0183547); + ssigpTa->SetBinContent(748,0.0186096); + ssigpTa->SetBinContent(749,0.0187705); + ssigpTa->SetBinContent(750,0.0186506); + ssigpTa->SetBinContent(751,0.0181536); + ssigpTa->SetBinContent(752,0.018027); + ssigpTa->SetBinContent(753,0.0182936); + ssigpTa->SetBinContent(754,0.0190068); + ssigpTa->SetBinContent(755,0.0202004); + ssigpTa->SetBinContent(756,0.0209513); + ssigpTa->SetBinContent(757,0.0213765); + ssigpTa->SetBinContent(758,0.0216879); + ssigpTa->SetBinContent(759,0.0219948); + ssigpTa->SetBinContent(760,0.0221831); + ssigpTa->SetBinContent(761,0.0220277); + ssigpTa->SetBinContent(762,0.0214168); + ssigpTa->SetBinContent(763,0.0212551); + ssigpTa->SetBinContent(764,0.0215723); + ssigpTa->SetBinContent(765,0.0224066); + ssigpTa->SetBinContent(766,0.0237972); + ssigpTa->SetBinContent(767,0.0246693); + ssigpTa->SetBinContent(768,0.025138); + ssigpTa->SetBinContent(769,0.0254757); + ssigpTa->SetBinContent(770,0.0258284); + ssigpTa->SetBinContent(771,0.0262007); + ssigpTa->SetBinContent(772,0.026282); + ssigpTa->SetBinContent(773,0.0254282); + ssigpTa->SetBinContent(774,0.0233299); + ssigpTa->SetBinContent(775,0.0225118); + ssigpTa->SetBinContent(776,0.0229058); + ssigpTa->SetBinContent(777,0.0240162); + ssigpTa->SetBinContent(778,0.0247717); + ssigpTa->SetBinContent(779,0.0252383); + ssigpTa->SetBinContent(780,0.0255932); + ssigpTa->SetBinContent(781,0.0259456); + ssigpTa->SetBinContent(782,0.0263026); + ssigpTa->SetBinContent(783,0.0266497); + ssigpTa->SetBinContent(784,0.0269359); + ssigpTa->SetBinContent(785,0.0271777); + ssigpTa->SetBinContent(786,0.027586); + ssigpTa->SetBinContent(787,0.0286488); + ssigpTa->SetBinContent(788,0.0294716); + ssigpTa->SetBinContent(789,0.0300103); + ssigpTa->SetBinContent(790,0.0304124); + ssigpTa->SetBinContent(791,0.0307957); + ssigpTa->SetBinContent(792,0.0312049); + ssigpTa->SetBinContent(793,0.0316503); + ssigpTa->SetBinContent(794,0.031997); + ssigpTa->SetBinContent(795,0.0320272); + ssigpTa->SetBinContent(796,0.0316315); + ssigpTa->SetBinContent(797,0.0317045); + ssigpTa->SetBinContent(798,0.032069); + ssigpTa->SetBinContent(799,0.0325069); + ssigpTa->SetBinContent(800,0.0329568); + ssigpTa->SetBinContent(801,0.033435); + ssigpTa->SetBinContent(802,0.0339114); + ssigpTa->SetBinContent(803,0.0343862); + ssigpTa->SetBinContent(804,0.0348902); + ssigpTa->SetBinContent(805,0.0354422); + ssigpTa->SetBinContent(806,0.0360163); + ssigpTa->SetBinContent(807,0.0365889); + ssigpTa->SetBinContent(808,0.0371458); + ssigpTa->SetBinContent(809,0.0376671); + ssigpTa->SetBinContent(810,0.0381192); + ssigpTa->SetBinContent(811,0.0385437); + ssigpTa->SetBinContent(812,0.0390613); + ssigpTa->SetBinContent(813,0.0395057); + ssigpTa->SetBinContent(814,0.0395424); + ssigpTa->SetBinContent(815,0.0389771); + ssigpTa->SetBinContent(816,0.0389537); + ssigpTa->SetBinContent(817,0.0394254); + ssigpTa->SetBinContent(818,0.0401159); + ssigpTa->SetBinContent(819,0.0401758); + ssigpTa->SetBinContent(820,0.0420796); + ssigpTa->SetBinContent(823,0.00940978); + ssigpTa->SetBinContent(824,0.00954779); + ssigpTa->SetBinContent(825,0.0095651); + ssigpTa->SetBinContent(826,0.00956651); + ssigpTa->SetBinContent(827,0.00956845); + ssigpTa->SetBinContent(828,0.00957091); + ssigpTa->SetBinContent(829,0.00957384); + ssigpTa->SetBinContent(830,0.00957746); + ssigpTa->SetBinContent(831,0.00958162); + ssigpTa->SetBinContent(832,0.00958636); + ssigpTa->SetBinContent(833,0.00959163); + ssigpTa->SetBinContent(834,0.00959757); + ssigpTa->SetBinContent(835,0.00960401); + ssigpTa->SetBinContent(836,0.0096109); + ssigpTa->SetBinContent(837,0.00961839); + ssigpTa->SetBinContent(838,0.00962644); + ssigpTa->SetBinContent(839,0.00963504); + ssigpTa->SetBinContent(840,0.00964425); + ssigpTa->SetBinContent(841,0.0096539); + ssigpTa->SetBinContent(842,0.0096642); + ssigpTa->SetBinContent(843,0.00967502); + ssigpTa->SetBinContent(844,0.00968649); + ssigpTa->SetBinContent(845,0.00969842); + ssigpTa->SetBinContent(846,0.00971088); + ssigpTa->SetBinContent(847,0.00972396); + ssigpTa->SetBinContent(848,0.0097375); + ssigpTa->SetBinContent(849,0.00975184); + ssigpTa->SetBinContent(850,0.00976656); + ssigpTa->SetBinContent(851,0.0097819); + ssigpTa->SetBinContent(852,0.00979769); + ssigpTa->SetBinContent(853,0.00981412); + ssigpTa->SetBinContent(854,0.00983109); + ssigpTa->SetBinContent(855,0.00984869); + ssigpTa->SetBinContent(856,0.00986684); + ssigpTa->SetBinContent(857,0.00988561); + ssigpTa->SetBinContent(858,0.00990485); + ssigpTa->SetBinContent(859,0.00992463); + ssigpTa->SetBinContent(860,0.00994501); + ssigpTa->SetBinContent(861,0.00996598); + ssigpTa->SetBinContent(862,0.00998749); + ssigpTa->SetBinContent(863,0.0100096); + ssigpTa->SetBinContent(864,0.0100323); + ssigpTa->SetBinContent(865,0.0100555); + ssigpTa->SetBinContent(866,0.0100795); + ssigpTa->SetBinContent(867,0.0101038); + ssigpTa->SetBinContent(868,0.0101288); + ssigpTa->SetBinContent(869,0.0101543); + ssigpTa->SetBinContent(870,0.0101804); + ssigpTa->SetBinContent(871,0.0102072); + ssigpTa->SetBinContent(872,0.0102345); + ssigpTa->SetBinContent(873,0.0102624); + ssigpTa->SetBinContent(874,0.0102908); + ssigpTa->SetBinContent(875,0.0103199); + ssigpTa->SetBinContent(876,0.0103497); + ssigpTa->SetBinContent(877,0.0103798); + ssigpTa->SetBinContent(878,0.0104106); + ssigpTa->SetBinContent(879,0.010442); + ssigpTa->SetBinContent(880,0.010474); + ssigpTa->SetBinContent(881,0.0105066); + ssigpTa->SetBinContent(882,0.01054); + ssigpTa->SetBinContent(883,0.0105738); + ssigpTa->SetBinContent(884,0.0106083); + ssigpTa->SetBinContent(885,0.0106434); + ssigpTa->SetBinContent(886,0.010679); + ssigpTa->SetBinContent(887,0.0107154); + ssigpTa->SetBinContent(888,0.0107523); + ssigpTa->SetBinContent(889,0.0107899); + ssigpTa->SetBinContent(890,0.0108282); + ssigpTa->SetBinContent(891,0.010867); + ssigpTa->SetBinContent(892,0.0109065); + ssigpTa->SetBinContent(893,0.0109466); + ssigpTa->SetBinContent(894,0.0109875); + ssigpTa->SetBinContent(895,0.0110288); + ssigpTa->SetBinContent(896,0.011071); + ssigpTa->SetBinContent(897,0.0111137); + ssigpTa->SetBinContent(898,0.0111571); + ssigpTa->SetBinContent(899,0.0112013); + ssigpTa->SetBinContent(900,0.0112461); + ssigpTa->SetBinContent(901,0.0112916); + ssigpTa->SetBinContent(902,0.0113378); + ssigpTa->SetBinContent(903,0.0113846); + ssigpTa->SetBinContent(904,0.0114322); + ssigpTa->SetBinContent(905,0.0114805); + ssigpTa->SetBinContent(906,0.0115295); + ssigpTa->SetBinContent(907,0.0115793); + ssigpTa->SetBinContent(908,0.0116298); + ssigpTa->SetBinContent(909,0.011681); + ssigpTa->SetBinContent(910,0.011733); + ssigpTa->SetBinContent(911,0.0117859); + ssigpTa->SetBinContent(912,0.0118395); + ssigpTa->SetBinContent(913,0.0118939); + ssigpTa->SetBinContent(914,0.011949); + ssigpTa->SetBinContent(915,0.0120049); + ssigpTa->SetBinContent(916,0.0120617); + ssigpTa->SetBinContent(917,0.0121193); + ssigpTa->SetBinContent(918,0.0121778); + ssigpTa->SetBinContent(919,0.0122372); + ssigpTa->SetBinContent(920,0.0122974); + ssigpTa->SetBinContent(921,0.0123586); + ssigpTa->SetBinContent(922,0.0124206); + ssigpTa->SetBinContent(923,0.0124836); + ssigpTa->SetBinContent(924,0.0125474); + ssigpTa->SetBinContent(925,0.0126123); + ssigpTa->SetBinContent(926,0.012696); + ssigpTa->SetBinContent(927,0.0128702); + ssigpTa->SetBinContent(928,0.0131592); + ssigpTa->SetBinContent(929,0.0135913); + ssigpTa->SetBinContent(930,0.0141066); + ssigpTa->SetBinContent(931,0.0144347); + ssigpTa->SetBinContent(932,0.0145517); + ssigpTa->SetBinContent(933,0.0146275); + ssigpTa->SetBinContent(934,0.0147042); + ssigpTa->SetBinContent(935,0.0147819); + ssigpTa->SetBinContent(936,0.0148607); + ssigpTa->SetBinContent(937,0.0149407); + ssigpTa->SetBinContent(938,0.0150217); + ssigpTa->SetBinContent(939,0.0150733); + ssigpTa->SetBinContent(940,0.0149662); + ssigpTa->SetBinContent(941,0.0147071); + ssigpTa->SetBinContent(942,0.014575); + ssigpTa->SetBinContent(943,0.0146753); + ssigpTa->SetBinContent(944,0.0148713); + ssigpTa->SetBinContent(945,0.0150781); + ssigpTa->SetBinContent(946,0.0152833); + ssigpTa->SetBinContent(947,0.0154869); + ssigpTa->SetBinContent(948,0.0156394); + ssigpTa->SetBinContent(949,0.015547); + ssigpTa->SetBinContent(950,0.0152093); + ssigpTa->SetBinContent(951,0.0147741); + ssigpTa->SetBinContent(952,0.0143466); + ssigpTa->SetBinContent(953,0.0142374); + ssigpTa->SetBinContent(954,0.0144593); + ssigpTa->SetBinContent(955,0.0147493); + ssigpTa->SetBinContent(956,0.0150428); + ssigpTa->SetBinContent(957,0.0153398); + ssigpTa->SetBinContent(958,0.0156383); + ssigpTa->SetBinContent(959,0.0158884); + ssigpTa->SetBinContent(960,0.0158946); + ssigpTa->SetBinContent(961,0.0156952); + ssigpTa->SetBinContent(962,0.0156833); + ssigpTa->SetBinContent(963,0.0159099); + ssigpTa->SetBinContent(964,0.0161853); + ssigpTa->SetBinContent(965,0.0164591); + ssigpTa->SetBinContent(966,0.0167316); + ssigpTa->SetBinContent(967,0.0169291); + ssigpTa->SetBinContent(968,0.016747); + ssigpTa->SetBinContent(969,0.0162632); + ssigpTa->SetBinContent(970,0.0160543); + ssigpTa->SetBinContent(971,0.0160255); + ssigpTa->SetBinContent(972,0.0159004); + ssigpTa->SetBinContent(973,0.015936); + ssigpTa->SetBinContent(974,0.0161748); + ssigpTa->SetBinContent(975,0.0164556); + ssigpTa->SetBinContent(976,0.0167381); + ssigpTa->SetBinContent(977,0.0170237); + ssigpTa->SetBinContent(978,0.0173125); + ssigpTa->SetBinContent(979,0.0176025); + ssigpTa->SetBinContent(980,0.0178939); + ssigpTa->SetBinContent(981,0.018187); + ssigpTa->SetBinContent(982,0.0184473); + ssigpTa->SetBinContent(983,0.0185458); + ssigpTa->SetBinContent(984,0.0185056); + ssigpTa->SetBinContent(985,0.0185099); + ssigpTa->SetBinContent(986,0.0182322); + ssigpTa->SetBinContent(987,0.0176368); + ssigpTa->SetBinContent(988,0.0174032); + ssigpTa->SetBinContent(989,0.017623); + ssigpTa->SetBinContent(990,0.0179393); + ssigpTa->SetBinContent(991,0.0182587); + ssigpTa->SetBinContent(992,0.0185794); + ssigpTa->SetBinContent(993,0.018901); + ssigpTa->SetBinContent(994,0.0192134); + ssigpTa->SetBinContent(995,0.0195109); + ssigpTa->SetBinContent(996,0.0198375); + ssigpTa->SetBinContent(997,0.0202395); + ssigpTa->SetBinContent(998,0.0206954); + ssigpTa->SetBinContent(999,0.0211007); + ssigpTa->SetBinContent(1000,0.0213175); + ssigpTa->SetBinContent(1001,0.0208725); + ssigpTa->SetBinContent(1002,0.019892); + ssigpTa->SetBinContent(1003,0.0193854); + ssigpTa->SetBinContent(1004,0.0194977); + ssigpTa->SetBinContent(1005,0.0197264); + ssigpTa->SetBinContent(1006,0.0199411); + ssigpTa->SetBinContent(1007,0.0201099); + ssigpTa->SetBinContent(1008,0.0201182); + ssigpTa->SetBinContent(1009,0.0194748); + ssigpTa->SetBinContent(1010,0.0183299); + ssigpTa->SetBinContent(1011,0.0177514); + ssigpTa->SetBinContent(1012,0.0178642); + ssigpTa->SetBinContent(1013,0.018121); + ssigpTa->SetBinContent(1014,0.0185088); + ssigpTa->SetBinContent(1015,0.0195168); + ssigpTa->SetBinContent(1016,0.0210234); + ssigpTa->SetBinContent(1017,0.0220541); + ssigpTa->SetBinContent(1018,0.0224846); + ssigpTa->SetBinContent(1019,0.0228083); + ssigpTa->SetBinContent(1020,0.0231415); + ssigpTa->SetBinContent(1021,0.0234725); + ssigpTa->SetBinContent(1022,0.0237986); + ssigpTa->SetBinContent(1023,0.0240337); + ssigpTa->SetBinContent(1024,0.023819); + ssigpTa->SetBinContent(1025,0.0232402); + ssigpTa->SetBinContent(1026,0.0230162); + ssigpTa->SetBinContent(1027,0.02335); + ssigpTa->SetBinContent(1028,0.0243391); + ssigpTa->SetBinContent(1029,0.0257969); + ssigpTa->SetBinContent(1030,0.0268357); + ssigpTa->SetBinContent(1031,0.0273412); + ssigpTa->SetBinContent(1032,0.0277405); + ssigpTa->SetBinContent(1033,0.0281323); + ssigpTa->SetBinContent(1034,0.0284088); + ssigpTa->SetBinContent(1035,0.0281374); + ssigpTa->SetBinContent(1036,0.0274258); + ssigpTa->SetBinContent(1037,0.0271476); + ssigpTa->SetBinContent(1038,0.0275434); + ssigpTa->SetBinContent(1039,0.0286988); + ssigpTa->SetBinContent(1040,0.0303934); + ssigpTa->SetBinContent(1041,0.031595); + ssigpTa->SetBinContent(1042,0.0321542); + ssigpTa->SetBinContent(1043,0.0325872); + ssigpTa->SetBinContent(1044,0.0330384); + ssigpTa->SetBinContent(1045,0.033517); + ssigpTa->SetBinContent(1046,0.0337152); + ssigpTa->SetBinContent(1047,0.0324349); + ssigpTa->SetBinContent(1048,0.0299501); + ssigpTa->SetBinContent(1049,0.0286855); + ssigpTa->SetBinContent(1050,0.029347); + ssigpTa->SetBinContent(1051,0.0307129); + ssigpTa->SetBinContent(1052,0.0317416); + ssigpTa->SetBinContent(1053,0.0323103); + ssigpTa->SetBinContent(1054,0.0327673); + ssigpTa->SetBinContent(1055,0.0332206); + ssigpTa->SetBinContent(1056,0.0336775); + ssigpTa->SetBinContent(1057,0.0341224); + ssigpTa->SetBinContent(1058,0.0344983); + ssigpTa->SetBinContent(1059,0.0347477); + ssigpTa->SetBinContent(1060,0.0353537); + ssigpTa->SetBinContent(1061,0.0366233); + ssigpTa->SetBinContent(1062,0.0377535); + ssigpTa->SetBinContent(1063,0.0384141); + ssigpTa->SetBinContent(1064,0.0389303); + ssigpTa->SetBinContent(1065,0.0394278); + ssigpTa->SetBinContent(1066,0.0399555); + ssigpTa->SetBinContent(1067,0.040525); + ssigpTa->SetBinContent(1068,0.0410119); + ssigpTa->SetBinContent(1069,0.0409924); + ssigpTa->SetBinContent(1070,0.0406024); + ssigpTa->SetBinContent(1071,0.0406298); + ssigpTa->SetBinContent(1072,0.0411262); + ssigpTa->SetBinContent(1073,0.0416526); + ssigpTa->SetBinContent(1074,0.0422164); + ssigpTa->SetBinContent(1075,0.0428242); + ssigpTa->SetBinContent(1076,0.0434368); + ssigpTa->SetBinContent(1077,0.0440477); + ssigpTa->SetBinContent(1078,0.0446961); + ssigpTa->SetBinContent(1079,0.0454026); + ssigpTa->SetBinContent(1080,0.046139); + ssigpTa->SetBinContent(1081,0.0468728); + ssigpTa->SetBinContent(1082,0.0475894); + ssigpTa->SetBinContent(1083,0.0482548); + ssigpTa->SetBinContent(1084,0.0488261); + ssigpTa->SetBinContent(1085,0.0493575); + ssigpTa->SetBinContent(1086,0.0500054); + ssigpTa->SetBinContent(1087,0.0506285); + ssigpTa->SetBinContent(1088,0.0506121); + ssigpTa->SetBinContent(1089,0.0500347); + ssigpTa->SetBinContent(1090,0.0499572); + ssigpTa->SetBinContent(1091,0.050615); + ssigpTa->SetBinContent(1092,0.0515069); + ssigpTa->SetBinContent(1093,0.0522949); + ssigpTa->SetBinContent(1094,0.0521184); + ssigpTa->SetBinContent(1097,0.00999712); + ssigpTa->SetBinContent(1098,0.00999473); + ssigpTa->SetBinContent(1099,0.00999474); + ssigpTa->SetBinContent(1100,0.0099962); + ssigpTa->SetBinContent(1101,0.00999832); + ssigpTa->SetBinContent(1102,0.0100007); + ssigpTa->SetBinContent(1103,0.0100039); + ssigpTa->SetBinContent(1104,0.0100076); + ssigpTa->SetBinContent(1105,0.010012); + ssigpTa->SetBinContent(1106,0.0100167); + ssigpTa->SetBinContent(1107,0.0100224); + ssigpTa->SetBinContent(1108,0.0100285); + ssigpTa->SetBinContent(1109,0.0100352); + ssigpTa->SetBinContent(1110,0.0100425); + ssigpTa->SetBinContent(1111,0.0100501); + ssigpTa->SetBinContent(1112,0.0100586); + ssigpTa->SetBinContent(1113,0.0100675); + ssigpTa->SetBinContent(1114,0.010077); + ssigpTa->SetBinContent(1115,0.0100872); + ssigpTa->SetBinContent(1116,0.010098); + ssigpTa->SetBinContent(1117,0.0101093); + ssigpTa->SetBinContent(1118,0.0101211); + ssigpTa->SetBinContent(1119,0.0101336); + ssigpTa->SetBinContent(1120,0.0101464); + ssigpTa->SetBinContent(1121,0.0101599); + ssigpTa->SetBinContent(1122,0.0101743); + ssigpTa->SetBinContent(1123,0.010189); + ssigpTa->SetBinContent(1124,0.0102045); + ssigpTa->SetBinContent(1125,0.0102202); + ssigpTa->SetBinContent(1126,0.0102366); + ssigpTa->SetBinContent(1127,0.0102536); + ssigpTa->SetBinContent(1128,0.0102715); + ssigpTa->SetBinContent(1129,0.0102898); + ssigpTa->SetBinContent(1130,0.0103086); + ssigpTa->SetBinContent(1131,0.0103281); + ssigpTa->SetBinContent(1132,0.0103481); + ssigpTa->SetBinContent(1133,0.0103687); + ssigpTa->SetBinContent(1134,0.0103899); + ssigpTa->SetBinContent(1135,0.0104119); + ssigpTa->SetBinContent(1136,0.0104341); + ssigpTa->SetBinContent(1137,0.0104572); + ssigpTa->SetBinContent(1138,0.0104805); + ssigpTa->SetBinContent(1139,0.010505); + ssigpTa->SetBinContent(1140,0.0105297); + ssigpTa->SetBinContent(1141,0.0105551); + ssigpTa->SetBinContent(1142,0.0105809); + ssigpTa->SetBinContent(1143,0.0106076); + ssigpTa->SetBinContent(1144,0.0106348); + ssigpTa->SetBinContent(1145,0.0106625); + ssigpTa->SetBinContent(1146,0.0106911); + ssigpTa->SetBinContent(1147,0.0107201); + ssigpTa->SetBinContent(1148,0.0107496); + ssigpTa->SetBinContent(1149,0.0107799); + ssigpTa->SetBinContent(1150,0.0108107); + ssigpTa->SetBinContent(1151,0.0108421); + ssigpTa->SetBinContent(1152,0.010874); + ssigpTa->SetBinContent(1153,0.0109068); + ssigpTa->SetBinContent(1154,0.01094); + ssigpTa->SetBinContent(1155,0.010974); + ssigpTa->SetBinContent(1156,0.0110087); + ssigpTa->SetBinContent(1157,0.011044); + ssigpTa->SetBinContent(1158,0.0110797); + ssigpTa->SetBinContent(1159,0.0111162); + ssigpTa->SetBinContent(1160,0.0111536); + ssigpTa->SetBinContent(1161,0.0111912); + ssigpTa->SetBinContent(1162,0.0112297); + ssigpTa->SetBinContent(1163,0.0112688); + ssigpTa->SetBinContent(1164,0.0113085); + ssigpTa->SetBinContent(1165,0.0113489); + ssigpTa->SetBinContent(1166,0.01139); + ssigpTa->SetBinContent(1167,0.0114318); + ssigpTa->SetBinContent(1168,0.011474); + ssigpTa->SetBinContent(1169,0.0115172); + ssigpTa->SetBinContent(1170,0.0115611); + ssigpTa->SetBinContent(1171,0.0116057); + ssigpTa->SetBinContent(1172,0.0116507); + ssigpTa->SetBinContent(1173,0.0116967); + ssigpTa->SetBinContent(1174,0.0117433); + ssigpTa->SetBinContent(1175,0.0117906); + ssigpTa->SetBinContent(1176,0.0118387); + ssigpTa->SetBinContent(1177,0.0118873); + ssigpTa->SetBinContent(1178,0.0119368); + ssigpTa->SetBinContent(1179,0.0119871); + ssigpTa->SetBinContent(1180,0.012038); + ssigpTa->SetBinContent(1181,0.0120899); + ssigpTa->SetBinContent(1182,0.0121424); + ssigpTa->SetBinContent(1183,0.0121957); + ssigpTa->SetBinContent(1184,0.0122497); + ssigpTa->SetBinContent(1185,0.0123046); + ssigpTa->SetBinContent(1186,0.0123605); + ssigpTa->SetBinContent(1187,0.0124171); + ssigpTa->SetBinContent(1188,0.0124743); + ssigpTa->SetBinContent(1189,0.0125326); + ssigpTa->SetBinContent(1190,0.0125915); + ssigpTa->SetBinContent(1191,0.0126515); + ssigpTa->SetBinContent(1192,0.0127124); + ssigpTa->SetBinContent(1193,0.0127742); + ssigpTa->SetBinContent(1194,0.0128369); + ssigpTa->SetBinContent(1195,0.0129004); + ssigpTa->SetBinContent(1196,0.0129651); + ssigpTa->SetBinContent(1197,0.0130305); + ssigpTa->SetBinContent(1198,0.013097); + ssigpTa->SetBinContent(1199,0.0131644); + ssigpTa->SetBinContent(1200,0.0132509); + ssigpTa->SetBinContent(1201,0.0134269); + ssigpTa->SetBinContent(1202,0.0137341); + ssigpTa->SetBinContent(1203,0.0141712); + ssigpTa->SetBinContent(1204,0.0147402); + ssigpTa->SetBinContent(1205,0.015074); + ssigpTa->SetBinContent(1206,0.0151944); + ssigpTa->SetBinContent(1207,0.0152732); + ssigpTa->SetBinContent(1208,0.0153531); + ssigpTa->SetBinContent(1209,0.0154338); + ssigpTa->SetBinContent(1210,0.0155156); + ssigpTa->SetBinContent(1211,0.0155988); + ssigpTa->SetBinContent(1212,0.0156831); + ssigpTa->SetBinContent(1213,0.0157378); + ssigpTa->SetBinContent(1214,0.0156318); + ssigpTa->SetBinContent(1215,0.0153398); + ssigpTa->SetBinContent(1216,0.0152038); + ssigpTa->SetBinContent(1217,0.0153134); + ssigpTa->SetBinContent(1218,0.0155187); + ssigpTa->SetBinContent(1219,0.0157349); + ssigpTa->SetBinContent(1220,0.0159497); + ssigpTa->SetBinContent(1221,0.0161626); + ssigpTa->SetBinContent(1222,0.0163246); + ssigpTa->SetBinContent(1223,0.0162416); + ssigpTa->SetBinContent(1224,0.0158652); + ssigpTa->SetBinContent(1225,0.0154452); + ssigpTa->SetBinContent(1226,0.014979); + ssigpTa->SetBinContent(1227,0.014886); + ssigpTa->SetBinContent(1228,0.0151215); + ssigpTa->SetBinContent(1229,0.015425); + ssigpTa->SetBinContent(1230,0.0157319); + ssigpTa->SetBinContent(1231,0.0160426); + ssigpTa->SetBinContent(1232,0.0163546); + ssigpTa->SetBinContent(1233,0.0166172); + ssigpTa->SetBinContent(1234,0.0166274); + ssigpTa->SetBinContent(1235,0.0163706); + ssigpTa->SetBinContent(1236,0.0163623); + ssigpTa->SetBinContent(1237,0.0166015); + ssigpTa->SetBinContent(1238,0.0168908); + ssigpTa->SetBinContent(1239,0.0171787); + ssigpTa->SetBinContent(1240,0.0174653); + ssigpTa->SetBinContent(1241,0.0176769); + ssigpTa->SetBinContent(1242,0.0175047); + ssigpTa->SetBinContent(1243,0.0169489); + ssigpTa->SetBinContent(1244,0.0167495); + ssigpTa->SetBinContent(1245,0.0167298); + ssigpTa->SetBinContent(1246,0.0165689); + ssigpTa->SetBinContent(1247,0.0166129); + ssigpTa->SetBinContent(1248,0.0168642); + ssigpTa->SetBinContent(1249,0.0171579); + ssigpTa->SetBinContent(1250,0.0174535); + ssigpTa->SetBinContent(1251,0.0177524); + ssigpTa->SetBinContent(1252,0.018055); + ssigpTa->SetBinContent(1253,0.0183586); + ssigpTa->SetBinContent(1254,0.018664); + ssigpTa->SetBinContent(1255,0.0189715); + ssigpTa->SetBinContent(1256,0.0192452); + ssigpTa->SetBinContent(1257,0.019346); + ssigpTa->SetBinContent(1258,0.019269); + ssigpTa->SetBinContent(1259,0.0192748); + ssigpTa->SetBinContent(1260,0.0190104); + ssigpTa->SetBinContent(1261,0.0183372); + ssigpTa->SetBinContent(1262,0.0181169); + ssigpTa->SetBinContent(1263,0.0183499); + ssigpTa->SetBinContent(1264,0.0186798); + ssigpTa->SetBinContent(1265,0.0190131); + ssigpTa->SetBinContent(1266,0.0193473); + ssigpTa->SetBinContent(1267,0.0196823); + ssigpTa->SetBinContent(1268,0.0200009); + ssigpTa->SetBinContent(1269,0.0202983); + ssigpTa->SetBinContent(1270,0.0206314); + ssigpTa->SetBinContent(1271,0.0210562); + ssigpTa->SetBinContent(1272,0.0215616); + ssigpTa->SetBinContent(1273,0.0219932); + ssigpTa->SetBinContent(1274,0.0222294); + ssigpTa->SetBinContent(1275,0.0218053); + ssigpTa->SetBinContent(1276,0.0207187); + ssigpTa->SetBinContent(1277,0.0202273); + ssigpTa->SetBinContent(1278,0.0203513); + ssigpTa->SetBinContent(1279,0.0205917); + ssigpTa->SetBinContent(1280,0.0208183); + ssigpTa->SetBinContent(1281,0.0210124); + ssigpTa->SetBinContent(1282,0.0210375); + ssigpTa->SetBinContent(1283,0.0204083); + ssigpTa->SetBinContent(1284,0.0191037); + ssigpTa->SetBinContent(1285,0.0185261); + ssigpTa->SetBinContent(1286,0.0186504); + ssigpTa->SetBinContent(1287,0.0189197); + ssigpTa->SetBinContent(1288,0.0193202); + ssigpTa->SetBinContent(1289,0.020335); + ssigpTa->SetBinContent(1290,0.0219618); + ssigpTa->SetBinContent(1291,0.0230002); + ssigpTa->SetBinContent(1292,0.0234432); + ssigpTa->SetBinContent(1293,0.0237811); + ssigpTa->SetBinContent(1294,0.0241284); + ssigpTa->SetBinContent(1295,0.0244737); + ssigpTa->SetBinContent(1296,0.0248146); + ssigpTa->SetBinContent(1297,0.0250645); + ssigpTa->SetBinContent(1298,0.0248639); + ssigpTa->SetBinContent(1299,0.0242113); + ssigpTa->SetBinContent(1300,0.0240014); + ssigpTa->SetBinContent(1301,0.0243507); + ssigpTa->SetBinContent(1302,0.0253613); + ssigpTa->SetBinContent(1303,0.0269562); + ssigpTa->SetBinContent(1304,0.0280174); + ssigpTa->SetBinContent(1305,0.0285414); + ssigpTa->SetBinContent(1306,0.0289576); + ssigpTa->SetBinContent(1307,0.0293677); + ssigpTa->SetBinContent(1308,0.0296636); + ssigpTa->SetBinContent(1309,0.0294158); + ssigpTa->SetBinContent(1310,0.0286306); + ssigpTa->SetBinContent(1311,0.0283749); + ssigpTa->SetBinContent(1312,0.0287912); + ssigpTa->SetBinContent(1313,0.0299644); + ssigpTa->SetBinContent(1314,0.0318042); + ssigpTa->SetBinContent(1315,0.0330255); + ssigpTa->SetBinContent(1316,0.0336054); + ssigpTa->SetBinContent(1317,0.0340609); + ssigpTa->SetBinContent(1318,0.0345358); + ssigpTa->SetBinContent(1319,0.0350371); + ssigpTa->SetBinContent(1320,0.0352623); + ssigpTa->SetBinContent(1321,0.0340253); + ssigpTa->SetBinContent(1322,0.0313216); + ssigpTa->SetBinContent(1323,0.0300954); + ssigpTa->SetBinContent(1324,0.0307764); + ssigpTa->SetBinContent(1325,0.0322538); + ssigpTa->SetBinContent(1326,0.0333012); + ssigpTa->SetBinContent(1327,0.0338927); + ssigpTa->SetBinContent(1328,0.0343757); + ssigpTa->SetBinContent(1329,0.0348548); + ssigpTa->SetBinContent(1330,0.035335); + ssigpTa->SetBinContent(1331,0.0358024); + ssigpTa->SetBinContent(1332,0.0362069); + ssigpTa->SetBinContent(1333,0.0364887); + ssigpTa->SetBinContent(1334,0.0370926); + ssigpTa->SetBinContent(1335,0.0384767); + ssigpTa->SetBinContent(1336,0.039627); + ssigpTa->SetBinContent(1337,0.0403114); + ssigpTa->SetBinContent(1338,0.0408593); + ssigpTa->SetBinContent(1339,0.0413923); + ssigpTa->SetBinContent(1340,0.0419546); + ssigpTa->SetBinContent(1341,0.0425542); + ssigpTa->SetBinContent(1342,0.0430748); + ssigpTa->SetBinContent(1343,0.0431314); + ssigpTa->SetBinContent(1344,0.0427391); + ssigpTa->SetBinContent(1345,0.0428419); + ssigpTa->SetBinContent(1346,0.0433538); + ssigpTa->SetBinContent(1347,0.0438803); + ssigpTa->SetBinContent(1348,0.0444561); + ssigpTa->SetBinContent(1349,0.0450974); + ssigpTa->SetBinContent(1350,0.0457451); + ssigpTa->SetBinContent(1351,0.0463921); + ssigpTa->SetBinContent(1352,0.0470792); + ssigpTa->SetBinContent(1353,0.0478248); + ssigpTa->SetBinContent(1354,0.0485976); + ssigpTa->SetBinContent(1355,0.0493685); + ssigpTa->SetBinContent(1356,0.0501235); + ssigpTa->SetBinContent(1357,0.0508333); + ssigpTa->SetBinContent(1358,0.0514424); + ssigpTa->SetBinContent(1359,0.0520053); + ssigpTa->SetBinContent(1360,0.052687); + ssigpTa->SetBinContent(1361,0.0533567); + ssigpTa->SetBinContent(1362,0.0534313); + ssigpTa->SetBinContent(1363,0.0528334); + ssigpTa->SetBinContent(1364,0.0528609); + ssigpTa->SetBinContent(1365,0.0535848); + ssigpTa->SetBinContent(1366,0.0545166); + ssigpTa->SetBinContent(1367,0.0554273); + ssigpTa->SetBinContent(1368,0.0560769); + ssigpTa->SetBinContent(1371,0.0101069); + ssigpTa->SetBinContent(1372,0.0101034); + ssigpTa->SetBinContent(1373,0.0101012); + ssigpTa->SetBinContent(1374,0.0101025); + ssigpTa->SetBinContent(1375,0.0101048); + ssigpTa->SetBinContent(1376,0.0101075); + ssigpTa->SetBinContent(1377,0.0101104); + ssigpTa->SetBinContent(1378,0.0101147); + ssigpTa->SetBinContent(1379,0.0101186); + ssigpTa->SetBinContent(1380,0.0101234); + ssigpTa->SetBinContent(1381,0.0101288); + ssigpTa->SetBinContent(1382,0.0101353); + ssigpTa->SetBinContent(1383,0.0101418); + ssigpTa->SetBinContent(1384,0.0101488); + ssigpTa->SetBinContent(1385,0.0101568); + ssigpTa->SetBinContent(1386,0.0101649); + ssigpTa->SetBinContent(1387,0.0101735); + ssigpTa->SetBinContent(1388,0.0101829); + ssigpTa->SetBinContent(1389,0.0101934); + ssigpTa->SetBinContent(1390,0.0102043); + ssigpTa->SetBinContent(1391,0.010216); + ssigpTa->SetBinContent(1392,0.0102278); + ssigpTa->SetBinContent(1393,0.0102398); + ssigpTa->SetBinContent(1394,0.0102525); + ssigpTa->SetBinContent(1395,0.0102664); + ssigpTa->SetBinContent(1396,0.0102805); + ssigpTa->SetBinContent(1397,0.0102958); + ssigpTa->SetBinContent(1398,0.0103106); + ssigpTa->SetBinContent(1399,0.0103265); + ssigpTa->SetBinContent(1400,0.0103422); + ssigpTa->SetBinContent(1401,0.0103595); + ssigpTa->SetBinContent(1402,0.0103775); + ssigpTa->SetBinContent(1403,0.0103958); + ssigpTa->SetBinContent(1404,0.0104141); + ssigpTa->SetBinContent(1405,0.0104333); + ssigpTa->SetBinContent(1406,0.0104533); + ssigpTa->SetBinContent(1407,0.0104738); + ssigpTa->SetBinContent(1408,0.0104951); + ssigpTa->SetBinContent(1409,0.0105172); + ssigpTa->SetBinContent(1410,0.0105397); + ssigpTa->SetBinContent(1411,0.010562); + ssigpTa->SetBinContent(1412,0.0105855); + ssigpTa->SetBinContent(1413,0.0106096); + ssigpTa->SetBinContent(1414,0.0106345); + ssigpTa->SetBinContent(1415,0.0106597); + ssigpTa->SetBinContent(1416,0.0106856); + ssigpTa->SetBinContent(1417,0.0107122); + ssigpTa->SetBinContent(1418,0.0107395); + ssigpTa->SetBinContent(1419,0.0107672); + ssigpTa->SetBinContent(1420,0.0107952); + ssigpTa->SetBinContent(1421,0.0108246); + ssigpTa->SetBinContent(1422,0.0108541); + ssigpTa->SetBinContent(1423,0.0108842); + ssigpTa->SetBinContent(1424,0.0109148); + ssigpTa->SetBinContent(1425,0.0109457); + ssigpTa->SetBinContent(1426,0.0109779); + ssigpTa->SetBinContent(1427,0.0110104); + ssigpTa->SetBinContent(1428,0.0110435); + ssigpTa->SetBinContent(1429,0.0110771); + ssigpTa->SetBinContent(1430,0.0111122); + ssigpTa->SetBinContent(1431,0.0111471); + ssigpTa->SetBinContent(1432,0.0111828); + ssigpTa->SetBinContent(1433,0.0112195); + ssigpTa->SetBinContent(1434,0.0112563); + ssigpTa->SetBinContent(1435,0.0112944); + ssigpTa->SetBinContent(1436,0.0113327); + ssigpTa->SetBinContent(1437,0.0113719); + ssigpTa->SetBinContent(1438,0.0114117); + ssigpTa->SetBinContent(1439,0.0114519); + ssigpTa->SetBinContent(1440,0.0114928); + ssigpTa->SetBinContent(1441,0.0115341); + ssigpTa->SetBinContent(1442,0.0115762); + ssigpTa->SetBinContent(1443,0.0116191); + ssigpTa->SetBinContent(1444,0.0116635); + ssigpTa->SetBinContent(1445,0.0117076); + ssigpTa->SetBinContent(1446,0.0117529); + ssigpTa->SetBinContent(1447,0.0117983); + ssigpTa->SetBinContent(1448,0.011845); + ssigpTa->SetBinContent(1449,0.0118919); + ssigpTa->SetBinContent(1450,0.0119397); + ssigpTa->SetBinContent(1451,0.0119883); + ssigpTa->SetBinContent(1452,0.0120375); + ssigpTa->SetBinContent(1453,0.0120876); + ssigpTa->SetBinContent(1454,0.0121386); + ssigpTa->SetBinContent(1455,0.0121903); + ssigpTa->SetBinContent(1456,0.0122431); + ssigpTa->SetBinContent(1457,0.0122962); + ssigpTa->SetBinContent(1458,0.0123498); + ssigpTa->SetBinContent(1459,0.0124043); + ssigpTa->SetBinContent(1460,0.0124603); + ssigpTa->SetBinContent(1461,0.0125171); + ssigpTa->SetBinContent(1462,0.0125742); + ssigpTa->SetBinContent(1463,0.012632); + ssigpTa->SetBinContent(1464,0.0126911); + ssigpTa->SetBinContent(1465,0.0127507); + ssigpTa->SetBinContent(1466,0.0128116); + ssigpTa->SetBinContent(1467,0.0128732); + ssigpTa->SetBinContent(1468,0.0129358); + ssigpTa->SetBinContent(1469,0.0129997); + ssigpTa->SetBinContent(1470,0.013064); + ssigpTa->SetBinContent(1471,0.0131293); + ssigpTa->SetBinContent(1472,0.0131954); + ssigpTa->SetBinContent(1473,0.0132629); + ssigpTa->SetBinContent(1474,0.0133485); + ssigpTa->SetBinContent(1475,0.0135202); + ssigpTa->SetBinContent(1476,0.0138201); + ssigpTa->SetBinContent(1477,0.0142646); + ssigpTa->SetBinContent(1478,0.0148553); + ssigpTa->SetBinContent(1479,0.0152011); + ssigpTa->SetBinContent(1480,0.0153222); + ssigpTa->SetBinContent(1481,0.0154007); + ssigpTa->SetBinContent(1482,0.0154805); + ssigpTa->SetBinContent(1483,0.015561); + ssigpTa->SetBinContent(1484,0.0156426); + ssigpTa->SetBinContent(1485,0.0157259); + ssigpTa->SetBinContent(1486,0.0158101); + ssigpTa->SetBinContent(1487,0.0158637); + ssigpTa->SetBinContent(1488,0.0157486); + ssigpTa->SetBinContent(1489,0.0154423); + ssigpTa->SetBinContent(1490,0.0153033); + ssigpTa->SetBinContent(1491,0.0154162); + ssigpTa->SetBinContent(1492,0.0156234); + ssigpTa->SetBinContent(1493,0.0158422); + ssigpTa->SetBinContent(1494,0.0160594); + ssigpTa->SetBinContent(1495,0.0162755); + ssigpTa->SetBinContent(1496,0.0164412); + ssigpTa->SetBinContent(1497,0.0163635); + ssigpTa->SetBinContent(1498,0.0159924); + ssigpTa->SetBinContent(1499,0.015599); + ssigpTa->SetBinContent(1500,0.0151809); + ssigpTa->SetBinContent(1501,0.0151138); + ssigpTa->SetBinContent(1502,0.0153527); + ssigpTa->SetBinContent(1503,0.0156582); + ssigpTa->SetBinContent(1504,0.0159667); + ssigpTa->SetBinContent(1505,0.0162784); + ssigpTa->SetBinContent(1506,0.0165912); + ssigpTa->SetBinContent(1507,0.0168513); + ssigpTa->SetBinContent(1508,0.0168323); + ssigpTa->SetBinContent(1509,0.0165294); + ssigpTa->SetBinContent(1510,0.0164961); + ssigpTa->SetBinContent(1511,0.0167384); + ssigpTa->SetBinContent(1512,0.0170341); + ssigpTa->SetBinContent(1513,0.0173296); + ssigpTa->SetBinContent(1514,0.0176241); + ssigpTa->SetBinContent(1515,0.0178426); + ssigpTa->SetBinContent(1516,0.0176661); + ssigpTa->SetBinContent(1517,0.0171011); + ssigpTa->SetBinContent(1518,0.0168955); + ssigpTa->SetBinContent(1519,0.0168708); + ssigpTa->SetBinContent(1520,0.0166908); + ssigpTa->SetBinContent(1521,0.0167297); + ssigpTa->SetBinContent(1522,0.0169852); + ssigpTa->SetBinContent(1523,0.0172835); + ssigpTa->SetBinContent(1524,0.0175845); + ssigpTa->SetBinContent(1525,0.017889); + ssigpTa->SetBinContent(1526,0.0181972); + ssigpTa->SetBinContent(1527,0.0185072); + ssigpTa->SetBinContent(1528,0.0188192); + ssigpTa->SetBinContent(1529,0.019134); + ssigpTa->SetBinContent(1530,0.0194149); + ssigpTa->SetBinContent(1531,0.0195067); + ssigpTa->SetBinContent(1532,0.0194014); + ssigpTa->SetBinContent(1533,0.0193965); + ssigpTa->SetBinContent(1534,0.0191309); + ssigpTa->SetBinContent(1535,0.018445); + ssigpTa->SetBinContent(1536,0.0182213); + ssigpTa->SetBinContent(1537,0.0184567); + ssigpTa->SetBinContent(1538,0.0187885); + ssigpTa->SetBinContent(1539,0.0191247); + ssigpTa->SetBinContent(1540,0.0194617); + ssigpTa->SetBinContent(1541,0.019799); + ssigpTa->SetBinContent(1542,0.0201115); + ssigpTa->SetBinContent(1543,0.0203909); + ssigpTa->SetBinContent(1544,0.0207209); + ssigpTa->SetBinContent(1545,0.0211771); + ssigpTa->SetBinContent(1546,0.0217359); + ssigpTa->SetBinContent(1547,0.0222059); + ssigpTa->SetBinContent(1548,0.0224555); + ssigpTa->SetBinContent(1549,0.0220481); + ssigpTa->SetBinContent(1550,0.0209902); + ssigpTa->SetBinContent(1551,0.0205114); + ssigpTa->SetBinContent(1552,0.0206409); + ssigpTa->SetBinContent(1553,0.0208882); + ssigpTa->SetBinContent(1554,0.0211236); + ssigpTa->SetBinContent(1555,0.0213346); + ssigpTa->SetBinContent(1556,0.0213836); + ssigpTa->SetBinContent(1557,0.0207198); + ssigpTa->SetBinContent(1558,0.0193254); + ssigpTa->SetBinContent(1559,0.0187029); + ssigpTa->SetBinContent(1560,0.0188299); + ssigpTa->SetBinContent(1561,0.0191062); + ssigpTa->SetBinContent(1562,0.0195117); + ssigpTa->SetBinContent(1563,0.0205115); + ssigpTa->SetBinContent(1564,0.0221033); + ssigpTa->SetBinContent(1565,0.023124); + ssigpTa->SetBinContent(1566,0.0235685); + ssigpTa->SetBinContent(1567,0.0239089); + ssigpTa->SetBinContent(1568,0.0242587); + ssigpTa->SetBinContent(1569,0.0246073); + ssigpTa->SetBinContent(1570,0.0249528); + ssigpTa->SetBinContent(1571,0.0252079); + ssigpTa->SetBinContent(1572,0.0250167); + ssigpTa->SetBinContent(1573,0.0243808); + ssigpTa->SetBinContent(1574,0.0241826); + ssigpTa->SetBinContent(1575,0.0245419); + ssigpTa->SetBinContent(1576,0.0255671); + ssigpTa->SetBinContent(1577,0.0271765); + ssigpTa->SetBinContent(1578,0.0282497); + ssigpTa->SetBinContent(1579,0.0287788); + ssigpTa->SetBinContent(1580,0.0291986); + ssigpTa->SetBinContent(1581,0.0296147); + ssigpTa->SetBinContent(1582,0.029921); + ssigpTa->SetBinContent(1583,0.0297063); + ssigpTa->SetBinContent(1584,0.028975); + ssigpTa->SetBinContent(1585,0.0287543); + ssigpTa->SetBinContent(1586,0.0291843); + ssigpTa->SetBinContent(1587,0.0303664); + ssigpTa->SetBinContent(1588,0.032203); + ssigpTa->SetBinContent(1589,0.0334278); + ssigpTa->SetBinContent(1590,0.0340161); + ssigpTa->SetBinContent(1591,0.0344836); + ssigpTa->SetBinContent(1592,0.0349705); + ssigpTa->SetBinContent(1593,0.0354819); + ssigpTa->SetBinContent(1594,0.0357244); + ssigpTa->SetBinContent(1595,0.0345655); + ssigpTa->SetBinContent(1596,0.0319796); + ssigpTa->SetBinContent(1597,0.0308274); + ssigpTa->SetBinContent(1598,0.0315278); + ssigpTa->SetBinContent(1599,0.0330206); + ssigpTa->SetBinContent(1600,0.0340745); + ssigpTa->SetBinContent(1601,0.0346709); + ssigpTa->SetBinContent(1602,0.0351674); + ssigpTa->SetBinContent(1603,0.0356602); + ssigpTa->SetBinContent(1604,0.0361501); + ssigpTa->SetBinContent(1605,0.0366289); + ssigpTa->SetBinContent(1606,0.0370587); + ssigpTa->SetBinContent(1607,0.0373914); + ssigpTa->SetBinContent(1608,0.0380329); + ssigpTa->SetBinContent(1609,0.0394279); + ssigpTa->SetBinContent(1610,0.0405618); + ssigpTa->SetBinContent(1611,0.0412471); + ssigpTa->SetBinContent(1612,0.0418142); + ssigpTa->SetBinContent(1613,0.0423748); + ssigpTa->SetBinContent(1614,0.0429582); + ssigpTa->SetBinContent(1615,0.0435694); + ssigpTa->SetBinContent(1616,0.0441118); + ssigpTa->SetBinContent(1617,0.0442457); + ssigpTa->SetBinContent(1618,0.0439713); + ssigpTa->SetBinContent(1619,0.0441402); + ssigpTa->SetBinContent(1620,0.0446556); + ssigpTa->SetBinContent(1621,0.0451629); + ssigpTa->SetBinContent(1622,0.0457382); + ssigpTa->SetBinContent(1623,0.0463905); + ssigpTa->SetBinContent(1624,0.0470514); + ssigpTa->SetBinContent(1625,0.0477175); + ssigpTa->SetBinContent(1626,0.0484269); + ssigpTa->SetBinContent(1627,0.0491886); + ssigpTa->SetBinContent(1628,0.0499718); + ssigpTa->SetBinContent(1629,0.0507524); + ssigpTa->SetBinContent(1630,0.0515219); + ssigpTa->SetBinContent(1631,0.0522587); + ssigpTa->SetBinContent(1632,0.0529131); + ssigpTa->SetBinContent(1633,0.0535184); + ssigpTa->SetBinContent(1634,0.0542264); + ssigpTa->SetBinContent(1635,0.0549135); + ssigpTa->SetBinContent(1636,0.0550172); + ssigpTa->SetBinContent(1637,0.0545056); + ssigpTa->SetBinContent(1638,0.0545974); + ssigpTa->SetBinContent(1639,0.0553595); + ssigpTa->SetBinContent(1640,0.0562923); + ssigpTa->SetBinContent(1641,0.057188); + ssigpTa->SetBinContent(1642,0.0578266); + ssigpTa->SetBinContent(1645,0.0103836); + ssigpTa->SetBinContent(1646,0.0103756); + ssigpTa->SetBinContent(1647,0.010372); + ssigpTa->SetBinContent(1648,0.0103736); + ssigpTa->SetBinContent(1649,0.0103762); + ssigpTa->SetBinContent(1650,0.0103787); + ssigpTa->SetBinContent(1651,0.010383); + ssigpTa->SetBinContent(1652,0.0103866); + ssigpTa->SetBinContent(1653,0.0103906); + ssigpTa->SetBinContent(1654,0.0103944); + ssigpTa->SetBinContent(1655,0.0104011); + ssigpTa->SetBinContent(1656,0.010407); + ssigpTa->SetBinContent(1657,0.0104132); + ssigpTa->SetBinContent(1658,0.0104211); + ssigpTa->SetBinContent(1659,0.0104286); + ssigpTa->SetBinContent(1660,0.0104362); + ssigpTa->SetBinContent(1661,0.0104444); + ssigpTa->SetBinContent(1662,0.0104529); + ssigpTa->SetBinContent(1663,0.0104636); + ssigpTa->SetBinContent(1664,0.0104751); + ssigpTa->SetBinContent(1665,0.0104873); + ssigpTa->SetBinContent(1666,0.0104988); + ssigpTa->SetBinContent(1667,0.010511); + ssigpTa->SetBinContent(1668,0.010524); + ssigpTa->SetBinContent(1669,0.0105371); + ssigpTa->SetBinContent(1670,0.0105524); + ssigpTa->SetBinContent(1671,0.0105671); + ssigpTa->SetBinContent(1672,0.0105828); + ssigpTa->SetBinContent(1673,0.010597); + ssigpTa->SetBinContent(1674,0.0106132); + ssigpTa->SetBinContent(1675,0.01063); + ssigpTa->SetBinContent(1676,0.0106487); + ssigpTa->SetBinContent(1677,0.0106667); + ssigpTa->SetBinContent(1678,0.0106846); + ssigpTa->SetBinContent(1679,0.0107032); + ssigpTa->SetBinContent(1680,0.010723); + ssigpTa->SetBinContent(1681,0.0107434); + ssigpTa->SetBinContent(1682,0.010765); + ssigpTa->SetBinContent(1683,0.0107875); + ssigpTa->SetBinContent(1684,0.0108097); + ssigpTa->SetBinContent(1685,0.0108318); + ssigpTa->SetBinContent(1686,0.0108554); + ssigpTa->SetBinContent(1687,0.0108793); + ssigpTa->SetBinContent(1688,0.0109042); + ssigpTa->SetBinContent(1689,0.0109289); + ssigpTa->SetBinContent(1690,0.0109554); + ssigpTa->SetBinContent(1691,0.010982); + ssigpTa->SetBinContent(1692,0.0110093); + ssigpTa->SetBinContent(1693,0.0110369); + ssigpTa->SetBinContent(1694,0.0110648); + ssigpTa->SetBinContent(1695,0.0110938); + ssigpTa->SetBinContent(1696,0.0111232); + ssigpTa->SetBinContent(1697,0.0111536); + ssigpTa->SetBinContent(1698,0.0111834); + ssigpTa->SetBinContent(1699,0.0112152); + ssigpTa->SetBinContent(1700,0.0112466); + ssigpTa->SetBinContent(1701,0.0112797); + ssigpTa->SetBinContent(1702,0.011312); + ssigpTa->SetBinContent(1703,0.0113454); + ssigpTa->SetBinContent(1704,0.0113799); + ssigpTa->SetBinContent(1705,0.0114156); + ssigpTa->SetBinContent(1706,0.0114515); + ssigpTa->SetBinContent(1707,0.0114879); + ssigpTa->SetBinContent(1708,0.0115254); + ssigpTa->SetBinContent(1709,0.011562); + ssigpTa->SetBinContent(1710,0.0116011); + ssigpTa->SetBinContent(1711,0.0116405); + ssigpTa->SetBinContent(1712,0.0116804); + ssigpTa->SetBinContent(1713,0.0117205); + ssigpTa->SetBinContent(1714,0.0117609); + ssigpTa->SetBinContent(1715,0.0118024); + ssigpTa->SetBinContent(1716,0.0118436); + ssigpTa->SetBinContent(1717,0.0118868); + ssigpTa->SetBinContent(1718,0.0119305); + ssigpTa->SetBinContent(1719,0.0119754); + ssigpTa->SetBinContent(1720,0.0120201); + ssigpTa->SetBinContent(1721,0.012066); + ssigpTa->SetBinContent(1722,0.0121113); + ssigpTa->SetBinContent(1723,0.0121585); + ssigpTa->SetBinContent(1724,0.0122058); + ssigpTa->SetBinContent(1725,0.0122546); + ssigpTa->SetBinContent(1726,0.0123036); + ssigpTa->SetBinContent(1727,0.012354); + ssigpTa->SetBinContent(1728,0.0124042); + ssigpTa->SetBinContent(1729,0.0124564); + ssigpTa->SetBinContent(1730,0.0125083); + ssigpTa->SetBinContent(1731,0.0125618); + ssigpTa->SetBinContent(1732,0.0126152); + ssigpTa->SetBinContent(1733,0.0126697); + ssigpTa->SetBinContent(1734,0.012725); + ssigpTa->SetBinContent(1735,0.0127821); + ssigpTa->SetBinContent(1736,0.0128391); + ssigpTa->SetBinContent(1737,0.012897); + ssigpTa->SetBinContent(1738,0.0129556); + ssigpTa->SetBinContent(1739,0.0130154); + ssigpTa->SetBinContent(1740,0.0130758); + ssigpTa->SetBinContent(1741,0.0131374); + ssigpTa->SetBinContent(1742,0.0131999); + ssigpTa->SetBinContent(1743,0.0132642); + ssigpTa->SetBinContent(1744,0.0133284); + ssigpTa->SetBinContent(1745,0.0133928); + ssigpTa->SetBinContent(1746,0.0134595); + ssigpTa->SetBinContent(1747,0.013526); + ssigpTa->SetBinContent(1748,0.0136094); + ssigpTa->SetBinContent(1749,0.0137706); + ssigpTa->SetBinContent(1750,0.0140564); + ssigpTa->SetBinContent(1751,0.0145164); + ssigpTa->SetBinContent(1752,0.0151564); + ssigpTa->SetBinContent(1753,0.0155278); + ssigpTa->SetBinContent(1754,0.0156524); + ssigpTa->SetBinContent(1755,0.0157307); + ssigpTa->SetBinContent(1756,0.0158097); + ssigpTa->SetBinContent(1757,0.01589); + ssigpTa->SetBinContent(1758,0.0159718); + ssigpTa->SetBinContent(1759,0.0160558); + ssigpTa->SetBinContent(1760,0.0161398); + ssigpTa->SetBinContent(1761,0.0161892); + ssigpTa->SetBinContent(1762,0.0160549); + ssigpTa->SetBinContent(1763,0.0157179); + ssigpTa->SetBinContent(1764,0.0155735); + ssigpTa->SetBinContent(1765,0.015694); + ssigpTa->SetBinContent(1766,0.015907); + ssigpTa->SetBinContent(1767,0.016131); + ssigpTa->SetBinContent(1768,0.0163542); + ssigpTa->SetBinContent(1769,0.0165776); + ssigpTa->SetBinContent(1770,0.0167511); + ssigpTa->SetBinContent(1771,0.0166812); + ssigpTa->SetBinContent(1772,0.016321); + ssigpTa->SetBinContent(1773,0.0159887); + ssigpTa->SetBinContent(1774,0.015676); + ssigpTa->SetBinContent(1775,0.0156686); + ssigpTa->SetBinContent(1776,0.0159181); + ssigpTa->SetBinContent(1777,0.0162222); + ssigpTa->SetBinContent(1778,0.0165297); + ssigpTa->SetBinContent(1779,0.0168384); + ssigpTa->SetBinContent(1780,0.0171479); + ssigpTa->SetBinContent(1781,0.017393); + ssigpTa->SetBinContent(1782,0.017326); + ssigpTa->SetBinContent(1783,0.0169426); + ssigpTa->SetBinContent(1784,0.0168724); + ssigpTa->SetBinContent(1785,0.0171142); + ssigpTa->SetBinContent(1786,0.0174217); + ssigpTa->SetBinContent(1787,0.0177302); + ssigpTa->SetBinContent(1788,0.0180384); + ssigpTa->SetBinContent(1789,0.0182652); + ssigpTa->SetBinContent(1790,0.0180908); + ssigpTa->SetBinContent(1791,0.0175248); + ssigpTa->SetBinContent(1792,0.017317); + ssigpTa->SetBinContent(1793,0.0172672); + ssigpTa->SetBinContent(1794,0.017036); + ssigpTa->SetBinContent(1795,0.0170539); + ssigpTa->SetBinContent(1796,0.017317); + ssigpTa->SetBinContent(1797,0.0176294); + ssigpTa->SetBinContent(1798,0.0179438); + ssigpTa->SetBinContent(1799,0.0182632); + ssigpTa->SetBinContent(1800,0.0185868); + ssigpTa->SetBinContent(1801,0.0189129); + ssigpTa->SetBinContent(1802,0.0192415); + ssigpTa->SetBinContent(1803,0.0195748); + ssigpTa->SetBinContent(1804,0.0198688); + ssigpTa->SetBinContent(1805,0.0199436); + ssigpTa->SetBinContent(1806,0.0197885); + ssigpTa->SetBinContent(1807,0.0197604); + ssigpTa->SetBinContent(1808,0.0194747); + ssigpTa->SetBinContent(1809,0.0187413); + ssigpTa->SetBinContent(1810,0.0184984); + ssigpTa->SetBinContent(1811,0.0187373); + ssigpTa->SetBinContent(1812,0.0190782); + ssigpTa->SetBinContent(1813,0.0194231); + ssigpTa->SetBinContent(1814,0.01977); + ssigpTa->SetBinContent(1815,0.0201134); + ssigpTa->SetBinContent(1816,0.0204146); + ssigpTa->SetBinContent(1817,0.0206574); + ssigpTa->SetBinContent(1818,0.0209855); + ssigpTa->SetBinContent(1819,0.0214906); + ssigpTa->SetBinContent(1820,0.0221401); + ssigpTa->SetBinContent(1821,0.02267); + ssigpTa->SetBinContent(1822,0.0229531); + ssigpTa->SetBinContent(1823,0.0226013); + ssigpTa->SetBinContent(1824,0.0216294); + ssigpTa->SetBinContent(1825,0.0212032); + ssigpTa->SetBinContent(1826,0.0213555); + ssigpTa->SetBinContent(1827,0.0216227); + ssigpTa->SetBinContent(1828,0.0218823); + ssigpTa->SetBinContent(1829,0.0221279); + ssigpTa->SetBinContent(1830,0.0221985); + ssigpTa->SetBinContent(1831,0.0214518); + ssigpTa->SetBinContent(1832,0.0198656); + ssigpTa->SetBinContent(1833,0.0191403); + ssigpTa->SetBinContent(1834,0.0192602); + ssigpTa->SetBinContent(1835,0.0195504); + ssigpTa->SetBinContent(1836,0.0199612); + ssigpTa->SetBinContent(1837,0.0209291); + ssigpTa->SetBinContent(1838,0.0224382); + ssigpTa->SetBinContent(1839,0.0234208); + ssigpTa->SetBinContent(1840,0.023864); + ssigpTa->SetBinContent(1841,0.024211); + ssigpTa->SetBinContent(1842,0.024567); + ssigpTa->SetBinContent(1843,0.0249232); + ssigpTa->SetBinContent(1844,0.0252786); + ssigpTa->SetBinContent(1845,0.0255458); + ssigpTa->SetBinContent(1846,0.0253817); + ssigpTa->SetBinContent(1847,0.0247914); + ssigpTa->SetBinContent(1848,0.0246254); + ssigpTa->SetBinContent(1849,0.0250047); + ssigpTa->SetBinContent(1850,0.0260416); + ssigpTa->SetBinContent(1851,0.027648); + ssigpTa->SetBinContent(1852,0.0287274); + ssigpTa->SetBinContent(1853,0.0292659); + ssigpTa->SetBinContent(1854,0.0296957); + ssigpTa->SetBinContent(1855,0.0301238); + ssigpTa->SetBinContent(1856,0.0304539); + ssigpTa->SetBinContent(1857,0.0303039); + ssigpTa->SetBinContent(1858,0.0296829); + ssigpTa->SetBinContent(1859,0.0295328); + ssigpTa->SetBinContent(1860,0.0299953); + ssigpTa->SetBinContent(1861,0.0311852); + ssigpTa->SetBinContent(1862,0.0330054); + ssigpTa->SetBinContent(1863,0.03423); + ssigpTa->SetBinContent(1864,0.0348376); + ssigpTa->SetBinContent(1865,0.0353271); + ssigpTa->SetBinContent(1866,0.0358371); + ssigpTa->SetBinContent(1867,0.0363699); + ssigpTa->SetBinContent(1868,0.0366544); + ssigpTa->SetBinContent(1869,0.0356083); + ssigpTa->SetBinContent(1870,0.0332219); + ssigpTa->SetBinContent(1871,0.0321828); + ssigpTa->SetBinContent(1872,0.0329485); + ssigpTa->SetBinContent(1873,0.0344953); + ssigpTa->SetBinContent(1874,0.0355882); + ssigpTa->SetBinContent(1875,0.0362008); + ssigpTa->SetBinContent(1876,0.0367143); + ssigpTa->SetBinContent(1877,0.0372261); + ssigpTa->SetBinContent(1878,0.0377326); + ssigpTa->SetBinContent(1879,0.0382316); + ssigpTa->SetBinContent(1880,0.0386948); + ssigpTa->SetBinContent(1881,0.0390749); + ssigpTa->SetBinContent(1882,0.0397827); + ssigpTa->SetBinContent(1883,0.0411914); + ssigpTa->SetBinContent(1884,0.0423362); + ssigpTa->SetBinContent(1885,0.0430308); + ssigpTa->SetBinContent(1886,0.0436244); + ssigpTa->SetBinContent(1887,0.0442178); + ssigpTa->SetBinContent(1888,0.0448282); + ssigpTa->SetBinContent(1889,0.0454561); + ssigpTa->SetBinContent(1890,0.0460322); + ssigpTa->SetBinContent(1891,0.046248); + ssigpTa->SetBinContent(1892,0.0461086); + ssigpTa->SetBinContent(1893,0.0463408); + ssigpTa->SetBinContent(1894,0.0468602); + ssigpTa->SetBinContent(1895,0.0473466); + ssigpTa->SetBinContent(1896,0.0479206); + ssigpTa->SetBinContent(1897,0.0485866); + ssigpTa->SetBinContent(1898,0.0492647); + ssigpTa->SetBinContent(1899,0.0499569); + ssigpTa->SetBinContent(1900,0.0506976); + ssigpTa->SetBinContent(1901,0.0514856); + ssigpTa->SetBinContent(1902,0.0522878); + ssigpTa->SetBinContent(1903,0.0530866); + ssigpTa->SetBinContent(1904,0.053879); + ssigpTa->SetBinContent(1905,0.0546557); + ssigpTa->SetBinContent(1906,0.055371); + ssigpTa->SetBinContent(1907,0.0560526); + ssigpTa->SetBinContent(1908,0.0567985); + ssigpTa->SetBinContent(1909,0.0574962); + ssigpTa->SetBinContent(1910,0.0576296); + ssigpTa->SetBinContent(1911,0.0571842); + ssigpTa->SetBinContent(1912,0.0573462); + ssigpTa->SetBinContent(1913,0.0581433); + ssigpTa->SetBinContent(1914,0.0590947); + ssigpTa->SetBinContent(1915,0.0600088); + ssigpTa->SetBinContent(1916,0.0607425); + ssigpTa->SetBinContent(1919,0.0108971); + ssigpTa->SetBinContent(1920,0.0108933); + ssigpTa->SetBinContent(1921,0.010888); + ssigpTa->SetBinContent(1922,0.0108892); + ssigpTa->SetBinContent(1923,0.0108917); + ssigpTa->SetBinContent(1924,0.0108954); + ssigpTa->SetBinContent(1925,0.0108991); + ssigpTa->SetBinContent(1926,0.0109041); + ssigpTa->SetBinContent(1927,0.0109062); + ssigpTa->SetBinContent(1928,0.0109109); + ssigpTa->SetBinContent(1929,0.0109178); + ssigpTa->SetBinContent(1930,0.0109245); + ssigpTa->SetBinContent(1931,0.0109304); + ssigpTa->SetBinContent(1932,0.0109374); + ssigpTa->SetBinContent(1933,0.010945); + ssigpTa->SetBinContent(1934,0.0109533); + ssigpTa->SetBinContent(1935,0.0109597); + ssigpTa->SetBinContent(1936,0.0109689); + ssigpTa->SetBinContent(1937,0.0109793); + ssigpTa->SetBinContent(1938,0.0109909); + ssigpTa->SetBinContent(1939,0.0110022); + ssigpTa->SetBinContent(1940,0.011015); + ssigpTa->SetBinContent(1941,0.0110267); + ssigpTa->SetBinContent(1942,0.01104); + ssigpTa->SetBinContent(1943,0.0110538); + ssigpTa->SetBinContent(1944,0.0110683); + ssigpTa->SetBinContent(1945,0.0110846); + ssigpTa->SetBinContent(1946,0.0110991); + ssigpTa->SetBinContent(1947,0.0111138); + ssigpTa->SetBinContent(1948,0.0111288); + ssigpTa->SetBinContent(1949,0.0111463); + ssigpTa->SetBinContent(1950,0.0111654); + ssigpTa->SetBinContent(1951,0.0111834); + ssigpTa->SetBinContent(1952,0.0112013); + ssigpTa->SetBinContent(1953,0.0112205); + ssigpTa->SetBinContent(1954,0.0112393); + ssigpTa->SetBinContent(1955,0.0112601); + ssigpTa->SetBinContent(1956,0.0112818); + ssigpTa->SetBinContent(1957,0.0113034); + ssigpTa->SetBinContent(1958,0.0113255); + ssigpTa->SetBinContent(1959,0.0113488); + ssigpTa->SetBinContent(1960,0.0113726); + ssigpTa->SetBinContent(1961,0.0113967); + ssigpTa->SetBinContent(1962,0.0114202); + ssigpTa->SetBinContent(1963,0.0114463); + ssigpTa->SetBinContent(1964,0.0114722); + ssigpTa->SetBinContent(1965,0.0114996); + ssigpTa->SetBinContent(1966,0.0115271); + ssigpTa->SetBinContent(1967,0.0115546); + ssigpTa->SetBinContent(1968,0.011583); + ssigpTa->SetBinContent(1969,0.0116114); + ssigpTa->SetBinContent(1970,0.0116417); + ssigpTa->SetBinContent(1971,0.0116709); + ssigpTa->SetBinContent(1972,0.0117022); + ssigpTa->SetBinContent(1973,0.0117322); + ssigpTa->SetBinContent(1974,0.0117654); + ssigpTa->SetBinContent(1975,0.0117976); + ssigpTa->SetBinContent(1976,0.0118301); + ssigpTa->SetBinContent(1977,0.0118626); + ssigpTa->SetBinContent(1978,0.0118973); + ssigpTa->SetBinContent(1979,0.011933); + ssigpTa->SetBinContent(1980,0.0119701); + ssigpTa->SetBinContent(1981,0.0120087); + ssigpTa->SetBinContent(1982,0.0120438); + ssigpTa->SetBinContent(1983,0.0120806); + ssigpTa->SetBinContent(1984,0.0121177); + ssigpTa->SetBinContent(1985,0.0121584); + ssigpTa->SetBinContent(1986,0.012198); + ssigpTa->SetBinContent(1987,0.0122376); + ssigpTa->SetBinContent(1988,0.0122801); + ssigpTa->SetBinContent(1989,0.0123214); + ssigpTa->SetBinContent(1990,0.0123646); + ssigpTa->SetBinContent(1991,0.0124059); + ssigpTa->SetBinContent(1992,0.0124493); + ssigpTa->SetBinContent(1993,0.0124943); + ssigpTa->SetBinContent(1994,0.0125397); + ssigpTa->SetBinContent(1995,0.0125851); + ssigpTa->SetBinContent(1996,0.0126322); + ssigpTa->SetBinContent(1997,0.0126773); + ssigpTa->SetBinContent(1998,0.0127268); + ssigpTa->SetBinContent(1999,0.0127743); + ssigpTa->SetBinContent(2000,0.0128251); + ssigpTa->SetBinContent(2001,0.0128747); + ssigpTa->SetBinContent(2002,0.0129251); + ssigpTa->SetBinContent(2003,0.0129756); + ssigpTa->SetBinContent(2004,0.0130286); + ssigpTa->SetBinContent(2005,0.0130822); + ssigpTa->SetBinContent(2006,0.0131372); + ssigpTa->SetBinContent(2007,0.0131898); + ssigpTa->SetBinContent(2008,0.0132456); + ssigpTa->SetBinContent(2009,0.0133019); + ssigpTa->SetBinContent(2010,0.0133594); + ssigpTa->SetBinContent(2011,0.0134177); + ssigpTa->SetBinContent(2012,0.0134769); + ssigpTa->SetBinContent(2013,0.0135365); + ssigpTa->SetBinContent(2014,0.0135969); + ssigpTa->SetBinContent(2015,0.0136578); + ssigpTa->SetBinContent(2016,0.013721); + ssigpTa->SetBinContent(2017,0.0137856); + ssigpTa->SetBinContent(2018,0.013851); + ssigpTa->SetBinContent(2019,0.0139156); + ssigpTa->SetBinContent(2020,0.0139814); + ssigpTa->SetBinContent(2021,0.0140482); + ssigpTa->SetBinContent(2022,0.0141285); + ssigpTa->SetBinContent(2023,0.0142741); + ssigpTa->SetBinContent(2024,0.0145432); + ssigpTa->SetBinContent(2025,0.0150346); + ssigpTa->SetBinContent(2026,0.015756); + ssigpTa->SetBinContent(2027,0.0161727); + ssigpTa->SetBinContent(2028,0.0163038); + ssigpTa->SetBinContent(2029,0.0163802); + ssigpTa->SetBinContent(2030,0.0164586); + ssigpTa->SetBinContent(2031,0.016539); + ssigpTa->SetBinContent(2032,0.0166222); + ssigpTa->SetBinContent(2033,0.0167071); + ssigpTa->SetBinContent(2034,0.0167905); + ssigpTa->SetBinContent(2035,0.0168331); + ssigpTa->SetBinContent(2036,0.0166674); + ssigpTa->SetBinContent(2037,0.0162774); + ssigpTa->SetBinContent(2038,0.0161242); + ssigpTa->SetBinContent(2039,0.0162573); + ssigpTa->SetBinContent(2040,0.0164844); + ssigpTa->SetBinContent(2041,0.0167179); + ssigpTa->SetBinContent(2042,0.016953); + ssigpTa->SetBinContent(2043,0.0171879); + ssigpTa->SetBinContent(2044,0.0173744); + ssigpTa->SetBinContent(2045,0.0173053); + ssigpTa->SetBinContent(2046,0.0169489); + ssigpTa->SetBinContent(2047,0.0166912); + ssigpTa->SetBinContent(2048,0.0165206); + ssigpTa->SetBinContent(2049,0.016597); + ssigpTa->SetBinContent(2050,0.0168583); + ssigpTa->SetBinContent(2051,0.0171585); + ssigpTa->SetBinContent(2052,0.0174592); + ssigpTa->SetBinContent(2053,0.017761); + ssigpTa->SetBinContent(2054,0.0180624); + ssigpTa->SetBinContent(2055,0.0182921); + ssigpTa->SetBinContent(2056,0.0181731); + ssigpTa->SetBinContent(2057,0.0177084); + ssigpTa->SetBinContent(2058,0.0176014); + ssigpTa->SetBinContent(2059,0.0178462); + ssigpTa->SetBinContent(2060,0.0181652); + ssigpTa->SetBinContent(2061,0.0184869); + ssigpTa->SetBinContent(2062,0.0188067); + ssigpTa->SetBinContent(2063,0.0190457); + ssigpTa->SetBinContent(2064,0.0188942); + ssigpTa->SetBinContent(2065,0.0183622); + ssigpTa->SetBinContent(2066,0.0181698); + ssigpTa->SetBinContent(2067,0.0180698); + ssigpTa->SetBinContent(2068,0.0177385); + ssigpTa->SetBinContent(2069,0.0177082); + ssigpTa->SetBinContent(2070,0.0179832); + ssigpTa->SetBinContent(2071,0.0183181); + ssigpTa->SetBinContent(2072,0.0186592); + ssigpTa->SetBinContent(2073,0.0190023); + ssigpTa->SetBinContent(2074,0.019353); + ssigpTa->SetBinContent(2075,0.0197059); + ssigpTa->SetBinContent(2076,0.0200626); + ssigpTa->SetBinContent(2077,0.0204234); + ssigpTa->SetBinContent(2078,0.0207362); + ssigpTa->SetBinContent(2079,0.0207847); + ssigpTa->SetBinContent(2080,0.0205553); + ssigpTa->SetBinContent(2081,0.0204889); + ssigpTa->SetBinContent(2082,0.0201466); + ssigpTa->SetBinContent(2083,0.0193246); + ssigpTa->SetBinContent(2084,0.0190281); + ssigpTa->SetBinContent(2085,0.0192756); + ssigpTa->SetBinContent(2086,0.0196343); + ssigpTa->SetBinContent(2087,0.0200011); + ssigpTa->SetBinContent(2088,0.0203682); + ssigpTa->SetBinContent(2089,0.0207266); + ssigpTa->SetBinContent(2090,0.020999); + ssigpTa->SetBinContent(2091,0.0211765); + ssigpTa->SetBinContent(2092,0.0214816); + ssigpTa->SetBinContent(2093,0.022044); + ssigpTa->SetBinContent(2094,0.0227832); + ssigpTa->SetBinContent(2095,0.023381); + ssigpTa->SetBinContent(2096,0.0237148); + ssigpTa->SetBinContent(2097,0.0234707); + ssigpTa->SetBinContent(2098,0.0226631); + ssigpTa->SetBinContent(2099,0.022351); + ssigpTa->SetBinContent(2100,0.0225545); + ssigpTa->SetBinContent(2101,0.0228645); + ssigpTa->SetBinContent(2102,0.0231685); + ssigpTa->SetBinContent(2103,0.0234652); + ssigpTa->SetBinContent(2104,0.0235513); + ssigpTa->SetBinContent(2105,0.022677); + ssigpTa->SetBinContent(2106,0.0208411); + ssigpTa->SetBinContent(2107,0.0199656); + ssigpTa->SetBinContent(2108,0.0200714); + ssigpTa->SetBinContent(2109,0.0203814); + ssigpTa->SetBinContent(2110,0.0208009); + ssigpTa->SetBinContent(2111,0.021701); + ssigpTa->SetBinContent(2112,0.0230838); + ssigpTa->SetBinContent(2113,0.023994); + ssigpTa->SetBinContent(2114,0.0244365); + ssigpTa->SetBinContent(2115,0.0247964); + ssigpTa->SetBinContent(2116,0.0251649); + ssigpTa->SetBinContent(2117,0.0255356); + ssigpTa->SetBinContent(2118,0.025908); + ssigpTa->SetBinContent(2119,0.0261988); + ssigpTa->SetBinContent(2120,0.0260903); + ssigpTa->SetBinContent(2121,0.0255898); + ssigpTa->SetBinContent(2122,0.0254857); + ssigpTa->SetBinContent(2123,0.0258954); + ssigpTa->SetBinContent(2124,0.026921); + ssigpTa->SetBinContent(2125,0.0284812); + ssigpTa->SetBinContent(2126,0.0295424); + ssigpTa->SetBinContent(2127,0.030095); + ssigpTa->SetBinContent(2128,0.0305447); + ssigpTa->SetBinContent(2129,0.0309966); + ssigpTa->SetBinContent(2130,0.0313644); + ssigpTa->SetBinContent(2131,0.0313179); + ssigpTa->SetBinContent(2132,0.0308601); + ssigpTa->SetBinContent(2133,0.0308218); + ssigpTa->SetBinContent(2134,0.0313326); + ssigpTa->SetBinContent(2135,0.0325148); + ssigpTa->SetBinContent(2136,0.0342785); + ssigpTa->SetBinContent(2137,0.0354862); + ssigpTa->SetBinContent(2138,0.0361217); + ssigpTa->SetBinContent(2139,0.0366499); + ssigpTa->SetBinContent(2140,0.0372001); + ssigpTa->SetBinContent(2141,0.0377714); + ssigpTa->SetBinContent(2142,0.0381105); + ssigpTa->SetBinContent(2143,0.0372141); + ssigpTa->SetBinContent(2144,0.0350542); + ssigpTa->SetBinContent(2145,0.0341724); + ssigpTa->SetBinContent(2146,0.035016); + ssigpTa->SetBinContent(2147,0.036639); + ssigpTa->SetBinContent(2148,0.0377908); + ssigpTa->SetBinContent(2149,0.0384414); + ssigpTa->SetBinContent(2150,0.0389862); + ssigpTa->SetBinContent(2151,0.0395276); + ssigpTa->SetBinContent(2152,0.0400685); + ssigpTa->SetBinContent(2153,0.040603); + ssigpTa->SetBinContent(2154,0.0411051); + ssigpTa->SetBinContent(2155,0.0415438); + ssigpTa->SetBinContent(2156,0.0423129); + ssigpTa->SetBinContent(2157,0.0437726); + ssigpTa->SetBinContent(2158,0.044953); + ssigpTa->SetBinContent(2159,0.0456922); + ssigpTa->SetBinContent(2160,0.0463289); + ssigpTa->SetBinContent(2161,0.04697); + ssigpTa->SetBinContent(2162,0.0476206); + ssigpTa->SetBinContent(2163,0.0482878); + ssigpTa->SetBinContent(2164,0.0489076); + ssigpTa->SetBinContent(2165,0.0492266); + ssigpTa->SetBinContent(2166,0.04922); + ssigpTa->SetBinContent(2167,0.0495405); + ssigpTa->SetBinContent(2168,0.0500814); + ssigpTa->SetBinContent(2169,0.0505789); + ssigpTa->SetBinContent(2170,0.0511818); + ssigpTa->SetBinContent(2171,0.0518907); + ssigpTa->SetBinContent(2172,0.0526206); + ssigpTa->SetBinContent(2173,0.0533709); + ssigpTa->SetBinContent(2174,0.0541796); + ssigpTa->SetBinContent(2175,0.0550343); + ssigpTa->SetBinContent(2176,0.0559001); + ssigpTa->SetBinContent(2177,0.0567602); + ssigpTa->SetBinContent(2178,0.0576226); + ssigpTa->SetBinContent(2179,0.0584811); + ssigpTa->SetBinContent(2180,0.0593225); + ssigpTa->SetBinContent(2181,0.0601538); + ssigpTa->SetBinContent(2182,0.0610155); + ssigpTa->SetBinContent(2183,0.0617923); + ssigpTa->SetBinContent(2184,0.062061); + ssigpTa->SetBinContent(2185,0.0618306); + ssigpTa->SetBinContent(2186,0.0621661); + ssigpTa->SetBinContent(2187,0.0630838); + ssigpTa->SetBinContent(2188,0.0641381); + ssigpTa->SetBinContent(2189,0.0652258); + ssigpTa->SetBinContent(2190,0.0659904); + ssigpTa->SetBinContent(2193,0.0116664); + ssigpTa->SetBinContent(2194,0.011659); + ssigpTa->SetBinContent(2195,0.0116574); + ssigpTa->SetBinContent(2196,0.0116582); + ssigpTa->SetBinContent(2197,0.01166); + ssigpTa->SetBinContent(2198,0.0116624); + ssigpTa->SetBinContent(2199,0.0116674); + ssigpTa->SetBinContent(2200,0.01167); + ssigpTa->SetBinContent(2201,0.0116726); + ssigpTa->SetBinContent(2202,0.0116774); + ssigpTa->SetBinContent(2203,0.0116858); + ssigpTa->SetBinContent(2204,0.011694); + ssigpTa->SetBinContent(2205,0.0116982); + ssigpTa->SetBinContent(2206,0.0117042); + ssigpTa->SetBinContent(2207,0.0117116); + ssigpTa->SetBinContent(2208,0.0117184); + ssigpTa->SetBinContent(2209,0.0117274); + ssigpTa->SetBinContent(2210,0.0117366); + ssigpTa->SetBinContent(2211,0.0117474); + ssigpTa->SetBinContent(2212,0.0117568); + ssigpTa->SetBinContent(2213,0.0117684); + ssigpTa->SetBinContent(2214,0.01178); + ssigpTa->SetBinContent(2215,0.0117942); + ssigpTa->SetBinContent(2216,0.0118066); + ssigpTa->SetBinContent(2217,0.0118216); + ssigpTa->SetBinContent(2218,0.0118358); + ssigpTa->SetBinContent(2219,0.0118516); + ssigpTa->SetBinContent(2220,0.0118674); + ssigpTa->SetBinContent(2221,0.0118808); + ssigpTa->SetBinContent(2222,0.011895); + ssigpTa->SetBinContent(2223,0.011914); + ssigpTa->SetBinContent(2224,0.0119308); + ssigpTa->SetBinContent(2225,0.0119508); + ssigpTa->SetBinContent(2226,0.011969); + ssigpTa->SetBinContent(2227,0.011989); + ssigpTa->SetBinContent(2228,0.0120082); + ssigpTa->SetBinContent(2229,0.012029); + ssigpTa->SetBinContent(2230,0.012049); + ssigpTa->SetBinContent(2231,0.0120708); + ssigpTa->SetBinContent(2232,0.0120916); + ssigpTa->SetBinContent(2233,0.0121166); + ssigpTa->SetBinContent(2234,0.0121406); + ssigpTa->SetBinContent(2235,0.012164); + ssigpTa->SetBinContent(2236,0.0121866); + ssigpTa->SetBinContent(2237,0.0122124); + ssigpTa->SetBinContent(2238,0.0122414); + ssigpTa->SetBinContent(2239,0.0122674); + ssigpTa->SetBinContent(2240,0.0122956); + ssigpTa->SetBinContent(2241,0.0123254); + ssigpTa->SetBinContent(2242,0.0123522); + ssigpTa->SetBinContent(2243,0.012383); + ssigpTa->SetBinContent(2244,0.0124122); + ssigpTa->SetBinContent(2245,0.0124422); + ssigpTa->SetBinContent(2246,0.0124714); + ssigpTa->SetBinContent(2247,0.0125038); + ssigpTa->SetBinContent(2248,0.0125346); + ssigpTa->SetBinContent(2249,0.0125664); + ssigpTa->SetBinContent(2250,0.0125988); + ssigpTa->SetBinContent(2251,0.0126306); + ssigpTa->SetBinContent(2252,0.0126648); + ssigpTa->SetBinContent(2253,0.0127006); + ssigpTa->SetBinContent(2254,0.0127396); + ssigpTa->SetBinContent(2255,0.0127762); + ssigpTa->SetBinContent(2256,0.0128138); + ssigpTa->SetBinContent(2257,0.0128464); + ssigpTa->SetBinContent(2258,0.0128848); + ssigpTa->SetBinContent(2259,0.012924); + ssigpTa->SetBinContent(2260,0.012964); + ssigpTa->SetBinContent(2261,0.0130048); + ssigpTa->SetBinContent(2262,0.0130464); + ssigpTa->SetBinContent(2263,0.0130928); + ssigpTa->SetBinContent(2264,0.0131344); + ssigpTa->SetBinContent(2265,0.0131762); + ssigpTa->SetBinContent(2266,0.013218); + ssigpTa->SetBinContent(2267,0.0132614); + ssigpTa->SetBinContent(2268,0.0133086); + ssigpTa->SetBinContent(2269,0.0133554); + ssigpTa->SetBinContent(2270,0.0134028); + ssigpTa->SetBinContent(2271,0.0134518); + ssigpTa->SetBinContent(2272,0.013497); + ssigpTa->SetBinContent(2273,0.0135476); + ssigpTa->SetBinContent(2274,0.013596); + ssigpTa->SetBinContent(2275,0.0136484); + ssigpTa->SetBinContent(2276,0.0136968); + ssigpTa->SetBinContent(2277,0.0137478); + ssigpTa->SetBinContent(2278,0.0138002); + ssigpTa->SetBinContent(2279,0.0138576); + ssigpTa->SetBinContent(2280,0.0139108); + ssigpTa->SetBinContent(2281,0.0139642); + ssigpTa->SetBinContent(2282,0.0140176); + ssigpTa->SetBinContent(2283,0.0140744); + ssigpTa->SetBinContent(2284,0.0141334); + ssigpTa->SetBinContent(2285,0.0141918); + ssigpTa->SetBinContent(2286,0.0142508); + ssigpTa->SetBinContent(2287,0.0143116); + ssigpTa->SetBinContent(2288,0.0143708); + ssigpTa->SetBinContent(2289,0.0144326); + ssigpTa->SetBinContent(2290,0.0144958); + ssigpTa->SetBinContent(2291,0.0145624); + ssigpTa->SetBinContent(2292,0.014629); + ssigpTa->SetBinContent(2293,0.014694); + ssigpTa->SetBinContent(2294,0.0147606); + ssigpTa->SetBinContent(2295,0.014828); + ssigpTa->SetBinContent(2296,0.0149044); + ssigpTa->SetBinContent(2297,0.01504); + ssigpTa->SetBinContent(2298,0.0152968); + ssigpTa->SetBinContent(2299,0.0158454); + ssigpTa->SetBinContent(2300,0.0166952); + ssigpTa->SetBinContent(2301,0.0171798); + ssigpTa->SetBinContent(2302,0.0173196); + ssigpTa->SetBinContent(2303,0.0173948); + ssigpTa->SetBinContent(2304,0.0174732); + ssigpTa->SetBinContent(2305,0.017554); + ssigpTa->SetBinContent(2306,0.0176388); + ssigpTa->SetBinContent(2307,0.0177238); + ssigpTa->SetBinContent(2308,0.0178064); + ssigpTa->SetBinContent(2309,0.0178402); + ssigpTa->SetBinContent(2310,0.0176236); + ssigpTa->SetBinContent(2311,0.0171528); + ssigpTa->SetBinContent(2312,0.0169756); + ssigpTa->SetBinContent(2313,0.0171316); + ssigpTa->SetBinContent(2314,0.0173774); + ssigpTa->SetBinContent(2315,0.0176326); + ssigpTa->SetBinContent(2316,0.0178856); + ssigpTa->SetBinContent(2317,0.0181432); + ssigpTa->SetBinContent(2318,0.0183448); + ssigpTa->SetBinContent(2319,0.018264); + ssigpTa->SetBinContent(2320,0.0178714); + ssigpTa->SetBinContent(2321,0.0176596); + ssigpTa->SetBinContent(2322,0.0176128); + ssigpTa->SetBinContent(2323,0.0177594); + ssigpTa->SetBinContent(2324,0.018039); + ssigpTa->SetBinContent(2325,0.0183378); + ssigpTa->SetBinContent(2326,0.0186398); + ssigpTa->SetBinContent(2327,0.018942); + ssigpTa->SetBinContent(2328,0.0192458); + ssigpTa->SetBinContent(2329,0.0194728); + ssigpTa->SetBinContent(2330,0.0193174); + ssigpTa->SetBinContent(2331,0.01878); + ssigpTa->SetBinContent(2332,0.0186448); + ssigpTa->SetBinContent(2333,0.018897); + ssigpTa->SetBinContent(2334,0.0192262); + ssigpTa->SetBinContent(2335,0.019557); + ssigpTa->SetBinContent(2336,0.01989); + ssigpTa->SetBinContent(2337,0.0201466); + ssigpTa->SetBinContent(2338,0.0200456); + ssigpTa->SetBinContent(2339,0.0195956); + ssigpTa->SetBinContent(2340,0.0194406); + ssigpTa->SetBinContent(2341,0.0192786); + ssigpTa->SetBinContent(2342,0.0188018); + ssigpTa->SetBinContent(2343,0.0187082); + ssigpTa->SetBinContent(2344,0.0189916); + ssigpTa->SetBinContent(2345,0.019359); + ssigpTa->SetBinContent(2346,0.0197282); + ssigpTa->SetBinContent(2347,0.0201054); + ssigpTa->SetBinContent(2348,0.0204856); + ssigpTa->SetBinContent(2349,0.0208726); + ssigpTa->SetBinContent(2350,0.0212616); + ssigpTa->SetBinContent(2351,0.021654); + ssigpTa->SetBinContent(2352,0.0219888); + ssigpTa->SetBinContent(2353,0.0220006); + ssigpTa->SetBinContent(2354,0.0216828); + ssigpTa->SetBinContent(2355,0.0215594); + ssigpTa->SetBinContent(2356,0.021165); + ssigpTa->SetBinContent(2357,0.0202292); + ssigpTa->SetBinContent(2358,0.0198858); + ssigpTa->SetBinContent(2359,0.020138); + ssigpTa->SetBinContent(2360,0.0205292); + ssigpTa->SetBinContent(2361,0.020926); + ssigpTa->SetBinContent(2362,0.0213276); + ssigpTa->SetBinContent(2363,0.0217022); + ssigpTa->SetBinContent(2364,0.021931); + ssigpTa->SetBinContent(2365,0.021992); + ssigpTa->SetBinContent(2366,0.0222564); + ssigpTa->SetBinContent(2367,0.0228498); + ssigpTa->SetBinContent(2368,0.0236594); + ssigpTa->SetBinContent(2369,0.0243082); + ssigpTa->SetBinContent(2370,0.0246996); + ssigpTa->SetBinContent(2371,0.0245866); + ssigpTa->SetBinContent(2372,0.0239878); + ssigpTa->SetBinContent(2373,0.0238174); + ssigpTa->SetBinContent(2374,0.0240994); + ssigpTa->SetBinContent(2375,0.0244666); + ssigpTa->SetBinContent(2376,0.0248332); + ssigpTa->SetBinContent(2377,0.0251722); + ssigpTa->SetBinContent(2378,0.025254); + ssigpTa->SetBinContent(2379,0.0242768); + ssigpTa->SetBinContent(2380,0.0222334); + ssigpTa->SetBinContent(2381,0.0212494); + ssigpTa->SetBinContent(2382,0.0213502); + ssigpTa->SetBinContent(2383,0.021688); + ssigpTa->SetBinContent(2384,0.0221104); + ssigpTa->SetBinContent(2385,0.0229338); + ssigpTa->SetBinContent(2386,0.0241476); + ssigpTa->SetBinContent(2387,0.0249774); + ssigpTa->SetBinContent(2388,0.0254222); + ssigpTa->SetBinContent(2389,0.0258028); + ssigpTa->SetBinContent(2390,0.0261954); + ssigpTa->SetBinContent(2391,0.0265912); + ssigpTa->SetBinContent(2392,0.0269902); + ssigpTa->SetBinContent(2393,0.027321); + ssigpTa->SetBinContent(2394,0.0273024); + ssigpTa->SetBinContent(2395,0.02694); + ssigpTa->SetBinContent(2396,0.0269348); + ssigpTa->SetBinContent(2397,0.0273798); + ssigpTa->SetBinContent(2398,0.028372); + ssigpTa->SetBinContent(2399,0.0298316); + ssigpTa->SetBinContent(2400,0.0308522); + ssigpTa->SetBinContent(2401,0.0314272); + ssigpTa->SetBinContent(2402,0.0319146); + ssigpTa->SetBinContent(2403,0.0324044); + ssigpTa->SetBinContent(2404,0.0328326); + ssigpTa->SetBinContent(2405,0.0329182); + ssigpTa->SetBinContent(2406,0.0326692); + ssigpTa->SetBinContent(2407,0.0327766); + ssigpTa->SetBinContent(2408,0.0333478); + ssigpTa->SetBinContent(2409,0.0345038); + ssigpTa->SetBinContent(2410,0.0361618); + ssigpTa->SetBinContent(2411,0.037333); + ssigpTa->SetBinContent(2412,0.038007); + ssigpTa->SetBinContent(2413,0.0385956); + ssigpTa->SetBinContent(2414,0.039208); + ssigpTa->SetBinContent(2415,0.039845); + ssigpTa->SetBinContent(2416,0.0402656); + ssigpTa->SetBinContent(2417,0.0395548); + ssigpTa->SetBinContent(2418,0.0376854); + ssigpTa->SetBinContent(2419,0.0369888); + ssigpTa->SetBinContent(2420,0.0379014); + ssigpTa->SetBinContent(2421,0.0395478); + ssigpTa->SetBinContent(2422,0.040745); + ssigpTa->SetBinContent(2423,0.041459); + ssigpTa->SetBinContent(2424,0.0420656); + ssigpTa->SetBinContent(2425,0.0426768); + ssigpTa->SetBinContent(2426,0.0432858); + ssigpTa->SetBinContent(2427,0.0438984); + ssigpTa->SetBinContent(2428,0.044474); + ssigpTa->SetBinContent(2429,0.0450024); + ssigpTa->SetBinContent(2430,0.0458558); + ssigpTa->SetBinContent(2431,0.0473592); + ssigpTa->SetBinContent(2432,0.0486012); + ssigpTa->SetBinContent(2433,0.049422); + ssigpTa->SetBinContent(2434,0.0501472); + ssigpTa->SetBinContent(2435,0.0508764); + ssigpTa->SetBinContent(2436,0.0516162); + ssigpTa->SetBinContent(2437,0.052366); + ssigpTa->SetBinContent(2438,0.0530908); + ssigpTa->SetBinContent(2439,0.053553); + ssigpTa->SetBinContent(2440,0.0537458); + ssigpTa->SetBinContent(2441,0.0542108); + ssigpTa->SetBinContent(2442,0.0548582); + ssigpTa->SetBinContent(2443,0.0554518); + ssigpTa->SetBinContent(2444,0.056162); + ssigpTa->SetBinContent(2445,0.0569918); + ssigpTa->SetBinContent(2446,0.057844); + ssigpTa->SetBinContent(2447,0.0587302); + ssigpTa->SetBinContent(2448,0.059685); + ssigpTa->SetBinContent(2449,0.0606904); + ssigpTa->SetBinContent(2450,0.0617086); + ssigpTa->SetBinContent(2451,0.0627248); + ssigpTa->SetBinContent(2452,0.0637472); + ssigpTa->SetBinContent(2453,0.0647936); + ssigpTa->SetBinContent(2454,0.0658844); + ssigpTa->SetBinContent(2455,0.0670358); + ssigpTa->SetBinContent(2456,0.0681522); + ssigpTa->SetBinContent(2457,0.0691648); + ssigpTa->SetBinContent(2458,0.0697766); + ssigpTa->SetBinContent(2459,0.070027); + ssigpTa->SetBinContent(2460,0.0707496); + ssigpTa->SetBinContent(2461,0.0719462); + ssigpTa->SetBinContent(2462,0.0732532); + ssigpTa->SetBinContent(2463,0.0745431); + ssigpTa->SetBinContent(2464,0.0755447); + ssigpTa->SetBinContent(2467,0.0125972); + ssigpTa->SetBinContent(2468,0.0125946); + ssigpTa->SetBinContent(2469,0.0125924); + ssigpTa->SetBinContent(2470,0.0125924); + ssigpTa->SetBinContent(2471,0.0125928); + ssigpTa->SetBinContent(2472,0.0125944); + ssigpTa->SetBinContent(2473,0.012596); + ssigpTa->SetBinContent(2474,0.012598); + ssigpTa->SetBinContent(2475,0.0125992); + ssigpTa->SetBinContent(2476,0.0126032); + ssigpTa->SetBinContent(2477,0.0126164); + ssigpTa->SetBinContent(2478,0.012624); + ssigpTa->SetBinContent(2479,0.01263); + ssigpTa->SetBinContent(2480,0.0126332); + ssigpTa->SetBinContent(2481,0.0126376); + ssigpTa->SetBinContent(2482,0.0126456); + ssigpTa->SetBinContent(2483,0.012654); + ssigpTa->SetBinContent(2484,0.0126664); + ssigpTa->SetBinContent(2485,0.0126776); + ssigpTa->SetBinContent(2486,0.0126848); + ssigpTa->SetBinContent(2487,0.012694); + ssigpTa->SetBinContent(2488,0.012708); + ssigpTa->SetBinContent(2489,0.0127216); + ssigpTa->SetBinContent(2490,0.0127368); + ssigpTa->SetBinContent(2491,0.0127488); + ssigpTa->SetBinContent(2492,0.012764); + ssigpTa->SetBinContent(2493,0.0127796); + ssigpTa->SetBinContent(2494,0.0127948); + ssigpTa->SetBinContent(2495,0.0128068); + ssigpTa->SetBinContent(2496,0.012822); + ssigpTa->SetBinContent(2497,0.0128376); + ssigpTa->SetBinContent(2498,0.012858); + ssigpTa->SetBinContent(2499,0.0128728); + ssigpTa->SetBinContent(2500,0.012896); + ssigpTa->SetBinContent(2501,0.0129144); + ssigpTa->SetBinContent(2502,0.0129336); + ssigpTa->SetBinContent(2503,0.012954); + ssigpTa->SetBinContent(2504,0.0129756); + ssigpTa->SetBinContent(2505,0.012994); + ssigpTa->SetBinContent(2506,0.0130168); + ssigpTa->SetBinContent(2507,0.013038); + ssigpTa->SetBinContent(2508,0.0130644); + ssigpTa->SetBinContent(2509,0.0130824); + ssigpTa->SetBinContent(2510,0.0131072); + ssigpTa->SetBinContent(2511,0.0131332); + ssigpTa->SetBinContent(2512,0.013162); + ssigpTa->SetBinContent(2513,0.0131892); + ssigpTa->SetBinContent(2514,0.0132184); + ssigpTa->SetBinContent(2515,0.0132456); + ssigpTa->SetBinContent(2516,0.013276); + ssigpTa->SetBinContent(2517,0.0133032); + ssigpTa->SetBinContent(2518,0.013334); + ssigpTa->SetBinContent(2519,0.0133612); + ssigpTa->SetBinContent(2520,0.013392); + ssigpTa->SetBinContent(2521,0.0134224); + ssigpTa->SetBinContent(2522,0.0134536); + ssigpTa->SetBinContent(2523,0.0134844); + ssigpTa->SetBinContent(2524,0.0135132); + ssigpTa->SetBinContent(2525,0.0135472); + ssigpTa->SetBinContent(2526,0.0135796); + ssigpTa->SetBinContent(2527,0.0136164); + ssigpTa->SetBinContent(2528,0.0136516); + ssigpTa->SetBinContent(2529,0.0136884); + ssigpTa->SetBinContent(2530,0.0137216); + ssigpTa->SetBinContent(2531,0.0137584); + ssigpTa->SetBinContent(2532,0.0137932); + ssigpTa->SetBinContent(2533,0.0138352); + ssigpTa->SetBinContent(2534,0.0138748); + ssigpTa->SetBinContent(2535,0.0139144); + ssigpTa->SetBinContent(2536,0.0139572); + ssigpTa->SetBinContent(2537,0.0139996); + ssigpTa->SetBinContent(2538,0.0140444); + ssigpTa->SetBinContent(2539,0.014084); + ssigpTa->SetBinContent(2540,0.014124); + ssigpTa->SetBinContent(2541,0.0141668); + ssigpTa->SetBinContent(2542,0.0142108); + ssigpTa->SetBinContent(2543,0.0142612); + ssigpTa->SetBinContent(2544,0.014312); + ssigpTa->SetBinContent(2545,0.0143588); + ssigpTa->SetBinContent(2546,0.0144068); + ssigpTa->SetBinContent(2547,0.0144508); + ssigpTa->SetBinContent(2548,0.0145032); + ssigpTa->SetBinContent(2549,0.014554); + ssigpTa->SetBinContent(2550,0.014604); + ssigpTa->SetBinContent(2551,0.0146528); + ssigpTa->SetBinContent(2552,0.0147076); + ssigpTa->SetBinContent(2553,0.0147628); + ssigpTa->SetBinContent(2554,0.014818); + ssigpTa->SetBinContent(2555,0.014868); + ssigpTa->SetBinContent(2556,0.014922); + ssigpTa->SetBinContent(2557,0.0149804); + ssigpTa->SetBinContent(2558,0.015038); + ssigpTa->SetBinContent(2559,0.015096); + ssigpTa->SetBinContent(2560,0.015154); + ssigpTa->SetBinContent(2561,0.015212); + ssigpTa->SetBinContent(2562,0.0152752); + ssigpTa->SetBinContent(2563,0.0153364); + ssigpTa->SetBinContent(2564,0.0154004); + ssigpTa->SetBinContent(2565,0.015466); + ssigpTa->SetBinContent(2566,0.0155316); + ssigpTa->SetBinContent(2567,0.0155988); + ssigpTa->SetBinContent(2568,0.0156644); + ssigpTa->SetBinContent(2569,0.01573); + ssigpTa->SetBinContent(2570,0.0158104); + ssigpTa->SetBinContent(2571,0.0159332); + ssigpTa->SetBinContent(2572,0.0161932); + ssigpTa->SetBinContent(2573,0.016836); + ssigpTa->SetBinContent(2574,0.0178656); + ssigpTa->SetBinContent(2575,0.0184488); + ssigpTa->SetBinContent(2576,0.0186036); + ssigpTa->SetBinContent(2577,0.0186768); + ssigpTa->SetBinContent(2578,0.0187548); + ssigpTa->SetBinContent(2579,0.0188356); + ssigpTa->SetBinContent(2580,0.01892); + ssigpTa->SetBinContent(2581,0.0190028); + ssigpTa->SetBinContent(2582,0.0190836); + ssigpTa->SetBinContent(2583,0.0191052); + ssigpTa->SetBinContent(2584,0.0188136); + ssigpTa->SetBinContent(2585,0.0182172); + ssigpTa->SetBinContent(2586,0.0180028); + ssigpTa->SetBinContent(2587,0.0181788); + ssigpTa->SetBinContent(2588,0.0184604); + ssigpTa->SetBinContent(2589,0.018742); + ssigpTa->SetBinContent(2590,0.0190304); + ssigpTa->SetBinContent(2591,0.0193188); + ssigpTa->SetBinContent(2592,0.019544); + ssigpTa->SetBinContent(2593,0.0194276); + ssigpTa->SetBinContent(2594,0.0189468); + ssigpTa->SetBinContent(2595,0.018728); + ssigpTa->SetBinContent(2596,0.0187508); + ssigpTa->SetBinContent(2597,0.0189528); + ssigpTa->SetBinContent(2598,0.01925); + ssigpTa->SetBinContent(2599,0.0195704); + ssigpTa->SetBinContent(2600,0.0198928); + ssigpTa->SetBinContent(2601,0.0202156); + ssigpTa->SetBinContent(2602,0.0205424); + ssigpTa->SetBinContent(2603,0.0207844); + ssigpTa->SetBinContent(2604,0.0205916); + ssigpTa->SetBinContent(2605,0.0199636); + ssigpTa->SetBinContent(2606,0.0197888); + ssigpTa->SetBinContent(2607,0.0200504); + ssigpTa->SetBinContent(2608,0.0203928); + ssigpTa->SetBinContent(2609,0.0207444); + ssigpTa->SetBinContent(2610,0.0210912); + ssigpTa->SetBinContent(2611,0.021382); + ssigpTa->SetBinContent(2612,0.0213468); + ssigpTa->SetBinContent(2613,0.0210064); + ssigpTa->SetBinContent(2614,0.0209056); + ssigpTa->SetBinContent(2615,0.0206732); + ssigpTa->SetBinContent(2616,0.020034); + ssigpTa->SetBinContent(2617,0.0198608); + ssigpTa->SetBinContent(2618,0.0201584); + ssigpTa->SetBinContent(2619,0.0205528); + ssigpTa->SetBinContent(2620,0.0209552); + ssigpTa->SetBinContent(2621,0.0213616); + ssigpTa->SetBinContent(2622,0.0217744); + ssigpTa->SetBinContent(2623,0.0221936); + ssigpTa->SetBinContent(2624,0.0226156); + ssigpTa->SetBinContent(2625,0.0230424); + ssigpTa->SetBinContent(2626,0.0233956); + ssigpTa->SetBinContent(2627,0.0233652); + ssigpTa->SetBinContent(2628,0.022926); + ssigpTa->SetBinContent(2629,0.0227556); + ssigpTa->SetBinContent(2630,0.0223308); + ssigpTa->SetBinContent(2631,0.0213608); + ssigpTa->SetBinContent(2632,0.0209964); + ssigpTa->SetBinContent(2633,0.0212784); + ssigpTa->SetBinContent(2634,0.0217004); + ssigpTa->SetBinContent(2635,0.0221348); + ssigpTa->SetBinContent(2636,0.0225712); + ssigpTa->SetBinContent(2637,0.0229692); + ssigpTa->SetBinContent(2638,0.0231256); + ssigpTa->SetBinContent(2639,0.02304); + ssigpTa->SetBinContent(2640,0.0232252); + ssigpTa->SetBinContent(2641,0.0238356); + ssigpTa->SetBinContent(2642,0.0246684); + ssigpTa->SetBinContent(2643,0.0253488); + ssigpTa->SetBinContent(2644,0.025784); + ssigpTa->SetBinContent(2645,0.0257872); + ssigpTa->SetBinContent(2646,0.0253692); + ssigpTa->SetBinContent(2647,0.0253332); + ssigpTa->SetBinContent(2648,0.0256832); + ssigpTa->SetBinContent(2649,0.0261172); + ssigpTa->SetBinContent(2650,0.026536); + ssigpTa->SetBinContent(2651,0.0268932); + ssigpTa->SetBinContent(2652,0.026942); + ssigpTa->SetBinContent(2653,0.0259232); + ssigpTa->SetBinContent(2654,0.023834); + ssigpTa->SetBinContent(2655,0.0228348); + ssigpTa->SetBinContent(2656,0.0229668); + ssigpTa->SetBinContent(2657,0.0233372); + ssigpTa->SetBinContent(2658,0.023778); + ssigpTa->SetBinContent(2659,0.0245236); + ssigpTa->SetBinContent(2660,0.0255852); + ssigpTa->SetBinContent(2661,0.0263436); + ssigpTa->SetBinContent(2662,0.026804); + ssigpTa->SetBinContent(2663,0.0272196); + ssigpTa->SetBinContent(2664,0.027646); + ssigpTa->SetBinContent(2665,0.0280792); + ssigpTa->SetBinContent(2666,0.0285176); + ssigpTa->SetBinContent(2667,0.0289008); + ssigpTa->SetBinContent(2668,0.0289976); + ssigpTa->SetBinContent(2669,0.0288168); + ssigpTa->SetBinContent(2670,0.0289336); + ssigpTa->SetBinContent(2671,0.0294304); + ssigpTa->SetBinContent(2672,0.0303736); + ssigpTa->SetBinContent(2673,0.0317056); + ssigpTa->SetBinContent(2674,0.0326796); + ssigpTa->SetBinContent(2675,0.0332912); + ssigpTa->SetBinContent(2676,0.0338336); + ssigpTa->SetBinContent(2677,0.034382); + ssigpTa->SetBinContent(2678,0.0348844); + ssigpTa->SetBinContent(2679,0.0351268); + ssigpTa->SetBinContent(2680,0.0351128); + ssigpTa->SetBinContent(2681,0.035386); + ssigpTa->SetBinContent(2682,0.036034); + ssigpTa->SetBinContent(2683,0.0371536); + ssigpTa->SetBinContent(2684,0.0386764); + ssigpTa->SetBinContent(2685,0.0398044); + ssigpTa->SetBinContent(2686,0.040534); + ssigpTa->SetBinContent(2687,0.0412016); + ssigpTa->SetBinContent(2688,0.0418972); + ssigpTa->SetBinContent(2689,0.0426176); + ssigpTa->SetBinContent(2690,0.0431512); + ssigpTa->SetBinContent(2691,0.0426724); + ssigpTa->SetBinContent(2692,0.0411664); + ssigpTa->SetBinContent(2693,0.0407); + ssigpTa->SetBinContent(2694,0.04165); + ssigpTa->SetBinContent(2695,0.0432336); + ssigpTa->SetBinContent(2696,0.0444396); + ssigpTa->SetBinContent(2697,0.0452356); + ssigpTa->SetBinContent(2698,0.0459512); + ssigpTa->SetBinContent(2699,0.0466696); + ssigpTa->SetBinContent(2700,0.0473972); + ssigpTa->SetBinContent(2701,0.048122); + ssigpTa->SetBinContent(2702,0.0488288); + ssigpTa->SetBinContent(2703,0.0494884); + ssigpTa->SetBinContent(2704,0.050446); + ssigpTa->SetBinContent(2705,0.0519596); + ssigpTa->SetBinContent(2706,0.0532556); + ssigpTa->SetBinContent(2707,0.054194); + ssigpTa->SetBinContent(2708,0.055054); + ssigpTa->SetBinContent(2709,0.0559268); + ssigpTa->SetBinContent(2710,0.056804); + ssigpTa->SetBinContent(2711,0.057702); + ssigpTa->SetBinContent(2712,0.0585824); + ssigpTa->SetBinContent(2713,0.0592648); + ssigpTa->SetBinContent(2714,0.0597192); + ssigpTa->SetBinContent(2715,0.0604144); + ssigpTa->SetBinContent(2716,0.0612524); + ssigpTa->SetBinContent(2717,0.0620356); + ssigpTa->SetBinContent(2718,0.062942); + ssigpTa->SetBinContent(2719,0.0639644); + ssigpTa->SetBinContent(2720,0.0650192); + ssigpTa->SetBinContent(2721,0.0661176); + ssigpTa->SetBinContent(2722,0.0672964); + ssigpTa->SetBinContent(2723,0.0685368); + ssigpTa->SetBinContent(2724,0.0697928); + ssigpTa->SetBinContent(2725,0.0710512); + ssigpTa->SetBinContent(2726,0.072328); + ssigpTa->SetBinContent(2727,0.073654); + ssigpTa->SetBinContent(2728,0.0751268); + ssigpTa->SetBinContent(2729,0.0767496); + ssigpTa->SetBinContent(2730,0.0782636); + ssigpTa->SetBinContent(2731,0.0796244); + ssigpTa->SetBinContent(2732,0.0807492); + ssigpTa->SetBinContent(2733,0.0816836); + ssigpTa->SetBinContent(2734,0.0829608); + ssigpTa->SetBinContent(2735,0.084564); + ssigpTa->SetBinContent(2736,0.0862444); + ssigpTa->SetBinContent(2737,0.0878608); + ssigpTa->SetBinContent(2738,0.0890528); + ssigpTa->SetBinContent(2741,0.0136622); + ssigpTa->SetBinContent(2742,0.0136583); + ssigpTa->SetBinContent(2743,0.013656); + ssigpTa->SetBinContent(2744,0.013656); + ssigpTa->SetBinContent(2745,0.013656); + ssigpTa->SetBinContent(2746,0.013656); + ssigpTa->SetBinContent(2747,0.0136568); + ssigpTa->SetBinContent(2748,0.0136568); + ssigpTa->SetBinContent(2749,0.0136568); + ssigpTa->SetBinContent(2750,0.0136672); + ssigpTa->SetBinContent(2751,0.0136776); + ssigpTa->SetBinContent(2752,0.013692); + ssigpTa->SetBinContent(2753,0.0136952); + ssigpTa->SetBinContent(2754,0.0136976); + ssigpTa->SetBinContent(2755,0.0137); + ssigpTa->SetBinContent(2756,0.013704); + ssigpTa->SetBinContent(2757,0.0137144); + ssigpTa->SetBinContent(2758,0.0137288); + ssigpTa->SetBinContent(2759,0.0137416); + ssigpTa->SetBinContent(2760,0.0137472); + ssigpTa->SetBinContent(2761,0.0137536); + ssigpTa->SetBinContent(2762,0.013768); + ssigpTa->SetBinContent(2763,0.0137824); + ssigpTa->SetBinContent(2764,0.0137944); + ssigpTa->SetBinContent(2765,0.0138096); + ssigpTa->SetBinContent(2766,0.0138216); + ssigpTa->SetBinContent(2767,0.013836); + ssigpTa->SetBinContent(2768,0.0138512); + ssigpTa->SetBinContent(2769,0.0138608); + ssigpTa->SetBinContent(2770,0.0138752); + ssigpTa->SetBinContent(2771,0.0138944); + ssigpTa->SetBinContent(2772,0.013908); + ssigpTa->SetBinContent(2773,0.0139288); + ssigpTa->SetBinContent(2774,0.0139472); + ssigpTa->SetBinContent(2775,0.013968); + ssigpTa->SetBinContent(2776,0.013984); + ssigpTa->SetBinContent(2777,0.0140048); + ssigpTa->SetBinContent(2778,0.0140272); + ssigpTa->SetBinContent(2779,0.014048); + ssigpTa->SetBinContent(2780,0.014064); + ssigpTa->SetBinContent(2781,0.0140896); + ssigpTa->SetBinContent(2782,0.0141064); + ssigpTa->SetBinContent(2783,0.0141312); + ssigpTa->SetBinContent(2784,0.0141512); + ssigpTa->SetBinContent(2785,0.01418); + ssigpTa->SetBinContent(2786,0.0142056); + ssigpTa->SetBinContent(2787,0.0142336); + ssigpTa->SetBinContent(2788,0.0142584); + ssigpTa->SetBinContent(2789,0.0142904); + ssigpTa->SetBinContent(2790,0.014312); + ssigpTa->SetBinContent(2791,0.0143416); + ssigpTa->SetBinContent(2792,0.0143688); + ssigpTa->SetBinContent(2793,0.0143952); + ssigpTa->SetBinContent(2794,0.014424); + ssigpTa->SetBinContent(2795,0.0144552); + ssigpTa->SetBinContent(2796,0.014488); + ssigpTa->SetBinContent(2797,0.0145144); + ssigpTa->SetBinContent(2798,0.014548); + ssigpTa->SetBinContent(2799,0.014576); + ssigpTa->SetBinContent(2800,0.0146128); + ssigpTa->SetBinContent(2801,0.0146456); + ssigpTa->SetBinContent(2802,0.0146816); + ssigpTa->SetBinContent(2803,0.0147104); + ssigpTa->SetBinContent(2804,0.0147464); + ssigpTa->SetBinContent(2805,0.0147784); + ssigpTa->SetBinContent(2806,0.0148176); + ssigpTa->SetBinContent(2807,0.0148544); + ssigpTa->SetBinContent(2808,0.0148976); + ssigpTa->SetBinContent(2809,0.0149368); + ssigpTa->SetBinContent(2810,0.0149736); + ssigpTa->SetBinContent(2811,0.015016); + ssigpTa->SetBinContent(2812,0.0150592); + ssigpTa->SetBinContent(2813,0.0151); + ssigpTa->SetBinContent(2814,0.0151392); + ssigpTa->SetBinContent(2815,0.0151784); + ssigpTa->SetBinContent(2816,0.01522); + ssigpTa->SetBinContent(2817,0.0152688); + ssigpTa->SetBinContent(2818,0.0153224); + ssigpTa->SetBinContent(2819,0.0153696); + ssigpTa->SetBinContent(2820,0.0154144); + ssigpTa->SetBinContent(2821,0.0154624); + ssigpTa->SetBinContent(2822,0.0155112); + ssigpTa->SetBinContent(2823,0.0155632); + ssigpTa->SetBinContent(2824,0.015612); + ssigpTa->SetBinContent(2825,0.0156616); + ssigpTa->SetBinContent(2826,0.0157128); + ssigpTa->SetBinContent(2827,0.0157672); + ssigpTa->SetBinContent(2828,0.0158184); + ssigpTa->SetBinContent(2829,0.0158696); + ssigpTa->SetBinContent(2830,0.0159248); + ssigpTa->SetBinContent(2831,0.01598); + ssigpTa->SetBinContent(2832,0.0160384); + ssigpTa->SetBinContent(2833,0.016092); + ssigpTa->SetBinContent(2834,0.0161456); + ssigpTa->SetBinContent(2835,0.016208); + ssigpTa->SetBinContent(2836,0.0162664); + ssigpTa->SetBinContent(2837,0.016332); + ssigpTa->SetBinContent(2838,0.0163936); + ssigpTa->SetBinContent(2839,0.0164536); + ssigpTa->SetBinContent(2840,0.01652); + ssigpTa->SetBinContent(2841,0.0165832); + ssigpTa->SetBinContent(2842,0.016652); + ssigpTa->SetBinContent(2843,0.01672); + ssigpTa->SetBinContent(2844,0.0167928); + ssigpTa->SetBinContent(2845,0.0169144); + ssigpTa->SetBinContent(2846,0.017184); + ssigpTa->SetBinContent(2847,0.0179496); + ssigpTa->SetBinContent(2848,0.0192168); + ssigpTa->SetBinContent(2849,0.019928); + ssigpTa->SetBinContent(2850,0.0201008); + ssigpTa->SetBinContent(2851,0.0201776); + ssigpTa->SetBinContent(2852,0.020252); + ssigpTa->SetBinContent(2853,0.020332); + ssigpTa->SetBinContent(2854,0.0204104); + ssigpTa->SetBinContent(2855,0.0204912); + ssigpTa->SetBinContent(2856,0.0205736); + ssigpTa->SetBinContent(2857,0.0205752); + ssigpTa->SetBinContent(2858,0.0201832); + ssigpTa->SetBinContent(2859,0.0194208); + ssigpTa->SetBinContent(2860,0.0191448); + ssigpTa->SetBinContent(2861,0.0193544); + ssigpTa->SetBinContent(2862,0.019672); + ssigpTa->SetBinContent(2863,0.0200008); + ssigpTa->SetBinContent(2864,0.0203288); + ssigpTa->SetBinContent(2865,0.020664); + ssigpTa->SetBinContent(2866,0.0209104); + ssigpTa->SetBinContent(2867,0.0207384); + ssigpTa->SetBinContent(2868,0.020124); + ssigpTa->SetBinContent(2869,0.0198552); + ssigpTa->SetBinContent(2870,0.0199248); + ssigpTa->SetBinContent(2871,0.0201648); + ssigpTa->SetBinContent(2872,0.0205); + ssigpTa->SetBinContent(2873,0.0208552); + ssigpTa->SetBinContent(2874,0.0212152); + ssigpTa->SetBinContent(2875,0.0215808); + ssigpTa->SetBinContent(2876,0.0219472); + ssigpTa->SetBinContent(2877,0.022216); + ssigpTa->SetBinContent(2878,0.0219704); + ssigpTa->SetBinContent(2879,0.0212048); + ssigpTa->SetBinContent(2880,0.0209656); + ssigpTa->SetBinContent(2881,0.021236); + ssigpTa->SetBinContent(2882,0.0216088); + ssigpTa->SetBinContent(2883,0.0219848); + ssigpTa->SetBinContent(2884,0.0223728); + ssigpTa->SetBinContent(2885,0.0226952); + ssigpTa->SetBinContent(2886,0.0227472); + ssigpTa->SetBinContent(2887,0.0225152); + ssigpTa->SetBinContent(2888,0.0224832); + ssigpTa->SetBinContent(2889,0.0221728); + ssigpTa->SetBinContent(2890,0.021352); + ssigpTa->SetBinContent(2891,0.0210928); + ssigpTa->SetBinContent(2892,0.0214008); + ssigpTa->SetBinContent(2893,0.0218232); + ssigpTa->SetBinContent(2894,0.0222576); + ssigpTa->SetBinContent(2895,0.0226944); + ssigpTa->SetBinContent(2896,0.0231408); + ssigpTa->SetBinContent(2897,0.023592); + ssigpTa->SetBinContent(2898,0.0240528); + ssigpTa->SetBinContent(2899,0.0245128); + ssigpTa->SetBinContent(2900,0.0248912); + ssigpTa->SetBinContent(2901,0.024792); + ssigpTa->SetBinContent(2902,0.024204); + ssigpTa->SetBinContent(2903,0.0239632); + ssigpTa->SetBinContent(2904,0.0235752); + ssigpTa->SetBinContent(2905,0.022644); + ssigpTa->SetBinContent(2906,0.0223304); + ssigpTa->SetBinContent(2907,0.0226456); + ssigpTa->SetBinContent(2908,0.0231048); + ssigpTa->SetBinContent(2909,0.0235744); + ssigpTa->SetBinContent(2910,0.0240512); + ssigpTa->SetBinContent(2911,0.0244624); + ssigpTa->SetBinContent(2912,0.0245424); + ssigpTa->SetBinContent(2913,0.0242648); + ssigpTa->SetBinContent(2914,0.0243664); + ssigpTa->SetBinContent(2915,0.0249608); + ssigpTa->SetBinContent(2916,0.0257944); + ssigpTa->SetBinContent(2917,0.0264824); + ssigpTa->SetBinContent(2918,0.0269544); + ssigpTa->SetBinContent(2919,0.0270464); + ssigpTa->SetBinContent(2920,0.0267776); + ssigpTa->SetBinContent(2921,0.0268464); + ssigpTa->SetBinContent(2922,0.0272624); + ssigpTa->SetBinContent(2923,0.0277512); + ssigpTa->SetBinContent(2924,0.0282184); + ssigpTa->SetBinContent(2925,0.0285528); + ssigpTa->SetBinContent(2926,0.028532); + ssigpTa->SetBinContent(2927,0.0275296); + ssigpTa->SetBinContent(2928,0.0255336); + ssigpTa->SetBinContent(2929,0.0246168); + ssigpTa->SetBinContent(2930,0.0247984); + ssigpTa->SetBinContent(2931,0.0252136); + ssigpTa->SetBinContent(2932,0.02568); + ssigpTa->SetBinContent(2933,0.0263768); + ssigpTa->SetBinContent(2934,0.0273104); + ssigpTa->SetBinContent(2935,0.0280208); + ssigpTa->SetBinContent(2936,0.0285128); + ssigpTa->SetBinContent(2937,0.0289728); + ssigpTa->SetBinContent(2938,0.029448); + ssigpTa->SetBinContent(2939,0.029932); + ssigpTa->SetBinContent(2940,0.03042); + ssigpTa->SetBinContent(2941,0.0308672); + ssigpTa->SetBinContent(2942,0.0311024); + ssigpTa->SetBinContent(2943,0.031128); + ssigpTa->SetBinContent(2944,0.0313936); + ssigpTa->SetBinContent(2945,0.031952); + ssigpTa->SetBinContent(2946,0.0328528); + ssigpTa->SetBinContent(2947,0.0340544); + ssigpTa->SetBinContent(2948,0.0349824); + ssigpTa->SetBinContent(2949,0.0356448); + ssigpTa->SetBinContent(2950,0.036256); + ssigpTa->SetBinContent(2951,0.0368744); + ssigpTa->SetBinContent(2952,0.0374704); + ssigpTa->SetBinContent(2953,0.037884); + ssigpTa->SetBinContent(2954,0.0381272); + ssigpTa->SetBinContent(2955,0.038588); + ssigpTa->SetBinContent(2956,0.0393272); + ssigpTa->SetBinContent(2957,0.0404104); + ssigpTa->SetBinContent(2958,0.041792); + ssigpTa->SetBinContent(2959,0.0428768); + ssigpTa->SetBinContent(2960,0.0436792); + ssigpTa->SetBinContent(2961,0.0444416); + ssigpTa->SetBinContent(2962,0.0452376); + ssigpTa->SetBinContent(2963,0.046056); + ssigpTa->SetBinContent(2964,0.0467184); + ssigpTa->SetBinContent(2965,0.046516); + ssigpTa->SetBinContent(2966,0.0454224); + ssigpTa->SetBinContent(2967,0.0452256); + ssigpTa->SetBinContent(2968,0.0461936); + ssigpTa->SetBinContent(2969,0.0476528); + ssigpTa->SetBinContent(2970,0.0488448); + ssigpTa->SetBinContent(2971,0.0497472); + ssigpTa->SetBinContent(2972,0.0506016); + ssigpTa->SetBinContent(2973,0.0514664); + ssigpTa->SetBinContent(2974,0.0523368); + ssigpTa->SetBinContent(2975,0.0532136); + ssigpTa->SetBinContent(2976,0.0540752); + ssigpTa->SetBinContent(2977,0.0549176); + ssigpTa->SetBinContent(2978,0.055984); + ssigpTa->SetBinContent(2979,0.0574832); + ssigpTa->SetBinContent(2980,0.0588272); + ssigpTa->SetBinContent(2981,0.0599064); + ssigpTa->SetBinContent(2982,0.0609448); + ssigpTa->SetBinContent(2983,0.0619888); + ssigpTa->SetBinContent(2984,0.0630512); + ssigpTa->SetBinContent(2985,0.0641288); + ssigpTa->SetBinContent(2986,0.0652192); + ssigpTa->SetBinContent(2987,0.0661568); + ssigpTa->SetBinContent(2988,0.0669304); + ssigpTa->SetBinContent(2989,0.0679032); + ssigpTa->SetBinContent(2990,0.0689888); + ssigpTa->SetBinContent(2991,0.0700248); + ssigpTa->SetBinContent(2992,0.07118); + ssigpTa->SetBinContent(2993,0.0724496); + ssigpTa->SetBinContent(2994,0.0737536); + ssigpTa->SetBinContent(2995,0.0751128); + ssigpTa->SetBinContent(2996,0.0765696); + ssigpTa->SetBinContent(2997,0.078096); + ssigpTa->SetBinContent(2998,0.0796464); + ssigpTa->SetBinContent(2999,0.081204); + ssigpTa->SetBinContent(3000,0.0827824); + ssigpTa->SetBinContent(3001,0.0844488); + ssigpTa->SetBinContent(3002,0.0863736); + ssigpTa->SetBinContent(3003,0.0885624); + ssigpTa->SetBinContent(3004,0.0905456); + ssigpTa->SetBinContent(3005,0.09232); + ssigpTa->SetBinContent(3006,0.0940224); + ssigpTa->SetBinContent(3007,0.095724); + ssigpTa->SetBinContent(3008,0.0976352); + ssigpTa->SetBinContent(3009,0.0997); + ssigpTa->SetBinContent(3010,0.101825); + ssigpTa->SetBinContent(3011,0.103833); + ssigpTa->SetBinContent(3012,0.105288); + ssigpTa->SetBinContent(3015,0.0148633); + ssigpTa->SetBinContent(3016,0.0148592); + ssigpTa->SetBinContent(3017,0.0148568); + ssigpTa->SetBinContent(3018,0.0148568); + ssigpTa->SetBinContent(3019,0.0148568); + ssigpTa->SetBinContent(3020,0.0148568); + ssigpTa->SetBinContent(3021,0.0148568); + ssigpTa->SetBinContent(3022,0.0148568); + ssigpTa->SetBinContent(3023,0.0148636); + ssigpTa->SetBinContent(3024,0.0148724); + ssigpTa->SetBinContent(3025,0.0148916); + ssigpTa->SetBinContent(3026,0.0148988); + ssigpTa->SetBinContent(3027,0.014904); + ssigpTa->SetBinContent(3028,0.014904); + ssigpTa->SetBinContent(3029,0.014904); + ssigpTa->SetBinContent(3030,0.0149072); + ssigpTa->SetBinContent(3031,0.0149144); + ssigpTa->SetBinContent(3032,0.0149324); + ssigpTa->SetBinContent(3033,0.0149484); + ssigpTa->SetBinContent(3034,0.0149552); + ssigpTa->SetBinContent(3035,0.0149604); + ssigpTa->SetBinContent(3036,0.0149688); + ssigpTa->SetBinContent(3037,0.014982); + ssigpTa->SetBinContent(3038,0.0149952); + ssigpTa->SetBinContent(3039,0.0150072); + ssigpTa->SetBinContent(3040,0.0150232); + ssigpTa->SetBinContent(3041,0.0150364); + ssigpTa->SetBinContent(3042,0.0150448); + ssigpTa->SetBinContent(3043,0.0150568); + ssigpTa->SetBinContent(3044,0.01507); + ssigpTa->SetBinContent(3045,0.015088); + ssigpTa->SetBinContent(3046,0.0151044); + ssigpTa->SetBinContent(3047,0.0151184); + ssigpTa->SetBinContent(3048,0.0151408); + ssigpTa->SetBinContent(3049,0.015156); + ssigpTa->SetBinContent(3050,0.0151712); + ssigpTa->SetBinContent(3051,0.0151924); + ssigpTa->SetBinContent(3052,0.0152128); + ssigpTa->SetBinContent(3053,0.0152328); + ssigpTa->SetBinContent(3054,0.015254); + ssigpTa->SetBinContent(3055,0.0152692); + ssigpTa->SetBinContent(3056,0.0152936); + ssigpTa->SetBinContent(3057,0.0153096); + ssigpTa->SetBinContent(3058,0.0153388); + ssigpTa->SetBinContent(3059,0.0153592); + ssigpTa->SetBinContent(3060,0.0153856); + ssigpTa->SetBinContent(3061,0.0154088); + ssigpTa->SetBinContent(3062,0.01544); + ssigpTa->SetBinContent(3063,0.0154604); + ssigpTa->SetBinContent(3064,0.0154896); + ssigpTa->SetBinContent(3065,0.01551); + ssigpTa->SetBinContent(3066,0.0155364); + ssigpTa->SetBinContent(3067,0.0155644); + ssigpTa->SetBinContent(3068,0.0155908); + ssigpTa->SetBinContent(3069,0.0156212); + ssigpTa->SetBinContent(3070,0.0156524); + ssigpTa->SetBinContent(3071,0.0156856); + ssigpTa->SetBinContent(3072,0.015708); + ssigpTa->SetBinContent(3073,0.0157452); + ssigpTa->SetBinContent(3074,0.0157708); + ssigpTa->SetBinContent(3075,0.01581); + ssigpTa->SetBinContent(3076,0.0158384); + ssigpTa->SetBinContent(3077,0.0158716); + ssigpTa->SetBinContent(3078,0.0159); + ssigpTa->SetBinContent(3079,0.0159364); + ssigpTa->SetBinContent(3080,0.0159668); + ssigpTa->SetBinContent(3081,0.0160064); + ssigpTa->SetBinContent(3082,0.0160476); + ssigpTa->SetBinContent(3083,0.016086); + ssigpTa->SetBinContent(3084,0.0161224); + ssigpTa->SetBinContent(3085,0.0161608); + ssigpTa->SetBinContent(3086,0.0162052); + ssigpTa->SetBinContent(3087,0.0162456); + ssigpTa->SetBinContent(3088,0.0162868); + ssigpTa->SetBinContent(3089,0.0163232); + ssigpTa->SetBinContent(3090,0.0163616); + ssigpTa->SetBinContent(3091,0.0164092); + ssigpTa->SetBinContent(3092,0.016456); + ssigpTa->SetBinContent(3093,0.0165044); + ssigpTa->SetBinContent(3094,0.016548); + ssigpTa->SetBinContent(3095,0.016598); + ssigpTa->SetBinContent(3096,0.0166476); + ssigpTa->SetBinContent(3097,0.0166944); + ssigpTa->SetBinContent(3098,0.0167428); + ssigpTa->SetBinContent(3099,0.016794); + ssigpTa->SetBinContent(3100,0.0168408); + ssigpTa->SetBinContent(3101,0.0168904); + ssigpTa->SetBinContent(3102,0.01694); + ssigpTa->SetBinContent(3103,0.0169904); + ssigpTa->SetBinContent(3104,0.0170448); + ssigpTa->SetBinContent(3105,0.0171024); + ssigpTa->SetBinContent(3106,0.0171568); + ssigpTa->SetBinContent(3107,0.0172084); + ssigpTa->SetBinContent(3108,0.0172648); + ssigpTa->SetBinContent(3109,0.0173184); + ssigpTa->SetBinContent(3110,0.0173812); + ssigpTa->SetBinContent(3111,0.0174352); + ssigpTa->SetBinContent(3112,0.0174948); + ssigpTa->SetBinContent(3113,0.0175544); + ssigpTa->SetBinContent(3114,0.017614); + ssigpTa->SetBinContent(3115,0.0176864); + ssigpTa->SetBinContent(3116,0.0177548); + ssigpTa->SetBinContent(3117,0.0178232); + ssigpTa->SetBinContent(3118,0.0178972); + ssigpTa->SetBinContent(3119,0.0180072); + ssigpTa->SetBinContent(3120,0.0182916); + ssigpTa->SetBinContent(3121,0.0192068); + ssigpTa->SetBinContent(3122,0.0207504); + ssigpTa->SetBinContent(3123,0.021612); + ssigpTa->SetBinContent(3124,0.0218184); + ssigpTa->SetBinContent(3125,0.02189); + ssigpTa->SetBinContent(3126,0.0219696); + ssigpTa->SetBinContent(3127,0.0220396); + ssigpTa->SetBinContent(3128,0.0221156); + ssigpTa->SetBinContent(3129,0.0221924); + ssigpTa->SetBinContent(3130,0.022274); + ssigpTa->SetBinContent(3131,0.0222568); + ssigpTa->SetBinContent(3132,0.021742); + ssigpTa->SetBinContent(3133,0.0207752); + ssigpTa->SetBinContent(3134,0.0204348); + ssigpTa->SetBinContent(3135,0.0206724); + ssigpTa->SetBinContent(3136,0.0210456); + ssigpTa->SetBinContent(3137,0.0214204); + ssigpTa->SetBinContent(3138,0.0218044); + ssigpTa->SetBinContent(3139,0.0221836); + ssigpTa->SetBinContent(3140,0.0224588); + ssigpTa->SetBinContent(3141,0.0222112); + ssigpTa->SetBinContent(3142,0.0214264); + ssigpTa->SetBinContent(3143,0.0210928); + ssigpTa->SetBinContent(3144,0.0211972); + ssigpTa->SetBinContent(3145,0.0214888); + ssigpTa->SetBinContent(3146,0.0218652); + ssigpTa->SetBinContent(3147,0.0222676); + ssigpTa->SetBinContent(3148,0.022678); + ssigpTa->SetBinContent(3149,0.0230912); + ssigpTa->SetBinContent(3150,0.0235164); + ssigpTa->SetBinContent(3151,0.0238156); + ssigpTa->SetBinContent(3152,0.0235012); + ssigpTa->SetBinContent(3153,0.0225548); + ssigpTa->SetBinContent(3154,0.0222256); + ssigpTa->SetBinContent(3155,0.0225124); + ssigpTa->SetBinContent(3156,0.022922); + ssigpTa->SetBinContent(3157,0.023344); + ssigpTa->SetBinContent(3158,0.0237684); + ssigpTa->SetBinContent(3159,0.0241504); + ssigpTa->SetBinContent(3160,0.0242784); + ssigpTa->SetBinContent(3161,0.0241816); + ssigpTa->SetBinContent(3162,0.0242068); + ssigpTa->SetBinContent(3163,0.0238212); + ssigpTa->SetBinContent(3164,0.0227936); + ssigpTa->SetBinContent(3165,0.0224364); + ssigpTa->SetBinContent(3166,0.02275); + ssigpTa->SetBinContent(3167,0.0232104); + ssigpTa->SetBinContent(3168,0.023674); + ssigpTa->SetBinContent(3169,0.0241524); + ssigpTa->SetBinContent(3170,0.02463); + ssigpTa->SetBinContent(3171,0.0251236); + ssigpTa->SetBinContent(3172,0.025622); + ssigpTa->SetBinContent(3173,0.0261248); + ssigpTa->SetBinContent(3174,0.0265212); + ssigpTa->SetBinContent(3175,0.02634); + ssigpTa->SetBinContent(3176,0.0255556); + ssigpTa->SetBinContent(3177,0.0252404); + ssigpTa->SetBinContent(3178,0.024908); + ssigpTa->SetBinContent(3179,0.0241052); + ssigpTa->SetBinContent(3180,0.0238668); + ssigpTa->SetBinContent(3181,0.0242324); + ssigpTa->SetBinContent(3182,0.024728); + ssigpTa->SetBinContent(3183,0.0252396); + ssigpTa->SetBinContent(3184,0.0257524); + ssigpTa->SetBinContent(3185,0.0261872); + ssigpTa->SetBinContent(3186,0.0261632); + ssigpTa->SetBinContent(3187,0.0256836); + ssigpTa->SetBinContent(3188,0.0256716); + ssigpTa->SetBinContent(3189,0.0262548); + ssigpTa->SetBinContent(3190,0.027064); + ssigpTa->SetBinContent(3191,0.0277584); + ssigpTa->SetBinContent(3192,0.0282656); + ssigpTa->SetBinContent(3193,0.0284388); + ssigpTa->SetBinContent(3194,0.0282972); + ssigpTa->SetBinContent(3195,0.0284616); + ssigpTa->SetBinContent(3196,0.0289388); + ssigpTa->SetBinContent(3197,0.0294824); + ssigpTa->SetBinContent(3198,0.0299876); + ssigpTa->SetBinContent(3199,0.0302772); + ssigpTa->SetBinContent(3200,0.0301408); + ssigpTa->SetBinContent(3201,0.0291784); + ssigpTa->SetBinContent(3202,0.027356); + ssigpTa->SetBinContent(3203,0.0265728); + ssigpTa->SetBinContent(3204,0.0268176); + ssigpTa->SetBinContent(3205,0.0272804); + ssigpTa->SetBinContent(3206,0.02779); + ssigpTa->SetBinContent(3207,0.0284576); + ssigpTa->SetBinContent(3208,0.02929); + ssigpTa->SetBinContent(3209,0.0299692); + ssigpTa->SetBinContent(3210,0.030502); + ssigpTa->SetBinContent(3211,0.0310208); + ssigpTa->SetBinContent(3212,0.0315548); + ssigpTa->SetBinContent(3213,0.0320988); + ssigpTa->SetBinContent(3214,0.032646); + ssigpTa->SetBinContent(3215,0.03317); + ssigpTa->SetBinContent(3216,0.0335556); + ssigpTa->SetBinContent(3217,0.0338124); + ssigpTa->SetBinContent(3218,0.0342408); + ssigpTa->SetBinContent(3219,0.0348728); + ssigpTa->SetBinContent(3220,0.0357432); + ssigpTa->SetBinContent(3221,0.0368172); + ssigpTa->SetBinContent(3222,0.0377112); + ssigpTa->SetBinContent(3223,0.0384316); + ssigpTa->SetBinContent(3224,0.0391192); + ssigpTa->SetBinContent(3225,0.0398244); + ssigpTa->SetBinContent(3226,0.0405208); + ssigpTa->SetBinContent(3227,0.0411248); + ssigpTa->SetBinContent(3228,0.0416448); + ssigpTa->SetBinContent(3229,0.0423132); + ssigpTa->SetBinContent(3230,0.0431536); + ssigpTa->SetBinContent(3231,0.0442124); + ssigpTa->SetBinContent(3232,0.045438); + ssigpTa->SetBinContent(3233,0.0464912); + ssigpTa->SetBinContent(3234,0.0473728); + ssigpTa->SetBinContent(3235,0.0482456); + ssigpTa->SetBinContent(3236,0.0491504); + ssigpTa->SetBinContent(3237,0.0500864); + ssigpTa->SetBinContent(3238,0.0508964); + ssigpTa->SetBinContent(3239,0.0509824); + ssigpTa->SetBinContent(3240,0.0503336); + ssigpTa->SetBinContent(3241,0.0504232); + ssigpTa->SetBinContent(3242,0.0514064); + ssigpTa->SetBinContent(3243,0.0527272); + ssigpTa->SetBinContent(3244,0.0538984); + ssigpTa->SetBinContent(3245,0.0549292); + ssigpTa->SetBinContent(3246,0.0559428); + ssigpTa->SetBinContent(3247,0.0569704); + ssigpTa->SetBinContent(3248,0.0580072); + ssigpTa->SetBinContent(3249,0.0590496); + ssigpTa->SetBinContent(3250,0.0600932); + ssigpTa->SetBinContent(3251,0.0611344); + ssigpTa->SetBinContent(3252,0.0623216); + ssigpTa->SetBinContent(3253,0.0637996); + ssigpTa->SetBinContent(3254,0.065192); + ssigpTa->SetBinContent(3255,0.066446); + ssigpTa->SetBinContent(3256,0.0676748); + ssigpTa->SetBinContent(3257,0.0689248); + ssigpTa->SetBinContent(3258,0.0701856); + ssigpTa->SetBinContent(3259,0.0714832); + ssigpTa->SetBinContent(3260,0.072796); + ssigpTa->SetBinContent(3261,0.074024); + ssigpTa->SetBinContent(3262,0.0751316); + ssigpTa->SetBinContent(3263,0.0764056); + ssigpTa->SetBinContent(3264,0.0777672); + ssigpTa->SetBinContent(3265,0.0790848); + ssigpTa->SetBinContent(3266,0.0805212); + ssigpTa->SetBinContent(3267,0.0820664); + ssigpTa->SetBinContent(3268,0.0836468); + ssigpTa->SetBinContent(3269,0.0852888); + ssigpTa->SetBinContent(3270,0.0870476); + ssigpTa->SetBinContent(3271,0.0888936); + ssigpTa->SetBinContent(3272,0.0907684); + ssigpTa->SetBinContent(3273,0.0926512); + ssigpTa->SetBinContent(3274,0.0945652); + ssigpTa->SetBinContent(3275,0.0965912); + ssigpTa->SetBinContent(3276,0.0990032); + ssigpTa->SetBinContent(3277,0.101793); + ssigpTa->SetBinContent(3278,0.104286); + ssigpTa->SetBinContent(3279,0.106492); + ssigpTa->SetBinContent(3280,0.108796); + ssigpTa->SetBinContent(3281,0.111281); + ssigpTa->SetBinContent(3282,0.113833); + ssigpTa->SetBinContent(3283,0.116399); + ssigpTa->SetBinContent(3284,0.118991); + ssigpTa->SetBinContent(3285,0.12143); + ssigpTa->SetBinContent(3286,0.123172); + ssigpTa->SetBinContent(3289,0.0162); + ssigpTa->SetBinContent(3290,0.0161983); + ssigpTa->SetBinContent(3291,0.016196); + ssigpTa->SetBinContent(3292,0.016196); + ssigpTa->SetBinContent(3293,0.016196); + ssigpTa->SetBinContent(3294,0.016196); + ssigpTa->SetBinContent(3295,0.016196); + ssigpTa->SetBinContent(3296,0.0161984); + ssigpTa->SetBinContent(3297,0.0162064); + ssigpTa->SetBinContent(3298,0.0162224); + ssigpTa->SetBinContent(3299,0.0162312); + ssigpTa->SetBinContent(3300,0.0162392); + ssigpTa->SetBinContent(3301,0.0162392); + ssigpTa->SetBinContent(3302,0.0162392); + ssigpTa->SetBinContent(3303,0.0162392); + ssigpTa->SetBinContent(3304,0.0162392); + ssigpTa->SetBinContent(3305,0.0162456); + ssigpTa->SetBinContent(3306,0.0162616); + ssigpTa->SetBinContent(3307,0.0162832); + ssigpTa->SetBinContent(3308,0.0162936); + ssigpTa->SetBinContent(3309,0.016296); + ssigpTa->SetBinContent(3310,0.0163048); + ssigpTa->SetBinContent(3311,0.0163112); + ssigpTa->SetBinContent(3312,0.01632); + ssigpTa->SetBinContent(3313,0.0163392); + ssigpTa->SetBinContent(3314,0.0163536); + ssigpTa->SetBinContent(3315,0.0163656); + ssigpTa->SetBinContent(3316,0.0163736); + ssigpTa->SetBinContent(3317,0.0163784); + ssigpTa->SetBinContent(3318,0.0163976); + ssigpTa->SetBinContent(3319,0.0164136); + ssigpTa->SetBinContent(3320,0.016428); + ssigpTa->SetBinContent(3321,0.016444); + ssigpTa->SetBinContent(3322,0.01646); + ssigpTa->SetBinContent(3323,0.016476); + ssigpTa->SetBinContent(3324,0.0164936); + ssigpTa->SetBinContent(3325,0.0165096); + ssigpTa->SetBinContent(3326,0.0165296); + ssigpTa->SetBinContent(3327,0.016548); + ssigpTa->SetBinContent(3328,0.0165648); + ssigpTa->SetBinContent(3329,0.0165912); + ssigpTa->SetBinContent(3330,0.0166024); + ssigpTa->SetBinContent(3331,0.0166248); + ssigpTa->SetBinContent(3332,0.0166464); + ssigpTa->SetBinContent(3333,0.016672); + ssigpTa->SetBinContent(3334,0.0166904); + ssigpTa->SetBinContent(3335,0.0167184); + ssigpTa->SetBinContent(3336,0.0167392); + ssigpTa->SetBinContent(3337,0.016772); + ssigpTa->SetBinContent(3338,0.0167888); + ssigpTa->SetBinContent(3339,0.0168112); + ssigpTa->SetBinContent(3340,0.01684); + ssigpTa->SetBinContent(3341,0.0168632); + ssigpTa->SetBinContent(3342,0.0168912); + ssigpTa->SetBinContent(3343,0.016916); + ssigpTa->SetBinContent(3344,0.0169512); + ssigpTa->SetBinContent(3345,0.0169744); + ssigpTa->SetBinContent(3346,0.0170064); + ssigpTa->SetBinContent(3347,0.0170304); + ssigpTa->SetBinContent(3348,0.017068); + ssigpTa->SetBinContent(3349,0.0170928); + ssigpTa->SetBinContent(3350,0.0171336); + ssigpTa->SetBinContent(3351,0.0171568); + ssigpTa->SetBinContent(3352,0.017192); + ssigpTa->SetBinContent(3353,0.0172168); + ssigpTa->SetBinContent(3354,0.0172488); + ssigpTa->SetBinContent(3355,0.0172848); + ssigpTa->SetBinContent(3356,0.0173232); + ssigpTa->SetBinContent(3357,0.0173664); + ssigpTa->SetBinContent(3358,0.017396); + ssigpTa->SetBinContent(3359,0.017436); + ssigpTa->SetBinContent(3360,0.0174776); + ssigpTa->SetBinContent(3361,0.0175168); + ssigpTa->SetBinContent(3362,0.01756); + ssigpTa->SetBinContent(3363,0.0176); + ssigpTa->SetBinContent(3364,0.0176384); + ssigpTa->SetBinContent(3365,0.0176768); + ssigpTa->SetBinContent(3366,0.0177256); + ssigpTa->SetBinContent(3367,0.0177592); + ssigpTa->SetBinContent(3368,0.0178088); + ssigpTa->SetBinContent(3369,0.0178552); + ssigpTa->SetBinContent(3370,0.0179048); + ssigpTa->SetBinContent(3371,0.0179456); + ssigpTa->SetBinContent(3372,0.0179952); + ssigpTa->SetBinContent(3373,0.0180416); + ssigpTa->SetBinContent(3374,0.0180912); + ssigpTa->SetBinContent(3375,0.018132); + ssigpTa->SetBinContent(3376,0.0181816); + ssigpTa->SetBinContent(3377,0.0182336); + ssigpTa->SetBinContent(3378,0.0182864); + ssigpTa->SetBinContent(3379,0.0183464); + ssigpTa->SetBinContent(3380,0.0184024); + ssigpTa->SetBinContent(3381,0.0184536); + ssigpTa->SetBinContent(3382,0.0185056); + ssigpTa->SetBinContent(3383,0.0185632); + ssigpTa->SetBinContent(3384,0.0186096); + ssigpTa->SetBinContent(3385,0.0186648); + ssigpTa->SetBinContent(3386,0.0187184); + ssigpTa->SetBinContent(3387,0.0187752); + ssigpTa->SetBinContent(3388,0.0188432); + ssigpTa->SetBinContent(3389,0.018912); + ssigpTa->SetBinContent(3390,0.0189864); + ssigpTa->SetBinContent(3391,0.0190512); + ssigpTa->SetBinContent(3392,0.0191192); + ssigpTa->SetBinContent(3393,0.0192208); + ssigpTa->SetBinContent(3394,0.0195216); + ssigpTa->SetBinContent(3395,0.0206008); + ssigpTa->SetBinContent(3396,0.0224576); + ssigpTa->SetBinContent(3397,0.0234944); + ssigpTa->SetBinContent(3398,0.023724); + ssigpTa->SetBinContent(3399,0.0238056); + ssigpTa->SetBinContent(3400,0.023876); + ssigpTa->SetBinContent(3401,0.023948); + ssigpTa->SetBinContent(3402,0.024016); + ssigpTa->SetBinContent(3403,0.0240872); + ssigpTa->SetBinContent(3404,0.0241688); + ssigpTa->SetBinContent(3405,0.0241232); + ssigpTa->SetBinContent(3406,0.0234704); + ssigpTa->SetBinContent(3407,0.0222856); + ssigpTa->SetBinContent(3408,0.0218616); + ssigpTa->SetBinContent(3409,0.0221496); + ssigpTa->SetBinContent(3410,0.0225752); + ssigpTa->SetBinContent(3411,0.0230096); + ssigpTa->SetBinContent(3412,0.0234472); + ssigpTa->SetBinContent(3413,0.0238832); + ssigpTa->SetBinContent(3414,0.0241864); + ssigpTa->SetBinContent(3415,0.023856); + ssigpTa->SetBinContent(3416,0.022876); + ssigpTa->SetBinContent(3417,0.0224608); + ssigpTa->SetBinContent(3418,0.0226072); + ssigpTa->SetBinContent(3419,0.0229496); + ssigpTa->SetBinContent(3420,0.0233808); + ssigpTa->SetBinContent(3421,0.0238368); + ssigpTa->SetBinContent(3422,0.0242992); + ssigpTa->SetBinContent(3423,0.0247736); + ssigpTa->SetBinContent(3424,0.0252536); + ssigpTa->SetBinContent(3425,0.0255968); + ssigpTa->SetBinContent(3426,0.025196); + ssigpTa->SetBinContent(3427,0.0240368); + ssigpTa->SetBinContent(3428,0.0236072); + ssigpTa->SetBinContent(3429,0.0239128); + ssigpTa->SetBinContent(3430,0.0243696); + ssigpTa->SetBinContent(3431,0.024836); + ssigpTa->SetBinContent(3432,0.0253104); + ssigpTa->SetBinContent(3433,0.0257472); + ssigpTa->SetBinContent(3434,0.0259784); + ssigpTa->SetBinContent(3435,0.0260072); + ssigpTa->SetBinContent(3436,0.0261128); + ssigpTa->SetBinContent(3437,0.0256312); + ssigpTa->SetBinContent(3438,0.0243776); + ssigpTa->SetBinContent(3439,0.0239064); + ssigpTa->SetBinContent(3440,0.0242328); + ssigpTa->SetBinContent(3441,0.024724); + ssigpTa->SetBinContent(3442,0.0252392); + ssigpTa->SetBinContent(3443,0.0257488); + ssigpTa->SetBinContent(3444,0.0262752); + ssigpTa->SetBinContent(3445,0.0268096); + ssigpTa->SetBinContent(3446,0.027352); + ssigpTa->SetBinContent(3447,0.0279008); + ssigpTa->SetBinContent(3448,0.0283192); + ssigpTa->SetBinContent(3449,0.0280376); + ssigpTa->SetBinContent(3450,0.0270312); + ssigpTa->SetBinContent(3451,0.0266176); + ssigpTa->SetBinContent(3452,0.0263792); + ssigpTa->SetBinContent(3453,0.0257248); + ssigpTa->SetBinContent(3454,0.025608); + ssigpTa->SetBinContent(3455,0.026016); + ssigpTa->SetBinContent(3456,0.0265568); + ssigpTa->SetBinContent(3457,0.0271088); + ssigpTa->SetBinContent(3458,0.027668); + ssigpTa->SetBinContent(3459,0.0281152); + ssigpTa->SetBinContent(3460,0.0279928); + ssigpTa->SetBinContent(3461,0.0272744); + ssigpTa->SetBinContent(3462,0.0271512); + ssigpTa->SetBinContent(3463,0.0277064); + ssigpTa->SetBinContent(3464,0.0284968); + ssigpTa->SetBinContent(3465,0.0291928); + ssigpTa->SetBinContent(3466,0.0297416); + ssigpTa->SetBinContent(3467,0.0299936); + ssigpTa->SetBinContent(3468,0.0299728); + ssigpTa->SetBinContent(3469,0.0302288); + ssigpTa->SetBinContent(3470,0.0307648); + ssigpTa->SetBinContent(3471,0.0313688); + ssigpTa->SetBinContent(3472,0.0319072); + ssigpTa->SetBinContent(3473,0.0321368); + ssigpTa->SetBinContent(3474,0.031856); + ssigpTa->SetBinContent(3475,0.0309224); + ssigpTa->SetBinContent(3476,0.0293208); + ssigpTa->SetBinContent(3477,0.0286912); + ssigpTa->SetBinContent(3478,0.0290032); + ssigpTa->SetBinContent(3479,0.0295272); + ssigpTa->SetBinContent(3480,0.0300856); + ssigpTa->SetBinContent(3481,0.0307416); + ssigpTa->SetBinContent(3482,0.0314928); + ssigpTa->SetBinContent(3483,0.0321544); + ssigpTa->SetBinContent(3484,0.0327328); + ssigpTa->SetBinContent(3485,0.0333168); + ssigpTa->SetBinContent(3486,0.03392); + ssigpTa->SetBinContent(3487,0.0345264); + ssigpTa->SetBinContent(3488,0.035144); + ssigpTa->SetBinContent(3489,0.0357488); + ssigpTa->SetBinContent(3490,0.0363016); + ssigpTa->SetBinContent(3491,0.0368048); + ssigpTa->SetBinContent(3492,0.0374056); + ssigpTa->SetBinContent(3493,0.0381208); + ssigpTa->SetBinContent(3494,0.0389688); + ssigpTa->SetBinContent(3495,0.0399232); + ssigpTa->SetBinContent(3496,0.0407912); + ssigpTa->SetBinContent(3497,0.0415744); + ssigpTa->SetBinContent(3498,0.04236); + ssigpTa->SetBinContent(3499,0.0431512); + ssigpTa->SetBinContent(3500,0.043964); + ssigpTa->SetBinContent(3501,0.0447624); + ssigpTa->SetBinContent(3502,0.045576); + ssigpTa->SetBinContent(3503,0.0464536); + ssigpTa->SetBinContent(3504,0.0474104); + ssigpTa->SetBinContent(3505,0.0484392); + ssigpTa->SetBinContent(3506,0.0495264); + ssigpTa->SetBinContent(3507,0.0505448); + ssigpTa->SetBinContent(3508,0.0515176); + ssigpTa->SetBinContent(3509,0.0525048); + ssigpTa->SetBinContent(3510,0.0535376); + ssigpTa->SetBinContent(3511,0.0545968); + ssigpTa->SetBinContent(3512,0.0555616); + ssigpTa->SetBinContent(3513,0.0559544); + ssigpTa->SetBinContent(3514,0.0557408); + ssigpTa->SetBinContent(3515,0.056128); + ssigpTa->SetBinContent(3516,0.0571384); + ssigpTa->SetBinContent(3517,0.0583176); + ssigpTa->SetBinContent(3518,0.0594888); + ssigpTa->SetBinContent(3519,0.060652); + ssigpTa->SetBinContent(3520,0.0618392); + ssigpTa->SetBinContent(3521,0.0630376); + ssigpTa->SetBinContent(3522,0.0642512); + ssigpTa->SetBinContent(3523,0.0654752); + ssigpTa->SetBinContent(3524,0.0667144); + ssigpTa->SetBinContent(3525,0.0679624); + ssigpTa->SetBinContent(3526,0.0692816); + ssigpTa->SetBinContent(3527,0.0707376); + ssigpTa->SetBinContent(3528,0.0721952); + ssigpTa->SetBinContent(3529,0.0736304); + ssigpTa->SetBinContent(3530,0.0750728); + ssigpTa->SetBinContent(3531,0.0765312); + ssigpTa->SetBinContent(3532,0.0780176); + ssigpTa->SetBinContent(3533,0.0795368); + ssigpTa->SetBinContent(3534,0.0811032); + ssigpTa->SetBinContent(3535,0.0826224); + ssigpTa->SetBinContent(3536,0.0840776); + ssigpTa->SetBinContent(3537,0.0856632); + ssigpTa->SetBinContent(3538,0.0873064); + ssigpTa->SetBinContent(3539,0.0889248); + ssigpTa->SetBinContent(3540,0.0906552); + ssigpTa->SetBinContent(3541,0.092492); + ssigpTa->SetBinContent(3542,0.0943584); + ssigpTa->SetBinContent(3543,0.096296); + ssigpTa->SetBinContent(3544,0.0983648); + ssigpTa->SetBinContent(3545,0.100546); + ssigpTa->SetBinContent(3546,0.102759); + ssigpTa->SetBinContent(3547,0.104988); + ssigpTa->SetBinContent(3548,0.107249); + ssigpTa->SetBinContent(3549,0.109657); + ssigpTa->SetBinContent(3550,0.112565); + ssigpTa->SetBinContent(3551,0.115974); + ssigpTa->SetBinContent(3552,0.118978); + ssigpTa->SetBinContent(3553,0.121645); + ssigpTa->SetBinContent(3554,0.124537); + ssigpTa->SetBinContent(3555,0.127799); + ssigpTa->SetBinContent(3556,0.130998); + ssigpTa->SetBinContent(3557,0.134066); + ssigpTa->SetBinContent(3558,0.137144); + ssigpTa->SetBinContent(3559,0.14003); + ssigpTa->SetBinContent(3560,0.142077); + ssigpTa->SetBinContent(3563,0.0176528); + ssigpTa->SetBinContent(3564,0.0176479); + ssigpTa->SetBinContent(3565,0.0176476); + ssigpTa->SetBinContent(3566,0.0176476); + ssigpTa->SetBinContent(3567,0.0176476); + ssigpTa->SetBinContent(3568,0.0176476); + ssigpTa->SetBinContent(3569,0.0176476); + ssigpTa->SetBinContent(3570,0.017654); + ssigpTa->SetBinContent(3571,0.0176652); + ssigpTa->SetBinContent(3572,0.0176764); + ssigpTa->SetBinContent(3573,0.0176832); + ssigpTa->SetBinContent(3574,0.0176832); + ssigpTa->SetBinContent(3575,0.0176832); + ssigpTa->SetBinContent(3576,0.0176832); + ssigpTa->SetBinContent(3577,0.0176832); + ssigpTa->SetBinContent(3578,0.0176832); + ssigpTa->SetBinContent(3579,0.017686); + ssigpTa->SetBinContent(3580,0.0176984); + ssigpTa->SetBinContent(3581,0.0177172); + ssigpTa->SetBinContent(3582,0.0177276); + ssigpTa->SetBinContent(3583,0.0177368); + ssigpTa->SetBinContent(3584,0.0177468); + ssigpTa->SetBinContent(3585,0.0177552); + ssigpTa->SetBinContent(3586,0.0177628); + ssigpTa->SetBinContent(3587,0.0177732); + ssigpTa->SetBinContent(3588,0.017792); + ssigpTa->SetBinContent(3589,0.0177996); + ssigpTa->SetBinContent(3590,0.0178024); + ssigpTa->SetBinContent(3591,0.0178136); + ssigpTa->SetBinContent(3592,0.0178312); + ssigpTa->SetBinContent(3593,0.01785); + ssigpTa->SetBinContent(3594,0.017864); + ssigpTa->SetBinContent(3595,0.0178744); + ssigpTa->SetBinContent(3596,0.0178868); + ssigpTa->SetBinContent(3597,0.0179036); + ssigpTa->SetBinContent(3598,0.017924); + ssigpTa->SetBinContent(3599,0.0179464); + ssigpTa->SetBinContent(3600,0.0179568); + ssigpTa->SetBinContent(3601,0.0179692); + ssigpTa->SetBinContent(3602,0.0179944); + ssigpTa->SetBinContent(3603,0.0180112); + ssigpTa->SetBinContent(3604,0.01803); + ssigpTa->SetBinContent(3605,0.018044); + ssigpTa->SetBinContent(3606,0.0180712); + ssigpTa->SetBinContent(3607,0.0180908); + ssigpTa->SetBinContent(3608,0.0181124); + ssigpTa->SetBinContent(3609,0.0181348); + ssigpTa->SetBinContent(3610,0.0181612); + ssigpTa->SetBinContent(3611,0.0181808); + ssigpTa->SetBinContent(3612,0.018208); + ssigpTa->SetBinContent(3613,0.0182276); + ssigpTa->SetBinContent(3614,0.0182528); + ssigpTa->SetBinContent(3615,0.0182828); + ssigpTa->SetBinContent(3616,0.018298); + ssigpTa->SetBinContent(3617,0.0183224); + ssigpTa->SetBinContent(3618,0.0183532); + ssigpTa->SetBinContent(3619,0.0183796); + ssigpTa->SetBinContent(3620,0.0183992); + ssigpTa->SetBinContent(3621,0.0184376); + ssigpTa->SetBinContent(3622,0.01846); + ssigpTa->SetBinContent(3623,0.0184976); + ssigpTa->SetBinContent(3624,0.0185256); + ssigpTa->SetBinContent(3625,0.0185648); + ssigpTa->SetBinContent(3626,0.0185864); + ssigpTa->SetBinContent(3627,0.0186128); + ssigpTa->SetBinContent(3628,0.0186444); + ssigpTa->SetBinContent(3629,0.0186736); + ssigpTa->SetBinContent(3630,0.0187212); + ssigpTa->SetBinContent(3631,0.0187504); + ssigpTa->SetBinContent(3632,0.018786); + ssigpTa->SetBinContent(3633,0.0188188); + ssigpTa->SetBinContent(3634,0.0188564); + ssigpTa->SetBinContent(3635,0.0188948); + ssigpTa->SetBinContent(3636,0.0189388); + ssigpTa->SetBinContent(3637,0.0189836); + ssigpTa->SetBinContent(3638,0.0190192); + ssigpTa->SetBinContent(3639,0.0190632); + ssigpTa->SetBinContent(3640,0.0190924); + ssigpTa->SetBinContent(3641,0.01914); + ssigpTa->SetBinContent(3642,0.019172); + ssigpTa->SetBinContent(3643,0.0192272); + ssigpTa->SetBinContent(3644,0.0192676); + ssigpTa->SetBinContent(3645,0.0193124); + ssigpTa->SetBinContent(3646,0.0193528); + ssigpTa->SetBinContent(3647,0.019408); + ssigpTa->SetBinContent(3648,0.0194428); + ssigpTa->SetBinContent(3649,0.0194932); + ssigpTa->SetBinContent(3650,0.01954); + ssigpTa->SetBinContent(3651,0.0195896); + ssigpTa->SetBinContent(3652,0.019644); + ssigpTa->SetBinContent(3653,0.019702); + ssigpTa->SetBinContent(3654,0.0197564); + ssigpTa->SetBinContent(3655,0.019806); + ssigpTa->SetBinContent(3656,0.019854); + ssigpTa->SetBinContent(3657,0.0199072); + ssigpTa->SetBinContent(3658,0.0199588); + ssigpTa->SetBinContent(3659,0.02001); + ssigpTa->SetBinContent(3660,0.020068); + ssigpTa->SetBinContent(3661,0.0201252); + ssigpTa->SetBinContent(3662,0.0201888); + ssigpTa->SetBinContent(3663,0.0202592); + ssigpTa->SetBinContent(3664,0.0203212); + ssigpTa->SetBinContent(3665,0.020384); + ssigpTa->SetBinContent(3666,0.0204476); + ssigpTa->SetBinContent(3667,0.0205404); + ssigpTa->SetBinContent(3668,0.0208612); + ssigpTa->SetBinContent(3669,0.0221212); + ssigpTa->SetBinContent(3670,0.02431); + ssigpTa->SetBinContent(3671,0.0255296); + ssigpTa->SetBinContent(3672,0.0257932); + ssigpTa->SetBinContent(3673,0.025868); + ssigpTa->SetBinContent(3674,0.0259412); + ssigpTa->SetBinContent(3675,0.0260112); + ssigpTa->SetBinContent(3676,0.0260768); + ssigpTa->SetBinContent(3677,0.0261452); + ssigpTa->SetBinContent(3678,0.026212); + ssigpTa->SetBinContent(3679,0.0261404); + ssigpTa->SetBinContent(3680,0.0253476); + ssigpTa->SetBinContent(3681,0.0239188); + ssigpTa->SetBinContent(3682,0.023426); + ssigpTa->SetBinContent(3683,0.023758); + ssigpTa->SetBinContent(3684,0.0242528); + ssigpTa->SetBinContent(3685,0.024744); + ssigpTa->SetBinContent(3686,0.0252408); + ssigpTa->SetBinContent(3687,0.0257356); + ssigpTa->SetBinContent(3688,0.0260764); + ssigpTa->SetBinContent(3689,0.025656); + ssigpTa->SetBinContent(3690,0.0244644); + ssigpTa->SetBinContent(3691,0.02396); + ssigpTa->SetBinContent(3692,0.0241432); + ssigpTa->SetBinContent(3693,0.0245456); + ssigpTa->SetBinContent(3694,0.0250312); + ssigpTa->SetBinContent(3695,0.0255448); + ssigpTa->SetBinContent(3696,0.0260696); + ssigpTa->SetBinContent(3697,0.0266); + ssigpTa->SetBinContent(3698,0.0271464); + ssigpTa->SetBinContent(3699,0.02753); + ssigpTa->SetBinContent(3700,0.0270368); + ssigpTa->SetBinContent(3701,0.025648); + ssigpTa->SetBinContent(3702,0.0251064); + ssigpTa->SetBinContent(3703,0.0254408); + ssigpTa->SetBinContent(3704,0.0259444); + ssigpTa->SetBinContent(3705,0.0264564); + ssigpTa->SetBinContent(3706,0.0269896); + ssigpTa->SetBinContent(3707,0.0274848); + ssigpTa->SetBinContent(3708,0.027818); + ssigpTa->SetBinContent(3709,0.027992); + ssigpTa->SetBinContent(3710,0.0281676); + ssigpTa->SetBinContent(3711,0.0275896); + ssigpTa->SetBinContent(3712,0.0260932); + ssigpTa->SetBinContent(3713,0.0255004); + ssigpTa->SetBinContent(3714,0.0258352); + ssigpTa->SetBinContent(3715,0.0263772); + ssigpTa->SetBinContent(3716,0.0269248); + ssigpTa->SetBinContent(3717,0.027492); + ssigpTa->SetBinContent(3718,0.0280564); + ssigpTa->SetBinContent(3719,0.0286404); + ssigpTa->SetBinContent(3720,0.029232); + ssigpTa->SetBinContent(3721,0.0298308); + ssigpTa->SetBinContent(3722,0.0302776); + ssigpTa->SetBinContent(3723,0.0298884); + ssigpTa->SetBinContent(3724,0.0286376); + ssigpTa->SetBinContent(3725,0.0281236); + ssigpTa->SetBinContent(3726,0.0279696); + ssigpTa->SetBinContent(3727,0.0275152); + ssigpTa->SetBinContent(3728,0.0275048); + ssigpTa->SetBinContent(3729,0.0279788); + ssigpTa->SetBinContent(3730,0.0285564); + ssigpTa->SetBinContent(3731,0.0291564); + ssigpTa->SetBinContent(3732,0.0297564); + ssigpTa->SetBinContent(3733,0.0302304); + ssigpTa->SetBinContent(3734,0.03); + ssigpTa->SetBinContent(3735,0.0290388); + ssigpTa->SetBinContent(3736,0.0287864); + ssigpTa->SetBinContent(3737,0.029322); + ssigpTa->SetBinContent(3738,0.0300796); + ssigpTa->SetBinContent(3739,0.0307832); + ssigpTa->SetBinContent(3740,0.0313676); + ssigpTa->SetBinContent(3741,0.0317032); + ssigpTa->SetBinContent(3742,0.031798); + ssigpTa->SetBinContent(3743,0.0321392); + ssigpTa->SetBinContent(3744,0.0327428); + ssigpTa->SetBinContent(3745,0.033396); + ssigpTa->SetBinContent(3746,0.03398); + ssigpTa->SetBinContent(3747,0.0341356); + ssigpTa->SetBinContent(3748,0.0336896); + ssigpTa->SetBinContent(3749,0.0327904); + ssigpTa->SetBinContent(3750,0.0314188); + ssigpTa->SetBinContent(3751,0.0309604); + ssigpTa->SetBinContent(3752,0.0313492); + ssigpTa->SetBinContent(3753,0.0319292); + ssigpTa->SetBinContent(3754,0.0325456); + ssigpTa->SetBinContent(3755,0.0331968); + ssigpTa->SetBinContent(3756,0.0338824); + ssigpTa->SetBinContent(3757,0.03453); + ssigpTa->SetBinContent(3758,0.0351624); + ssigpTa->SetBinContent(3759,0.035818); + ssigpTa->SetBinContent(3760,0.0364904); + ssigpTa->SetBinContent(3761,0.0371768); + ssigpTa->SetBinContent(3762,0.0378596); + ssigpTa->SetBinContent(3763,0.0385628); + ssigpTa->SetBinContent(3764,0.0392824); + ssigpTa->SetBinContent(3765,0.0400424); + ssigpTa->SetBinContent(3766,0.0408272); + ssigpTa->SetBinContent(3767,0.0416384); + ssigpTa->SetBinContent(3768,0.0424612); + ssigpTa->SetBinContent(3769,0.0433092); + ssigpTa->SetBinContent(3770,0.0441452); + ssigpTa->SetBinContent(3771,0.0450128); + ssigpTa->SetBinContent(3772,0.0458868); + ssigpTa->SetBinContent(3773,0.046788); + ssigpTa->SetBinContent(3774,0.0477116); + ssigpTa->SetBinContent(3775,0.048716); + ssigpTa->SetBinContent(3776,0.0498152); + ssigpTa->SetBinContent(3777,0.0509112); + ssigpTa->SetBinContent(3778,0.0519776); + ssigpTa->SetBinContent(3779,0.0529976); + ssigpTa->SetBinContent(3780,0.05395); + ssigpTa->SetBinContent(3781,0.0549532); + ssigpTa->SetBinContent(3782,0.0560252); + ssigpTa->SetBinContent(3783,0.0571384); + ssigpTa->SetBinContent(3784,0.0582964); + ssigpTa->SetBinContent(3785,0.05949); + ssigpTa->SetBinContent(3786,0.0606228); + ssigpTa->SetBinContent(3787,0.061302); + ssigpTa->SetBinContent(3788,0.0615344); + ssigpTa->SetBinContent(3789,0.0622012); + ssigpTa->SetBinContent(3790,0.063248); + ssigpTa->SetBinContent(3791,0.0643); + ssigpTa->SetBinContent(3792,0.0654748); + ssigpTa->SetBinContent(3793,0.0667892); + ssigpTa->SetBinContent(3794,0.0681512); + ssigpTa->SetBinContent(3795,0.0695328); + ssigpTa->SetBinContent(3796,0.0709284); + ssigpTa->SetBinContent(3797,0.0723436); + ssigpTa->SetBinContent(3798,0.073782); + ssigpTa->SetBinContent(3799,0.0752452); + ssigpTa->SetBinContent(3800,0.0767068); + ssigpTa->SetBinContent(3801,0.0781504); + ssigpTa->SetBinContent(3802,0.0796872); + ssigpTa->SetBinContent(3803,0.0813052); + ssigpTa->SetBinContent(3804,0.0829704); + ssigpTa->SetBinContent(3805,0.0846508); + ssigpTa->SetBinContent(3806,0.08636); + ssigpTa->SetBinContent(3807,0.0881188); + ssigpTa->SetBinContent(3808,0.0899352); + ssigpTa->SetBinContent(3809,0.0917612); + ssigpTa->SetBinContent(3810,0.0935636); + ssigpTa->SetBinContent(3811,0.0954596); + ssigpTa->SetBinContent(3812,0.0974036); + ssigpTa->SetBinContent(3813,0.0993224); + ssigpTa->SetBinContent(3814,0.101356); + ssigpTa->SetBinContent(3815,0.103482); + ssigpTa->SetBinContent(3816,0.105648); + ssigpTa->SetBinContent(3817,0.107874); + ssigpTa->SetBinContent(3818,0.110272); + ssigpTa->SetBinContent(3819,0.112786); + ssigpTa->SetBinContent(3820,0.115349); + ssigpTa->SetBinContent(3821,0.117932); + ssigpTa->SetBinContent(3822,0.120554); + ssigpTa->SetBinContent(3823,0.12335); + ssigpTa->SetBinContent(3824,0.126761); + ssigpTa->SetBinContent(3825,0.130787); + ssigpTa->SetBinContent(3826,0.134319); + ssigpTa->SetBinContent(3827,0.137432); + ssigpTa->SetBinContent(3828,0.140926); + ssigpTa->SetBinContent(3829,0.144945); + ssigpTa->SetBinContent(3830,0.148783); + ssigpTa->SetBinContent(3831,0.152362); + ssigpTa->SetBinContent(3832,0.15593); + ssigpTa->SetBinContent(3833,0.159265); + ssigpTa->SetBinContent(3834,0.161633); + ssigpTa->SetBinContent(3837,0.0191789); + ssigpTa->SetBinContent(3838,0.01918); + ssigpTa->SetBinContent(3839,0.0191776); + ssigpTa->SetBinContent(3840,0.0191776); + ssigpTa->SetBinContent(3841,0.0191776); + ssigpTa->SetBinContent(3842,0.0191776); + ssigpTa->SetBinContent(3843,0.0191808); + ssigpTa->SetBinContent(3844,0.0191872); + ssigpTa->SetBinContent(3845,0.0192032); + ssigpTa->SetBinContent(3846,0.019212); + ssigpTa->SetBinContent(3847,0.0192152); + ssigpTa->SetBinContent(3848,0.0192152); + ssigpTa->SetBinContent(3849,0.0192152); + ssigpTa->SetBinContent(3850,0.0192152); + ssigpTa->SetBinContent(3851,0.0192152); + ssigpTa->SetBinContent(3852,0.0192192); + ssigpTa->SetBinContent(3853,0.0192192); + ssigpTa->SetBinContent(3854,0.0192248); + ssigpTa->SetBinContent(3855,0.0192328); + ssigpTa->SetBinContent(3856,0.0192416); + ssigpTa->SetBinContent(3857,0.0192552); + ssigpTa->SetBinContent(3858,0.0192784); + ssigpTa->SetBinContent(3859,0.019292); + ssigpTa->SetBinContent(3860,0.0192952); + ssigpTa->SetBinContent(3861,0.0193032); + ssigpTa->SetBinContent(3862,0.0193088); + ssigpTa->SetBinContent(3863,0.0193144); + ssigpTa->SetBinContent(3864,0.0193216); + ssigpTa->SetBinContent(3865,0.0193352); + ssigpTa->SetBinContent(3866,0.0193608); + ssigpTa->SetBinContent(3867,0.01938); + ssigpTa->SetBinContent(3868,0.0193888); + ssigpTa->SetBinContent(3869,0.0193944); + ssigpTa->SetBinContent(3870,0.0194); + ssigpTa->SetBinContent(3871,0.019412); + ssigpTa->SetBinContent(3872,0.0194448); + ssigpTa->SetBinContent(3873,0.019464); + ssigpTa->SetBinContent(3874,0.0194768); + ssigpTa->SetBinContent(3875,0.0194856); + ssigpTa->SetBinContent(3876,0.0194976); + ssigpTa->SetBinContent(3877,0.0195216); + ssigpTa->SetBinContent(3878,0.0195352); + ssigpTa->SetBinContent(3879,0.0195584); + ssigpTa->SetBinContent(3880,0.01958); + ssigpTa->SetBinContent(3881,0.0196016); + ssigpTa->SetBinContent(3882,0.0196208); + ssigpTa->SetBinContent(3883,0.0196424); + ssigpTa->SetBinContent(3884,0.0196656); + ssigpTa->SetBinContent(3885,0.0196896); + ssigpTa->SetBinContent(3886,0.0197048); + ssigpTa->SetBinContent(3887,0.0197272); + ssigpTa->SetBinContent(3888,0.0197584); + ssigpTa->SetBinContent(3889,0.0197816); + ssigpTa->SetBinContent(3890,0.019796); + ssigpTa->SetBinContent(3891,0.0198152); + ssigpTa->SetBinContent(3892,0.0198464); + ssigpTa->SetBinContent(3893,0.0198728); + ssigpTa->SetBinContent(3894,0.0198976); + ssigpTa->SetBinContent(3895,0.0199264); + ssigpTa->SetBinContent(3896,0.0199568); + ssigpTa->SetBinContent(3897,0.0199832); + ssigpTa->SetBinContent(3898,0.0200232); + ssigpTa->SetBinContent(3899,0.0200488); + ssigpTa->SetBinContent(3900,0.020076); + ssigpTa->SetBinContent(3901,0.0201024); + ssigpTa->SetBinContent(3902,0.0201272); + ssigpTa->SetBinContent(3903,0.020172); + ssigpTa->SetBinContent(3904,0.020204); + ssigpTa->SetBinContent(3905,0.020244); + ssigpTa->SetBinContent(3906,0.0202664); + ssigpTa->SetBinContent(3907,0.0203008); + ssigpTa->SetBinContent(3908,0.0203352); + ssigpTa->SetBinContent(3909,0.0203664); + ssigpTa->SetBinContent(3910,0.0204136); + ssigpTa->SetBinContent(3911,0.0204544); + ssigpTa->SetBinContent(3912,0.0204952); + ssigpTa->SetBinContent(3913,0.0205272); + ssigpTa->SetBinContent(3914,0.0205704); + ssigpTa->SetBinContent(3915,0.020596); + ssigpTa->SetBinContent(3916,0.0206504); + ssigpTa->SetBinContent(3917,0.020684); + ssigpTa->SetBinContent(3918,0.0207384); + ssigpTa->SetBinContent(3919,0.0207696); + ssigpTa->SetBinContent(3920,0.02082); + ssigpTa->SetBinContent(3921,0.0208576); + ssigpTa->SetBinContent(3922,0.020908); + ssigpTa->SetBinContent(3923,0.0209464); + ssigpTa->SetBinContent(3924,0.021); + ssigpTa->SetBinContent(3925,0.0210504); + ssigpTa->SetBinContent(3926,0.0210976); + ssigpTa->SetBinContent(3927,0.0211496); + ssigpTa->SetBinContent(3928,0.0212072); + ssigpTa->SetBinContent(3929,0.021244); + ssigpTa->SetBinContent(3930,0.0212984); + ssigpTa->SetBinContent(3931,0.0213408); + ssigpTa->SetBinContent(3932,0.0213992); + ssigpTa->SetBinContent(3933,0.021456); + ssigpTa->SetBinContent(3934,0.0215168); + ssigpTa->SetBinContent(3935,0.0215736); + ssigpTa->SetBinContent(3936,0.0216328); + ssigpTa->SetBinContent(3937,0.021696); + ssigpTa->SetBinContent(3938,0.0217512); + ssigpTa->SetBinContent(3939,0.021812); + ssigpTa->SetBinContent(3940,0.0218752); + ssigpTa->SetBinContent(3941,0.0219672); + ssigpTa->SetBinContent(3942,0.0223056); + ssigpTa->SetBinContent(3943,0.0237456); + ssigpTa->SetBinContent(3944,0.0262816); + ssigpTa->SetBinContent(3945,0.02768); + ssigpTa->SetBinContent(3946,0.0279776); + ssigpTa->SetBinContent(3947,0.0280496); + ssigpTa->SetBinContent(3948,0.0281184); + ssigpTa->SetBinContent(3949,0.028188); + ssigpTa->SetBinContent(3950,0.0282616); + ssigpTa->SetBinContent(3951,0.0283144); + ssigpTa->SetBinContent(3952,0.0283832); + ssigpTa->SetBinContent(3953,0.02828); + ssigpTa->SetBinContent(3954,0.027344); + ssigpTa->SetBinContent(3955,0.0256728); + ssigpTa->SetBinContent(3956,0.0250944); + ssigpTa->SetBinContent(3957,0.0254816); + ssigpTa->SetBinContent(3958,0.0260336); + ssigpTa->SetBinContent(3959,0.0265864); + ssigpTa->SetBinContent(3960,0.0271416); + ssigpTa->SetBinContent(3961,0.0277016); + ssigpTa->SetBinContent(3962,0.0280824); + ssigpTa->SetBinContent(3963,0.0275784); + ssigpTa->SetBinContent(3964,0.02616); + ssigpTa->SetBinContent(3965,0.0255664); + ssigpTa->SetBinContent(3966,0.0257864); + ssigpTa->SetBinContent(3967,0.0262512); + ssigpTa->SetBinContent(3968,0.0267936); + ssigpTa->SetBinContent(3969,0.027372); + ssigpTa->SetBinContent(3970,0.0279568); + ssigpTa->SetBinContent(3971,0.0285504); + ssigpTa->SetBinContent(3972,0.029168); + ssigpTa->SetBinContent(3973,0.0295928); + ssigpTa->SetBinContent(3974,0.0290008); + ssigpTa->SetBinContent(3975,0.0273672); + ssigpTa->SetBinContent(3976,0.0267208); + ssigpTa->SetBinContent(3977,0.0270744); + ssigpTa->SetBinContent(3978,0.0276328); + ssigpTa->SetBinContent(3979,0.0282); + ssigpTa->SetBinContent(3980,0.0287816); + ssigpTa->SetBinContent(3981,0.0293568); + ssigpTa->SetBinContent(3982,0.0297856); + ssigpTa->SetBinContent(3983,0.0300984); + ssigpTa->SetBinContent(3984,0.0303552); + ssigpTa->SetBinContent(3985,0.0296736); + ssigpTa->SetBinContent(3986,0.0279224); + ssigpTa->SetBinContent(3987,0.027208); + ssigpTa->SetBinContent(3988,0.0275608); + ssigpTa->SetBinContent(3989,0.0281408); + ssigpTa->SetBinContent(3990,0.0287448); + ssigpTa->SetBinContent(3991,0.0293472); + ssigpTa->SetBinContent(3992,0.029976); + ssigpTa->SetBinContent(3993,0.0306024); + ssigpTa->SetBinContent(3994,0.0312464); + ssigpTa->SetBinContent(3995,0.0318952); + ssigpTa->SetBinContent(3996,0.0323768); + ssigpTa->SetBinContent(3997,0.031872); + ssigpTa->SetBinContent(3998,0.0303656); + ssigpTa->SetBinContent(3999,0.0297392); + ssigpTa->SetBinContent(4000,0.0296896); + ssigpTa->SetBinContent(4001,0.0294176); + ssigpTa->SetBinContent(4002,0.0295472); + ssigpTa->SetBinContent(4003,0.0300696); + ssigpTa->SetBinContent(4004,0.030704); + ssigpTa->SetBinContent(4005,0.0313432); + ssigpTa->SetBinContent(4006,0.031996); + ssigpTa->SetBinContent(4007,0.0324992); + ssigpTa->SetBinContent(4008,0.0321568); + ssigpTa->SetBinContent(4009,0.0309504); + ssigpTa->SetBinContent(4010,0.0305648); + ssigpTa->SetBinContent(4011,0.0310688); + ssigpTa->SetBinContent(4012,0.0318016); + ssigpTa->SetBinContent(4013,0.0325048); + ssigpTa->SetBinContent(4014,0.0331336); + ssigpTa->SetBinContent(4015,0.0335488); + ssigpTa->SetBinContent(4016,0.0337616); + ssigpTa->SetBinContent(4017,0.034196); + ssigpTa->SetBinContent(4018,0.034852); + ssigpTa->SetBinContent(4019,0.0355712); + ssigpTa->SetBinContent(4020,0.0361864); + ssigpTa->SetBinContent(4021,0.0362712); + ssigpTa->SetBinContent(4022,0.0356472); + ssigpTa->SetBinContent(4023,0.0347712); + ssigpTa->SetBinContent(4024,0.033648); + ssigpTa->SetBinContent(4025,0.0333616); + ssigpTa->SetBinContent(4026,0.0338312); + ssigpTa->SetBinContent(4027,0.0344792); + ssigpTa->SetBinContent(4028,0.0351496); + ssigpTa->SetBinContent(4029,0.0358016); + ssigpTa->SetBinContent(4030,0.0364264); + ssigpTa->SetBinContent(4031,0.0370752); + ssigpTa->SetBinContent(4032,0.0377576); + ssigpTa->SetBinContent(4033,0.0384856); + ssigpTa->SetBinContent(4034,0.0392424); + ssigpTa->SetBinContent(4035,0.039996); + ssigpTa->SetBinContent(4036,0.0407648); + ssigpTa->SetBinContent(4037,0.0415504); + ssigpTa->SetBinContent(4038,0.0424472); + ssigpTa->SetBinContent(4039,0.0434616); + ssigpTa->SetBinContent(4040,0.044444); + ssigpTa->SetBinContent(4041,0.0453456); + ssigpTa->SetBinContent(4042,0.0461712); + ssigpTa->SetBinContent(4043,0.0469032); + ssigpTa->SetBinContent(4044,0.0477344); + ssigpTa->SetBinContent(4045,0.0486704); + ssigpTa->SetBinContent(4046,0.04966); + ssigpTa->SetBinContent(4047,0.0506568); + ssigpTa->SetBinContent(4048,0.0517032); + ssigpTa->SetBinContent(4049,0.0529152); + ssigpTa->SetBinContent(4050,0.0543048); + ssigpTa->SetBinContent(4051,0.0556112); + ssigpTa->SetBinContent(4052,0.0567992); + ssigpTa->SetBinContent(4053,0.057812); + ssigpTa->SetBinContent(4054,0.0586488); + ssigpTa->SetBinContent(4055,0.0596456); + ssigpTa->SetBinContent(4056,0.0608248); + ssigpTa->SetBinContent(4057,0.0620672); + ssigpTa->SetBinContent(4058,0.063356); + ssigpTa->SetBinContent(4059,0.064684); + ssigpTa->SetBinContent(4060,0.0659776); + ssigpTa->SetBinContent(4061,0.066964); + ssigpTa->SetBinContent(4062,0.0676016); + ssigpTa->SetBinContent(4063,0.06856); + ssigpTa->SetBinContent(4064,0.0696336); + ssigpTa->SetBinContent(4065,0.0705744); + ssigpTa->SetBinContent(4066,0.0717704); + ssigpTa->SetBinContent(4067,0.0732312); + ssigpTa->SetBinContent(4068,0.0747824); + ssigpTa->SetBinContent(4069,0.0763504); + ssigpTa->SetBinContent(4070,0.0779328); + ssigpTa->SetBinContent(4071,0.0795384); + ssigpTa->SetBinContent(4072,0.0811752); + ssigpTa->SetBinContent(4073,0.0828608); + ssigpTa->SetBinContent(4074,0.0844672); + ssigpTa->SetBinContent(4075,0.0859256); + ssigpTa->SetBinContent(4076,0.0875384); + ssigpTa->SetBinContent(4077,0.089364); + ssigpTa->SetBinContent(4078,0.0912448); + ssigpTa->SetBinContent(4079,0.0931616); + ssigpTa->SetBinContent(4080,0.0950992); + ssigpTa->SetBinContent(4081,0.0970912); + ssigpTa->SetBinContent(4082,0.0991632); + ssigpTa->SetBinContent(4083,0.101287); + ssigpTa->SetBinContent(4084,0.103433); + ssigpTa->SetBinContent(4085,0.10565); + ssigpTa->SetBinContent(4086,0.107888); + ssigpTa->SetBinContent(4087,0.110123); + ssigpTa->SetBinContent(4088,0.112458); + ssigpTa->SetBinContent(4089,0.114885); + ssigpTa->SetBinContent(4090,0.117331); + ssigpTa->SetBinContent(4091,0.119882); + ssigpTa->SetBinContent(4092,0.122594); + ssigpTa->SetBinContent(4093,0.125456); + ssigpTa->SetBinContent(4094,0.12837); + ssigpTa->SetBinContent(4095,0.13131); + ssigpTa->SetBinContent(4096,0.134298); + ssigpTa->SetBinContent(4097,0.137481); + ssigpTa->SetBinContent(4098,0.141395); + ssigpTa->SetBinContent(4099,0.146038); + ssigpTa->SetBinContent(4100,0.15009); + ssigpTa->SetBinContent(4101,0.153663); + ssigpTa->SetBinContent(4102,0.157744); + ssigpTa->SetBinContent(4103,0.16251); + ssigpTa->SetBinContent(4104,0.166987); + ssigpTa->SetBinContent(4105,0.171075); + ssigpTa->SetBinContent(4106,0.175131); + ssigpTa->SetBinContent(4107,0.17893); + ssigpTa->SetBinContent(4108,0.181618); + ssigpTa->SetBinContent(4111,0.0216911); + ssigpTa->SetBinContent(4112,0.0214608); + ssigpTa->SetBinContent(4113,0.021434); + ssigpTa->SetBinContent(4114,0.021434); + ssigpTa->SetBinContent(4115,0.021434); + ssigpTa->SetBinContent(4116,0.021434); + ssigpTa->SetBinContent(4117,0.021434); + ssigpTa->SetBinContent(4118,0.0214404); + ssigpTa->SetBinContent(4119,0.0214468); + ssigpTa->SetBinContent(4120,0.0214532); + ssigpTa->SetBinContent(4121,0.0214532); + ssigpTa->SetBinContent(4122,0.0214532); + ssigpTa->SetBinContent(4123,0.0214532); + ssigpTa->SetBinContent(4124,0.0214532); + ssigpTa->SetBinContent(4125,0.0214612); + ssigpTa->SetBinContent(4126,0.0214692); + ssigpTa->SetBinContent(4127,0.0214772); + ssigpTa->SetBinContent(4128,0.0214772); + ssigpTa->SetBinContent(4129,0.02148); + ssigpTa->SetBinContent(4130,0.0214836); + ssigpTa->SetBinContent(4131,0.0214972); + ssigpTa->SetBinContent(4132,0.0215216); + ssigpTa->SetBinContent(4133,0.0215352); + ssigpTa->SetBinContent(4134,0.0215388); + ssigpTa->SetBinContent(4135,0.0215388); + ssigpTa->SetBinContent(4136,0.0215416); + ssigpTa->SetBinContent(4137,0.0215496); + ssigpTa->SetBinContent(4138,0.0215692); + ssigpTa->SetBinContent(4139,0.0215908); + ssigpTa->SetBinContent(4140,0.0216152); + ssigpTa->SetBinContent(4141,0.0216288); + ssigpTa->SetBinContent(4142,0.0216352); + ssigpTa->SetBinContent(4143,0.0216352); + ssigpTa->SetBinContent(4144,0.0216352); + ssigpTa->SetBinContent(4145,0.0216532); + ssigpTa->SetBinContent(4146,0.0216776); + ssigpTa->SetBinContent(4147,0.02171); + ssigpTa->SetBinContent(4148,0.0217172); + ssigpTa->SetBinContent(4149,0.0217208); + ssigpTa->SetBinContent(4150,0.02173); + ssigpTa->SetBinContent(4151,0.02174); + ssigpTa->SetBinContent(4152,0.0217616); + ssigpTa->SetBinContent(4153,0.0217876); + ssigpTa->SetBinContent(4154,0.021812); + ssigpTa->SetBinContent(4155,0.0218336); + ssigpTa->SetBinContent(4156,0.0218472); + ssigpTa->SetBinContent(4157,0.021876); + ssigpTa->SetBinContent(4158,0.0218976); + ssigpTa->SetBinContent(4159,0.0219156); + ssigpTa->SetBinContent(4160,0.0219284); + ssigpTa->SetBinContent(4161,0.021942); + ssigpTa->SetBinContent(4162,0.0219744); + ssigpTa->SetBinContent(4163,0.0219988); + ssigpTa->SetBinContent(4164,0.022014); + ssigpTa->SetBinContent(4165,0.0220276); + ssigpTa->SetBinContent(4166,0.0220708); + ssigpTa->SetBinContent(4167,0.022096); + ssigpTa->SetBinContent(4168,0.0221212); + ssigpTa->SetBinContent(4169,0.0221484); + ssigpTa->SetBinContent(4170,0.0221736); + ssigpTa->SetBinContent(4171,0.0222016); + ssigpTa->SetBinContent(4172,0.022234); + ssigpTa->SetBinContent(4173,0.0222568); + ssigpTa->SetBinContent(4174,0.0222864); + ssigpTa->SetBinContent(4175,0.022308); + ssigpTa->SetBinContent(4176,0.0223468); + ssigpTa->SetBinContent(4177,0.0223756); + ssigpTa->SetBinContent(4178,0.0224208); + ssigpTa->SetBinContent(4179,0.022446); + ssigpTa->SetBinContent(4180,0.022474); + ssigpTa->SetBinContent(4181,0.0225064); + ssigpTa->SetBinContent(4182,0.0225424); + ssigpTa->SetBinContent(4183,0.022574); + ssigpTa->SetBinContent(4184,0.0226128); + ssigpTa->SetBinContent(4185,0.0226508); + ssigpTa->SetBinContent(4186,0.0226868); + ssigpTa->SetBinContent(4187,0.0227212); + ssigpTa->SetBinContent(4188,0.0227544); + ssigpTa->SetBinContent(4189,0.0227996); + ssigpTa->SetBinContent(4190,0.0228284); + ssigpTa->SetBinContent(4191,0.0228852); + ssigpTa->SetBinContent(4192,0.0229168); + ssigpTa->SetBinContent(4193,0.0229708); + ssigpTa->SetBinContent(4194,0.0230024); + ssigpTa->SetBinContent(4195,0.0230512); + ssigpTa->SetBinContent(4196,0.023088); + ssigpTa->SetBinContent(4197,0.0231368); + ssigpTa->SetBinContent(4198,0.0231908); + ssigpTa->SetBinContent(4199,0.0232368); + ssigpTa->SetBinContent(4200,0.0232748); + ssigpTa->SetBinContent(4201,0.0233236); + ssigpTa->SetBinContent(4202,0.0233696); + ssigpTa->SetBinContent(4203,0.0234236); + ssigpTa->SetBinContent(4204,0.0234552); + ssigpTa->SetBinContent(4205,0.023512); + ssigpTa->SetBinContent(4206,0.0235616); + ssigpTa->SetBinContent(4207,0.0236256); + ssigpTa->SetBinContent(4208,0.023686); + ssigpTa->SetBinContent(4209,0.0237392); + ssigpTa->SetBinContent(4210,0.0238076); + ssigpTa->SetBinContent(4211,0.02386); + ssigpTa->SetBinContent(4212,0.0239132); + ssigpTa->SetBinContent(4213,0.0239736); + ssigpTa->SetBinContent(4214,0.0240412); + ssigpTa->SetBinContent(4215,0.0241144); + ssigpTa->SetBinContent(4216,0.0244668); + ssigpTa->SetBinContent(4217,0.0260984); + ssigpTa->SetBinContent(4218,0.0292664); + ssigpTa->SetBinContent(4219,0.0308736); + ssigpTa->SetBinContent(4220,0.0311932); + ssigpTa->SetBinContent(4221,0.0312716); + ssigpTa->SetBinContent(4222,0.0313312); + ssigpTa->SetBinContent(4223,0.0314016); + ssigpTa->SetBinContent(4224,0.0314736); + ssigpTa->SetBinContent(4225,0.0315376); + ssigpTa->SetBinContent(4226,0.0315908); + ssigpTa->SetBinContent(4227,0.0314792); + ssigpTa->SetBinContent(4228,0.0303888); + ssigpTa->SetBinContent(4229,0.0282352); + ssigpTa->SetBinContent(4230,0.0276088); + ssigpTa->SetBinContent(4231,0.0280624); + ssigpTa->SetBinContent(4232,0.028706); + ssigpTa->SetBinContent(4233,0.0293272); + ssigpTa->SetBinContent(4234,0.0299752); + ssigpTa->SetBinContent(4235,0.0306268); + ssigpTa->SetBinContent(4236,0.0310804); + ssigpTa->SetBinContent(4237,0.0305064); + ssigpTa->SetBinContent(4238,0.02865); + ssigpTa->SetBinContent(4239,0.0279708); + ssigpTa->SetBinContent(4240,0.02827); + ssigpTa->SetBinContent(4241,0.028826); + ssigpTa->SetBinContent(4242,0.0294552); + ssigpTa->SetBinContent(4243,0.0301168); + ssigpTa->SetBinContent(4244,0.0307884); + ssigpTa->SetBinContent(4245,0.0314876); + ssigpTa->SetBinContent(4246,0.0321924); + ssigpTa->SetBinContent(4247,0.032692); + ssigpTa->SetBinContent(4248,0.032028); + ssigpTa->SetBinContent(4249,0.0298944); + ssigpTa->SetBinContent(4250,0.0291548); + ssigpTa->SetBinContent(4251,0.0295592); + ssigpTa->SetBinContent(4252,0.030192); + ssigpTa->SetBinContent(4253,0.0308392); + ssigpTa->SetBinContent(4254,0.03151); + ssigpTa->SetBinContent(4255,0.0321688); + ssigpTa->SetBinContent(4256,0.0327452); + ssigpTa->SetBinContent(4257,0.0332696); + ssigpTa->SetBinContent(4258,0.0336212); + ssigpTa->SetBinContent(4259,0.0328708); + ssigpTa->SetBinContent(4260,0.0306056); + ssigpTa->SetBinContent(4261,0.0297896); + ssigpTa->SetBinContent(4262,0.0301804); + ssigpTa->SetBinContent(4263,0.0308288); + ssigpTa->SetBinContent(4264,0.0314844); + ssigpTa->SetBinContent(4265,0.0321688); + ssigpTa->SetBinContent(4266,0.032862); + ssigpTa->SetBinContent(4267,0.0335804); + ssigpTa->SetBinContent(4268,0.0342864); + ssigpTa->SetBinContent(4269,0.035022); + ssigpTa->SetBinContent(4270,0.0355408); + ssigpTa->SetBinContent(4271,0.0349492); + ssigpTa->SetBinContent(4272,0.0329124); + ssigpTa->SetBinContent(4273,0.0321904); + ssigpTa->SetBinContent(4274,0.0322624); + ssigpTa->SetBinContent(4275,0.032316); + ssigpTa->SetBinContent(4276,0.032594); + ssigpTa->SetBinContent(4277,0.0332108); + ssigpTa->SetBinContent(4278,0.0339148); + ssigpTa->SetBinContent(4279,0.0346316); + ssigpTa->SetBinContent(4280,0.0353564); + ssigpTa->SetBinContent(4281,0.0359084); + ssigpTa->SetBinContent(4282,0.0354844); + ssigpTa->SetBinContent(4283,0.0337844); + ssigpTa->SetBinContent(4284,0.0332884); + ssigpTa->SetBinContent(4285,0.0337816); + ssigpTa->SetBinContent(4286,0.0344408); + ssigpTa->SetBinContent(4287,0.035176); + ssigpTa->SetBinContent(4288,0.0358676); + ssigpTa->SetBinContent(4289,0.0363904); + ssigpTa->SetBinContent(4290,0.0367772); + ssigpTa->SetBinContent(4291,0.0373268); + ssigpTa->SetBinContent(4292,0.0380716); + ssigpTa->SetBinContent(4293,0.0388684); + ssigpTa->SetBinContent(4294,0.0395492); + ssigpTa->SetBinContent(4295,0.0395788); + ssigpTa->SetBinContent(4296,0.0385684); + ssigpTa->SetBinContent(4297,0.0377404); + ssigpTa->SetBinContent(4298,0.0370024); + ssigpTa->SetBinContent(4299,0.0369304); + ssigpTa->SetBinContent(4300,0.0375092); + ssigpTa->SetBinContent(4301,0.038258); + ssigpTa->SetBinContent(4302,0.039016); + ssigpTa->SetBinContent(4303,0.039698); + ssigpTa->SetBinContent(4304,0.0402108); + ssigpTa->SetBinContent(4305,0.0408864); + ssigpTa->SetBinContent(4306,0.0416588); + ssigpTa->SetBinContent(4307,0.0424924); + ssigpTa->SetBinContent(4308,0.0433476); + ssigpTa->SetBinContent(4309,0.0442164); + ssigpTa->SetBinContent(4310,0.0450868); + ssigpTa->SetBinContent(4311,0.0460068); + ssigpTa->SetBinContent(4312,0.0471016); + ssigpTa->SetBinContent(4313,0.0485264); + ssigpTa->SetBinContent(4314,0.0497336); + ssigpTa->SetBinContent(4315,0.0507868); + ssigpTa->SetBinContent(4316,0.0516372); + ssigpTa->SetBinContent(4317,0.052196); + ssigpTa->SetBinContent(4318,0.05305); + ssigpTa->SetBinContent(4319,0.0541248); + ssigpTa->SetBinContent(4320,0.0552464); + ssigpTa->SetBinContent(4321,0.0563924); + ssigpTa->SetBinContent(4322,0.0576076); + ssigpTa->SetBinContent(4323,0.0590616); + ssigpTa->SetBinContent(4324,0.0609096); + ssigpTa->SetBinContent(4325,0.0624824); + ssigpTa->SetBinContent(4326,0.0638372); + ssigpTa->SetBinContent(4327,0.0649012); + ssigpTa->SetBinContent(4328,0.065518); + ssigpTa->SetBinContent(4329,0.0665684); + ssigpTa->SetBinContent(4330,0.0679052); + ssigpTa->SetBinContent(4331,0.0693248); + ssigpTa->SetBinContent(4332,0.070794); + ssigpTa->SetBinContent(4333,0.0723144); + ssigpTa->SetBinContent(4334,0.0738384); + ssigpTa->SetBinContent(4335,0.0751556); + ssigpTa->SetBinContent(4336,0.0764032); + ssigpTa->SetBinContent(4337,0.0776896); + ssigpTa->SetBinContent(4338,0.0788724); + ssigpTa->SetBinContent(4339,0.0795936); + ssigpTa->SetBinContent(4340,0.080886); + ssigpTa->SetBinContent(4341,0.0825692); + ssigpTa->SetBinContent(4342,0.084364); + ssigpTa->SetBinContent(4343,0.0861884); + ssigpTa->SetBinContent(4344,0.0880388); + ssigpTa->SetBinContent(4345,0.0899028); + ssigpTa->SetBinContent(4346,0.0918216); + ssigpTa->SetBinContent(4347,0.0938004); + ssigpTa->SetBinContent(4348,0.095692); + ssigpTa->SetBinContent(4349,0.097076); + ssigpTa->SetBinContent(4350,0.0988796); + ssigpTa->SetBinContent(4351,0.100978); + ssigpTa->SetBinContent(4352,0.10318); + ssigpTa->SetBinContent(4353,0.105408); + ssigpTa->SetBinContent(4354,0.107668); + ssigpTa->SetBinContent(4355,0.109978); + ssigpTa->SetBinContent(4356,0.112396); + ssigpTa->SetBinContent(4357,0.114914); + ssigpTa->SetBinContent(4358,0.117539); + ssigpTa->SetBinContent(4359,0.12017); + ssigpTa->SetBinContent(4360,0.122816); + ssigpTa->SetBinContent(4361,0.125474); + ssigpTa->SetBinContent(4362,0.128226); + ssigpTa->SetBinContent(4363,0.131047); + ssigpTa->SetBinContent(4364,0.133923); + ssigpTa->SetBinContent(4365,0.136876); + ssigpTa->SetBinContent(4366,0.140061); + ssigpTa->SetBinContent(4367,0.143386); + ssigpTa->SetBinContent(4368,0.146775); + ssigpTa->SetBinContent(4369,0.150217); + ssigpTa->SetBinContent(4370,0.153689); + ssigpTa->SetBinContent(4371,0.157404); + ssigpTa->SetBinContent(4372,0.161963); + ssigpTa->SetBinContent(4373,0.167546); + ssigpTa->SetBinContent(4374,0.17227); + ssigpTa->SetBinContent(4375,0.176449); + ssigpTa->SetBinContent(4376,0.181259); + ssigpTa->SetBinContent(4377,0.187122); + ssigpTa->SetBinContent(4378,0.192396); + ssigpTa->SetBinContent(4379,0.19718); + ssigpTa->SetBinContent(4380,0.201913); + ssigpTa->SetBinContent(4381,0.206665); + ssigpTa->SetBinContent(4382,0.212544); + ssigpTa->SetBinContent(4385,0.0300322); + ssigpTa->SetBinContent(4386,0.02949); + ssigpTa->SetBinContent(4387,0.0292064); + ssigpTa->SetBinContent(4388,0.0292064); + ssigpTa->SetBinContent(4389,0.0292064); + ssigpTa->SetBinContent(4390,0.0292064); + ssigpTa->SetBinContent(4391,0.0292064); + ssigpTa->SetBinContent(4392,0.0292064); + ssigpTa->SetBinContent(4393,0.0292096); + ssigpTa->SetBinContent(4394,0.0292096); + ssigpTa->SetBinContent(4395,0.0292096); + ssigpTa->SetBinContent(4396,0.0292096); + ssigpTa->SetBinContent(4397,0.0292096); + ssigpTa->SetBinContent(4398,0.0292136); + ssigpTa->SetBinContent(4399,0.0292216); + ssigpTa->SetBinContent(4400,0.0292416); + ssigpTa->SetBinContent(4401,0.0292496); + ssigpTa->SetBinContent(4402,0.0292536); + ssigpTa->SetBinContent(4403,0.0292536); + ssigpTa->SetBinContent(4404,0.0292536); + ssigpTa->SetBinContent(4405,0.0292608); + ssigpTa->SetBinContent(4406,0.0292712); + ssigpTa->SetBinContent(4407,0.0292784); + ssigpTa->SetBinContent(4408,0.0292784); + ssigpTa->SetBinContent(4409,0.0292784); + ssigpTa->SetBinContent(4410,0.0293024); + ssigpTa->SetBinContent(4411,0.0293264); + ssigpTa->SetBinContent(4412,0.0293624); + ssigpTa->SetBinContent(4413,0.0293936); + ssigpTa->SetBinContent(4414,0.029408); + ssigpTa->SetBinContent(4415,0.0294152); + ssigpTa->SetBinContent(4416,0.0294152); + ssigpTa->SetBinContent(4417,0.0294152); + ssigpTa->SetBinContent(4418,0.0294192); + ssigpTa->SetBinContent(4419,0.0294272); + ssigpTa->SetBinContent(4420,0.0294576); + ssigpTa->SetBinContent(4421,0.0294728); + ssigpTa->SetBinContent(4422,0.029484); + ssigpTa->SetBinContent(4423,0.029484); + ssigpTa->SetBinContent(4424,0.029484); + ssigpTa->SetBinContent(4425,0.0294912); + ssigpTa->SetBinContent(4426,0.0295064); + ssigpTa->SetBinContent(4427,0.0295336); + ssigpTa->SetBinContent(4428,0.0295648); + ssigpTa->SetBinContent(4429,0.029588); + ssigpTa->SetBinContent(4430,0.0296152); + ssigpTa->SetBinContent(4431,0.0296304); + ssigpTa->SetBinContent(4432,0.0296576); + ssigpTa->SetBinContent(4433,0.0296688); + ssigpTa->SetBinContent(4434,0.0296728); + ssigpTa->SetBinContent(4435,0.029684); + ssigpTa->SetBinContent(4436,0.0297224); + ssigpTa->SetBinContent(4437,0.0297496); + ssigpTa->SetBinContent(4438,0.0297576); + ssigpTa->SetBinContent(4439,0.0297888); + ssigpTa->SetBinContent(4440,0.0298232); + ssigpTa->SetBinContent(4441,0.0298664); + ssigpTa->SetBinContent(4442,0.0298816); + ssigpTa->SetBinContent(4443,0.0299); + ssigpTa->SetBinContent(4444,0.0299152); + ssigpTa->SetBinContent(4445,0.0299424); + ssigpTa->SetBinContent(4446,0.0299608); + ssigpTa->SetBinContent(4447,0.029992); + ssigpTa->SetBinContent(4448,0.0300192); + ssigpTa->SetBinContent(4449,0.0300624); + ssigpTa->SetBinContent(4450,0.0300816); + ssigpTa->SetBinContent(4451,0.0301312); + ssigpTa->SetBinContent(4452,0.0301584); + ssigpTa->SetBinContent(4453,0.0301808); + ssigpTa->SetBinContent(4454,0.0302); + ssigpTa->SetBinContent(4455,0.0302432); + ssigpTa->SetBinContent(4456,0.0302816); + ssigpTa->SetBinContent(4457,0.0303168); + ssigpTa->SetBinContent(4458,0.0303472); + ssigpTa->SetBinContent(4459,0.0303736); + ssigpTa->SetBinContent(4460,0.030396); + ssigpTa->SetBinContent(4461,0.0304592); + ssigpTa->SetBinContent(4462,0.0304976); + ssigpTa->SetBinContent(4463,0.0305328); + ssigpTa->SetBinContent(4464,0.0305744); + ssigpTa->SetBinContent(4465,0.0305976); + ssigpTa->SetBinContent(4466,0.0306552); + ssigpTa->SetBinContent(4467,0.0306904); + ssigpTa->SetBinContent(4468,0.030736); + ssigpTa->SetBinContent(4469,0.0307672); + ssigpTa->SetBinContent(4470,0.0308208); + ssigpTa->SetBinContent(4471,0.030872); + ssigpTa->SetBinContent(4472,0.0309216); + ssigpTa->SetBinContent(4473,0.030972); + ssigpTa->SetBinContent(4474,0.0309984); + ssigpTa->SetBinContent(4475,0.0310368); + ssigpTa->SetBinContent(4476,0.0310944); + ssigpTa->SetBinContent(4477,0.0311536); + ssigpTa->SetBinContent(4478,0.0311992); + ssigpTa->SetBinContent(4479,0.0312384); + ssigpTa->SetBinContent(4480,0.0313); + ssigpTa->SetBinContent(4481,0.0313536); + ssigpTa->SetBinContent(4482,0.0314032); + ssigpTa->SetBinContent(4483,0.0314856); + ssigpTa->SetBinContent(4484,0.0315392); + ssigpTa->SetBinContent(4485,0.0316008); + ssigpTa->SetBinContent(4486,0.0316472); + ssigpTa->SetBinContent(4487,0.0317088); + ssigpTa->SetBinContent(4488,0.0317824); + ssigpTa->SetBinContent(4489,0.0318272); + ssigpTa->SetBinContent(4490,0.0321432); + ssigpTa->SetBinContent(4491,0.0345472); + ssigpTa->SetBinContent(4492,0.03962); + ssigpTa->SetBinContent(4493,0.0420136); + ssigpTa->SetBinContent(4494,0.0423904); + ssigpTa->SetBinContent(4495,0.042456); + ssigpTa->SetBinContent(4496,0.0425136); + ssigpTa->SetBinContent(4497,0.0425992); + ssigpTa->SetBinContent(4498,0.042672); + ssigpTa->SetBinContent(4499,0.0427264); + ssigpTa->SetBinContent(4500,0.042816); + ssigpTa->SetBinContent(4501,0.0426616); + ssigpTa->SetBinContent(4502,0.0409664); + ssigpTa->SetBinContent(4503,0.0374248); + ssigpTa->SetBinContent(4504,0.0365176); + ssigpTa->SetBinContent(4505,0.0372864); + ssigpTa->SetBinContent(4506,0.0381888); + ssigpTa->SetBinContent(4507,0.0391152); + ssigpTa->SetBinContent(4508,0.0400456); + ssigpTa->SetBinContent(4509,0.0410032); + ssigpTa->SetBinContent(4510,0.0417288); + ssigpTa->SetBinContent(4511,0.0408072); + ssigpTa->SetBinContent(4512,0.0376712); + ssigpTa->SetBinContent(4513,0.0366288); + ssigpTa->SetBinContent(4514,0.0372056); + ssigpTa->SetBinContent(4515,0.0380512); + ssigpTa->SetBinContent(4516,0.0389736); + ssigpTa->SetBinContent(4517,0.0399184); + ssigpTa->SetBinContent(4518,0.0409032); + ssigpTa->SetBinContent(4519,0.041896); + ssigpTa->SetBinContent(4520,0.0429512); + ssigpTa->SetBinContent(4521,0.0437304); + ssigpTa->SetBinContent(4522,0.0426728); + ssigpTa->SetBinContent(4523,0.0391512); + ssigpTa->SetBinContent(4524,0.037944); + ssigpTa->SetBinContent(4525,0.0385744); + ssigpTa->SetBinContent(4526,0.0394768); + ssigpTa->SetBinContent(4527,0.0404024); + ssigpTa->SetBinContent(4528,0.0413512); + ssigpTa->SetBinContent(4529,0.0423232); + ssigpTa->SetBinContent(4530,0.0433288); + ssigpTa->SetBinContent(4531,0.04444); + ssigpTa->SetBinContent(4532,0.0452032); + ssigpTa->SetBinContent(4533,0.044016); + ssigpTa->SetBinContent(4534,0.040344); + ssigpTa->SetBinContent(4535,0.039032); + ssigpTa->SetBinContent(4536,0.0396344); + ssigpTa->SetBinContent(4537,0.040512); + ssigpTa->SetBinContent(4538,0.041396); + ssigpTa->SetBinContent(4539,0.0423088); + ssigpTa->SetBinContent(4540,0.043268); + ssigpTa->SetBinContent(4541,0.044252); + ssigpTa->SetBinContent(4542,0.0452352); + ssigpTa->SetBinContent(4543,0.0462304); + ssigpTa->SetBinContent(4544,0.0470032); + ssigpTa->SetBinContent(4545,0.0459472); + ssigpTa->SetBinContent(4546,0.0423808); + ssigpTa->SetBinContent(4547,0.0411784); + ssigpTa->SetBinContent(4548,0.0417368); + ssigpTa->SetBinContent(4549,0.042644); + ssigpTa->SetBinContent(4550,0.0434512); + ssigpTa->SetBinContent(4551,0.044336); + ssigpTa->SetBinContent(4552,0.0453032); + ssigpTa->SetBinContent(4553,0.0462624); + ssigpTa->SetBinContent(4554,0.0472576); + ssigpTa->SetBinContent(4555,0.0480352); + ssigpTa->SetBinContent(4556,0.0472048); + ssigpTa->SetBinContent(4557,0.0441728); + ssigpTa->SetBinContent(4558,0.0432136); + ssigpTa->SetBinContent(4559,0.0437416); + ssigpTa->SetBinContent(4560,0.0442984); + ssigpTa->SetBinContent(4561,0.0451008); + ssigpTa->SetBinContent(4562,0.0460312); + ssigpTa->SetBinContent(4563,0.0468936); + ssigpTa->SetBinContent(4564,0.0477776); + ssigpTa->SetBinContent(4565,0.0487072); + ssigpTa->SetBinContent(4566,0.049748); + ssigpTa->SetBinContent(4567,0.05082); + ssigpTa->SetBinContent(4568,0.051788); + ssigpTa->SetBinContent(4569,0.0515048); + ssigpTa->SetBinContent(4570,0.0494088); + ssigpTa->SetBinContent(4571,0.0486296); + ssigpTa->SetBinContent(4572,0.0488952); + ssigpTa->SetBinContent(4573,0.049476); + ssigpTa->SetBinContent(4574,0.0504); + ssigpTa->SetBinContent(4575,0.0514744); + ssigpTa->SetBinContent(4576,0.0525552); + ssigpTa->SetBinContent(4577,0.053324); + ssigpTa->SetBinContent(4578,0.0536304); + ssigpTa->SetBinContent(4579,0.0543992); + ssigpTa->SetBinContent(4580,0.0555048); + ssigpTa->SetBinContent(4581,0.056692); + ssigpTa->SetBinContent(4582,0.0578936); + ssigpTa->SetBinContent(4583,0.05912); + ssigpTa->SetBinContent(4584,0.0603696); + ssigpTa->SetBinContent(4585,0.06168); + ssigpTa->SetBinContent(4586,0.0634816); + ssigpTa->SetBinContent(4587,0.0660496); + ssigpTa->SetBinContent(4588,0.0680152); + ssigpTa->SetBinContent(4589,0.0695232); + ssigpTa->SetBinContent(4590,0.0704776); + ssigpTa->SetBinContent(4591,0.0706696); + ssigpTa->SetBinContent(4592,0.0716128); + ssigpTa->SetBinContent(4593,0.0731392); + ssigpTa->SetBinContent(4594,0.074744); + ssigpTa->SetBinContent(4595,0.0763808); + ssigpTa->SetBinContent(4596,0.0781048); + ssigpTa->SetBinContent(4597,0.0804096); + ssigpTa->SetBinContent(4598,0.0835384); + ssigpTa->SetBinContent(4599,0.0859952); + ssigpTa->SetBinContent(4600,0.087932); + ssigpTa->SetBinContent(4601,0.089128); + ssigpTa->SetBinContent(4602,0.0893216); + ssigpTa->SetBinContent(4603,0.0905064); + ssigpTa->SetBinContent(4604,0.0924064); + ssigpTa->SetBinContent(4605,0.0944136); + ssigpTa->SetBinContent(4606,0.0965024); + ssigpTa->SetBinContent(4607,0.0986824); + ssigpTa->SetBinContent(4608,0.100873); + ssigpTa->SetBinContent(4609,0.103267); + ssigpTa->SetBinContent(4610,0.106059); + ssigpTa->SetBinContent(4611,0.108449); + ssigpTa->SetBinContent(4612,0.109909); + ssigpTa->SetBinContent(4613,0.110258); + ssigpTa->SetBinContent(4614,0.111824); + ssigpTa->SetBinContent(4615,0.114264); + ssigpTa->SetBinContent(4616,0.116858); + ssigpTa->SetBinContent(4617,0.119527); + ssigpTa->SetBinContent(4618,0.1222); + ssigpTa->SetBinContent(4619,0.124936); + ssigpTa->SetBinContent(4620,0.127732); + ssigpTa->SetBinContent(4621,0.13073); + ssigpTa->SetBinContent(4622,0.133384); + ssigpTa->SetBinContent(4623,0.134858); + ssigpTa->SetBinContent(4624,0.137171); + ssigpTa->SetBinContent(4625,0.140245); + ssigpTa->SetBinContent(4626,0.143434); + ssigpTa->SetBinContent(4627,0.146689); + ssigpTa->SetBinContent(4628,0.149976); + ssigpTa->SetBinContent(4629,0.153337); + ssigpTa->SetBinContent(4630,0.156866); + ssigpTa->SetBinContent(4631,0.160656); + ssigpTa->SetBinContent(4632,0.164721); + ssigpTa->SetBinContent(4633,0.168678); + ssigpTa->SetBinContent(4634,0.172592); + ssigpTa->SetBinContent(4635,0.176554); + ssigpTa->SetBinContent(4636,0.180613); + ssigpTa->SetBinContent(4637,0.184743); + ssigpTa->SetBinContent(4638,0.188902); + ssigpTa->SetBinContent(4639,0.193249); + ssigpTa->SetBinContent(4640,0.197861); + ssigpTa->SetBinContent(4641,0.20271); + ssigpTa->SetBinContent(4642,0.207654); + ssigpTa->SetBinContent(4643,0.212632); + ssigpTa->SetBinContent(4644,0.217709); + ssigpTa->SetBinContent(4645,0.223063); + ssigpTa->SetBinContent(4646,0.229761); + ssigpTa->SetBinContent(4647,0.238198); + ssigpTa->SetBinContent(4648,0.245158); + ssigpTa->SetBinContent(4649,0.251166); + ssigpTa->SetBinContent(4650,0.258366); + ssigpTa->SetBinContent(4651,0.267423); + ssigpTa->SetBinContent(4652,0.275315); + ssigpTa->SetBinContent(4653,0.282244); + ssigpTa->SetBinContent(4654,0.289138); + ssigpTa->SetBinContent(4655,0.298959); + ssigpTa->SetBinContent(4656,0.309827); + ssigpTa->SetBinContent(4659,0.0565328); + ssigpTa->SetBinContent(4660,0.0557579); + ssigpTa->SetBinContent(4661,0.0551436); + ssigpTa->SetBinContent(4662,0.0551436); + ssigpTa->SetBinContent(4663,0.0551436); + ssigpTa->SetBinContent(4664,0.0551436); + ssigpTa->SetBinContent(4665,0.0551436); + ssigpTa->SetBinContent(4666,0.0551436); + ssigpTa->SetBinContent(4667,0.0551436); + ssigpTa->SetBinContent(4668,0.0551436); + ssigpTa->SetBinContent(4669,0.0551436); + ssigpTa->SetBinContent(4670,0.0551436); + ssigpTa->SetBinContent(4671,0.0551436); + ssigpTa->SetBinContent(4672,0.0551436); + ssigpTa->SetBinContent(4673,0.0551516); + ssigpTa->SetBinContent(4674,0.0551596); + ssigpTa->SetBinContent(4675,0.0551676); + ssigpTa->SetBinContent(4676,0.0551676); + ssigpTa->SetBinContent(4677,0.0551676); + ssigpTa->SetBinContent(4678,0.0551676); + ssigpTa->SetBinContent(4679,0.0551676); + ssigpTa->SetBinContent(4680,0.0551712); + ssigpTa->SetBinContent(4681,0.0551712); + ssigpTa->SetBinContent(4682,0.0551712); + ssigpTa->SetBinContent(4683,0.0552112); + ssigpTa->SetBinContent(4684,0.0552592); + ssigpTa->SetBinContent(4685,0.0553632); + ssigpTa->SetBinContent(4686,0.0554112); + ssigpTa->SetBinContent(4687,0.0554352); + ssigpTa->SetBinContent(4688,0.0554468); + ssigpTa->SetBinContent(4689,0.0554468); + ssigpTa->SetBinContent(4690,0.0554468); + ssigpTa->SetBinContent(4691,0.0554468); + ssigpTa->SetBinContent(4692,0.0554468); + ssigpTa->SetBinContent(4693,0.0554548); + ssigpTa->SetBinContent(4694,0.0554628); + ssigpTa->SetBinContent(4695,0.0554744); + ssigpTa->SetBinContent(4696,0.0554744); + ssigpTa->SetBinContent(4697,0.0554744); + ssigpTa->SetBinContent(4698,0.0554744); + ssigpTa->SetBinContent(4699,0.0554744); + ssigpTa->SetBinContent(4700,0.0554824); + ssigpTa->SetBinContent(4701,0.055502); + ssigpTa->SetBinContent(4702,0.055526); + ssigpTa->SetBinContent(4703,0.055566); + ssigpTa->SetBinContent(4704,0.055582); + ssigpTa->SetBinContent(4705,0.0556016); + ssigpTa->SetBinContent(4706,0.0556096); + ssigpTa->SetBinContent(4707,0.0556176); + ssigpTa->SetBinContent(4708,0.0556176); + ssigpTa->SetBinContent(4709,0.0556576); + ssigpTa->SetBinContent(4710,0.0557092); + ssigpTa->SetBinContent(4711,0.0557572); + ssigpTa->SetBinContent(4712,0.0558132); + ssigpTa->SetBinContent(4713,0.0558292); + ssigpTa->SetBinContent(4714,0.0558808); + ssigpTa->SetBinContent(4715,0.0559048); + ssigpTa->SetBinContent(4716,0.0559208); + ssigpTa->SetBinContent(4717,0.0559244); + ssigpTa->SetBinContent(4718,0.0559324); + ssigpTa->SetBinContent(4719,0.0559404); + ssigpTa->SetBinContent(4720,0.05596); + ssigpTa->SetBinContent(4721,0.055976); + ssigpTa->SetBinContent(4722,0.056024); + ssigpTa->SetBinContent(4723,0.056048); + ssigpTa->SetBinContent(4724,0.0561076); + ssigpTa->SetBinContent(4725,0.0561556); + ssigpTa->SetBinContent(4726,0.0562072); + ssigpTa->SetBinContent(4727,0.0562152); + ssigpTa->SetBinContent(4728,0.0562712); + ssigpTa->SetBinContent(4729,0.0562988); + ssigpTa->SetBinContent(4730,0.0563468); + ssigpTa->SetBinContent(4731,0.0563708); + ssigpTa->SetBinContent(4732,0.0563904); + ssigpTa->SetBinContent(4733,0.0563984); + ssigpTa->SetBinContent(4734,0.056458); + ssigpTa->SetBinContent(4735,0.056522); + ssigpTa->SetBinContent(4736,0.05661); + ssigpTa->SetBinContent(4737,0.0566376); + ssigpTa->SetBinContent(4738,0.0566536); + ssigpTa->SetBinContent(4739,0.0567212); + ssigpTa->SetBinContent(4740,0.0567452); + ssigpTa->SetBinContent(4741,0.0567968); + ssigpTa->SetBinContent(4742,0.0568208); + ssigpTa->SetBinContent(4743,0.0568804); + ssigpTa->SetBinContent(4744,0.0569444); + ssigpTa->SetBinContent(4745,0.057012); + ssigpTa->SetBinContent(4746,0.057068); + ssigpTa->SetBinContent(4747,0.0571356); + ssigpTa->SetBinContent(4748,0.0571596); + ssigpTa->SetBinContent(4749,0.0571872); + ssigpTa->SetBinContent(4750,0.0572752); + ssigpTa->SetBinContent(4751,0.0573508); + ssigpTa->SetBinContent(4752,0.0574148); + ssigpTa->SetBinContent(4753,0.0574504); + ssigpTa->SetBinContent(4754,0.0575384); + ssigpTa->SetBinContent(4755,0.057574); + ssigpTa->SetBinContent(4756,0.0576496); + ssigpTa->SetBinContent(4757,0.0577216); + ssigpTa->SetBinContent(4758,0.0578212); + ssigpTa->SetBinContent(4759,0.0578568); + ssigpTa->SetBinContent(4760,0.0579368); + ssigpTa->SetBinContent(4761,0.0580284); + ssigpTa->SetBinContent(4762,0.058096); + ssigpTa->SetBinContent(4763,0.058072); + ssigpTa->SetBinContent(4764,0.0586152); + ssigpTa->SetBinContent(4765,0.0636028); + ssigpTa->SetBinContent(4766,0.0739944); + ssigpTa->SetBinContent(4767,0.079078); + ssigpTa->SetBinContent(4768,0.0797856); + ssigpTa->SetBinContent(4769,0.0798932); + ssigpTa->SetBinContent(4770,0.0799732); + ssigpTa->SetBinContent(4771,0.0800568); + ssigpTa->SetBinContent(4772,0.0801564); + ssigpTa->SetBinContent(4773,0.08028); + ssigpTa->SetBinContent(4774,0.08036); + ssigpTa->SetBinContent(4775,0.0799876); + ssigpTa->SetBinContent(4776,0.0762552); + ssigpTa->SetBinContent(4777,0.0689568); + ssigpTa->SetBinContent(4778,0.0669536); + ssigpTa->SetBinContent(4779,0.0685148); + ssigpTa->SetBinContent(4780,0.070364); + ssigpTa->SetBinContent(4781,0.0722016); + ssigpTa->SetBinContent(4782,0.0741148); + ssigpTa->SetBinContent(4783,0.076036); + ssigpTa->SetBinContent(4784,0.0774612); + ssigpTa->SetBinContent(4785,0.0753104); + ssigpTa->SetBinContent(4786,0.068782); + ssigpTa->SetBinContent(4787,0.0664676); + ssigpTa->SetBinContent(4788,0.067706); + ssigpTa->SetBinContent(4789,0.0694876); + ssigpTa->SetBinContent(4790,0.0713288); + ssigpTa->SetBinContent(4791,0.07325); + ssigpTa->SetBinContent(4792,0.0751872); + ssigpTa->SetBinContent(4793,0.077216); + ssigpTa->SetBinContent(4794,0.0792812); + ssigpTa->SetBinContent(4795,0.080814); + ssigpTa->SetBinContent(4796,0.0784108); + ssigpTa->SetBinContent(4797,0.0710696); + ssigpTa->SetBinContent(4798,0.0683508); + ssigpTa->SetBinContent(4799,0.069496); + ssigpTa->SetBinContent(4800,0.0713016); + ssigpTa->SetBinContent(4801,0.0731188); + ssigpTa->SetBinContent(4802,0.0750196); + ssigpTa->SetBinContent(4803,0.0769968); + ssigpTa->SetBinContent(4804,0.079342); + ssigpTa->SetBinContent(4805,0.0821412); + ssigpTa->SetBinContent(4806,0.083906); + ssigpTa->SetBinContent(4807,0.0813908); + ssigpTa->SetBinContent(4808,0.0737268); + ssigpTa->SetBinContent(4809,0.0708604); + ssigpTa->SetBinContent(4810,0.0719256); + ssigpTa->SetBinContent(4811,0.0735588); + ssigpTa->SetBinContent(4812,0.07524); + ssigpTa->SetBinContent(4813,0.0769488); + ssigpTa->SetBinContent(4814,0.078782); + ssigpTa->SetBinContent(4815,0.0806028); + ssigpTa->SetBinContent(4816,0.0825); + ssigpTa->SetBinContent(4817,0.0844088); + ssigpTa->SetBinContent(4818,0.0858296); + ssigpTa->SetBinContent(4819,0.083174); + ssigpTa->SetBinContent(4820,0.075528); + ssigpTa->SetBinContent(4821,0.0727132); + ssigpTa->SetBinContent(4822,0.07455); + ssigpTa->SetBinContent(4823,0.0777344); + ssigpTa->SetBinContent(4824,0.0801356); + ssigpTa->SetBinContent(4825,0.0819608); + ssigpTa->SetBinContent(4826,0.0837896); + ssigpTa->SetBinContent(4827,0.0856104); + ssigpTa->SetBinContent(4828,0.0874596); + ssigpTa->SetBinContent(4829,0.0888244); + ssigpTa->SetBinContent(4830,0.0866328); + ssigpTa->SetBinContent(4831,0.0799836); + ssigpTa->SetBinContent(4832,0.0775208); + ssigpTa->SetBinContent(4833,0.078042); + ssigpTa->SetBinContent(4834,0.0784628); + ssigpTa->SetBinContent(4835,0.0796116); + ssigpTa->SetBinContent(4836,0.0813284); + ssigpTa->SetBinContent(4837,0.0833012); + ssigpTa->SetBinContent(4838,0.085566); + ssigpTa->SetBinContent(4839,0.0877228); + ssigpTa->SetBinContent(4840,0.0897232); + ssigpTa->SetBinContent(4841,0.091784); + ssigpTa->SetBinContent(4842,0.0934724); + ssigpTa->SetBinContent(4843,0.0922248); + ssigpTa->SetBinContent(4844,0.087356); + ssigpTa->SetBinContent(4845,0.0864888); + ssigpTa->SetBinContent(4846,0.0892084); + ssigpTa->SetBinContent(4847,0.0916772); + ssigpTa->SetBinContent(4848,0.0937344); + ssigpTa->SetBinContent(4849,0.0958832); + ssigpTa->SetBinContent(4850,0.0979556); + ssigpTa->SetBinContent(4851,0.0990964); + ssigpTa->SetBinContent(4852,0.0990788); + ssigpTa->SetBinContent(4853,0.100228); + ssigpTa->SetBinContent(4854,0.102368); + ssigpTa->SetBinContent(4855,0.104681); + ssigpTa->SetBinContent(4856,0.107077); + ssigpTa->SetBinContent(4857,0.109501); + ssigpTa->SetBinContent(4858,0.111942); + ssigpTa->SetBinContent(4859,0.114658); + ssigpTa->SetBinContent(4860,0.118714); + ssigpTa->SetBinContent(4861,0.124518); + ssigpTa->SetBinContent(4862,0.128878); + ssigpTa->SetBinContent(4863,0.131841); + ssigpTa->SetBinContent(4864,0.133209); + ssigpTa->SetBinContent(4865,0.132704); + ssigpTa->SetBinContent(4866,0.134064); + ssigpTa->SetBinContent(4867,0.136947); + ssigpTa->SetBinContent(4868,0.140118); + ssigpTa->SetBinContent(4869,0.143369); + ssigpTa->SetBinContent(4870,0.14688); + ssigpTa->SetBinContent(4871,0.151859); + ssigpTa->SetBinContent(4872,0.158689); + ssigpTa->SetBinContent(4873,0.164011); + ssigpTa->SetBinContent(4874,0.167729); + ssigpTa->SetBinContent(4875,0.169511); + ssigpTa->SetBinContent(4876,0.1689); + ssigpTa->SetBinContent(4877,0.170634); + ssigpTa->SetBinContent(4878,0.174264); + ssigpTa->SetBinContent(4879,0.178222); + ssigpTa->SetBinContent(4880,0.182367); + ssigpTa->SetBinContent(4881,0.186625); + ssigpTa->SetBinContent(4882,0.191142); + ssigpTa->SetBinContent(4883,0.196779); + ssigpTa->SetBinContent(4884,0.203925); + ssigpTa->SetBinContent(4885,0.209562); + ssigpTa->SetBinContent(4886,0.212083); + ssigpTa->SetBinContent(4887,0.211868); + ssigpTa->SetBinContent(4888,0.214397); + ssigpTa->SetBinContent(4889,0.219193); + ssigpTa->SetBinContent(4890,0.224382); + ssigpTa->SetBinContent(4891,0.229726); + ssigpTa->SetBinContent(4892,0.235126); + ssigpTa->SetBinContent(4893,0.240594); + ssigpTa->SetBinContent(4894,0.246262); + ssigpTa->SetBinContent(4895,0.252366); + ssigpTa->SetBinContent(4896,0.257443); + ssigpTa->SetBinContent(4897,0.259708); + ssigpTa->SetBinContent(4898,0.263844); + ssigpTa->SetBinContent(4899,0.269878); + ssigpTa->SetBinContent(4900,0.276293); + ssigpTa->SetBinContent(4901,0.282835); + ssigpTa->SetBinContent(4902,0.289458); + ssigpTa->SetBinContent(4903,0.296224); + ssigpTa->SetBinContent(4904,0.303374); + ssigpTa->SetBinContent(4905,0.311223); + ssigpTa->SetBinContent(4906,0.319756); + ssigpTa->SetBinContent(4907,0.32796); + ssigpTa->SetBinContent(4908,0.335961); + ssigpTa->SetBinContent(4909,0.344082); + ssigpTa->SetBinContent(4910,0.352318); + ssigpTa->SetBinContent(4911,0.360602); + ssigpTa->SetBinContent(4912,0.369002); + ssigpTa->SetBinContent(4913,0.377694); + ssigpTa->SetBinContent(4914,0.387004); + ssigpTa->SetBinContent(4915,0.396741); + ssigpTa->SetBinContent(4916,0.406655); + ssigpTa->SetBinContent(4917,0.416684); + ssigpTa->SetBinContent(4918,0.426865); + ssigpTa->SetBinContent(4919,0.437658); + ssigpTa->SetBinContent(4920,0.451278); + ssigpTa->SetBinContent(4921,0.46839); + ssigpTa->SetBinContent(4922,0.482545); + ssigpTa->SetBinContent(4923,0.494733); + ssigpTa->SetBinContent(4924,0.509616); + ssigpTa->SetBinContent(4925,0.528387); + ssigpTa->SetBinContent(4926,0.54458); + ssigpTa->SetBinContent(4927,0.558592); + ssigpTa->SetBinContent(4928,0.57246); + ssigpTa->SetBinContent(4929,0.592432); + ssigpTa->SetBinContent(4930,0.610786); + ssigpTa->SetBinContent(4933,0.172111); + ssigpTa->SetBinContent(4934,0.156742); + ssigpTa->SetBinContent(4935,0.154372); + ssigpTa->SetBinContent(4936,0.154372); + ssigpTa->SetBinContent(4937,0.154372); + ssigpTa->SetBinContent(4938,0.154372); + ssigpTa->SetBinContent(4939,0.154372); + ssigpTa->SetBinContent(4940,0.154372); + ssigpTa->SetBinContent(4941,0.154372); + ssigpTa->SetBinContent(4942,0.154372); + ssigpTa->SetBinContent(4943,0.154372); + ssigpTa->SetBinContent(4944,0.154372); + ssigpTa->SetBinContent(4945,0.154372); + ssigpTa->SetBinContent(4946,0.154372); + ssigpTa->SetBinContent(4947,0.154372); + ssigpTa->SetBinContent(4948,0.154376); + ssigpTa->SetBinContent(4949,0.154376); + ssigpTa->SetBinContent(4950,0.154376); + ssigpTa->SetBinContent(4951,0.154376); + ssigpTa->SetBinContent(4952,0.154376); + ssigpTa->SetBinContent(4953,0.154376); + ssigpTa->SetBinContent(4954,0.154376); + ssigpTa->SetBinContent(4955,0.154376); + ssigpTa->SetBinContent(4956,0.154396); + ssigpTa->SetBinContent(4957,0.154436); + ssigpTa->SetBinContent(4958,0.154616); + ssigpTa->SetBinContent(4959,0.154752); + ssigpTa->SetBinContent(4960,0.154872); + ssigpTa->SetBinContent(4961,0.154888); + ssigpTa->SetBinContent(4962,0.154888); + ssigpTa->SetBinContent(4963,0.154888); + ssigpTa->SetBinContent(4964,0.154888); + ssigpTa->SetBinContent(4965,0.154888); + ssigpTa->SetBinContent(4966,0.154888); + ssigpTa->SetBinContent(4967,0.154888); + ssigpTa->SetBinContent(4968,0.154892); + ssigpTa->SetBinContent(4969,0.154892); + ssigpTa->SetBinContent(4970,0.154892); + ssigpTa->SetBinContent(4971,0.155172); + ssigpTa->SetBinContent(4972,0.155172); + ssigpTa->SetBinContent(4973,0.155172); + ssigpTa->SetBinContent(4974,0.155172); + ssigpTa->SetBinContent(4975,0.155176); + ssigpTa->SetBinContent(4976,0.155192); + ssigpTa->SetBinContent(4977,0.155208); + ssigpTa->SetBinContent(4978,0.155224); + ssigpTa->SetBinContent(4979,0.155224); + ssigpTa->SetBinContent(4980,0.155228); + ssigpTa->SetBinContent(4981,0.155228); + ssigpTa->SetBinContent(4982,0.155248); + ssigpTa->SetBinContent(4983,0.155288); + ssigpTa->SetBinContent(4984,0.155388); + ssigpTa->SetBinContent(4985,0.155512); + ssigpTa->SetBinContent(4986,0.155612); + ssigpTa->SetBinContent(4987,0.155708); + ssigpTa->SetBinContent(4988,0.155724); + ssigpTa->SetBinContent(4989,0.155744); + ssigpTa->SetBinContent(4990,0.155744); + ssigpTa->SetBinContent(4991,0.155744); + ssigpTa->SetBinContent(4992,0.155744); + ssigpTa->SetBinContent(4993,0.156028); + ssigpTa->SetBinContent(4994,0.156028); + ssigpTa->SetBinContent(4995,0.156044); + ssigpTa->SetBinContent(4996,0.15606); + ssigpTa->SetBinContent(4997,0.1561); + ssigpTa->SetBinContent(4998,0.15614); + ssigpTa->SetBinContent(4999,0.15624); + ssigpTa->SetBinContent(5000,0.156284); + ssigpTa->SetBinContent(5001,0.156384); + ssigpTa->SetBinContent(5002,0.156464); + ssigpTa->SetBinContent(5003,0.156564); + ssigpTa->SetBinContent(5004,0.15658); + ssigpTa->SetBinContent(5005,0.156596); + ssigpTa->SetBinContent(5006,0.1566); + ssigpTa->SetBinContent(5007,0.1569); + ssigpTa->SetBinContent(5008,0.15694); + ssigpTa->SetBinContent(5009,0.15706); + ssigpTa->SetBinContent(5010,0.157116); + ssigpTa->SetBinContent(5011,0.157152); + ssigpTa->SetBinContent(5012,0.157236); + ssigpTa->SetBinContent(5013,0.157316); + ssigpTa->SetBinContent(5014,0.157416); + ssigpTa->SetBinContent(5015,0.157432); + ssigpTa->SetBinContent(5016,0.157468); + ssigpTa->SetBinContent(5017,0.157792); + ssigpTa->SetBinContent(5018,0.157892); + ssigpTa->SetBinContent(5019,0.157952); + ssigpTa->SetBinContent(5020,0.158068); + ssigpTa->SetBinContent(5021,0.158168); + ssigpTa->SetBinContent(5022,0.158248); + ssigpTa->SetBinContent(5023,0.158284); + ssigpTa->SetBinContent(5024,0.158624); + ssigpTa->SetBinContent(5025,0.15874); + ssigpTa->SetBinContent(5026,0.158784); + ssigpTa->SetBinContent(5027,0.1589); + ssigpTa->SetBinContent(5028,0.159); + ssigpTa->SetBinContent(5029,0.159116); + ssigpTa->SetBinContent(5030,0.15916); + ssigpTa->SetBinContent(5031,0.15956); + ssigpTa->SetBinContent(5032,0.159616); + ssigpTa->SetBinContent(5033,0.159736); + ssigpTa->SetBinContent(5034,0.159852); + ssigpTa->SetBinContent(5035,0.159992); + ssigpTa->SetBinContent(5036,0.160348); + ssigpTa->SetBinContent(5037,0.160236); + ssigpTa->SetBinContent(5038,0.16104); + ssigpTa->SetBinContent(5039,0.171796); + ssigpTa->SetBinContent(5040,0.210092); + ssigpTa->SetBinContent(5041,0.2213); + ssigpTa->SetBinContent(5042,0.223036); + ssigpTa->SetBinContent(5043,0.223176); + ssigpTa->SetBinContent(5044,0.223312); + ssigpTa->SetBinContent(5045,0.223712); + ssigpTa->SetBinContent(5046,0.223872); + ssigpTa->SetBinContent(5047,0.224028); + ssigpTa->SetBinContent(5048,0.224228); + ssigpTa->SetBinContent(5049,0.223408); + ssigpTa->SetBinContent(5050,0.215268); + ssigpTa->SetBinContent(5051,0.186904); + ssigpTa->SetBinContent(5052,0.185032); + ssigpTa->SetBinContent(5053,0.189324); + ssigpTa->SetBinContent(5054,0.194748); + ssigpTa->SetBinContent(5055,0.200156); + ssigpTa->SetBinContent(5056,0.205384); + ssigpTa->SetBinContent(5057,0.210928); + ssigpTa->SetBinContent(5058,0.215172); + ssigpTa->SetBinContent(5059,0.211888); + ssigpTa->SetBinContent(5060,0.186156); + ssigpTa->SetBinContent(5061,0.182376); + ssigpTa->SetBinContent(5062,0.186336); + ssigpTa->SetBinContent(5063,0.191648); + ssigpTa->SetBinContent(5064,0.196776); + ssigpTa->SetBinContent(5065,0.202284); + ssigpTa->SetBinContent(5066,0.207864); + ssigpTa->SetBinContent(5067,0.213544); + ssigpTa->SetBinContent(5068,0.219604); + ssigpTa->SetBinContent(5069,0.224284); + ssigpTa->SetBinContent(5070,0.2206); + ssigpTa->SetBinContent(5071,0.191728); + ssigpTa->SetBinContent(5072,0.186656); + ssigpTa->SetBinContent(5073,0.190408); + ssigpTa->SetBinContent(5074,0.195336); + ssigpTa->SetBinContent(5075,0.20072); + ssigpTa->SetBinContent(5076,0.205868); + ssigpTa->SetBinContent(5077,0.211576); + ssigpTa->SetBinContent(5078,0.218536); + ssigpTa->SetBinContent(5079,0.228204); + ssigpTa->SetBinContent(5080,0.233528); + ssigpTa->SetBinContent(5081,0.229336); + ssigpTa->SetBinContent(5082,0.1998); + ssigpTa->SetBinContent(5083,0.194376); + ssigpTa->SetBinContent(5084,0.197592); + ssigpTa->SetBinContent(5085,0.202248); + ssigpTa->SetBinContent(5086,0.20664); + ssigpTa->SetBinContent(5087,0.211792); + ssigpTa->SetBinContent(5088,0.216704); + ssigpTa->SetBinContent(5089,0.221788); + ssigpTa->SetBinContent(5090,0.227136); + ssigpTa->SetBinContent(5091,0.23266); + ssigpTa->SetBinContent(5092,0.236728); + ssigpTa->SetBinContent(5093,0.23222); + ssigpTa->SetBinContent(5094,0.20176); + ssigpTa->SetBinContent(5095,0.196892); + ssigpTa->SetBinContent(5096,0.202312); + ssigpTa->SetBinContent(5097,0.215176); + ssigpTa->SetBinContent(5098,0.222096); + ssigpTa->SetBinContent(5099,0.227324); + ssigpTa->SetBinContent(5100,0.2323); + ssigpTa->SetBinContent(5101,0.237328); + ssigpTa->SetBinContent(5102,0.24262); + ssigpTa->SetBinContent(5103,0.246368); + ssigpTa->SetBinContent(5104,0.242748); + ssigpTa->SetBinContent(5105,0.216124); + ssigpTa->SetBinContent(5106,0.211628); + ssigpTa->SetBinContent(5107,0.21314); + ssigpTa->SetBinContent(5108,0.212244); + ssigpTa->SetBinContent(5109,0.215556); + ssigpTa->SetBinContent(5110,0.220324); + ssigpTa->SetBinContent(5111,0.226232); + ssigpTa->SetBinContent(5112,0.23394); + ssigpTa->SetBinContent(5113,0.2401); + ssigpTa->SetBinContent(5114,0.2458); + ssigpTa->SetBinContent(5115,0.251484); + ssigpTa->SetBinContent(5116,0.256428); + ssigpTa->SetBinContent(5117,0.254636); + ssigpTa->SetBinContent(5118,0.233924); + ssigpTa->SetBinContent(5119,0.233856); + ssigpTa->SetBinContent(5120,0.246628); + ssigpTa->SetBinContent(5121,0.254352); + ssigpTa->SetBinContent(5122,0.260672); + ssigpTa->SetBinContent(5123,0.266572); + ssigpTa->SetBinContent(5124,0.272508); + ssigpTa->SetBinContent(5125,0.276308); + ssigpTa->SetBinContent(5126,0.273624); + ssigpTa->SetBinContent(5127,0.277444); + ssigpTa->SetBinContent(5128,0.283456); + ssigpTa->SetBinContent(5129,0.290012); + ssigpTa->SetBinContent(5130,0.296924); + ssigpTa->SetBinContent(5131,0.303916); + ssigpTa->SetBinContent(5132,0.311024); + ssigpTa->SetBinContent(5133,0.318696); + ssigpTa->SetBinContent(5134,0.329532); + ssigpTa->SetBinContent(5135,0.349692); + ssigpTa->SetBinContent(5136,0.36124); + ssigpTa->SetBinContent(5137,0.369752); + ssigpTa->SetBinContent(5138,0.374464); + ssigpTa->SetBinContent(5139,0.368992); + ssigpTa->SetBinContent(5140,0.373684); + ssigpTa->SetBinContent(5141,0.3819); + ssigpTa->SetBinContent(5142,0.390808); + ssigpTa->SetBinContent(5143,0.400176); + ssigpTa->SetBinContent(5144,0.41022); + ssigpTa->SetBinContent(5145,0.423508); + ssigpTa->SetBinContent(5146,0.446628); + ssigpTa->SetBinContent(5147,0.46098); + ssigpTa->SetBinContent(5148,0.471812); + ssigpTa->SetBinContent(5149,0.477852); + ssigpTa->SetBinContent(5150,0.471056); + ssigpTa->SetBinContent(5151,0.477112); + ssigpTa->SetBinContent(5152,0.487484); + ssigpTa->SetBinContent(5153,0.498752); + ssigpTa->SetBinContent(5154,0.510532); + ssigpTa->SetBinContent(5155,0.522628); + ssigpTa->SetBinContent(5156,0.535604); + ssigpTa->SetBinContent(5157,0.551612); + ssigpTa->SetBinContent(5158,0.576568); + ssigpTa->SetBinContent(5159,0.592824); + ssigpTa->SetBinContent(5160,0.601396); + ssigpTa->SetBinContent(5161,0.595248); + ssigpTa->SetBinContent(5162,0.603896); + ssigpTa->SetBinContent(5163,0.617784); + ssigpTa->SetBinContent(5164,0.632796); + ssigpTa->SetBinContent(5165,0.647964); + ssigpTa->SetBinContent(5166,0.663304); + ssigpTa->SetBinContent(5167,0.679044); + ssigpTa->SetBinContent(5168,0.695244); + ssigpTa->SetBinContent(5169,0.712496); + ssigpTa->SetBinContent(5170,0.72966); + ssigpTa->SetBinContent(5171,0.73128); + ssigpTa->SetBinContent(5172,0.744232); + ssigpTa->SetBinContent(5173,0.761608); + ssigpTa->SetBinContent(5174,0.77996); + ssigpTa->SetBinContent(5175,0.798812); + ssigpTa->SetBinContent(5176,0.81784); + ssigpTa->SetBinContent(5177,0.83718); + ssigpTa->SetBinContent(5178,0.857796); + ssigpTa->SetBinContent(5179,0.880196); + ssigpTa->SetBinContent(5180,0.905996); + ssigpTa->SetBinContent(5181,0.929384); + ssigpTa->SetBinContent(5182,0.952496); + ssigpTa->SetBinContent(5183,0.976052); + ssigpTa->SetBinContent(5184,0.99978); + ssigpTa->SetBinContent(5185,1.02358); + ssigpTa->SetBinContent(5186,1.04755); + ssigpTa->SetBinContent(5187,1.07247); + ssigpTa->SetBinContent(5188,1.09921); + ssigpTa->SetBinContent(5189,1.12735); + ssigpTa->SetBinContent(5190,1.15584); + ssigpTa->SetBinContent(5191,1.18453); + ssigpTa->SetBinContent(5192,1.21384); + ssigpTa->SetBinContent(5193,1.24474); + ssigpTa->SetBinContent(5194,1.28162); + ssigpTa->SetBinContent(5195,1.33597); + ssigpTa->SetBinContent(5196,1.37438); + ssigpTa->SetBinContent(5197,1.40902); + ssigpTa->SetBinContent(5198,1.44986); + ssigpTa->SetBinContent(5199,1.50948); + ssigpTa->SetBinContent(5200,1.55407); + ssigpTa->SetBinContent(5201,1.59428); + ssigpTa->SetBinContent(5202,1.63405); + ssigpTa->SetBinContent(5203,1.69819); + ssigpTa->SetBinContent(5204,1.90111); + ssigpTa->SetBinContent(5207,0.436141); + ssigpTa->SetBinContent(5208,0.4658); + ssigpTa->SetBinContent(5209,0.454475); + ssigpTa->SetBinContent(5210,0.454475); + ssigpTa->SetBinContent(5211,0.454475); + ssigpTa->SetBinContent(5212,0.454475); + ssigpTa->SetBinContent(5213,0.454475); + ssigpTa->SetBinContent(5214,0.454475); + ssigpTa->SetBinContent(5215,0.454475); + ssigpTa->SetBinContent(5216,0.454475); + ssigpTa->SetBinContent(5217,0.454475); + ssigpTa->SetBinContent(5218,0.454475); + ssigpTa->SetBinContent(5219,0.454475); + ssigpTa->SetBinContent(5220,0.454475); + ssigpTa->SetBinContent(5221,0.454475); + ssigpTa->SetBinContent(5222,0.454475); + ssigpTa->SetBinContent(5223,0.454475); + ssigpTa->SetBinContent(5224,0.454475); + ssigpTa->SetBinContent(5225,0.454475); + ssigpTa->SetBinContent(5226,0.454475); + ssigpTa->SetBinContent(5227,0.454475); + ssigpTa->SetBinContent(5228,0.454475); + ssigpTa->SetBinContent(5229,0.454475); + ssigpTa->SetBinContent(5230,0.454475); + ssigpTa->SetBinContent(5231,0.454558); + ssigpTa->SetBinContent(5232,0.454683); + ssigpTa->SetBinContent(5233,0.454933); + ssigpTa->SetBinContent(5234,0.455025); + ssigpTa->SetBinContent(5235,0.455067); + ssigpTa->SetBinContent(5236,0.455067); + ssigpTa->SetBinContent(5237,0.455067); + ssigpTa->SetBinContent(5238,0.455067); + ssigpTa->SetBinContent(5239,0.455067); + ssigpTa->SetBinContent(5240,0.455067); + ssigpTa->SetBinContent(5241,0.455067); + ssigpTa->SetBinContent(5242,0.455067); + ssigpTa->SetBinContent(5243,0.455067); + ssigpTa->SetBinContent(5244,0.45565); + ssigpTa->SetBinContent(5245,0.456233); + ssigpTa->SetBinContent(5246,0.456817); + ssigpTa->SetBinContent(5247,0.456817); + ssigpTa->SetBinContent(5248,0.456817); + ssigpTa->SetBinContent(5249,0.456817); + ssigpTa->SetBinContent(5250,0.456817); + ssigpTa->SetBinContent(5251,0.456825); + ssigpTa->SetBinContent(5252,0.456825); + ssigpTa->SetBinContent(5253,0.456825); + ssigpTa->SetBinContent(5254,0.456825); + ssigpTa->SetBinContent(5255,0.456825); + ssigpTa->SetBinContent(5256,0.456825); + ssigpTa->SetBinContent(5257,0.456867); + ssigpTa->SetBinContent(5258,0.45695); + ssigpTa->SetBinContent(5259,0.457075); + ssigpTa->SetBinContent(5260,0.457283); + ssigpTa->SetBinContent(5261,0.457367); + ssigpTa->SetBinContent(5262,0.457417); + ssigpTa->SetBinContent(5263,0.457417); + ssigpTa->SetBinContent(5264,0.457417); + ssigpTa->SetBinContent(5265,0.457417); + ssigpTa->SetBinContent(5266,0.458); + ssigpTa->SetBinContent(5267,0.458583); + ssigpTa->SetBinContent(5268,0.459167); + ssigpTa->SetBinContent(5269,0.459167); + ssigpTa->SetBinContent(5270,0.459175); + ssigpTa->SetBinContent(5271,0.459175); + ssigpTa->SetBinContent(5272,0.459217); + ssigpTa->SetBinContent(5273,0.459258); + ssigpTa->SetBinContent(5274,0.459342); + ssigpTa->SetBinContent(5275,0.459425); + ssigpTa->SetBinContent(5276,0.459633); + ssigpTa->SetBinContent(5277,0.459717); + ssigpTa->SetBinContent(5278,0.459767); + ssigpTa->SetBinContent(5279,0.459767); + ssigpTa->SetBinContent(5280,0.46035); + ssigpTa->SetBinContent(5281,0.460933); + ssigpTa->SetBinContent(5282,0.461558); + ssigpTa->SetBinContent(5283,0.4616); + ssigpTa->SetBinContent(5284,0.46165); + ssigpTa->SetBinContent(5285,0.461692); + ssigpTa->SetBinContent(5286,0.461775); + ssigpTa->SetBinContent(5287,0.461983); + ssigpTa->SetBinContent(5288,0.462067); + ssigpTa->SetBinContent(5289,0.462117); + ssigpTa->SetBinContent(5290,0.4627); + ssigpTa->SetBinContent(5291,0.463325); + ssigpTa->SetBinContent(5292,0.46395); + ssigpTa->SetBinContent(5293,0.464033); + ssigpTa->SetBinContent(5294,0.464125); + ssigpTa->SetBinContent(5295,0.464333); + ssigpTa->SetBinContent(5296,0.464417); + ssigpTa->SetBinContent(5297,0.465042); + ssigpTa->SetBinContent(5298,0.465675); + ssigpTa->SetBinContent(5299,0.4663); + ssigpTa->SetBinContent(5300,0.466383); + ssigpTa->SetBinContent(5301,0.466467); + ssigpTa->SetBinContent(5302,0.466683); + ssigpTa->SetBinContent(5303,0.466767); + ssigpTa->SetBinContent(5304,0.467433); + ssigpTa->SetBinContent(5305,0.468058); + ssigpTa->SetBinContent(5306,0.468733); + ssigpTa->SetBinContent(5307,0.468817); + ssigpTa->SetBinContent(5308,0.469025); + ssigpTa->SetBinContent(5309,0.469742); + ssigpTa->SetBinContent(5310,0.470367); + ssigpTa->SetBinContent(5311,0.469658); + ssigpTa->SetBinContent(5312,0.471567); + ssigpTa->SetBinContent(5313,0.526908); + ssigpTa->SetBinContent(5314,0.5948); + ssigpTa->SetBinContent(5315,0.6521); + ssigpTa->SetBinContent(5316,0.656142); + ssigpTa->SetBinContent(5317,0.656358); + ssigpTa->SetBinContent(5318,0.657067); + ssigpTa->SetBinContent(5319,0.657775); + ssigpTa->SetBinContent(5320,0.658492); + ssigpTa->SetBinContent(5321,0.658742); + ssigpTa->SetBinContent(5322,0.659492); + ssigpTa->SetBinContent(5323,0.657625); + ssigpTa->SetBinContent(5324,0.614292); + ssigpTa->SetBinContent(5325,0.570083); + ssigpTa->SetBinContent(5326,0.54); + ssigpTa->SetBinContent(5327,0.556183); + ssigpTa->SetBinContent(5328,0.571908); + ssigpTa->SetBinContent(5329,0.587583); + ssigpTa->SetBinContent(5330,0.60335); + ssigpTa->SetBinContent(5331,0.619158); + ssigpTa->SetBinContent(5332,0.632842); + ssigpTa->SetBinContent(5333,0.60315); + ssigpTa->SetBinContent(5334,0.564142); + ssigpTa->SetBinContent(5335,0.533608); + ssigpTa->SetBinContent(5336,0.54645); + ssigpTa->SetBinContent(5337,0.561967); + ssigpTa->SetBinContent(5338,0.577642); + ssigpTa->SetBinContent(5339,0.593408); + ssigpTa->SetBinContent(5340,0.609842); + ssigpTa->SetBinContent(5341,0.62695); + ssigpTa->SetBinContent(5342,0.6448); + ssigpTa->SetBinContent(5343,0.6602); + ssigpTa->SetBinContent(5344,0.627058); + ssigpTa->SetBinContent(5345,0.582283); + ssigpTa->SetBinContent(5346,0.546208); + ssigpTa->SetBinContent(5347,0.557383); + ssigpTa->SetBinContent(5348,0.5729); + ssigpTa->SetBinContent(5349,0.587833); + ssigpTa->SetBinContent(5350,0.60355); + ssigpTa->SetBinContent(5351,0.620275); + ssigpTa->SetBinContent(5352,0.643592); + ssigpTa->SetBinContent(5353,0.668108); + ssigpTa->SetBinContent(5354,0.687833); + ssigpTa->SetBinContent(5355,0.653025); + ssigpTa->SetBinContent(5356,0.606525); + ssigpTa->SetBinContent(5357,0.56895); + ssigpTa->SetBinContent(5358,0.57925); + ssigpTa->SetBinContent(5359,0.592508); + ssigpTa->SetBinContent(5360,0.606517); + ssigpTa->SetBinContent(5361,0.620608); + ssigpTa->SetBinContent(5362,0.635542); + ssigpTa->SetBinContent(5363,0.650433); + ssigpTa->SetBinContent(5364,0.666117); + ssigpTa->SetBinContent(5365,0.682425); + ssigpTa->SetBinContent(5366,0.695733); + ssigpTa->SetBinContent(5367,0.659); + ssigpTa->SetBinContent(5368,0.611592); + ssigpTa->SetBinContent(5369,0.573975); + ssigpTa->SetBinContent(5370,0.597533); + ssigpTa->SetBinContent(5371,0.626358); + ssigpTa->SetBinContent(5372,0.653042); + ssigpTa->SetBinContent(5373,0.667925); + ssigpTa->SetBinContent(5374,0.682275); + ssigpTa->SetBinContent(5375,0.697158); + ssigpTa->SetBinContent(5376,0.712133); + ssigpTa->SetBinContent(5377,0.724858); + ssigpTa->SetBinContent(5378,0.693083); + ssigpTa->SetBinContent(5379,0.652283); + ssigpTa->SetBinContent(5380,0.618458); + ssigpTa->SetBinContent(5381,0.620467); + ssigpTa->SetBinContent(5382,0.623858); + ssigpTa->SetBinContent(5383,0.6295); + ssigpTa->SetBinContent(5384,0.644092); + ssigpTa->SetBinContent(5385,0.663108); + ssigpTa->SetBinContent(5386,0.68355); + ssigpTa->SetBinContent(5387,0.70345); + ssigpTa->SetBinContent(5388,0.720092); + ssigpTa->SetBinContent(5389,0.7372); + ssigpTa->SetBinContent(5390,0.752092); + ssigpTa->SetBinContent(5391,0.729575); + ssigpTa->SetBinContent(5392,0.699133); + ssigpTa->SetBinContent(5393,0.688567); + ssigpTa->SetBinContent(5394,0.717575); + ssigpTa->SetBinContent(5395,0.74785); + ssigpTa->SetBinContent(5396,0.765742); + ssigpTa->SetBinContent(5397,0.783725); + ssigpTa->SetBinContent(5398,0.801042); + ssigpTa->SetBinContent(5399,0.806317); + ssigpTa->SetBinContent(5400,0.809083); + ssigpTa->SetBinContent(5401,0.814358); + ssigpTa->SetBinContent(5402,0.832383); + ssigpTa->SetBinContent(5403,0.851875); + ssigpTa->SetBinContent(5404,0.87215); + ssigpTa->SetBinContent(5405,0.8931); + ssigpTa->SetBinContent(5406,0.91405); + ssigpTa->SetBinContent(5407,0.936375); + ssigpTa->SetBinContent(5408,0.976658); + ssigpTa->SetBinContent(5409,1.02126); + ssigpTa->SetBinContent(5410,1.06381); + ssigpTa->SetBinContent(5411,1.08865); + ssigpTa->SetBinContent(5412,1.09316); + ssigpTa->SetBinContent(5413,1.09371); + ssigpTa->SetBinContent(5414,1.09825); + ssigpTa->SetBinContent(5415,1.12281); + ssigpTa->SetBinContent(5416,1.14936); + ssigpTa->SetBinContent(5417,1.17671); + ssigpTa->SetBinContent(5418,1.20593); + ssigpTa->SetBinContent(5419,1.25395); + ssigpTa->SetBinContent(5420,1.30701); + ssigpTa->SetBinContent(5421,1.35804); + ssigpTa->SetBinContent(5422,1.39016); + ssigpTa->SetBinContent(5423,1.39619); + ssigpTa->SetBinContent(5424,1.39712); + ssigpTa->SetBinContent(5425,1.40307); + ssigpTa->SetBinContent(5426,1.43432); + ssigpTa->SetBinContent(5427,1.46785); + ssigpTa->SetBinContent(5428,1.50231); + ssigpTa->SetBinContent(5429,1.53815); + ssigpTa->SetBinContent(5430,1.57595); + ssigpTa->SetBinContent(5431,1.63175); + ssigpTa->SetBinContent(5432,1.69236); + ssigpTa->SetBinContent(5433,1.74876); + ssigpTa->SetBinContent(5434,1.76078); + ssigpTa->SetBinContent(5435,1.76623); + ssigpTa->SetBinContent(5436,1.77864); + ssigpTa->SetBinContent(5437,1.8205); + ssigpTa->SetBinContent(5438,1.86483); + ssigpTa->SetBinContent(5439,1.90952); + ssigpTa->SetBinContent(5440,1.95486); + ssigpTa->SetBinContent(5441,2.00102); + ssigpTa->SetBinContent(5442,2.04902); + ssigpTa->SetBinContent(5443,2.10378); + ssigpTa->SetBinContent(5444,2.13742); + ssigpTa->SetBinContent(5445,2.16574); + ssigpTa->SetBinContent(5446,2.19293); + ssigpTa->SetBinContent(5447,2.24458); + ssigpTa->SetBinContent(5448,2.29915); + ssigpTa->SetBinContent(5449,2.3546); + ssigpTa->SetBinContent(5450,2.41084); + ssigpTa->SetBinContent(5451,2.46858); + ssigpTa->SetBinContent(5452,2.52909); + ssigpTa->SetBinContent(5453,2.5979); + ssigpTa->SetBinContent(5454,2.66943); + ssigpTa->SetBinContent(5455,2.74142); + ssigpTa->SetBinContent(5456,2.80966); + ssigpTa->SetBinContent(5457,2.87911); + ssigpTa->SetBinContent(5458,2.94932); + ssigpTa->SetBinContent(5459,3.01961); + ssigpTa->SetBinContent(5460,3.09074); + ssigpTa->SetBinContent(5461,3.16491); + ssigpTa->SetBinContent(5462,3.24374); + ssigpTa->SetBinContent(5463,3.32641); + ssigpTa->SetBinContent(5464,3.41067); + ssigpTa->SetBinContent(5465,3.49577); + ssigpTa->SetBinContent(5466,3.5824); + ssigpTa->SetBinContent(5467,3.67268); + ssigpTa->SetBinContent(5468,3.79708); + ssigpTa->SetBinContent(5469,3.92967); + ssigpTa->SetBinContent(5470,4.0581); + ssigpTa->SetBinContent(5471,4.15907); + ssigpTa->SetBinContent(5472,4.29522); + ssigpTa->SetBinContent(5473,4.44339); + ssigpTa->SetBinContent(5474,4.59034); + ssigpTa->SetBinContent(5475,4.70792); + ssigpTa->SetBinContent(5476,4.82576); + ssigpTa->SetBinContent(5477,5.06458); + ssigpTa->SetBinContent(5478,4.80471); + ssigpTa->SetBinContent(5481,0.902885); + ssigpTa->SetBinContent(5482,0.873029); + ssigpTa->SetBinContent(5483,0.899972); + ssigpTa->SetBinContent(5484,0.899972); + ssigpTa->SetBinContent(5485,0.899972); + ssigpTa->SetBinContent(5486,0.899972); + ssigpTa->SetBinContent(5487,0.899972); + ssigpTa->SetBinContent(5488,0.899972); + ssigpTa->SetBinContent(5489,0.899972); + ssigpTa->SetBinContent(5490,0.899972); + ssigpTa->SetBinContent(5491,0.899972); + ssigpTa->SetBinContent(5492,0.899972); + ssigpTa->SetBinContent(5493,0.899972); + ssigpTa->SetBinContent(5494,0.899972); + ssigpTa->SetBinContent(5495,0.899972); + ssigpTa->SetBinContent(5496,0.899972); + ssigpTa->SetBinContent(5497,0.899972); + ssigpTa->SetBinContent(5498,0.899972); + ssigpTa->SetBinContent(5499,0.899972); + ssigpTa->SetBinContent(5500,0.899972); + ssigpTa->SetBinContent(5501,0.899972); + ssigpTa->SetBinContent(5502,0.899972); + ssigpTa->SetBinContent(5503,0.899972); + ssigpTa->SetBinContent(5504,0.899972); + ssigpTa->SetBinContent(5505,0.899972); + ssigpTa->SetBinContent(5506,0.900111); + ssigpTa->SetBinContent(5507,0.900222); + ssigpTa->SetBinContent(5508,0.900333); + ssigpTa->SetBinContent(5509,0.900333); + ssigpTa->SetBinContent(5510,0.900333); + ssigpTa->SetBinContent(5511,0.900333); + ssigpTa->SetBinContent(5512,0.900333); + ssigpTa->SetBinContent(5513,0.900333); + ssigpTa->SetBinContent(5514,0.900333); + ssigpTa->SetBinContent(5515,0.900333); + ssigpTa->SetBinContent(5516,0.900333); + ssigpTa->SetBinContent(5517,0.900722); + ssigpTa->SetBinContent(5518,0.9015); + ssigpTa->SetBinContent(5519,0.903444); + ssigpTa->SetBinContent(5520,0.904222); + ssigpTa->SetBinContent(5521,0.904611); + ssigpTa->SetBinContent(5522,0.904611); + ssigpTa->SetBinContent(5523,0.904611); + ssigpTa->SetBinContent(5524,0.904611); + ssigpTa->SetBinContent(5525,0.904611); + ssigpTa->SetBinContent(5526,0.904611); + ssigpTa->SetBinContent(5527,0.904611); + ssigpTa->SetBinContent(5528,0.904611); + ssigpTa->SetBinContent(5529,0.904611); + ssigpTa->SetBinContent(5530,0.904611); + ssigpTa->SetBinContent(5531,0.904611); + ssigpTa->SetBinContent(5532,0.904639); + ssigpTa->SetBinContent(5533,0.90475); + ssigpTa->SetBinContent(5534,0.904861); + ssigpTa->SetBinContent(5535,0.904972); + ssigpTa->SetBinContent(5536,0.904972); + ssigpTa->SetBinContent(5537,0.904972); + ssigpTa->SetBinContent(5538,0.904972); + ssigpTa->SetBinContent(5539,0.905361); + ssigpTa->SetBinContent(5540,0.906139); + ssigpTa->SetBinContent(5541,0.908083); + ssigpTa->SetBinContent(5542,0.908861); + ssigpTa->SetBinContent(5543,0.90925); + ssigpTa->SetBinContent(5544,0.90925); + ssigpTa->SetBinContent(5545,0.90925); + ssigpTa->SetBinContent(5546,0.90925); + ssigpTa->SetBinContent(5547,0.909278); + ssigpTa->SetBinContent(5548,0.909278); + ssigpTa->SetBinContent(5549,0.909389); + ssigpTa->SetBinContent(5550,0.9095); + ssigpTa->SetBinContent(5551,0.909611); + ssigpTa->SetBinContent(5552,0.909611); + ssigpTa->SetBinContent(5553,0.91); + ssigpTa->SetBinContent(5554,0.910778); + ssigpTa->SetBinContent(5555,0.912722); + ssigpTa->SetBinContent(5556,0.9135); + ssigpTa->SetBinContent(5557,0.913917); + ssigpTa->SetBinContent(5558,0.913917); + ssigpTa->SetBinContent(5559,0.913917); + ssigpTa->SetBinContent(5560,0.914028); + ssigpTa->SetBinContent(5561,0.914139); + ssigpTa->SetBinContent(5562,0.91425); + ssigpTa->SetBinContent(5563,0.914639); + ssigpTa->SetBinContent(5564,0.915417); + ssigpTa->SetBinContent(5565,0.917361); + ssigpTa->SetBinContent(5566,0.918167); + ssigpTa->SetBinContent(5567,0.918556); + ssigpTa->SetBinContent(5568,0.918667); + ssigpTa->SetBinContent(5569,0.918778); + ssigpTa->SetBinContent(5570,0.919278); + ssigpTa->SetBinContent(5571,0.920056); + ssigpTa->SetBinContent(5572,0.922); + ssigpTa->SetBinContent(5573,0.922806); + ssigpTa->SetBinContent(5574,0.923194); + ssigpTa->SetBinContent(5575,0.923306); + ssigpTa->SetBinContent(5576,0.923417); + ssigpTa->SetBinContent(5577,0.923917); + ssigpTa->SetBinContent(5578,0.924694); + ssigpTa->SetBinContent(5579,0.926667); + ssigpTa->SetBinContent(5580,0.927444); + ssigpTa->SetBinContent(5581,0.927944); + ssigpTa->SetBinContent(5582,0.928444); + ssigpTa->SetBinContent(5583,0.929333); + ssigpTa->SetBinContent(5584,0.930528); + ssigpTa->SetBinContent(5585,0.929639); + ssigpTa->SetBinContent(5586,0.957083); + ssigpTa->SetBinContent(5587,1.02694); + ssigpTa->SetBinContent(5588,1.19358); + ssigpTa->SetBinContent(5589,1.26667); + ssigpTa->SetBinContent(5590,1.29867); + ssigpTa->SetBinContent(5591,1.29956); + ssigpTa->SetBinContent(5592,1.30044); + ssigpTa->SetBinContent(5593,1.30242); + ssigpTa->SetBinContent(5594,1.30331); + ssigpTa->SetBinContent(5595,1.30419); + ssigpTa->SetBinContent(5596,1.30511); + ssigpTa->SetBinContent(5597,1.28267); + ssigpTa->SetBinContent(5598,1.23222); + ssigpTa->SetBinContent(5599,1.11439); + ssigpTa->SetBinContent(5600,1.09142); + ssigpTa->SetBinContent(5601,1.09894); + ssigpTa->SetBinContent(5602,1.13206); + ssigpTa->SetBinContent(5603,1.16325); + ssigpTa->SetBinContent(5604,1.19378); + ssigpTa->SetBinContent(5605,1.22547); + ssigpTa->SetBinContent(5606,1.23228); + ssigpTa->SetBinContent(5607,1.20658); + ssigpTa->SetBinContent(5608,1.10275); + ssigpTa->SetBinContent(5609,1.07536); + ssigpTa->SetBinContent(5610,1.08117); + ssigpTa->SetBinContent(5611,1.11233); + ssigpTa->SetBinContent(5612,1.14275); + ssigpTa->SetBinContent(5613,1.17444); + ssigpTa->SetBinContent(5614,1.20692); + ssigpTa->SetBinContent(5615,1.24067); + ssigpTa->SetBinContent(5616,1.27639); + ssigpTa->SetBinContent(5617,1.28458); + ssigpTa->SetBinContent(5618,1.25553); + ssigpTa->SetBinContent(5619,1.13764); + ssigpTa->SetBinContent(5620,1.10197); + ssigpTa->SetBinContent(5621,1.10386); + ssigpTa->SetBinContent(5622,1.13297); + ssigpTa->SetBinContent(5623,1.16378); + ssigpTa->SetBinContent(5624,1.19419); + ssigpTa->SetBinContent(5625,1.23017); + ssigpTa->SetBinContent(5626,1.27219); + ssigpTa->SetBinContent(5627,1.32417); + ssigpTa->SetBinContent(5628,1.33675); + ssigpTa->SetBinContent(5629,1.30706); + ssigpTa->SetBinContent(5630,1.18542); + ssigpTa->SetBinContent(5631,1.14756); + ssigpTa->SetBinContent(5632,1.14611); + ssigpTa->SetBinContent(5633,1.17306); + ssigpTa->SetBinContent(5634,1.19961); + ssigpTa->SetBinContent(5635,1.22872); + ssigpTa->SetBinContent(5636,1.25744); + ssigpTa->SetBinContent(5637,1.28708); + ssigpTa->SetBinContent(5638,1.31825); + ssigpTa->SetBinContent(5639,1.35033); + ssigpTa->SetBinContent(5640,1.35364); + ssigpTa->SetBinContent(5641,1.31908); + ssigpTa->SetBinContent(5642,1.19403); + ssigpTa->SetBinContent(5643,1.16347); + ssigpTa->SetBinContent(5644,1.17842); + ssigpTa->SetBinContent(5645,1.24358); + ssigpTa->SetBinContent(5646,1.28731); + ssigpTa->SetBinContent(5647,1.32225); + ssigpTa->SetBinContent(5648,1.35061); + ssigpTa->SetBinContent(5649,1.37944); + ssigpTa->SetBinContent(5650,1.40975); + ssigpTa->SetBinContent(5651,1.41369); + ssigpTa->SetBinContent(5652,1.38533); + ssigpTa->SetBinContent(5653,1.27619); + ssigpTa->SetBinContent(5654,1.24017); + ssigpTa->SetBinContent(5655,1.22961); + ssigpTa->SetBinContent(5656,1.23158); + ssigpTa->SetBinContent(5657,1.24886); + ssigpTa->SetBinContent(5658,1.27525); + ssigpTa->SetBinContent(5659,1.31086); + ssigpTa->SetBinContent(5660,1.35325); + ssigpTa->SetBinContent(5661,1.39017); + ssigpTa->SetBinContent(5662,1.42497); + ssigpTa->SetBinContent(5663,1.45833); + ssigpTa->SetBinContent(5664,1.47111); + ssigpTa->SetBinContent(5665,1.45431); + ssigpTa->SetBinContent(5666,1.37714); + ssigpTa->SetBinContent(5667,1.37467); + ssigpTa->SetBinContent(5668,1.42436); + ssigpTa->SetBinContent(5669,1.474); + ssigpTa->SetBinContent(5670,1.51631); + ssigpTa->SetBinContent(5671,1.55097); + ssigpTa->SetBinContent(5672,1.57992); + ssigpTa->SetBinContent(5673,1.59975); + ssigpTa->SetBinContent(5674,1.59728); + ssigpTa->SetBinContent(5675,1.6175); + ssigpTa->SetBinContent(5676,1.64761); + ssigpTa->SetBinContent(5677,1.68603); + ssigpTa->SetBinContent(5678,1.72647); + ssigpTa->SetBinContent(5679,1.76772); + ssigpTa->SetBinContent(5680,1.80947); + ssigpTa->SetBinContent(5681,1.86172); + ssigpTa->SetBinContent(5682,1.92797); + ssigpTa->SetBinContent(5683,2.02764); + ssigpTa->SetBinContent(5684,2.09803); + ssigpTa->SetBinContent(5685,2.14622); + ssigpTa->SetBinContent(5686,2.17019); + ssigpTa->SetBinContent(5687,2.15875); + ssigpTa->SetBinContent(5688,2.18308); + ssigpTa->SetBinContent(5689,2.22286); + ssigpTa->SetBinContent(5690,2.27517); + ssigpTa->SetBinContent(5691,2.32956); + ssigpTa->SetBinContent(5692,2.39572); + ssigpTa->SetBinContent(5693,2.47706); + ssigpTa->SetBinContent(5694,2.59361); + ssigpTa->SetBinContent(5695,2.68075); + ssigpTa->SetBinContent(5696,2.74103); + ssigpTa->SetBinContent(5697,2.77219); + ssigpTa->SetBinContent(5698,2.75811); + ssigpTa->SetBinContent(5699,2.78928); + ssigpTa->SetBinContent(5700,2.83983); + ssigpTa->SetBinContent(5701,2.90606); + ssigpTa->SetBinContent(5702,2.97475); + ssigpTa->SetBinContent(5703,3.04525); + ssigpTa->SetBinContent(5704,3.12828); + ssigpTa->SetBinContent(5705,3.226); + ssigpTa->SetBinContent(5706,3.35642); + ssigpTa->SetBinContent(5707,3.44283); + ssigpTa->SetBinContent(5708,3.49539); + ssigpTa->SetBinContent(5709,3.48894); + ssigpTa->SetBinContent(5710,3.53511); + ssigpTa->SetBinContent(5711,3.60511); + ssigpTa->SetBinContent(5712,3.69286); + ssigpTa->SetBinContent(5713,3.78142); + ssigpTa->SetBinContent(5714,3.87094); + ssigpTa->SetBinContent(5715,3.96283); + ssigpTa->SetBinContent(5716,4.06078); + ssigpTa->SetBinContent(5717,4.15308); + ssigpTa->SetBinContent(5718,4.24231); + ssigpTa->SetBinContent(5719,4.27825); + ssigpTa->SetBinContent(5720,4.35347); + ssigpTa->SetBinContent(5721,4.44528); + ssigpTa->SetBinContent(5722,4.55286); + ssigpTa->SetBinContent(5723,4.66292); + ssigpTa->SetBinContent(5724,4.77464); + ssigpTa->SetBinContent(5725,4.88892); + ssigpTa->SetBinContent(5726,5.01175); + ssigpTa->SetBinContent(5727,5.14333); + ssigpTa->SetBinContent(5728,5.28861); + ssigpTa->SetBinContent(5729,5.42689); + ssigpTa->SetBinContent(5730,5.56453); + ssigpTa->SetBinContent(5731,5.70203); + ssigpTa->SetBinContent(5732,5.84081); + ssigpTa->SetBinContent(5733,5.98036); + ssigpTa->SetBinContent(5734,6.12197); + ssigpTa->SetBinContent(5735,6.26911); + ssigpTa->SetBinContent(5736,6.42517); + ssigpTa->SetBinContent(5737,6.58844); + ssigpTa->SetBinContent(5738,6.75506); + ssigpTa->SetBinContent(5739,6.92372); + ssigpTa->SetBinContent(5740,7.09536); + ssigpTa->SetBinContent(5741,7.28942); + ssigpTa->SetBinContent(5742,7.51053); + ssigpTa->SetBinContent(5743,7.79389); + ssigpTa->SetBinContent(5744,8.02342); + ssigpTa->SetBinContent(5745,8.25378); + ssigpTa->SetBinContent(5746,8.49847); + ssigpTa->SetBinContent(5747,8.81264); + ssigpTa->SetBinContent(5748,9.07772); + ssigpTa->SetBinContent(5749,9.32575); + ssigpTa->SetBinContent(5750,9.55897); + ssigpTa->SetBinContent(5751,9.46026); + ssigpTa->SetBinContent(5752,9.95015); + ssigpTa->SetEntries(5169); + + init = true; + } + + double percent = ssigpTa->Interpolate(eta, ptGeV); + return percent; + } + + + + // Fractional resolution in % + //double ITKPercentageresol(double pt [GeV], double eta) { +double UpgradePerformance::ITKPercentageresol_LoIfixBronze(double ptMeV, double eta){ + double ptGeV = ptMeV/1000.; + static TH2D *ssigpTa; + static bool init = false; + + if (fabs(eta)>2.7) return 0.; + + if(!init){ + Double_t xAxis1[273] = {0, 0.005, 0.015, 0.025, 0.035, 0.045, 0.055, 0.065, 0.075, 0.085, 0.095, 0.105, 0.115, 0.125, 0.135, 0.145, 0.155, 0.165, 0.175, 0.185, 0.195, 0.205, 0.215, 0.225, 0.235, 0.245, 0.255, 0.265, 0.275, 0.285, 0.295, 0.305, 0.315, 0.325, 0.335, 0.345, 0.355, 0.365, 0.375, 0.385, 0.395, 0.405, 0.415, 0.425, 0.435, 0.445, 0.455, 0.465, 0.475, 0.485, 0.495, 0.505, 0.515, 0.525, 0.535, 0.545, 0.555, 0.565, 0.575, 0.585, 0.595, 0.605, 0.615, 0.625, 0.635, 0.645, 0.655, 0.665, 0.675, 0.685, 0.695, 0.705, 0.715, 0.725, 0.735, 0.745, 0.755, 0.765, 0.775, 0.785, 0.795, 0.805, 0.815, 0.825, 0.835, 0.845, 0.855, 0.865, 0.875, 0.885, 0.895, 0.905, 0.915, 0.925, 0.935, 0.945, 0.955, 0.965, 0.975, 0.985, 0.995, 1.005, 1.015, 1.025, 1.035, 1.045, 1.055, 1.065, 1.075, 1.085, 1.095, 1.105, 1.115, 1.125, 1.135, 1.145, 1.155, 1.165, 1.175, 1.185, 1.195, 1.205, 1.215, 1.225, 1.235, 1.245, 1.255, 1.265, 1.275, 1.285, 1.295, 1.305, 1.315, 1.325, 1.335, 1.345, 1.355, 1.365, 1.375, 1.385, 1.395, 1.405, 1.415, 1.425, 1.435, 1.445, 1.455, 1.465, 1.475, 1.485, 1.495, 1.505, 1.515, 1.525, 1.535, 1.545, 1.555, 1.565, 1.575, 1.585, 1.595, 1.605, 1.615, 1.625, 1.635, 1.645, 1.655, 1.665, 1.675, 1.685, 1.695, 1.705, 1.715, 1.725, 1.735, 1.745, 1.755, 1.765, 1.775, 1.785, 1.795, 1.805, 1.815, 1.825, 1.835, 1.845, 1.855, 1.865, 1.875, 1.885, 1.895, 1.905, 1.915, 1.925, 1.935, 1.945, 1.955, 1.965, 1.975, 1.985, 1.995, 2.005, 2.015, 2.025, 2.035, 2.045, 2.055, 2.065, 2.075, 2.085, 2.095, 2.105, 2.115, 2.125, 2.135, 2.145, 2.155, 2.165, 2.175, 2.185, 2.195, 2.205, 2.215, 2.225, 2.235, 2.245, 2.255, 2.265, 2.275, 2.285, 2.295, 2.305, 2.315, 2.325, 2.335, 2.345, 2.355, 2.365, 2.375, 2.385, 2.395, 2.405, 2.415, 2.425, 2.435, 2.445, 2.455, 2.465, 2.475, 2.485, 2.495, 2.505, 2.515, 2.525, 2.535, 2.545, 2.555, 2.565, 2.575, 2.585, 2.595, 2.605, 2.615, 2.625, 2.635, 2.645, 2.655, 2.665, 2.675, 2.685, 2.695, 2.705, 2.7371}; + Double_t yAxis1[21] = {0, 0.1, 0.35, 0.75, 1.5, 3.5, 7.5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 150, 350, 750, 4000, 7070}; + + ssigpTa = new TH2D("ssigpTa","ssigpTa",272, xAxis1,20, yAxis1); + ssigpTa->SetDirectory(0); + ssigpTa->SetBinContent(275,0.00337818); + ssigpTa->SetBinContent(276,0.00361671); + ssigpTa->SetBinContent(277,0.0034161); + ssigpTa->SetBinContent(278,0.00341663); + ssigpTa->SetBinContent(279,0.00341734); + ssigpTa->SetBinContent(280,0.00341821); + ssigpTa->SetBinContent(281,0.00341931); + ssigpTa->SetBinContent(282,0.00342058); + ssigpTa->SetBinContent(283,0.00342209); + ssigpTa->SetBinContent(284,0.00342379); + ssigpTa->SetBinContent(285,0.00342569); + ssigpTa->SetBinContent(286,0.00342777); + ssigpTa->SetBinContent(287,0.00343008); + ssigpTa->SetBinContent(288,0.00343259); + ssigpTa->SetBinContent(289,0.00343529); + ssigpTa->SetBinContent(290,0.0034382); + ssigpTa->SetBinContent(291,0.00344129); + ssigpTa->SetBinContent(292,0.00344458); + ssigpTa->SetBinContent(293,0.00344808); + ssigpTa->SetBinContent(294,0.00345179); + ssigpTa->SetBinContent(295,0.0034557); + ssigpTa->SetBinContent(296,0.00345979); + ssigpTa->SetBinContent(297,0.00346409); + ssigpTa->SetBinContent(298,0.0034686); + ssigpTa->SetBinContent(299,0.00347331); + ssigpTa->SetBinContent(300,0.00347826); + ssigpTa->SetBinContent(301,0.00348336); + ssigpTa->SetBinContent(302,0.00348866); + ssigpTa->SetBinContent(303,0.0034942); + ssigpTa->SetBinContent(304,0.00349992); + ssigpTa->SetBinContent(305,0.00350587); + ssigpTa->SetBinContent(306,0.00351197); + ssigpTa->SetBinContent(307,0.00351831); + ssigpTa->SetBinContent(308,0.00352483); + ssigpTa->SetBinContent(309,0.00353158); + ssigpTa->SetBinContent(310,0.00353851); + ssigpTa->SetBinContent(311,0.00354564); + ssigpTa->SetBinContent(312,0.00355301); + ssigpTa->SetBinContent(313,0.00356058); + ssigpTa->SetBinContent(314,0.00356836); + ssigpTa->SetBinContent(315,0.00357632); + ssigpTa->SetBinContent(316,0.00358449); + ssigpTa->SetBinContent(317,0.00359288); + ssigpTa->SetBinContent(318,0.00360148); + ssigpTa->SetBinContent(319,0.00361029); + ssigpTa->SetBinContent(320,0.00361931); + ssigpTa->SetBinContent(321,0.0036285); + ssigpTa->SetBinContent(322,0.00363792); + ssigpTa->SetBinContent(323,0.00364758); + ssigpTa->SetBinContent(324,0.00365746); + ssigpTa->SetBinContent(325,0.0036675); + ssigpTa->SetBinContent(326,0.00367779); + ssigpTa->SetBinContent(327,0.00368829); + ssigpTa->SetBinContent(328,0.003699); + ssigpTa->SetBinContent(329,0.00370991); + ssigpTa->SetBinContent(330,0.00372106); + ssigpTa->SetBinContent(331,0.0037324); + ssigpTa->SetBinContent(332,0.00374397); + ssigpTa->SetBinContent(333,0.0037558); + ssigpTa->SetBinContent(334,0.00376783); + ssigpTa->SetBinContent(335,0.00378007); + ssigpTa->SetBinContent(336,0.00379252); + ssigpTa->SetBinContent(337,0.00380519); + ssigpTa->SetBinContent(338,0.00381809); + ssigpTa->SetBinContent(339,0.00383124); + ssigpTa->SetBinContent(340,0.00384463); + ssigpTa->SetBinContent(341,0.00385821); + ssigpTa->SetBinContent(342,0.00387205); + ssigpTa->SetBinContent(343,0.00388614); + ssigpTa->SetBinContent(344,0.00390044); + ssigpTa->SetBinContent(345,0.00391499); + ssigpTa->SetBinContent(346,0.00392977); + ssigpTa->SetBinContent(347,0.00394477); + ssigpTa->SetBinContent(348,0.00396003); + ssigpTa->SetBinContent(349,0.00397554); + ssigpTa->SetBinContent(350,0.0039913); + ssigpTa->SetBinContent(351,0.00400729); + ssigpTa->SetBinContent(352,0.00402353); + ssigpTa->SetBinContent(353,0.00404004); + ssigpTa->SetBinContent(354,0.00405681); + ssigpTa->SetBinContent(355,0.00407386); + ssigpTa->SetBinContent(356,0.00409115); + ssigpTa->SetBinContent(357,0.00410869); + ssigpTa->SetBinContent(358,0.00412651); + ssigpTa->SetBinContent(359,0.00414461); + ssigpTa->SetBinContent(360,0.00416297); + ssigpTa->SetBinContent(361,0.00418164); + ssigpTa->SetBinContent(362,0.00420058); + ssigpTa->SetBinContent(363,0.00421982); + ssigpTa->SetBinContent(364,0.00423933); + ssigpTa->SetBinContent(365,0.00425914); + ssigpTa->SetBinContent(366,0.00427924); + ssigpTa->SetBinContent(367,0.00429965); + ssigpTa->SetBinContent(368,0.00432037); + ssigpTa->SetBinContent(369,0.00434139); + ssigpTa->SetBinContent(370,0.00436276); + ssigpTa->SetBinContent(371,0.00438447); + ssigpTa->SetBinContent(372,0.00440652); + ssigpTa->SetBinContent(373,0.00442886); + ssigpTa->SetBinContent(374,0.00445158); + ssigpTa->SetBinContent(375,0.00447463); + ssigpTa->SetBinContent(376,0.00449803); + ssigpTa->SetBinContent(377,0.00452179); + ssigpTa->SetBinContent(378,0.00454598); + ssigpTa->SetBinContent(379,0.00457049); + ssigpTa->SetBinContent(380,0.00459545); + ssigpTa->SetBinContent(381,0.00505904); + ssigpTa->SetBinContent(382,0.00574372); + ssigpTa->SetBinContent(383,0.00621098); + ssigpTa->SetBinContent(384,0.0062415); + ssigpTa->SetBinContent(385,0.00627238); + ssigpTa->SetBinContent(386,0.00630363); + ssigpTa->SetBinContent(387,0.00633526); + ssigpTa->SetBinContent(388,0.00636729); + ssigpTa->SetBinContent(389,0.00639968); + ssigpTa->SetBinContent(390,0.00643246); + ssigpTa->SetBinContent(391,0.00646566); + ssigpTa->SetBinContent(392,0.00609819); + ssigpTa->SetBinContent(393,0.00554344); + ssigpTa->SetBinContent(394,0.00521005); + ssigpTa->SetBinContent(395,0.00529117); + ssigpTa->SetBinContent(396,0.0053724); + ssigpTa->SetBinContent(397,0.00545373); + ssigpTa->SetBinContent(398,0.00553517); + ssigpTa->SetBinContent(399,0.0056167); + ssigpTa->SetBinContent(400,0.00569839); + ssigpTa->SetBinContent(401,0.00567778); + ssigpTa->SetBinContent(402,0.00561205); + ssigpTa->SetBinContent(403,0.00535853); + ssigpTa->SetBinContent(404,0.00508716); + ssigpTa->SetBinContent(405,0.00493911); + ssigpTa->SetBinContent(406,0.00503982); + ssigpTa->SetBinContent(407,0.00514212); + ssigpTa->SetBinContent(408,0.00524657); + ssigpTa->SetBinContent(409,0.00535325); + ssigpTa->SetBinContent(410,0.00546141); + ssigpTa->SetBinContent(411,0.00557089); + ssigpTa->SetBinContent(412,0.00559384); + ssigpTa->SetBinContent(413,0.00557042); + ssigpTa->SetBinContent(414,0.00559012); + ssigpTa->SetBinContent(415,0.00569745); + ssigpTa->SetBinContent(416,0.00580688); + ssigpTa->SetBinContent(417,0.00591758); + ssigpTa->SetBinContent(418,0.00602946); + ssigpTa->SetBinContent(419,0.00614328); + ssigpTa->SetBinContent(420,0.00625867); + ssigpTa->SetBinContent(421,0.00637549); + ssigpTa->SetBinContent(422,0.00649454); + ssigpTa->SetBinContent(423,0.00650313); + ssigpTa->SetBinContent(424,0.00645118); + ssigpTa->SetBinContent(425,0.0064543); + ssigpTa->SetBinContent(426,0.00656751); + ssigpTa->SetBinContent(427,0.00668111); + ssigpTa->SetBinContent(428,0.00679511); + ssigpTa->SetBinContent(429,0.00691075); + ssigpTa->SetBinContent(430,0.00702742); + ssigpTa->SetBinContent(431,0.00714473); + ssigpTa->SetBinContent(432,0.0072624); + ssigpTa->SetBinContent(433,0.00738087); + ssigpTa->SetBinContent(434,0.00749966); + ssigpTa->SetBinContent(435,0.00753616); + ssigpTa->SetBinContent(436,0.00752502); + ssigpTa->SetBinContent(437,0.00755896); + ssigpTa->SetBinContent(438,0.00742836); + ssigpTa->SetBinContent(439,0.00717596); + ssigpTa->SetBinContent(440,0.00705018); + ssigpTa->SetBinContent(441,0.00717507); + ssigpTa->SetBinContent(442,0.00730402); + ssigpTa->SetBinContent(443,0.00743333); + ssigpTa->SetBinContent(444,0.00756337); + ssigpTa->SetBinContent(445,0.00769505); + ssigpTa->SetBinContent(446,0.00783103); + ssigpTa->SetBinContent(447,0.00796852); + ssigpTa->SetBinContent(448,0.00810636); + ssigpTa->SetBinContent(449,0.00827554); + ssigpTa->SetBinContent(450,0.00846017); + ssigpTa->SetBinContent(451,0.00862844); + ssigpTa->SetBinContent(452,0.00876348); + ssigpTa->SetBinContent(453,0.00853329); + ssigpTa->SetBinContent(454,0.00811138); + ssigpTa->SetBinContent(455,0.00785463); + ssigpTa->SetBinContent(456,0.00795055); + ssigpTa->SetBinContent(457,0.00804327); + ssigpTa->SetBinContent(458,0.00813323); + ssigpTa->SetBinContent(459,0.00822313); + ssigpTa->SetBinContent(460,0.00831501); + ssigpTa->SetBinContent(461,0.00801461); + ssigpTa->SetBinContent(462,0.00752109); + ssigpTa->SetBinContent(463,0.00722751); + ssigpTa->SetBinContent(464,0.00732906); + ssigpTa->SetBinContent(465,0.00743328); + ssigpTa->SetBinContent(466,0.00753957); + ssigpTa->SetBinContent(467,0.00800312); + ssigpTa->SetBinContent(468,0.00864716); + ssigpTa->SetBinContent(469,0.00912218); + ssigpTa->SetBinContent(470,0.00924785); + ssigpTa->SetBinContent(471,0.00937861); + ssigpTa->SetBinContent(472,0.00951352); + ssigpTa->SetBinContent(473,0.00964798); + ssigpTa->SetBinContent(474,0.00978078); + ssigpTa->SetBinContent(475,0.00991443); + ssigpTa->SetBinContent(476,0.00979115); + ssigpTa->SetBinContent(477,0.00953693); + ssigpTa->SetBinContent(478,0.00940768); + ssigpTa->SetBinContent(479,0.00953383); + ssigpTa->SetBinContent(480,0.00998143); + ssigpTa->SetBinContent(481,0.0105968); + ssigpTa->SetBinContent(482,0.0110665); + ssigpTa->SetBinContent(483,0.0112268); + ssigpTa->SetBinContent(484,0.0113891); + ssigpTa->SetBinContent(485,0.0115473); + ssigpTa->SetBinContent(486,0.0117049); + ssigpTa->SetBinContent(487,0.0115538); + ssigpTa->SetBinContent(488,0.0112445); + ssigpTa->SetBinContent(489,0.0110895); + ssigpTa->SetBinContent(490,0.0112404); + ssigpTa->SetBinContent(491,0.0117604); + ssigpTa->SetBinContent(492,0.0124758); + ssigpTa->SetBinContent(493,0.0130191); + ssigpTa->SetBinContent(494,0.0131966); + ssigpTa->SetBinContent(495,0.0133731); + ssigpTa->SetBinContent(496,0.0135552); + ssigpTa->SetBinContent(497,0.0137496); + ssigpTa->SetBinContent(498,0.0139493); + ssigpTa->SetBinContent(499,0.0133139); + ssigpTa->SetBinContent(500,0.0122432); + ssigpTa->SetBinContent(501,0.0115733); + ssigpTa->SetBinContent(502,0.0119924); + ssigpTa->SetBinContent(503,0.0125625); + ssigpTa->SetBinContent(504,0.0130152); + ssigpTa->SetBinContent(505,0.0132077); + ssigpTa->SetBinContent(506,0.0133906); + ssigpTa->SetBinContent(507,0.0135732); + ssigpTa->SetBinContent(508,0.0137615); + ssigpTa->SetBinContent(509,0.0139451); + ssigpTa->SetBinContent(510,0.0141184); + ssigpTa->SetBinContent(511,0.0142392); + ssigpTa->SetBinContent(512,0.0145845); + ssigpTa->SetBinContent(513,0.0151497); + ssigpTa->SetBinContent(514,0.0156433); + ssigpTa->SetBinContent(515,0.0158746); + ssigpTa->SetBinContent(516,0.0160849); + ssigpTa->SetBinContent(517,0.0162849); + ssigpTa->SetBinContent(518,0.0165039); + ssigpTa->SetBinContent(519,0.016746); + ssigpTa->SetBinContent(520,0.0169917); + ssigpTa->SetBinContent(521,0.0169143); + ssigpTa->SetBinContent(522,0.0167028); + ssigpTa->SetBinContent(523,0.0166552); + ssigpTa->SetBinContent(524,0.0168126); + ssigpTa->SetBinContent(525,0.0168891); + ssigpTa->SetBinContent(526,0.0170249); + ssigpTa->SetBinContent(527,0.0172724); + ssigpTa->SetBinContent(528,0.0175178); + ssigpTa->SetBinContent(529,0.0177586); + ssigpTa->SetBinContent(530,0.0180145); + ssigpTa->SetBinContent(531,0.018296); + ssigpTa->SetBinContent(532,0.0185915); + ssigpTa->SetBinContent(533,0.018885); + ssigpTa->SetBinContent(534,0.0191725); + ssigpTa->SetBinContent(535,0.0194426); + ssigpTa->SetBinContent(536,0.0197047); + ssigpTa->SetBinContent(537,0.0199818); + ssigpTa->SetBinContent(538,0.0202832); + ssigpTa->SetBinContent(539,0.0205993); + ssigpTa->SetBinContent(540,0.0205291); + ssigpTa->SetBinContent(541,0.0202446); + ssigpTa->SetBinContent(542,0.0201367); + ssigpTa->SetBinContent(543,0.0204468); + ssigpTa->SetBinContent(544,0.0208142); + ssigpTa->SetBinContent(545,0.0224464); + ssigpTa->SetBinContent(546,0.0211893); + ssigpTa->SetBinContent(549,0.00671789); + ssigpTa->SetBinContent(550,0.00649339); + ssigpTa->SetBinContent(551,0.00658941); + ssigpTa->SetBinContent(552,0.0065904); + ssigpTa->SetBinContent(553,0.00659177); + ssigpTa->SetBinContent(554,0.00659347); + ssigpTa->SetBinContent(555,0.00659555); + ssigpTa->SetBinContent(556,0.00659808); + ssigpTa->SetBinContent(557,0.00660093); + ssigpTa->SetBinContent(558,0.00660426); + ssigpTa->SetBinContent(559,0.0066079); + ssigpTa->SetBinContent(560,0.00661192); + ssigpTa->SetBinContent(561,0.00661635); + ssigpTa->SetBinContent(562,0.00662118); + ssigpTa->SetBinContent(563,0.00662641); + ssigpTa->SetBinContent(564,0.00663203); + ssigpTa->SetBinContent(565,0.00663801); + ssigpTa->SetBinContent(566,0.00664434); + ssigpTa->SetBinContent(567,0.00665109); + ssigpTa->SetBinContent(568,0.00665826); + ssigpTa->SetBinContent(569,0.00666577); + ssigpTa->SetBinContent(570,0.00667366); + ssigpTa->SetBinContent(571,0.00668193); + ssigpTa->SetBinContent(572,0.00669062); + ssigpTa->SetBinContent(573,0.00669973); + ssigpTa->SetBinContent(574,0.00670923); + ssigpTa->SetBinContent(575,0.0067191); + ssigpTa->SetBinContent(576,0.00672932); + ssigpTa->SetBinContent(577,0.00673999); + ssigpTa->SetBinContent(578,0.00675104); + ssigpTa->SetBinContent(579,0.00676244); + ssigpTa->SetBinContent(580,0.00677429); + ssigpTa->SetBinContent(581,0.00678645); + ssigpTa->SetBinContent(582,0.00679907); + ssigpTa->SetBinContent(583,0.00681202); + ssigpTa->SetBinContent(584,0.0068254); + ssigpTa->SetBinContent(585,0.0068392); + ssigpTa->SetBinContent(586,0.0068534); + ssigpTa->SetBinContent(587,0.006868); + ssigpTa->SetBinContent(588,0.00688299); + ssigpTa->SetBinContent(589,0.00689833); + ssigpTa->SetBinContent(590,0.00691409); + ssigpTa->SetBinContent(591,0.00693028); + ssigpTa->SetBinContent(592,0.00694684); + ssigpTa->SetBinContent(593,0.00696384); + ssigpTa->SetBinContent(594,0.00698121); + ssigpTa->SetBinContent(595,0.00699893); + ssigpTa->SetBinContent(596,0.00701713); + ssigpTa->SetBinContent(597,0.00703573); + ssigpTa->SetBinContent(598,0.00705475); + ssigpTa->SetBinContent(599,0.00707413); + ssigpTa->SetBinContent(600,0.00709396); + ssigpTa->SetBinContent(601,0.00711421); + ssigpTa->SetBinContent(602,0.00713483); + ssigpTa->SetBinContent(603,0.0071559); + ssigpTa->SetBinContent(604,0.00717739); + ssigpTa->SetBinContent(605,0.00719928); + ssigpTa->SetBinContent(606,0.0072216); + ssigpTa->SetBinContent(607,0.00724436); + ssigpTa->SetBinContent(608,0.00726758); + ssigpTa->SetBinContent(609,0.00729117); + ssigpTa->SetBinContent(610,0.00731518); + ssigpTa->SetBinContent(611,0.00733962); + ssigpTa->SetBinContent(612,0.0073645); + ssigpTa->SetBinContent(613,0.00738987); + ssigpTa->SetBinContent(614,0.00741563); + ssigpTa->SetBinContent(615,0.00744184); + ssigpTa->SetBinContent(616,0.00746853); + ssigpTa->SetBinContent(617,0.00749567); + ssigpTa->SetBinContent(618,0.00752324); + ssigpTa->SetBinContent(619,0.0075513); + ssigpTa->SetBinContent(620,0.0075798); + ssigpTa->SetBinContent(621,0.00760871); + ssigpTa->SetBinContent(622,0.00763811); + ssigpTa->SetBinContent(623,0.00766802); + ssigpTa->SetBinContent(624,0.00769837); + ssigpTa->SetBinContent(625,0.00772924); + ssigpTa->SetBinContent(626,0.00776053); + ssigpTa->SetBinContent(627,0.00779236); + ssigpTa->SetBinContent(628,0.00782472); + ssigpTa->SetBinContent(629,0.00785754); + ssigpTa->SetBinContent(630,0.00789092); + ssigpTa->SetBinContent(631,0.00792474); + ssigpTa->SetBinContent(632,0.00795904); + ssigpTa->SetBinContent(633,0.00799393); + ssigpTa->SetBinContent(634,0.00802933); + ssigpTa->SetBinContent(635,0.00806529); + ssigpTa->SetBinContent(636,0.0081018); + ssigpTa->SetBinContent(637,0.00813888); + ssigpTa->SetBinContent(638,0.00817652); + ssigpTa->SetBinContent(639,0.00821467); + ssigpTa->SetBinContent(640,0.00825344); + ssigpTa->SetBinContent(641,0.00829277); + ssigpTa->SetBinContent(642,0.00833268); + ssigpTa->SetBinContent(643,0.00837321); + ssigpTa->SetBinContent(644,0.00841438); + ssigpTa->SetBinContent(645,0.00845624); + ssigpTa->SetBinContent(646,0.00849868); + ssigpTa->SetBinContent(647,0.00854177); + ssigpTa->SetBinContent(648,0.0085855); + ssigpTa->SetBinContent(649,0.00862993); + ssigpTa->SetBinContent(650,0.00867501); + ssigpTa->SetBinContent(651,0.00872083); + ssigpTa->SetBinContent(652,0.00876736); + ssigpTa->SetBinContent(653,0.00881468); + ssigpTa->SetBinContent(654,0.00902705); + ssigpTa->SetBinContent(655,0.00973433); + ssigpTa->SetBinContent(656,0.0111021); + ssigpTa->SetBinContent(657,0.011816); + ssigpTa->SetBinContent(658,0.0120388); + ssigpTa->SetBinContent(659,0.0120983); + ssigpTa->SetBinContent(660,0.0121586); + ssigpTa->SetBinContent(661,0.0122196); + ssigpTa->SetBinContent(662,0.0122813); + ssigpTa->SetBinContent(663,0.0123438); + ssigpTa->SetBinContent(664,0.012407); + ssigpTa->SetBinContent(665,0.0123206); + ssigpTa->SetBinContent(666,0.011788); + ssigpTa->SetBinContent(667,0.0106739); + ssigpTa->SetBinContent(668,0.0102028); + ssigpTa->SetBinContent(669,0.0102039); + ssigpTa->SetBinContent(670,0.0103606); + ssigpTa->SetBinContent(671,0.0105175); + ssigpTa->SetBinContent(672,0.0106746); + ssigpTa->SetBinContent(673,0.010832); + ssigpTa->SetBinContent(674,0.0109513); + ssigpTa->SetBinContent(675,0.0109572); + ssigpTa->SetBinContent(676,0.0107253); + ssigpTa->SetBinContent(677,0.0103854); + ssigpTa->SetBinContent(678,0.00979537); + ssigpTa->SetBinContent(679,0.00961598); + ssigpTa->SetBinContent(680,0.0097178); + ssigpTa->SetBinContent(681,0.00991542); + ssigpTa->SetBinContent(682,0.010117); + ssigpTa->SetBinContent(683,0.0103229); + ssigpTa->SetBinContent(684,0.0105316); + ssigpTa->SetBinContent(685,0.0107098); + ssigpTa->SetBinContent(686,0.0107892); + ssigpTa->SetBinContent(687,0.0107331); + ssigpTa->SetBinContent(688,0.010807); + ssigpTa->SetBinContent(689,0.010982); + ssigpTa->SetBinContent(690,0.011193); + ssigpTa->SetBinContent(691,0.0114066); + ssigpTa->SetBinContent(692,0.0116225); + ssigpTa->SetBinContent(693,0.0118422); + ssigpTa->SetBinContent(694,0.0120649); + ssigpTa->SetBinContent(695,0.0122904); + ssigpTa->SetBinContent(696,0.012478); + ssigpTa->SetBinContent(697,0.0125381); + ssigpTa->SetBinContent(698,0.012425); + ssigpTa->SetBinContent(699,0.0124756); + ssigpTa->SetBinContent(700,0.012653); + ssigpTa->SetBinContent(701,0.0128719); + ssigpTa->SetBinContent(702,0.0130926); + ssigpTa->SetBinContent(703,0.0133151); + ssigpTa->SetBinContent(704,0.0135406); + ssigpTa->SetBinContent(705,0.0137666); + ssigpTa->SetBinContent(706,0.0139939); + ssigpTa->SetBinContent(707,0.0142225); + ssigpTa->SetBinContent(708,0.0144206); + ssigpTa->SetBinContent(709,0.0145181); + ssigpTa->SetBinContent(710,0.0144852); + ssigpTa->SetBinContent(711,0.0144857); + ssigpTa->SetBinContent(712,0.0143098); + ssigpTa->SetBinContent(713,0.0137976); + ssigpTa->SetBinContent(714,0.0136608); + ssigpTa->SetBinContent(715,0.0138098); + ssigpTa->SetBinContent(716,0.0140564); + ssigpTa->SetBinContent(717,0.0143067); + ssigpTa->SetBinContent(718,0.0145568); + ssigpTa->SetBinContent(719,0.0148119); + ssigpTa->SetBinContent(720,0.0150729); + ssigpTa->SetBinContent(721,0.0153381); + ssigpTa->SetBinContent(722,0.015615); + ssigpTa->SetBinContent(723,0.0159282); + ssigpTa->SetBinContent(724,0.0162892); + ssigpTa->SetBinContent(725,0.0165996); + ssigpTa->SetBinContent(726,0.0167368); + ssigpTa->SetBinContent(727,0.0164477); + ssigpTa->SetBinContent(728,0.015598); + ssigpTa->SetBinContent(729,0.0152606); + ssigpTa->SetBinContent(730,0.0153131); + ssigpTa->SetBinContent(731,0.0154921); + ssigpTa->SetBinContent(732,0.0156661); + ssigpTa->SetBinContent(733,0.0158416); + ssigpTa->SetBinContent(734,0.0158707); + ssigpTa->SetBinContent(735,0.0154614); + ssigpTa->SetBinContent(736,0.0144658); + ssigpTa->SetBinContent(737,0.0140676); + ssigpTa->SetBinContent(738,0.0141164); + ssigpTa->SetBinContent(739,0.0143161); + ssigpTa->SetBinContent(740,0.014655); + ssigpTa->SetBinContent(741,0.0153941); + ssigpTa->SetBinContent(742,0.0166729); + ssigpTa->SetBinContent(743,0.0174347); + ssigpTa->SetBinContent(744,0.0178088); + ssigpTa->SetBinContent(745,0.0180603); + ssigpTa->SetBinContent(746,0.0183187); + ssigpTa->SetBinContent(747,0.018577); + ssigpTa->SetBinContent(748,0.0188336); + ssigpTa->SetBinContent(749,0.0189942); + ssigpTa->SetBinContent(750,0.0188652); + ssigpTa->SetBinContent(751,0.0183456); + ssigpTa->SetBinContent(752,0.0182064); + ssigpTa->SetBinContent(753,0.0184733); + ssigpTa->SetBinContent(754,0.0192015); + ssigpTa->SetBinContent(755,0.0204244); + ssigpTa->SetBinContent(756,0.0211908); + ssigpTa->SetBinContent(757,0.0216181); + ssigpTa->SetBinContent(758,0.0219274); + ssigpTa->SetBinContent(759,0.0222338); + ssigpTa->SetBinContent(760,0.0224211); + ssigpTa->SetBinContent(761,0.0222587); + ssigpTa->SetBinContent(762,0.0216291); + ssigpTa->SetBinContent(763,0.0214576); + ssigpTa->SetBinContent(764,0.0217733); + ssigpTa->SetBinContent(765,0.02262); + ssigpTa->SetBinContent(766,0.0240378); + ssigpTa->SetBinContent(767,0.0249269); + ssigpTa->SetBinContent(768,0.0254044); + ssigpTa->SetBinContent(769,0.025747); + ssigpTa->SetBinContent(770,0.0261004); + ssigpTa->SetBinContent(771,0.0264708); + ssigpTa->SetBinContent(772,0.0265439); + ssigpTa->SetBinContent(773,0.0256669); + ssigpTa->SetBinContent(774,0.0235218); + ssigpTa->SetBinContent(775,0.0226846); + ssigpTa->SetBinContent(776,0.0230818); + ssigpTa->SetBinContent(777,0.0242072); + ssigpTa->SetBinContent(778,0.0249677); + ssigpTa->SetBinContent(779,0.0254347); + ssigpTa->SetBinContent(780,0.0257887); + ssigpTa->SetBinContent(781,0.0261429); + ssigpTa->SetBinContent(782,0.0265037); + ssigpTa->SetBinContent(783,0.0268553); + ssigpTa->SetBinContent(784,0.0271736); + ssigpTa->SetBinContent(785,0.0274936); + ssigpTa->SetBinContent(786,0.0280525); + ssigpTa->SetBinContent(787,0.0291565); + ssigpTa->SetBinContent(788,0.029988); + ssigpTa->SetBinContent(789,0.0305256); + ssigpTa->SetBinContent(790,0.0309349); + ssigpTa->SetBinContent(791,0.0313279); + ssigpTa->SetBinContent(792,0.0317523); + ssigpTa->SetBinContent(793,0.0322137); + ssigpTa->SetBinContent(794,0.0325627); + ssigpTa->SetBinContent(795,0.0325688); + ssigpTa->SetBinContent(796,0.0321307); + ssigpTa->SetBinContent(797,0.0321458); + ssigpTa->SetBinContent(798,0.032358); + ssigpTa->SetBinContent(799,0.0325003); + ssigpTa->SetBinContent(800,0.0327988); + ssigpTa->SetBinContent(801,0.0332353); + ssigpTa->SetBinContent(802,0.0337083); + ssigpTa->SetBinContent(803,0.0341782); + ssigpTa->SetBinContent(804,0.0346733); + ssigpTa->SetBinContent(805,0.0352149); + ssigpTa->SetBinContent(806,0.0357795); + ssigpTa->SetBinContent(807,0.0363438); + ssigpTa->SetBinContent(808,0.036894); + ssigpTa->SetBinContent(809,0.0374209); + ssigpTa->SetBinContent(810,0.0379304); + ssigpTa->SetBinContent(811,0.0384699); + ssigpTa->SetBinContent(812,0.0390492); + ssigpTa->SetBinContent(813,0.0395057); + ssigpTa->SetBinContent(814,0.0395424); + ssigpTa->SetBinContent(815,0.0389771); + ssigpTa->SetBinContent(816,0.0389537); + ssigpTa->SetBinContent(817,0.0394254); + ssigpTa->SetBinContent(818,0.0401159); + ssigpTa->SetBinContent(819,0.0401758); + ssigpTa->SetBinContent(820,0.0420796); + ssigpTa->SetBinContent(823,0.0083028); + ssigpTa->SetBinContent(824,0.00842469); + ssigpTa->SetBinContent(825,0.00843993); + ssigpTa->SetBinContent(826,0.00844117); + ssigpTa->SetBinContent(827,0.0084429); + ssigpTa->SetBinContent(828,0.00844507); + ssigpTa->SetBinContent(829,0.00844786); + ssigpTa->SetBinContent(830,0.00845096); + ssigpTa->SetBinContent(831,0.00845473); + ssigpTa->SetBinContent(832,0.00845899); + ssigpTa->SetBinContent(833,0.00846368); + ssigpTa->SetBinContent(834,0.00846881); + ssigpTa->SetBinContent(835,0.00847444); + ssigpTa->SetBinContent(836,0.00848059); + ssigpTa->SetBinContent(837,0.00848725); + ssigpTa->SetBinContent(838,0.0084945); + ssigpTa->SetBinContent(839,0.00850217); + ssigpTa->SetBinContent(840,0.00851026); + ssigpTa->SetBinContent(841,0.00851894); + ssigpTa->SetBinContent(842,0.00852805); + ssigpTa->SetBinContent(843,0.00853766); + ssigpTa->SetBinContent(844,0.00854777); + ssigpTa->SetBinContent(845,0.00855831); + ssigpTa->SetBinContent(846,0.00856945); + ssigpTa->SetBinContent(847,0.00858112); + ssigpTa->SetBinContent(848,0.00859328); + ssigpTa->SetBinContent(849,0.0086059); + ssigpTa->SetBinContent(850,0.00861902); + ssigpTa->SetBinContent(851,0.00863262); + ssigpTa->SetBinContent(852,0.0086467); + ssigpTa->SetBinContent(853,0.00866134); + ssigpTa->SetBinContent(854,0.00867634); + ssigpTa->SetBinContent(855,0.00869206); + ssigpTa->SetBinContent(856,0.00870808); + ssigpTa->SetBinContent(857,0.00872474); + ssigpTa->SetBinContent(858,0.00874178); + ssigpTa->SetBinContent(859,0.00875956); + ssigpTa->SetBinContent(860,0.00877773); + ssigpTa->SetBinContent(861,0.00879642); + ssigpTa->SetBinContent(862,0.00881554); + ssigpTa->SetBinContent(863,0.00883515); + ssigpTa->SetBinContent(864,0.00885527); + ssigpTa->SetBinContent(865,0.008876); + ssigpTa->SetBinContent(866,0.00889725); + ssigpTa->SetBinContent(867,0.00891895); + ssigpTa->SetBinContent(868,0.0089412); + ssigpTa->SetBinContent(869,0.00896392); + ssigpTa->SetBinContent(870,0.0089871); + ssigpTa->SetBinContent(871,0.00901094); + ssigpTa->SetBinContent(872,0.00903523); + ssigpTa->SetBinContent(873,0.00906006); + ssigpTa->SetBinContent(874,0.00908539); + ssigpTa->SetBinContent(875,0.00911125); + ssigpTa->SetBinContent(876,0.00913766); + ssigpTa->SetBinContent(877,0.0091646); + ssigpTa->SetBinContent(878,0.0091921); + ssigpTa->SetBinContent(879,0.00922017); + ssigpTa->SetBinContent(880,0.0092487); + ssigpTa->SetBinContent(881,0.00927784); + ssigpTa->SetBinContent(882,0.00930744); + ssigpTa->SetBinContent(883,0.00933765); + ssigpTa->SetBinContent(884,0.00936837); + ssigpTa->SetBinContent(885,0.00939964); + ssigpTa->SetBinContent(886,0.00943154); + ssigpTa->SetBinContent(887,0.0094639); + ssigpTa->SetBinContent(888,0.00949695); + ssigpTa->SetBinContent(889,0.00953043); + ssigpTa->SetBinContent(890,0.0095646); + ssigpTa->SetBinContent(891,0.0095993); + ssigpTa->SetBinContent(892,0.00963454); + ssigpTa->SetBinContent(893,0.00967045); + ssigpTa->SetBinContent(894,0.00970691); + ssigpTa->SetBinContent(895,0.00974386); + ssigpTa->SetBinContent(896,0.00978138); + ssigpTa->SetBinContent(897,0.00981961); + ssigpTa->SetBinContent(898,0.0098585); + ssigpTa->SetBinContent(899,0.00989795); + ssigpTa->SetBinContent(900,0.00993806); + ssigpTa->SetBinContent(901,0.00997875); + ssigpTa->SetBinContent(902,0.0100201); + ssigpTa->SetBinContent(903,0.0100621); + ssigpTa->SetBinContent(904,0.0101047); + ssigpTa->SetBinContent(905,0.010148); + ssigpTa->SetBinContent(906,0.0101919); + ssigpTa->SetBinContent(907,0.0102365); + ssigpTa->SetBinContent(908,0.0102817); + ssigpTa->SetBinContent(909,0.0103277); + ssigpTa->SetBinContent(910,0.0103744); + ssigpTa->SetBinContent(911,0.0104218); + ssigpTa->SetBinContent(912,0.0104699); + ssigpTa->SetBinContent(913,0.0105187); + ssigpTa->SetBinContent(914,0.0105682); + ssigpTa->SetBinContent(915,0.0106185); + ssigpTa->SetBinContent(916,0.0106695); + ssigpTa->SetBinContent(917,0.0107214); + ssigpTa->SetBinContent(918,0.010774); + ssigpTa->SetBinContent(919,0.0108275); + ssigpTa->SetBinContent(920,0.0108818); + ssigpTa->SetBinContent(921,0.0109367); + ssigpTa->SetBinContent(922,0.0109927); + ssigpTa->SetBinContent(923,0.0110494); + ssigpTa->SetBinContent(924,0.011107); + ssigpTa->SetBinContent(925,0.0111655); + ssigpTa->SetBinContent(926,0.0112251); + ssigpTa->SetBinContent(927,0.0112856); + ssigpTa->SetBinContent(928,0.011505); + ssigpTa->SetBinContent(929,0.0125163); + ssigpTa->SetBinContent(930,0.0141647); + ssigpTa->SetBinContent(931,0.0151845); + ssigpTa->SetBinContent(932,0.0154174); + ssigpTa->SetBinContent(933,0.0154936); + ssigpTa->SetBinContent(934,0.0155707); + ssigpTa->SetBinContent(935,0.0156486); + ssigpTa->SetBinContent(936,0.0157276); + ssigpTa->SetBinContent(937,0.0158077); + ssigpTa->SetBinContent(938,0.0158886); + ssigpTa->SetBinContent(939,0.0158257); + ssigpTa->SetBinContent(940,0.0150449); + ssigpTa->SetBinContent(941,0.013714); + ssigpTa->SetBinContent(942,0.0130122); + ssigpTa->SetBinContent(943,0.0130633); + ssigpTa->SetBinContent(944,0.0132642); + ssigpTa->SetBinContent(945,0.0134654); + ssigpTa->SetBinContent(946,0.0136669); + ssigpTa->SetBinContent(947,0.0138688); + ssigpTa->SetBinContent(948,0.0140339); + ssigpTa->SetBinContent(949,0.0140157); + ssigpTa->SetBinContent(950,0.0137715); + ssigpTa->SetBinContent(951,0.0132514); + ssigpTa->SetBinContent(952,0.012571); + ssigpTa->SetBinContent(953,0.0122831); + ssigpTa->SetBinContent(954,0.0124433); + ssigpTa->SetBinContent(955,0.012697); + ssigpTa->SetBinContent(956,0.0129559); + ssigpTa->SetBinContent(957,0.01322); + ssigpTa->SetBinContent(958,0.013488); + ssigpTa->SetBinContent(959,0.0137265); + ssigpTa->SetBinContent(960,0.0138041); + ssigpTa->SetBinContent(961,0.0137435); + ssigpTa->SetBinContent(962,0.0138139); + ssigpTa->SetBinContent(963,0.0140476); + ssigpTa->SetBinContent(964,0.014318); + ssigpTa->SetBinContent(965,0.014592); + ssigpTa->SetBinContent(966,0.0148688); + ssigpTa->SetBinContent(967,0.0151502); + ssigpTa->SetBinContent(968,0.0154358); + ssigpTa->SetBinContent(969,0.0157251); + ssigpTa->SetBinContent(970,0.0159775); + ssigpTa->SetBinContent(971,0.0160255); + ssigpTa->SetBinContent(972,0.0159004); + ssigpTa->SetBinContent(973,0.015936); + ssigpTa->SetBinContent(974,0.0161748); + ssigpTa->SetBinContent(975,0.0164556); + ssigpTa->SetBinContent(976,0.0167381); + ssigpTa->SetBinContent(977,0.0170237); + ssigpTa->SetBinContent(978,0.0173125); + ssigpTa->SetBinContent(979,0.0176025); + ssigpTa->SetBinContent(980,0.0178939); + ssigpTa->SetBinContent(981,0.018187); + ssigpTa->SetBinContent(982,0.0184473); + ssigpTa->SetBinContent(983,0.0185458); + ssigpTa->SetBinContent(984,0.0185056); + ssigpTa->SetBinContent(985,0.0185099); + ssigpTa->SetBinContent(986,0.0182322); + ssigpTa->SetBinContent(987,0.0176368); + ssigpTa->SetBinContent(988,0.0174032); + ssigpTa->SetBinContent(989,0.017623); + ssigpTa->SetBinContent(990,0.0179393); + ssigpTa->SetBinContent(991,0.0182587); + ssigpTa->SetBinContent(992,0.0185794); + ssigpTa->SetBinContent(993,0.0189053); + ssigpTa->SetBinContent(994,0.0192396); + ssigpTa->SetBinContent(995,0.0195785); + ssigpTa->SetBinContent(996,0.0199298); + ssigpTa->SetBinContent(997,0.0203406); + ssigpTa->SetBinContent(998,0.0208013); + ssigpTa->SetBinContent(999,0.0212102); + ssigpTa->SetBinContent(1000,0.0214281); + ssigpTa->SetBinContent(1001,0.020976); + ssigpTa->SetBinContent(1002,0.0199797); + ssigpTa->SetBinContent(1003,0.0194648); + ssigpTa->SetBinContent(1004,0.0195764); + ssigpTa->SetBinContent(1005,0.0198061); + ssigpTa->SetBinContent(1006,0.0200301); + ssigpTa->SetBinContent(1007,0.0202547); + ssigpTa->SetBinContent(1008,0.0203408); + ssigpTa->SetBinContent(1009,0.0197201); + ssigpTa->SetBinContent(1010,0.0185348); + ssigpTa->SetBinContent(1011,0.0179288); + ssigpTa->SetBinContent(1012,0.0180381); + ssigpTa->SetBinContent(1013,0.0182943); + ssigpTa->SetBinContent(1014,0.0186832); + ssigpTa->SetBinContent(1015,0.0197113); + ssigpTa->SetBinContent(1016,0.0212545); + ssigpTa->SetBinContent(1017,0.0223105); + ssigpTa->SetBinContent(1018,0.0227457); + ssigpTa->SetBinContent(1019,0.0230666); + ssigpTa->SetBinContent(1020,0.0233964); + ssigpTa->SetBinContent(1021,0.0237264); + ssigpTa->SetBinContent(1022,0.0240543); + ssigpTa->SetBinContent(1023,0.0242902); + ssigpTa->SetBinContent(1024,0.024062); + ssigpTa->SetBinContent(1025,0.0234573); + ssigpTa->SetBinContent(1026,0.0232157); + ssigpTa->SetBinContent(1027,0.0235494); + ssigpTa->SetBinContent(1028,0.0245585); + ssigpTa->SetBinContent(1029,0.0260494); + ssigpTa->SetBinContent(1030,0.0271084); + ssigpTa->SetBinContent(1031,0.027615); + ssigpTa->SetBinContent(1032,0.028011); + ssigpTa->SetBinContent(1033,0.0284021); + ssigpTa->SetBinContent(1034,0.0286781); + ssigpTa->SetBinContent(1035,0.0283956); + ssigpTa->SetBinContent(1036,0.0276625); + ssigpTa->SetBinContent(1037,0.0273691); + ssigpTa->SetBinContent(1038,0.0277631); + ssigpTa->SetBinContent(1039,0.0289348); + ssigpTa->SetBinContent(1040,0.03066); + ssigpTa->SetBinContent(1041,0.0318839); + ssigpTa->SetBinContent(1042,0.0324527); + ssigpTa->SetBinContent(1043,0.0328911); + ssigpTa->SetBinContent(1044,0.0333432); + ssigpTa->SetBinContent(1045,0.0338188); + ssigpTa->SetBinContent(1046,0.0340102); + ssigpTa->SetBinContent(1047,0.0326992); + ssigpTa->SetBinContent(1048,0.0301684); + ssigpTa->SetBinContent(1049,0.0288781); + ssigpTa->SetBinContent(1050,0.0295481); + ssigpTa->SetBinContent(1051,0.0309303); + ssigpTa->SetBinContent(1052,0.0319665); + ssigpTa->SetBinContent(1053,0.0325345); + ssigpTa->SetBinContent(1054,0.0329909); + ssigpTa->SetBinContent(1055,0.0334462); + ssigpTa->SetBinContent(1056,0.0339077); + ssigpTa->SetBinContent(1057,0.0343585); + ssigpTa->SetBinContent(1058,0.0347556); + ssigpTa->SetBinContent(1059,0.0351032); + ssigpTa->SetBinContent(1060,0.0358269); + ssigpTa->SetBinContent(1061,0.0371662); + ssigpTa->SetBinContent(1062,0.0382915); + ssigpTa->SetBinContent(1063,0.0389551); + ssigpTa->SetBinContent(1064,0.0394792); + ssigpTa->SetBinContent(1065,0.0399875); + ssigpTa->SetBinContent(1066,0.040532); + ssigpTa->SetBinContent(1067,0.0411198); + ssigpTa->SetBinContent(1068,0.0416096); + ssigpTa->SetBinContent(1069,0.0415602); + ssigpTa->SetBinContent(1070,0.041127); + ssigpTa->SetBinContent(1071,0.0410952); + ssigpTa->SetBinContent(1072,0.0413861); + ssigpTa->SetBinContent(1073,0.0415856); + ssigpTa->SetBinContent(1074,0.0419429); + ssigpTa->SetBinContent(1075,0.0425115); + ssigpTa->SetBinContent(1076,0.0431192); + ssigpTa->SetBinContent(1077,0.0437228); + ssigpTa->SetBinContent(1078,0.0443608); + ssigpTa->SetBinContent(1079,0.0450562); + ssigpTa->SetBinContent(1080,0.0457822); + ssigpTa->SetBinContent(1081,0.0465068); + ssigpTa->SetBinContent(1082,0.0472143); + ssigpTa->SetBinContent(1083,0.0478899); + ssigpTa->SetBinContent(1084,0.0485506); + ssigpTa->SetBinContent(1085,0.0492446); + ssigpTa->SetBinContent(1086,0.0499872); + ssigpTa->SetBinContent(1087,0.0506285); + ssigpTa->SetBinContent(1088,0.0506121); + ssigpTa->SetBinContent(1089,0.0500347); + ssigpTa->SetBinContent(1090,0.0499572); + ssigpTa->SetBinContent(1091,0.050615); + ssigpTa->SetBinContent(1092,0.0515069); + ssigpTa->SetBinContent(1093,0.0522949); + ssigpTa->SetBinContent(1094,0.0521184); + ssigpTa->SetBinContent(1097,0.00881691); + ssigpTa->SetBinContent(1098,0.00881491); + ssigpTa->SetBinContent(1099,0.00881498); + ssigpTa->SetBinContent(1100,0.0088162); + ssigpTa->SetBinContent(1101,0.00881803); + ssigpTa->SetBinContent(1102,0.00882032); + ssigpTa->SetBinContent(1103,0.00882319); + ssigpTa->SetBinContent(1104,0.00882649); + ssigpTa->SetBinContent(1105,0.00883036); + ssigpTa->SetBinContent(1106,0.00883494); + ssigpTa->SetBinContent(1107,0.00883993); + ssigpTa->SetBinContent(1108,0.00884522); + ssigpTa->SetBinContent(1109,0.00885106); + ssigpTa->SetBinContent(1110,0.00885748); + ssigpTa->SetBinContent(1111,0.00886432); + ssigpTa->SetBinContent(1112,0.00887174); + ssigpTa->SetBinContent(1113,0.00887982); + ssigpTa->SetBinContent(1114,0.00888835); + ssigpTa->SetBinContent(1115,0.00889711); + ssigpTa->SetBinContent(1116,0.00890666); + ssigpTa->SetBinContent(1117,0.00891666); + ssigpTa->SetBinContent(1118,0.00892712); + ssigpTa->SetBinContent(1119,0.00893836); + ssigpTa->SetBinContent(1120,0.00894986); + ssigpTa->SetBinContent(1121,0.00896191); + ssigpTa->SetBinContent(1122,0.0089747); + ssigpTa->SetBinContent(1123,0.00898774); + ssigpTa->SetBinContent(1124,0.00900145); + ssigpTa->SetBinContent(1125,0.00901566); + ssigpTa->SetBinContent(1126,0.00903029); + ssigpTa->SetBinContent(1127,0.0090453); + ssigpTa->SetBinContent(1128,0.00906109); + ssigpTa->SetBinContent(1129,0.00907718); + ssigpTa->SetBinContent(1130,0.00909405); + ssigpTa->SetBinContent(1131,0.00911126); + ssigpTa->SetBinContent(1132,0.0091291); + ssigpTa->SetBinContent(1133,0.00914755); + ssigpTa->SetBinContent(1134,0.00916666); + ssigpTa->SetBinContent(1135,0.00918585); + ssigpTa->SetBinContent(1136,0.00920577); + ssigpTa->SetBinContent(1137,0.00922602); + ssigpTa->SetBinContent(1138,0.0092471); + ssigpTa->SetBinContent(1139,0.00926861); + ssigpTa->SetBinContent(1140,0.00929062); + ssigpTa->SetBinContent(1141,0.0093134); + ssigpTa->SetBinContent(1142,0.00933645); + ssigpTa->SetBinContent(1143,0.00936015); + ssigpTa->SetBinContent(1144,0.0093844); + ssigpTa->SetBinContent(1145,0.00940908); + ssigpTa->SetBinContent(1146,0.00943445); + ssigpTa->SetBinContent(1147,0.00946021); + ssigpTa->SetBinContent(1148,0.0094865); + ssigpTa->SetBinContent(1149,0.0095133); + ssigpTa->SetBinContent(1150,0.00954081); + ssigpTa->SetBinContent(1151,0.00956873); + ssigpTa->SetBinContent(1152,0.00959747); + ssigpTa->SetBinContent(1153,0.00962672); + ssigpTa->SetBinContent(1154,0.00965655); + ssigpTa->SetBinContent(1155,0.00968673); + ssigpTa->SetBinContent(1156,0.00971753); + ssigpTa->SetBinContent(1157,0.00974882); + ssigpTa->SetBinContent(1158,0.00978074); + ssigpTa->SetBinContent(1159,0.00981349); + ssigpTa->SetBinContent(1160,0.00984642); + ssigpTa->SetBinContent(1161,0.00988033); + ssigpTa->SetBinContent(1162,0.00991458); + ssigpTa->SetBinContent(1163,0.00994962); + ssigpTa->SetBinContent(1164,0.00998513); + ssigpTa->SetBinContent(1165,0.0100212); + ssigpTa->SetBinContent(1166,0.0100578); + ssigpTa->SetBinContent(1167,0.0100951); + ssigpTa->SetBinContent(1168,0.0101331); + ssigpTa->SetBinContent(1169,0.0101715); + ssigpTa->SetBinContent(1170,0.0102103); + ssigpTa->SetBinContent(1171,0.01025); + ssigpTa->SetBinContent(1172,0.0102905); + ssigpTa->SetBinContent(1173,0.0103317); + ssigpTa->SetBinContent(1174,0.0103736); + ssigpTa->SetBinContent(1175,0.0104158); + ssigpTa->SetBinContent(1176,0.0104589); + ssigpTa->SetBinContent(1177,0.0105023); + ssigpTa->SetBinContent(1178,0.0105468); + ssigpTa->SetBinContent(1179,0.0105919); + ssigpTa->SetBinContent(1180,0.0106376); + ssigpTa->SetBinContent(1181,0.0106839); + ssigpTa->SetBinContent(1182,0.010731); + ssigpTa->SetBinContent(1183,0.0107787); + ssigpTa->SetBinContent(1184,0.0108273); + ssigpTa->SetBinContent(1185,0.0108765); + ssigpTa->SetBinContent(1186,0.0109266); + ssigpTa->SetBinContent(1187,0.0109772); + ssigpTa->SetBinContent(1188,0.0110289); + ssigpTa->SetBinContent(1189,0.0110811); + ssigpTa->SetBinContent(1190,0.0111344); + ssigpTa->SetBinContent(1191,0.0111882); + ssigpTa->SetBinContent(1192,0.011243); + ssigpTa->SetBinContent(1193,0.0112986); + ssigpTa->SetBinContent(1194,0.0113548); + ssigpTa->SetBinContent(1195,0.0114122); + ssigpTa->SetBinContent(1196,0.0114701); + ssigpTa->SetBinContent(1197,0.0115293); + ssigpTa->SetBinContent(1198,0.0115891); + ssigpTa->SetBinContent(1199,0.01165); + ssigpTa->SetBinContent(1200,0.0117119); + ssigpTa->SetBinContent(1201,0.0117749); + ssigpTa->SetBinContent(1202,0.0119973); + ssigpTa->SetBinContent(1203,0.013014); + ssigpTa->SetBinContent(1204,0.0148302); + ssigpTa->SetBinContent(1205,0.0158562); + ssigpTa->SetBinContent(1206,0.0160926); + ssigpTa->SetBinContent(1207,0.0161718); + ssigpTa->SetBinContent(1208,0.016252); + ssigpTa->SetBinContent(1209,0.0163332); + ssigpTa->SetBinContent(1210,0.0164153); + ssigpTa->SetBinContent(1211,0.0164988); + ssigpTa->SetBinContent(1212,0.0165829); + ssigpTa->SetBinContent(1213,0.0165231); + ssigpTa->SetBinContent(1214,0.0157431); + ssigpTa->SetBinContent(1215,0.0142656); + ssigpTa->SetBinContent(1216,0.0135704); + ssigpTa->SetBinContent(1217,0.0136306); + ssigpTa->SetBinContent(1218,0.0138413); + ssigpTa->SetBinContent(1219,0.0140526); + ssigpTa->SetBinContent(1220,0.014264); + ssigpTa->SetBinContent(1221,0.0144765); + ssigpTa->SetBinContent(1222,0.014652); + ssigpTa->SetBinContent(1223,0.0146418); + ssigpTa->SetBinContent(1224,0.0143622); + ssigpTa->SetBinContent(1225,0.0138564); + ssigpTa->SetBinContent(1226,0.0131222); + ssigpTa->SetBinContent(1227,0.0128523); + ssigpTa->SetBinContent(1228,0.0130259); + ssigpTa->SetBinContent(1229,0.0132925); + ssigpTa->SetBinContent(1230,0.0135646); + ssigpTa->SetBinContent(1231,0.0138422); + ssigpTa->SetBinContent(1232,0.0141239); + ssigpTa->SetBinContent(1233,0.0143749); + ssigpTa->SetBinContent(1234,0.0144532); + ssigpTa->SetBinContent(1235,0.0143364); + ssigpTa->SetBinContent(1236,0.0144061); + ssigpTa->SetBinContent(1237,0.0146507); + ssigpTa->SetBinContent(1238,0.0149337); + ssigpTa->SetBinContent(1239,0.0152203); + ssigpTa->SetBinContent(1240,0.01551); + ssigpTa->SetBinContent(1241,0.0158045); + ssigpTa->SetBinContent(1242,0.0161032); + ssigpTa->SetBinContent(1243,0.016406); + ssigpTa->SetBinContent(1244,0.0166722); + ssigpTa->SetBinContent(1245,0.0167298); + ssigpTa->SetBinContent(1246,0.0165689); + ssigpTa->SetBinContent(1247,0.0166129); + ssigpTa->SetBinContent(1248,0.0168642); + ssigpTa->SetBinContent(1249,0.0171579); + ssigpTa->SetBinContent(1250,0.0174535); + ssigpTa->SetBinContent(1251,0.0177524); + ssigpTa->SetBinContent(1252,0.018055); + ssigpTa->SetBinContent(1253,0.0183586); + ssigpTa->SetBinContent(1254,0.018664); + ssigpTa->SetBinContent(1255,0.0189715); + ssigpTa->SetBinContent(1256,0.0192452); + ssigpTa->SetBinContent(1257,0.019346); + ssigpTa->SetBinContent(1258,0.019269); + ssigpTa->SetBinContent(1259,0.0192748); + ssigpTa->SetBinContent(1260,0.0190104); + ssigpTa->SetBinContent(1261,0.0183372); + ssigpTa->SetBinContent(1262,0.0181169); + ssigpTa->SetBinContent(1263,0.0183499); + ssigpTa->SetBinContent(1264,0.0186798); + ssigpTa->SetBinContent(1265,0.0190131); + ssigpTa->SetBinContent(1266,0.0193473); + ssigpTa->SetBinContent(1267,0.0196873); + ssigpTa->SetBinContent(1268,0.0200359); + ssigpTa->SetBinContent(1269,0.0203897); + ssigpTa->SetBinContent(1270,0.0207566); + ssigpTa->SetBinContent(1271,0.0211922); + ssigpTa->SetBinContent(1272,0.0217042); + ssigpTa->SetBinContent(1273,0.0221406); + ssigpTa->SetBinContent(1274,0.0223786); + ssigpTa->SetBinContent(1275,0.0219451); + ssigpTa->SetBinContent(1276,0.0208369); + ssigpTa->SetBinContent(1277,0.0203344); + ssigpTa->SetBinContent(1278,0.0204578); + ssigpTa->SetBinContent(1279,0.0206993); + ssigpTa->SetBinContent(1280,0.0209346); + ssigpTa->SetBinContent(1281,0.021171); + ssigpTa->SetBinContent(1282,0.0212643); + ssigpTa->SetBinContent(1283,0.0206448); + ssigpTa->SetBinContent(1284,0.0192957); + ssigpTa->SetBinContent(1285,0.0186916); + ssigpTa->SetBinContent(1286,0.0188127); + ssigpTa->SetBinContent(1287,0.0190812); + ssigpTa->SetBinContent(1288,0.0194823); + ssigpTa->SetBinContent(1289,0.0205149); + ssigpTa->SetBinContent(1290,0.0221787); + ssigpTa->SetBinContent(1291,0.0232398); + ssigpTa->SetBinContent(1292,0.0236876); + ssigpTa->SetBinContent(1293,0.0240222); + ssigpTa->SetBinContent(1294,0.0243658); + ssigpTa->SetBinContent(1295,0.0247098); + ssigpTa->SetBinContent(1296,0.0250524); + ssigpTa->SetBinContent(1297,0.025303); + ssigpTa->SetBinContent(1298,0.0250895); + ssigpTa->SetBinContent(1299,0.0244097); + ssigpTa->SetBinContent(1300,0.0241832); + ssigpTa->SetBinContent(1301,0.0245321); + ssigpTa->SetBinContent(1302,0.0255612); + ssigpTa->SetBinContent(1303,0.0271898); + ssigpTa->SetBinContent(1304,0.0282695); + ssigpTa->SetBinContent(1305,0.0287939); + ssigpTa->SetBinContent(1306,0.0292065); + ssigpTa->SetBinContent(1307,0.0296157); + ssigpTa->SetBinContent(1308,0.029911); + ssigpTa->SetBinContent(1309,0.0296527); + ssigpTa->SetBinContent(1310,0.0288465); + ssigpTa->SetBinContent(1311,0.0285768); + ssigpTa->SetBinContent(1312,0.0289908); + ssigpTa->SetBinContent(1313,0.0301792); + ssigpTa->SetBinContent(1314,0.0320493); + ssigpTa->SetBinContent(1315,0.0332914); + ssigpTa->SetBinContent(1316,0.0338802); + ssigpTa->SetBinContent(1317,0.034341); + ssigpTa->SetBinContent(1318,0.0348162); + ssigpTa->SetBinContent(1319,0.0353145); + ssigpTa->SetBinContent(1320,0.0355334); + ssigpTa->SetBinContent(1321,0.0342749); + ssigpTa->SetBinContent(1322,0.0315307); + ssigpTa->SetBinContent(1323,0.0302881); + ssigpTa->SetBinContent(1324,0.0309772); + ssigpTa->SetBinContent(1325,0.0324695); + ssigpTa->SetBinContent(1326,0.0335222); + ssigpTa->SetBinContent(1327,0.0341127); + ssigpTa->SetBinContent(1328,0.034595); + ssigpTa->SetBinContent(1329,0.0350762); + ssigpTa->SetBinContent(1330,0.0355612); + ssigpTa->SetBinContent(1331,0.0360349); + ssigpTa->SetBinContent(1332,0.0364556); + ssigpTa->SetBinContent(1333,0.0367855); + ssigpTa->SetBinContent(1334,0.0374685); + ssigpTa->SetBinContent(1335,0.0388864); + ssigpTa->SetBinContent(1336,0.0400404); + ssigpTa->SetBinContent(1337,0.0407269); + ssigpTa->SetBinContent(1338,0.0412802); + ssigpTa->SetBinContent(1339,0.0418215); + ssigpTa->SetBinContent(1340,0.042397); + ssigpTa->SetBinContent(1341,0.0430106); + ssigpTa->SetBinContent(1342,0.0435323); + ssigpTa->SetBinContent(1343,0.0435641); + ssigpTa->SetBinContent(1344,0.0431344); + ssigpTa->SetBinContent(1345,0.0431875); + ssigpTa->SetBinContent(1346,0.0435249); + ssigpTa->SetBinContent(1347,0.0437442); + ssigpTa->SetBinContent(1348,0.0441445); + ssigpTa->SetBinContent(1349,0.0447503); + ssigpTa->SetBinContent(1350,0.0453923); + ssigpTa->SetBinContent(1351,0.046032); + ssigpTa->SetBinContent(1352,0.0467101); + ssigpTa->SetBinContent(1353,0.0474464); + ssigpTa->SetBinContent(1354,0.0482114); + ssigpTa->SetBinContent(1355,0.0489736); + ssigpTa->SetBinContent(1356,0.0497202); + ssigpTa->SetBinContent(1357,0.0504398); + ssigpTa->SetBinContent(1358,0.051146); + ssigpTa->SetBinContent(1359,0.0518859); + ssigpTa->SetBinContent(1360,0.0526693); + ssigpTa->SetBinContent(1361,0.0533567); + ssigpTa->SetBinContent(1362,0.0534313); + ssigpTa->SetBinContent(1363,0.0528334); + ssigpTa->SetBinContent(1364,0.0528609); + ssigpTa->SetBinContent(1365,0.0535848); + ssigpTa->SetBinContent(1366,0.0545166); + ssigpTa->SetBinContent(1367,0.0554273); + ssigpTa->SetBinContent(1368,0.0560769); + ssigpTa->SetBinContent(1371,0.00890856); + ssigpTa->SetBinContent(1372,0.00890469); + ssigpTa->SetBinContent(1373,0.00890268); + ssigpTa->SetBinContent(1374,0.00890386); + ssigpTa->SetBinContent(1375,0.00890554); + ssigpTa->SetBinContent(1376,0.00890794); + ssigpTa->SetBinContent(1377,0.00891054); + ssigpTa->SetBinContent(1378,0.00891402); + ssigpTa->SetBinContent(1379,0.0089177); + ssigpTa->SetBinContent(1380,0.00892268); + ssigpTa->SetBinContent(1381,0.00892744); + ssigpTa->SetBinContent(1382,0.008933); + ssigpTa->SetBinContent(1383,0.00893876); + ssigpTa->SetBinContent(1384,0.00894526); + ssigpTa->SetBinContent(1385,0.0089517); + ssigpTa->SetBinContent(1386,0.00895912); + ssigpTa->SetBinContent(1387,0.00896728); + ssigpTa->SetBinContent(1388,0.0089757); + ssigpTa->SetBinContent(1389,0.00898462); + ssigpTa->SetBinContent(1390,0.00899372); + ssigpTa->SetBinContent(1391,0.00900372); + ssigpTa->SetBinContent(1392,0.00901462); + ssigpTa->SetBinContent(1393,0.0090257); + ssigpTa->SetBinContent(1394,0.00903728); + ssigpTa->SetBinContent(1395,0.0090492); + ssigpTa->SetBinContent(1396,0.00906148); + ssigpTa->SetBinContent(1397,0.00907504); + ssigpTa->SetBinContent(1398,0.00908854); + ssigpTa->SetBinContent(1399,0.00910272); + ssigpTa->SetBinContent(1400,0.00911754); + ssigpTa->SetBinContent(1401,0.00913248); + ssigpTa->SetBinContent(1402,0.00914798); + ssigpTa->SetBinContent(1403,0.00916392); + ssigpTa->SetBinContent(1404,0.00918066); + ssigpTa->SetBinContent(1405,0.009198); + ssigpTa->SetBinContent(1406,0.00921542); + ssigpTa->SetBinContent(1407,0.00923408); + ssigpTa->SetBinContent(1408,0.00925284); + ssigpTa->SetBinContent(1409,0.0092721); + ssigpTa->SetBinContent(1410,0.00929154); + ssigpTa->SetBinContent(1411,0.00931212); + ssigpTa->SetBinContent(1412,0.00933304); + ssigpTa->SetBinContent(1413,0.00935454); + ssigpTa->SetBinContent(1414,0.00937646); + ssigpTa->SetBinContent(1415,0.00939872); + ssigpTa->SetBinContent(1416,0.0094223); + ssigpTa->SetBinContent(1417,0.0094458); + ssigpTa->SetBinContent(1418,0.00946996); + ssigpTa->SetBinContent(1419,0.00949496); + ssigpTa->SetBinContent(1420,0.00951998); + ssigpTa->SetBinContent(1421,0.0095458); + ssigpTa->SetBinContent(1422,0.0095715); + ssigpTa->SetBinContent(1423,0.00959834); + ssigpTa->SetBinContent(1424,0.00962568); + ssigpTa->SetBinContent(1425,0.00965344); + ssigpTa->SetBinContent(1426,0.00968204); + ssigpTa->SetBinContent(1427,0.0097116); + ssigpTa->SetBinContent(1428,0.00974142); + ssigpTa->SetBinContent(1429,0.0097716); + ssigpTa->SetBinContent(1430,0.00980204); + ssigpTa->SetBinContent(1431,0.00983306); + ssigpTa->SetBinContent(1432,0.0098649); + ssigpTa->SetBinContent(1433,0.00989708); + ssigpTa->SetBinContent(1434,0.00993064); + ssigpTa->SetBinContent(1435,0.00996392); + ssigpTa->SetBinContent(1436,0.00999842); + ssigpTa->SetBinContent(1437,0.0100335); + ssigpTa->SetBinContent(1438,0.0100687); + ssigpTa->SetBinContent(1439,0.0101047); + ssigpTa->SetBinContent(1440,0.0101406); + ssigpTa->SetBinContent(1441,0.010178); + ssigpTa->SetBinContent(1442,0.010216); + ssigpTa->SetBinContent(1443,0.0102544); + ssigpTa->SetBinContent(1444,0.0102927); + ssigpTa->SetBinContent(1445,0.010332); + ssigpTa->SetBinContent(1446,0.0103724); + ssigpTa->SetBinContent(1447,0.0104137); + ssigpTa->SetBinContent(1448,0.0104554); + ssigpTa->SetBinContent(1449,0.0104978); + ssigpTa->SetBinContent(1450,0.0105406); + ssigpTa->SetBinContent(1451,0.010584); + ssigpTa->SetBinContent(1452,0.010628); + ssigpTa->SetBinContent(1453,0.0106734); + ssigpTa->SetBinContent(1454,0.0107187); + ssigpTa->SetBinContent(1455,0.0107652); + ssigpTa->SetBinContent(1456,0.0108117); + ssigpTa->SetBinContent(1457,0.0108597); + ssigpTa->SetBinContent(1458,0.0109078); + ssigpTa->SetBinContent(1459,0.0109569); + ssigpTa->SetBinContent(1460,0.0110065); + ssigpTa->SetBinContent(1461,0.0110574); + ssigpTa->SetBinContent(1462,0.0111089); + ssigpTa->SetBinContent(1463,0.0111614); + ssigpTa->SetBinContent(1464,0.0112141); + ssigpTa->SetBinContent(1465,0.0112678); + ssigpTa->SetBinContent(1466,0.0113224); + ssigpTa->SetBinContent(1467,0.0113776); + ssigpTa->SetBinContent(1468,0.0114341); + ssigpTa->SetBinContent(1469,0.0114907); + ssigpTa->SetBinContent(1470,0.0115491); + ssigpTa->SetBinContent(1471,0.0116079); + ssigpTa->SetBinContent(1472,0.0116678); + ssigpTa->SetBinContent(1473,0.0117283); + ssigpTa->SetBinContent(1474,0.0117901); + ssigpTa->SetBinContent(1475,0.0118531); + ssigpTa->SetBinContent(1476,0.0120759); + ssigpTa->SetBinContent(1477,0.0131019); + ssigpTa->SetBinContent(1478,0.0149324); + ssigpTa->SetBinContent(1479,0.0159672); + ssigpTa->SetBinContent(1480,0.0162042); + ssigpTa->SetBinContent(1481,0.0162834); + ssigpTa->SetBinContent(1482,0.0163635); + ssigpTa->SetBinContent(1483,0.0164445); + ssigpTa->SetBinContent(1484,0.0165268); + ssigpTa->SetBinContent(1485,0.0166097); + ssigpTa->SetBinContent(1486,0.016694); + ssigpTa->SetBinContent(1487,0.0166332); + ssigpTa->SetBinContent(1488,0.0158472); + ssigpTa->SetBinContent(1489,0.0143621); + ssigpTa->SetBinContent(1490,0.0136635); + ssigpTa->SetBinContent(1491,0.0137281); + ssigpTa->SetBinContent(1492,0.0139441); + ssigpTa->SetBinContent(1493,0.0141608); + ssigpTa->SetBinContent(1494,0.0143792); + ssigpTa->SetBinContent(1495,0.014599); + ssigpTa->SetBinContent(1496,0.0147825); + ssigpTa->SetBinContent(1497,0.0147675); + ssigpTa->SetBinContent(1498,0.014468); + ssigpTa->SetBinContent(1499,0.0139914); + ssigpTa->SetBinContent(1500,0.0133372); + ssigpTa->SetBinContent(1501,0.0131128); + ssigpTa->SetBinContent(1502,0.0132958); + ssigpTa->SetBinContent(1503,0.0135697); + ssigpTa->SetBinContent(1504,0.0138483); + ssigpTa->SetBinContent(1505,0.014133); + ssigpTa->SetBinContent(1506,0.0144211); + ssigpTa->SetBinContent(1507,0.0146744); + ssigpTa->SetBinContent(1508,0.0147053); + ssigpTa->SetBinContent(1509,0.0144984); + ssigpTa->SetBinContent(1510,0.0145188); + ssigpTa->SetBinContent(1511,0.0147634); + ssigpTa->SetBinContent(1512,0.01505); + ssigpTa->SetBinContent(1513,0.0153411); + ssigpTa->SetBinContent(1514,0.0156355); + ssigpTa->SetBinContent(1515,0.0159345); + ssigpTa->SetBinContent(1516,0.0162381); + ssigpTa->SetBinContent(1517,0.0165457); + ssigpTa->SetBinContent(1518,0.016817); + ssigpTa->SetBinContent(1519,0.0168708); + ssigpTa->SetBinContent(1520,0.0166908); + ssigpTa->SetBinContent(1521,0.0167297); + ssigpTa->SetBinContent(1522,0.0169852); + ssigpTa->SetBinContent(1523,0.0172835); + ssigpTa->SetBinContent(1524,0.0175845); + ssigpTa->SetBinContent(1525,0.017889); + ssigpTa->SetBinContent(1526,0.0181972); + ssigpTa->SetBinContent(1527,0.0185072); + ssigpTa->SetBinContent(1528,0.0188192); + ssigpTa->SetBinContent(1529,0.019134); + ssigpTa->SetBinContent(1530,0.0194149); + ssigpTa->SetBinContent(1531,0.0195067); + ssigpTa->SetBinContent(1532,0.0194014); + ssigpTa->SetBinContent(1533,0.0193965); + ssigpTa->SetBinContent(1534,0.0191309); + ssigpTa->SetBinContent(1535,0.018445); + ssigpTa->SetBinContent(1536,0.0182213); + ssigpTa->SetBinContent(1537,0.0184567); + ssigpTa->SetBinContent(1538,0.0187885); + ssigpTa->SetBinContent(1539,0.0191247); + ssigpTa->SetBinContent(1540,0.0194617); + ssigpTa->SetBinContent(1541,0.0198047); + ssigpTa->SetBinContent(1542,0.0201563); + ssigpTa->SetBinContent(1543,0.0205132); + ssigpTa->SetBinContent(1544,0.0208874); + ssigpTa->SetBinContent(1545,0.0213583); + ssigpTa->SetBinContent(1546,0.0219285); + ssigpTa->SetBinContent(1547,0.0224065); + ssigpTa->SetBinContent(1548,0.0226601); + ssigpTa->SetBinContent(1549,0.0222411); + ssigpTa->SetBinContent(1550,0.0211546); + ssigpTa->SetBinContent(1551,0.0206615); + ssigpTa->SetBinContent(1552,0.0207913); + ssigpTa->SetBinContent(1553,0.0210409); + ssigpTa->SetBinContent(1554,0.0212847); + ssigpTa->SetBinContent(1555,0.0215247); + ssigpTa->SetBinContent(1556,0.0216078); + ssigpTa->SetBinContent(1557,0.0209395); + ssigpTa->SetBinContent(1558,0.0195013); + ssigpTa->SetBinContent(1559,0.0188524); + ssigpTa->SetBinContent(1560,0.018976); + ssigpTa->SetBinContent(1561,0.0192516); + ssigpTa->SetBinContent(1562,0.0196577); + ssigpTa->SetBinContent(1563,0.0206729); + ssigpTa->SetBinContent(1564,0.022296); + ssigpTa->SetBinContent(1565,0.0233369); + ssigpTa->SetBinContent(1566,0.0237859); + ssigpTa->SetBinContent(1567,0.0241238); + ssigpTa->SetBinContent(1568,0.0244695); + ssigpTa->SetBinContent(1569,0.0248166); + ssigpTa->SetBinContent(1570,0.0251634); + ssigpTa->SetBinContent(1571,0.0254185); + ssigpTa->SetBinContent(1572,0.0252164); + ssigpTa->SetBinContent(1573,0.0245569); + ssigpTa->SetBinContent(1574,0.0243447); + ssigpTa->SetBinContent(1575,0.0247036); + ssigpTa->SetBinContent(1576,0.0257456); + ssigpTa->SetBinContent(1577,0.0273837); + ssigpTa->SetBinContent(1578,0.0284731); + ssigpTa->SetBinContent(1579,0.0290022); + ssigpTa->SetBinContent(1580,0.0294183); + ssigpTa->SetBinContent(1581,0.0298337); + ssigpTa->SetBinContent(1582,0.0301393); + ssigpTa->SetBinContent(1583,0.0299193); + ssigpTa->SetBinContent(1584,0.0291739); + ssigpTa->SetBinContent(1585,0.028945); + ssigpTa->SetBinContent(1586,0.0293738); + ssigpTa->SetBinContent(1587,0.0305677); + ssigpTa->SetBinContent(1588,0.0324292); + ssigpTa->SetBinContent(1589,0.0336709); + ssigpTa->SetBinContent(1590,0.0342672); + ssigpTa->SetBinContent(1591,0.0347394); + ssigpTa->SetBinContent(1592,0.0352266); + ssigpTa->SetBinContent(1593,0.0357344); + ssigpTa->SetBinContent(1594,0.0359731); + ssigpTa->SetBinContent(1595,0.0347978); + ssigpTa->SetBinContent(1596,0.032183); + ssigpTa->SetBinContent(1597,0.0310194); + ssigpTa->SetBinContent(1598,0.0317262); + ssigpTa->SetBinContent(1599,0.0332287); + ssigpTa->SetBinContent(1600,0.0342837); + ssigpTa->SetBinContent(1601,0.034878); + ssigpTa->SetBinContent(1602,0.0353729); + ssigpTa->SetBinContent(1603,0.035867); + ssigpTa->SetBinContent(1604,0.0363612); + ssigpTa->SetBinContent(1605,0.036846); + ssigpTa->SetBinContent(1606,0.0372819); + ssigpTa->SetBinContent(1607,0.0376101); + ssigpTa->SetBinContent(1608,0.0382542); + ssigpTa->SetBinContent(1609,0.0396527); + ssigpTa->SetBinContent(1610,0.040793); + ssigpTa->SetBinContent(1611,0.0414791); + ssigpTa->SetBinContent(1612,0.0420483); + ssigpTa->SetBinContent(1613,0.0426129); + ssigpTa->SetBinContent(1614,0.0432039); + ssigpTa->SetBinContent(1615,0.043822); + ssigpTa->SetBinContent(1616,0.044363); + ssigpTa->SetBinContent(1617,0.0444796); + ssigpTa->SetBinContent(1618,0.0441817); + ssigpTa->SetBinContent(1619,0.0443163); + ssigpTa->SetBinContent(1620,0.0447107); + ssigpTa->SetBinContent(1621,0.0449947); + ssigpTa->SetBinContent(1622,0.0454481); + ssigpTa->SetBinContent(1623,0.0460741); + ssigpTa->SetBinContent(1624,0.0467299); + ssigpTa->SetBinContent(1625,0.0473903); + ssigpTa->SetBinContent(1626,0.0480924); + ssigpTa->SetBinContent(1627,0.0488475); + ssigpTa->SetBinContent(1628,0.0496242); + ssigpTa->SetBinContent(1629,0.0503979); + ssigpTa->SetBinContent(1630,0.05116); + ssigpTa->SetBinContent(1631,0.0519063); + ssigpTa->SetBinContent(1632,0.0526464); + ssigpTa->SetBinContent(1633,0.053414); + ssigpTa->SetBinContent(1634,0.0542113); + ssigpTa->SetBinContent(1635,0.0549135); + ssigpTa->SetBinContent(1636,0.0550172); + ssigpTa->SetBinContent(1637,0.0545056); + ssigpTa->SetBinContent(1638,0.0545974); + ssigpTa->SetBinContent(1639,0.0553595); + ssigpTa->SetBinContent(1640,0.0562923); + ssigpTa->SetBinContent(1641,0.057188); + ssigpTa->SetBinContent(1642,0.0578266); + ssigpTa->SetBinContent(1645,0.00916722); + ssigpTa->SetBinContent(1646,0.00915792); + ssigpTa->SetBinContent(1647,0.0091536); + ssigpTa->SetBinContent(1648,0.00915436); + ssigpTa->SetBinContent(1649,0.00915596); + ssigpTa->SetBinContent(1650,0.00915748); + ssigpTa->SetBinContent(1651,0.00916044); + ssigpTa->SetBinContent(1652,0.0091632); + ssigpTa->SetBinContent(1653,0.00916768); + ssigpTa->SetBinContent(1654,0.0091726); + ssigpTa->SetBinContent(1655,0.00917788); + ssigpTa->SetBinContent(1656,0.00918256); + ssigpTa->SetBinContent(1657,0.00918844); + ssigpTa->SetBinContent(1658,0.00919492); + ssigpTa->SetBinContent(1659,0.0092012); + ssigpTa->SetBinContent(1660,0.00920788); + ssigpTa->SetBinContent(1661,0.00921692); + ssigpTa->SetBinContent(1662,0.00922552); + ssigpTa->SetBinContent(1663,0.00923456); + ssigpTa->SetBinContent(1664,0.0092436); + ssigpTa->SetBinContent(1665,0.009254); + ssigpTa->SetBinContent(1666,0.00926416); + ssigpTa->SetBinContent(1667,0.00927592); + ssigpTa->SetBinContent(1668,0.00928652); + ssigpTa->SetBinContent(1669,0.00929808); + ssigpTa->SetBinContent(1670,0.00931044); + ssigpTa->SetBinContent(1671,0.00932356); + ssigpTa->SetBinContent(1672,0.00933764); + ssigpTa->SetBinContent(1673,0.0093512); + ssigpTa->SetBinContent(1674,0.00936588); + ssigpTa->SetBinContent(1675,0.0093814); + ssigpTa->SetBinContent(1676,0.00939648); + ssigpTa->SetBinContent(1677,0.00941256); + ssigpTa->SetBinContent(1678,0.0094284); + ssigpTa->SetBinContent(1679,0.00944568); + ssigpTa->SetBinContent(1680,0.00946312); + ssigpTa->SetBinContent(1681,0.0094812); + ssigpTa->SetBinContent(1682,0.0095004); + ssigpTa->SetBinContent(1683,0.0095192); + ssigpTa->SetBinContent(1684,0.009539); + ssigpTa->SetBinContent(1685,0.0095592); + ssigpTa->SetBinContent(1686,0.0095804); + ssigpTa->SetBinContent(1687,0.0096014); + ssigpTa->SetBinContent(1688,0.00962256); + ssigpTa->SetBinContent(1689,0.00964532); + ssigpTa->SetBinContent(1690,0.00966804); + ssigpTa->SetBinContent(1691,0.00969172); + ssigpTa->SetBinContent(1692,0.00971648); + ssigpTa->SetBinContent(1693,0.00974076); + ssigpTa->SetBinContent(1694,0.00976608); + ssigpTa->SetBinContent(1695,0.00979072); + ssigpTa->SetBinContent(1696,0.00981724); + ssigpTa->SetBinContent(1697,0.00984332); + ssigpTa->SetBinContent(1698,0.00987036); + ssigpTa->SetBinContent(1699,0.0098982); + ssigpTa->SetBinContent(1700,0.00992624); + ssigpTa->SetBinContent(1701,0.00995544); + ssigpTa->SetBinContent(1702,0.00998584); + ssigpTa->SetBinContent(1703,0.0100154); + ssigpTa->SetBinContent(1704,0.010046); + ssigpTa->SetBinContent(1705,0.0100762); + ssigpTa->SetBinContent(1706,0.0101076); + ssigpTa->SetBinContent(1707,0.0101407); + ssigpTa->SetBinContent(1708,0.0101729); + ssigpTa->SetBinContent(1709,0.010207); + ssigpTa->SetBinContent(1710,0.0102405); + ssigpTa->SetBinContent(1711,0.0102754); + ssigpTa->SetBinContent(1712,0.0103111); + ssigpTa->SetBinContent(1713,0.0103462); + ssigpTa->SetBinContent(1714,0.0103816); + ssigpTa->SetBinContent(1715,0.0104185); + ssigpTa->SetBinContent(1716,0.0104572); + ssigpTa->SetBinContent(1717,0.0104952); + ssigpTa->SetBinContent(1718,0.010533); + ssigpTa->SetBinContent(1719,0.0105717); + ssigpTa->SetBinContent(1720,0.0106118); + ssigpTa->SetBinContent(1721,0.0106526); + ssigpTa->SetBinContent(1722,0.0106944); + ssigpTa->SetBinContent(1723,0.0107366); + ssigpTa->SetBinContent(1724,0.0107795); + ssigpTa->SetBinContent(1725,0.0108222); + ssigpTa->SetBinContent(1726,0.010867); + ssigpTa->SetBinContent(1727,0.0109112); + ssigpTa->SetBinContent(1728,0.0109569); + ssigpTa->SetBinContent(1729,0.011002); + ssigpTa->SetBinContent(1730,0.0110497); + ssigpTa->SetBinContent(1731,0.0110964); + ssigpTa->SetBinContent(1732,0.0111448); + ssigpTa->SetBinContent(1733,0.0111938); + ssigpTa->SetBinContent(1734,0.0112432); + ssigpTa->SetBinContent(1735,0.011294); + ssigpTa->SetBinContent(1736,0.0113452); + ssigpTa->SetBinContent(1737,0.0113971); + ssigpTa->SetBinContent(1738,0.011449); + ssigpTa->SetBinContent(1739,0.0115023); + ssigpTa->SetBinContent(1740,0.0115566); + ssigpTa->SetBinContent(1741,0.0116116); + ssigpTa->SetBinContent(1742,0.011667); + ssigpTa->SetBinContent(1743,0.0117245); + ssigpTa->SetBinContent(1744,0.0117819); + ssigpTa->SetBinContent(1745,0.0118413); + ssigpTa->SetBinContent(1746,0.011901); + ssigpTa->SetBinContent(1747,0.0119614); + ssigpTa->SetBinContent(1748,0.0120225); + ssigpTa->SetBinContent(1749,0.0120847); + ssigpTa->SetBinContent(1750,0.0123108); + ssigpTa->SetBinContent(1751,0.0133496); + ssigpTa->SetBinContent(1752,0.01522); + ssigpTa->SetBinContent(1753,0.0162672); + ssigpTa->SetBinContent(1754,0.0165072); + ssigpTa->SetBinContent(1755,0.016586); + ssigpTa->SetBinContent(1756,0.016666); + ssigpTa->SetBinContent(1757,0.0167472); + ssigpTa->SetBinContent(1758,0.0168286); + ssigpTa->SetBinContent(1759,0.0169117); + ssigpTa->SetBinContent(1760,0.016995); + ssigpTa->SetBinContent(1761,0.0169325); + ssigpTa->SetBinContent(1762,0.0161404); + ssigpTa->SetBinContent(1763,0.0146349); + ssigpTa->SetBinContent(1764,0.0139396); + ssigpTa->SetBinContent(1765,0.0140139); + ssigpTa->SetBinContent(1766,0.0142434); + ssigpTa->SetBinContent(1767,0.0144758); + ssigpTa->SetBinContent(1768,0.0147104); + ssigpTa->SetBinContent(1769,0.0149484); + ssigpTa->SetBinContent(1770,0.0151468); + ssigpTa->SetBinContent(1771,0.0151136); + ssigpTa->SetBinContent(1772,0.0147758); + ssigpTa->SetBinContent(1773,0.014369); + ssigpTa->SetBinContent(1774,0.0138907); + ssigpTa->SetBinContent(1775,0.0137746); + ssigpTa->SetBinContent(1776,0.0139872); + ssigpTa->SetBinContent(1777,0.0142726); + ssigpTa->SetBinContent(1778,0.0145631); + ssigpTa->SetBinContent(1779,0.0148584); + ssigpTa->SetBinContent(1780,0.0151579); + ssigpTa->SetBinContent(1781,0.0153994); + ssigpTa->SetBinContent(1782,0.0153332); + ssigpTa->SetBinContent(1783,0.0149496); + ssigpTa->SetBinContent(1784,0.0148733); + ssigpTa->SetBinContent(1785,0.0151066); + ssigpTa->SetBinContent(1786,0.0154041); + ssigpTa->SetBinContent(1787,0.0157056); + ssigpTa->SetBinContent(1788,0.0160111); + ssigpTa->SetBinContent(1789,0.0163212); + ssigpTa->SetBinContent(1790,0.0166358); + ssigpTa->SetBinContent(1791,0.0169554); + ssigpTa->SetBinContent(1792,0.0172344); + ssigpTa->SetBinContent(1793,0.0172672); + ssigpTa->SetBinContent(1794,0.017036); + ssigpTa->SetBinContent(1795,0.0170539); + ssigpTa->SetBinContent(1796,0.017317); + ssigpTa->SetBinContent(1797,0.0176294); + ssigpTa->SetBinContent(1798,0.0179438); + ssigpTa->SetBinContent(1799,0.0182632); + ssigpTa->SetBinContent(1800,0.0185868); + ssigpTa->SetBinContent(1801,0.0189129); + ssigpTa->SetBinContent(1802,0.0192415); + ssigpTa->SetBinContent(1803,0.0195748); + ssigpTa->SetBinContent(1804,0.0198688); + ssigpTa->SetBinContent(1805,0.0199436); + ssigpTa->SetBinContent(1806,0.0197885); + ssigpTa->SetBinContent(1807,0.0197604); + ssigpTa->SetBinContent(1808,0.0194747); + ssigpTa->SetBinContent(1809,0.0187413); + ssigpTa->SetBinContent(1810,0.0184984); + ssigpTa->SetBinContent(1811,0.0187373); + ssigpTa->SetBinContent(1812,0.0190782); + ssigpTa->SetBinContent(1813,0.0194231); + ssigpTa->SetBinContent(1814,0.01977); + ssigpTa->SetBinContent(1815,0.0201222); + ssigpTa->SetBinContent(1816,0.020484); + ssigpTa->SetBinContent(1817,0.0208526); + ssigpTa->SetBinContent(1818,0.0212498); + ssigpTa->SetBinContent(1819,0.0217806); + ssigpTa->SetBinContent(1820,0.022454); + ssigpTa->SetBinContent(1821,0.0230008); + ssigpTa->SetBinContent(1822,0.0232924); + ssigpTa->SetBinContent(1823,0.022925); + ssigpTa->SetBinContent(1824,0.0219097); + ssigpTa->SetBinContent(1825,0.0214641); + ssigpTa->SetBinContent(1826,0.0216168); + ssigpTa->SetBinContent(1827,0.021889); + ssigpTa->SetBinContent(1828,0.0221556); + ssigpTa->SetBinContent(1829,0.0223965); + ssigpTa->SetBinContent(1830,0.0224321); + ssigpTa->SetBinContent(1831,0.0216483); + ssigpTa->SetBinContent(1832,0.0200179); + ssigpTa->SetBinContent(1833,0.0192687); + ssigpTa->SetBinContent(1834,0.0193858); + ssigpTa->SetBinContent(1835,0.0196754); + ssigpTa->SetBinContent(1836,0.0200872); + ssigpTa->SetBinContent(1837,0.021065); + ssigpTa->SetBinContent(1838,0.0225971); + ssigpTa->SetBinContent(1839,0.0235951); + ssigpTa->SetBinContent(1840,0.024043); + ssigpTa->SetBinContent(1841,0.0243877); + ssigpTa->SetBinContent(1842,0.0247407); + ssigpTa->SetBinContent(1843,0.0250946); + ssigpTa->SetBinContent(1844,0.0254506); + ssigpTa->SetBinContent(1845,0.0257186); + ssigpTa->SetBinContent(1846,0.0255474); + ssigpTa->SetBinContent(1847,0.0249433); + ssigpTa->SetBinContent(1848,0.0247678); + ssigpTa->SetBinContent(1849,0.0251483); + ssigpTa->SetBinContent(1850,0.0261963); + ssigpTa->SetBinContent(1851,0.0278234); + ssigpTa->SetBinContent(1852,0.028914); + ssigpTa->SetBinContent(1853,0.0294517); + ssigpTa->SetBinContent(1854,0.0298789); + ssigpTa->SetBinContent(1855,0.0303063); + ssigpTa->SetBinContent(1856,0.0306384); + ssigpTa->SetBinContent(1857,0.0304879); + ssigpTa->SetBinContent(1858,0.0298646); + ssigpTa->SetBinContent(1859,0.0297126); + ssigpTa->SetBinContent(1860,0.0301746); + ssigpTa->SetBinContent(1861,0.0313724); + ssigpTa->SetBinContent(1862,0.0332074); + ssigpTa->SetBinContent(1863,0.0344423); + ssigpTa->SetBinContent(1864,0.0350554); + ssigpTa->SetBinContent(1865,0.0355487); + ssigpTa->SetBinContent(1866,0.0360593); + ssigpTa->SetBinContent(1867,0.0365884); + ssigpTa->SetBinContent(1868,0.0368686); + ssigpTa->SetBinContent(1869,0.0358054); + ssigpTa->SetBinContent(1870,0.0333908); + ssigpTa->SetBinContent(1871,0.0323382); + ssigpTa->SetBinContent(1872,0.0331075); + ssigpTa->SetBinContent(1873,0.0346586); + ssigpTa->SetBinContent(1874,0.0357507); + ssigpTa->SetBinContent(1875,0.0363587); + ssigpTa->SetBinContent(1876,0.0368707); + ssigpTa->SetBinContent(1877,0.0373816); + ssigpTa->SetBinContent(1878,0.0378915); + ssigpTa->SetBinContent(1879,0.0383944); + ssigpTa->SetBinContent(1880,0.0388504); + ssigpTa->SetBinContent(1881,0.0391918); + ssigpTa->SetBinContent(1882,0.0398374); + ssigpTa->SetBinContent(1883,0.041234); + ssigpTa->SetBinContent(1884,0.0423833); + ssigpTa->SetBinContent(1885,0.0430812); + ssigpTa->SetBinContent(1886,0.0436742); + ssigpTa->SetBinContent(1887,0.0442685); + ssigpTa->SetBinContent(1888,0.0448803); + ssigpTa->SetBinContent(1889,0.045512); + ssigpTa->SetBinContent(1890,0.0460857); + ssigpTa->SetBinContent(1891,0.0462944); + ssigpTa->SetBinContent(1892,0.046147); + ssigpTa->SetBinContent(1893,0.046367); + ssigpTa->SetBinContent(1894,0.0468146); + ssigpTa->SetBinContent(1895,0.0471714); + ssigpTa->SetBinContent(1896,0.0476727); + ssigpTa->SetBinContent(1897,0.0483267); + ssigpTa->SetBinContent(1898,0.0490025); + ssigpTa->SetBinContent(1899,0.0496908); + ssigpTa->SetBinContent(1900,0.0504265); + ssigpTa->SetBinContent(1901,0.051209); + ssigpTa->SetBinContent(1902,0.0520059); + ssigpTa->SetBinContent(1903,0.0527989); + ssigpTa->SetBinContent(1904,0.053587); + ssigpTa->SetBinContent(1905,0.0543714); + ssigpTa->SetBinContent(1906,0.0551592); + ssigpTa->SetBinContent(1907,0.0559657); + ssigpTa->SetBinContent(1908,0.0567865); + ssigpTa->SetBinContent(1909,0.0574962); + ssigpTa->SetBinContent(1910,0.0576296); + ssigpTa->SetBinContent(1911,0.0571842); + ssigpTa->SetBinContent(1912,0.0573462); + ssigpTa->SetBinContent(1913,0.0581433); + ssigpTa->SetBinContent(1914,0.0590947); + ssigpTa->SetBinContent(1915,0.0600088); + ssigpTa->SetBinContent(1916,0.0607425); + ssigpTa->SetBinContent(1919,0.00970322); + ssigpTa->SetBinContent(1920,0.00969825); + ssigpTa->SetBinContent(1921,0.0096908); + ssigpTa->SetBinContent(1922,0.0096912); + ssigpTa->SetBinContent(1923,0.00969168); + ssigpTa->SetBinContent(1924,0.00969296); + ssigpTa->SetBinContent(1925,0.00969432); + ssigpTa->SetBinContent(1926,0.0096988); + ssigpTa->SetBinContent(1927,0.00970296); + ssigpTa->SetBinContent(1928,0.0097088); + ssigpTa->SetBinContent(1929,0.00971336); + ssigpTa->SetBinContent(1930,0.0097176); + ssigpTa->SetBinContent(1931,0.00972264); + ssigpTa->SetBinContent(1932,0.00972888); + ssigpTa->SetBinContent(1933,0.00973552); + ssigpTa->SetBinContent(1934,0.00974264); + ssigpTa->SetBinContent(1935,0.00975056); + ssigpTa->SetBinContent(1936,0.00976048); + ssigpTa->SetBinContent(1937,0.00977008); + ssigpTa->SetBinContent(1938,0.00978); + ssigpTa->SetBinContent(1939,0.0097888); + ssigpTa->SetBinContent(1940,0.00980088); + ssigpTa->SetBinContent(1941,0.00981008); + ssigpTa->SetBinContent(1942,0.00982096); + ssigpTa->SetBinContent(1943,0.00983184); + ssigpTa->SetBinContent(1944,0.00984352); + ssigpTa->SetBinContent(1945,0.00985808); + ssigpTa->SetBinContent(1946,0.00987064); + ssigpTa->SetBinContent(1947,0.0098836); + ssigpTa->SetBinContent(1948,0.00989896); + ssigpTa->SetBinContent(1949,0.009914); + ssigpTa->SetBinContent(1950,0.00993136); + ssigpTa->SetBinContent(1951,0.00994528); + ssigpTa->SetBinContent(1952,0.00996192); + ssigpTa->SetBinContent(1953,0.00997744); + ssigpTa->SetBinContent(1954,0.00999528); + ssigpTa->SetBinContent(1955,0.0100145); + ssigpTa->SetBinContent(1956,0.0100328); + ssigpTa->SetBinContent(1957,0.0100528); + ssigpTa->SetBinContent(1958,0.0100716); + ssigpTa->SetBinContent(1959,0.0100924); + ssigpTa->SetBinContent(1960,0.0101132); + ssigpTa->SetBinContent(1961,0.0101329); + ssigpTa->SetBinContent(1962,0.0101542); + ssigpTa->SetBinContent(1963,0.0101758); + ssigpTa->SetBinContent(1964,0.0101992); + ssigpTa->SetBinContent(1965,0.0102222); + ssigpTa->SetBinContent(1966,0.0102467); + ssigpTa->SetBinContent(1967,0.0102725); + ssigpTa->SetBinContent(1968,0.0102959); + ssigpTa->SetBinContent(1969,0.010321); + ssigpTa->SetBinContent(1970,0.0103464); + ssigpTa->SetBinContent(1971,0.0103734); + ssigpTa->SetBinContent(1972,0.0104006); + ssigpTa->SetBinContent(1973,0.0104273); + ssigpTa->SetBinContent(1974,0.0104552); + ssigpTa->SetBinContent(1975,0.010484); + ssigpTa->SetBinContent(1976,0.0105132); + ssigpTa->SetBinContent(1977,0.010544); + ssigpTa->SetBinContent(1978,0.0105732); + ssigpTa->SetBinContent(1979,0.0106041); + ssigpTa->SetBinContent(1980,0.0106358); + ssigpTa->SetBinContent(1981,0.0106678); + ssigpTa->SetBinContent(1982,0.0107016); + ssigpTa->SetBinContent(1983,0.0107329); + ssigpTa->SetBinContent(1984,0.0107663); + ssigpTa->SetBinContent(1985,0.0108009); + ssigpTa->SetBinContent(1986,0.0108363); + ssigpTa->SetBinContent(1987,0.0108714); + ssigpTa->SetBinContent(1988,0.0109056); + ssigpTa->SetBinContent(1989,0.0109431); + ssigpTa->SetBinContent(1990,0.0109814); + ssigpTa->SetBinContent(1991,0.0110198); + ssigpTa->SetBinContent(1992,0.0110569); + ssigpTa->SetBinContent(1993,0.0110965); + ssigpTa->SetBinContent(1994,0.0111357); + ssigpTa->SetBinContent(1995,0.0111758); + ssigpTa->SetBinContent(1996,0.0112174); + ssigpTa->SetBinContent(1997,0.0112587); + ssigpTa->SetBinContent(1998,0.0113008); + ssigpTa->SetBinContent(1999,0.0113454); + ssigpTa->SetBinContent(2000,0.0113887); + ssigpTa->SetBinContent(2001,0.011435); + ssigpTa->SetBinContent(2002,0.0114776); + ssigpTa->SetBinContent(2003,0.0115246); + ssigpTa->SetBinContent(2004,0.0115697); + ssigpTa->SetBinContent(2005,0.011618); + ssigpTa->SetBinContent(2006,0.0116651); + ssigpTa->SetBinContent(2007,0.0117143); + ssigpTa->SetBinContent(2008,0.0117639); + ssigpTa->SetBinContent(2009,0.0118139); + ssigpTa->SetBinContent(2010,0.0118656); + ssigpTa->SetBinContent(2011,0.0119149); + ssigpTa->SetBinContent(2012,0.011967); + ssigpTa->SetBinContent(2013,0.01202); + ssigpTa->SetBinContent(2014,0.0120746); + ssigpTa->SetBinContent(2015,0.0121288); + ssigpTa->SetBinContent(2016,0.0121834); + ssigpTa->SetBinContent(2017,0.0122401); + ssigpTa->SetBinContent(2018,0.0122989); + ssigpTa->SetBinContent(2019,0.012358); + ssigpTa->SetBinContent(2020,0.012418); + ssigpTa->SetBinContent(2021,0.012478); + ssigpTa->SetBinContent(2022,0.0125385); + ssigpTa->SetBinContent(2023,0.0125998); + ssigpTa->SetBinContent(2024,0.0128271); + ssigpTa->SetBinContent(2025,0.0139102); + ssigpTa->SetBinContent(2026,0.0158674); + ssigpTa->SetBinContent(2027,0.0169585); + ssigpTa->SetBinContent(2028,0.0171992); + ssigpTa->SetBinContent(2029,0.0172776); + ssigpTa->SetBinContent(2030,0.017358); + ssigpTa->SetBinContent(2031,0.0174376); + ssigpTa->SetBinContent(2032,0.0175193); + ssigpTa->SetBinContent(2033,0.0175998); + ssigpTa->SetBinContent(2034,0.0176836); + ssigpTa->SetBinContent(2035,0.0176178); + ssigpTa->SetBinContent(2036,0.0168005); + ssigpTa->SetBinContent(2037,0.0152438); + ssigpTa->SetBinContent(2038,0.0145374); + ssigpTa->SetBinContent(2039,0.014633); + ssigpTa->SetBinContent(2040,0.0148875); + ssigpTa->SetBinContent(2041,0.0151456); + ssigpTa->SetBinContent(2042,0.0154062); + ssigpTa->SetBinContent(2043,0.0156731); + ssigpTa->SetBinContent(2044,0.015887); + ssigpTa->SetBinContent(2045,0.0158172); + ssigpTa->SetBinContent(2046,0.0154174); + ssigpTa->SetBinContent(2047,0.0151022); + ssigpTa->SetBinContent(2048,0.0148643); + ssigpTa->SetBinContent(2049,0.0149031); + ssigpTa->SetBinContent(2050,0.0151574); + ssigpTa->SetBinContent(2051,0.0154561); + ssigpTa->SetBinContent(2052,0.015757); + ssigpTa->SetBinContent(2053,0.0160635); + ssigpTa->SetBinContent(2054,0.0163718); + ssigpTa->SetBinContent(2055,0.016596); + ssigpTa->SetBinContent(2056,0.0164122); + ssigpTa->SetBinContent(2057,0.0158157); + ssigpTa->SetBinContent(2058,0.0156266); + ssigpTa->SetBinContent(2059,0.0158502); + ssigpTa->SetBinContent(2060,0.0161651); + ssigpTa->SetBinContent(2061,0.0164843); + ssigpTa->SetBinContent(2062,0.0168062); + ssigpTa->SetBinContent(2063,0.0171333); + ssigpTa->SetBinContent(2064,0.0174662); + ssigpTa->SetBinContent(2065,0.0178038); + ssigpTa->SetBinContent(2066,0.0180874); + ssigpTa->SetBinContent(2067,0.0180698); + ssigpTa->SetBinContent(2068,0.0177385); + ssigpTa->SetBinContent(2069,0.0177082); + ssigpTa->SetBinContent(2070,0.0179832); + ssigpTa->SetBinContent(2071,0.0183181); + ssigpTa->SetBinContent(2072,0.0186592); + ssigpTa->SetBinContent(2073,0.0190023); + ssigpTa->SetBinContent(2074,0.019353); + ssigpTa->SetBinContent(2075,0.0197059); + ssigpTa->SetBinContent(2076,0.0200626); + ssigpTa->SetBinContent(2077,0.0204234); + ssigpTa->SetBinContent(2078,0.0207362); + ssigpTa->SetBinContent(2079,0.0207847); + ssigpTa->SetBinContent(2080,0.0205553); + ssigpTa->SetBinContent(2081,0.0204889); + ssigpTa->SetBinContent(2082,0.0201466); + ssigpTa->SetBinContent(2083,0.0193246); + ssigpTa->SetBinContent(2084,0.0190281); + ssigpTa->SetBinContent(2085,0.0192756); + ssigpTa->SetBinContent(2086,0.0196343); + ssigpTa->SetBinContent(2087,0.0200011); + ssigpTa->SetBinContent(2088,0.0203682); + ssigpTa->SetBinContent(2089,0.0207422); + ssigpTa->SetBinContent(2090,0.0211266); + ssigpTa->SetBinContent(2091,0.0215206); + ssigpTa->SetBinContent(2092,0.0219514); + ssigpTa->SetBinContent(2093,0.022561); + ssigpTa->SetBinContent(2094,0.0233422); + ssigpTa->SetBinContent(2095,0.0239738); + ssigpTa->SetBinContent(2096,0.0243218); + ssigpTa->SetBinContent(2097,0.0240518); + ssigpTa->SetBinContent(2098,0.0231818); + ssigpTa->SetBinContent(2099,0.0228358); + ssigpTa->SetBinContent(2100,0.023043); + ssigpTa->SetBinContent(2101,0.0233606); + ssigpTa->SetBinContent(2102,0.023665); + ssigpTa->SetBinContent(2103,0.0238903); + ssigpTa->SetBinContent(2104,0.0238209); + ssigpTa->SetBinContent(2105,0.0228474); + ssigpTa->SetBinContent(2106,0.0209691); + ssigpTa->SetBinContent(2107,0.0200777); + ssigpTa->SetBinContent(2108,0.020182); + ssigpTa->SetBinContent(2109,0.0204938); + ssigpTa->SetBinContent(2110,0.0209121); + ssigpTa->SetBinContent(2111,0.0218188); + ssigpTa->SetBinContent(2112,0.0232123); + ssigpTa->SetBinContent(2113,0.0241323); + ssigpTa->SetBinContent(2114,0.024579); + ssigpTa->SetBinContent(2115,0.0249386); + ssigpTa->SetBinContent(2116,0.0253054); + ssigpTa->SetBinContent(2117,0.0256747); + ssigpTa->SetBinContent(2118,0.0260473); + ssigpTa->SetBinContent(2119,0.026339); + ssigpTa->SetBinContent(2120,0.026231); + ssigpTa->SetBinContent(2121,0.0257257); + ssigpTa->SetBinContent(2122,0.0256222); + ssigpTa->SetBinContent(2123,0.0260315); + ssigpTa->SetBinContent(2124,0.0270624); + ssigpTa->SetBinContent(2125,0.0286322); + ssigpTa->SetBinContent(2126,0.0296984); + ssigpTa->SetBinContent(2127,0.0302514); + ssigpTa->SetBinContent(2128,0.030699); + ssigpTa->SetBinContent(2129,0.0311517); + ssigpTa->SetBinContent(2130,0.0315207); + ssigpTa->SetBinContent(2131,0.0314769); + ssigpTa->SetBinContent(2132,0.0310206); + ssigpTa->SetBinContent(2133,0.0309825); + ssigpTa->SetBinContent(2134,0.0314934); + ssigpTa->SetBinContent(2135,0.0326776); + ssigpTa->SetBinContent(2136,0.0344494); + ssigpTa->SetBinContent(2137,0.035661); + ssigpTa->SetBinContent(2138,0.0362999); + ssigpTa->SetBinContent(2139,0.0368325); + ssigpTa->SetBinContent(2140,0.0373826); + ssigpTa->SetBinContent(2141,0.0379527); + ssigpTa->SetBinContent(2142,0.0382847); + ssigpTa->SetBinContent(2143,0.0373715); + ssigpTa->SetBinContent(2144,0.0351758); + ssigpTa->SetBinContent(2145,0.0342798); + ssigpTa->SetBinContent(2146,0.0351245); + ssigpTa->SetBinContent(2147,0.0367557); + ssigpTa->SetBinContent(2148,0.0379063); + ssigpTa->SetBinContent(2149,0.0385553); + ssigpTa->SetBinContent(2150,0.039098); + ssigpTa->SetBinContent(2151,0.0396423); + ssigpTa->SetBinContent(2152,0.0401839); + ssigpTa->SetBinContent(2153,0.040723); + ssigpTa->SetBinContent(2154,0.0412196); + ssigpTa->SetBinContent(2155,0.0416106); + ssigpTa->SetBinContent(2156,0.0423106); + ssigpTa->SetBinContent(2157,0.0437558); + ssigpTa->SetBinContent(2158,0.0449496); + ssigpTa->SetBinContent(2159,0.0456946); + ssigpTa->SetBinContent(2160,0.0463309); + ssigpTa->SetBinContent(2161,0.0469713); + ssigpTa->SetBinContent(2162,0.0476251); + ssigpTa->SetBinContent(2163,0.0482954); + ssigpTa->SetBinContent(2164,0.0489199); + ssigpTa->SetBinContent(2165,0.0492391); + ssigpTa->SetBinContent(2166,0.0492368); + ssigpTa->SetBinContent(2167,0.0495533); + ssigpTa->SetBinContent(2168,0.050055); + ssigpTa->SetBinContent(2169,0.0504712); + ssigpTa->SetBinContent(2170,0.0510339); + ssigpTa->SetBinContent(2171,0.0517386); + ssigpTa->SetBinContent(2172,0.0524694); + ssigpTa->SetBinContent(2173,0.0532199); + ssigpTa->SetBinContent(2174,0.0540271); + ssigpTa->SetBinContent(2175,0.0548781); + ssigpTa->SetBinContent(2176,0.0557416); + ssigpTa->SetBinContent(2177,0.0565994); + ssigpTa->SetBinContent(2178,0.0574602); + ssigpTa->SetBinContent(2179,0.0583298); + ssigpTa->SetBinContent(2180,0.0592098); + ssigpTa->SetBinContent(2181,0.0601038); + ssigpTa->SetBinContent(2182,0.0610051); + ssigpTa->SetBinContent(2183,0.0617923); + ssigpTa->SetBinContent(2184,0.062061); + ssigpTa->SetBinContent(2185,0.0618306); + ssigpTa->SetBinContent(2186,0.0621661); + ssigpTa->SetBinContent(2187,0.0630838); + ssigpTa->SetBinContent(2188,0.0641381); + ssigpTa->SetBinContent(2189,0.0652258); + ssigpTa->SetBinContent(2190,0.0659904); + ssigpTa->SetBinContent(2193,0.0105689); + ssigpTa->SetBinContent(2194,0.0105592); + ssigpTa->SetBinContent(2195,0.0105568); + ssigpTa->SetBinContent(2196,0.0105568); + ssigpTa->SetBinContent(2197,0.010557); + ssigpTa->SetBinContent(2198,0.010557); + ssigpTa->SetBinContent(2199,0.0105604); + ssigpTa->SetBinContent(2200,0.0105644); + ssigpTa->SetBinContent(2201,0.0105718); + ssigpTa->SetBinContent(2202,0.0105768); + ssigpTa->SetBinContent(2203,0.0105802); + ssigpTa->SetBinContent(2204,0.0105828); + ssigpTa->SetBinContent(2205,0.0105862); + ssigpTa->SetBinContent(2206,0.0105938); + ssigpTa->SetBinContent(2207,0.0106004); + ssigpTa->SetBinContent(2208,0.010607); + ssigpTa->SetBinContent(2209,0.0106162); + ssigpTa->SetBinContent(2210,0.0106246); + ssigpTa->SetBinContent(2211,0.0106352); + ssigpTa->SetBinContent(2212,0.0106436); + ssigpTa->SetBinContent(2213,0.0106544); + ssigpTa->SetBinContent(2214,0.0106644); + ssigpTa->SetBinContent(2215,0.0106754); + ssigpTa->SetBinContent(2216,0.0106838); + ssigpTa->SetBinContent(2217,0.0106946); + ssigpTa->SetBinContent(2218,0.0107088); + ssigpTa->SetBinContent(2219,0.0107212); + ssigpTa->SetBinContent(2220,0.0107338); + ssigpTa->SetBinContent(2221,0.0107464); + ssigpTa->SetBinContent(2222,0.0107598); + ssigpTa->SetBinContent(2223,0.0107772); + ssigpTa->SetBinContent(2224,0.010793); + ssigpTa->SetBinContent(2225,0.0108096); + ssigpTa->SetBinContent(2226,0.0108214); + ssigpTa->SetBinContent(2227,0.0108398); + ssigpTa->SetBinContent(2228,0.0108572); + ssigpTa->SetBinContent(2229,0.0108772); + ssigpTa->SetBinContent(2230,0.0108964); + ssigpTa->SetBinContent(2231,0.010913); + ssigpTa->SetBinContent(2232,0.0109338); + ssigpTa->SetBinContent(2233,0.010953); + ssigpTa->SetBinContent(2234,0.010974); + ssigpTa->SetBinContent(2235,0.0109932); + ssigpTa->SetBinContent(2236,0.011014); + ssigpTa->SetBinContent(2237,0.0110366); + ssigpTa->SetBinContent(2238,0.011059); + ssigpTa->SetBinContent(2239,0.0110808); + ssigpTa->SetBinContent(2240,0.0111066); + ssigpTa->SetBinContent(2241,0.0111308); + ssigpTa->SetBinContent(2242,0.011155); + ssigpTa->SetBinContent(2243,0.0111784); + ssigpTa->SetBinContent(2244,0.0112034); + ssigpTa->SetBinContent(2245,0.0112308); + ssigpTa->SetBinContent(2246,0.0112568); + ssigpTa->SetBinContent(2247,0.0112858); + ssigpTa->SetBinContent(2248,0.0113134); + ssigpTa->SetBinContent(2249,0.0113402); + ssigpTa->SetBinContent(2250,0.011371); + ssigpTa->SetBinContent(2251,0.0114002); + ssigpTa->SetBinContent(2252,0.0114302); + ssigpTa->SetBinContent(2253,0.0114602); + ssigpTa->SetBinContent(2254,0.0114926); + ssigpTa->SetBinContent(2255,0.011526); + ssigpTa->SetBinContent(2256,0.0115552); + ssigpTa->SetBinContent(2257,0.0115878); + ssigpTa->SetBinContent(2258,0.0116188); + ssigpTa->SetBinContent(2259,0.011653); + ssigpTa->SetBinContent(2260,0.011688); + ssigpTa->SetBinContent(2261,0.0117206); + ssigpTa->SetBinContent(2262,0.0117556); + ssigpTa->SetBinContent(2263,0.011793); + ssigpTa->SetBinContent(2264,0.0118322); + ssigpTa->SetBinContent(2265,0.011869); + ssigpTa->SetBinContent(2266,0.011908); + ssigpTa->SetBinContent(2267,0.0119472); + ssigpTa->SetBinContent(2268,0.0119872); + ssigpTa->SetBinContent(2269,0.0120272); + ssigpTa->SetBinContent(2270,0.0120674); + ssigpTa->SetBinContent(2271,0.0121082); + ssigpTa->SetBinContent(2272,0.01215); + ssigpTa->SetBinContent(2273,0.0121924); + ssigpTa->SetBinContent(2274,0.0122398); + ssigpTa->SetBinContent(2275,0.0122824); + ssigpTa->SetBinContent(2276,0.0123282); + ssigpTa->SetBinContent(2277,0.0123708); + ssigpTa->SetBinContent(2278,0.0124192); + ssigpTa->SetBinContent(2279,0.0124634); + ssigpTa->SetBinContent(2280,0.012511); + ssigpTa->SetBinContent(2281,0.0125584); + ssigpTa->SetBinContent(2282,0.0126084); + ssigpTa->SetBinContent(2283,0.0126592); + ssigpTa->SetBinContent(2284,0.0127078); + ssigpTa->SetBinContent(2285,0.0127586); + ssigpTa->SetBinContent(2286,0.012808); + ssigpTa->SetBinContent(2287,0.0128644); + ssigpTa->SetBinContent(2288,0.0129194); + ssigpTa->SetBinContent(2289,0.0129712); + ssigpTa->SetBinContent(2290,0.0130262); + ssigpTa->SetBinContent(2291,0.0130814); + ssigpTa->SetBinContent(2292,0.0131396); + ssigpTa->SetBinContent(2293,0.0132004); + ssigpTa->SetBinContent(2294,0.0132596); + ssigpTa->SetBinContent(2295,0.0133204); + ssigpTa->SetBinContent(2296,0.0133796); + ssigpTa->SetBinContent(2297,0.0134406); + ssigpTa->SetBinContent(2298,0.0136824); + ssigpTa->SetBinContent(2299,0.0148728); + ssigpTa->SetBinContent(2300,0.0170404); + ssigpTa->SetBinContent(2301,0.0182378); + ssigpTa->SetBinContent(2302,0.0184922); + ssigpTa->SetBinContent(2303,0.0185688); + ssigpTa->SetBinContent(2304,0.0186464); + ssigpTa->SetBinContent(2305,0.018725); + ssigpTa->SetBinContent(2306,0.0188026); + ssigpTa->SetBinContent(2307,0.0188836); + ssigpTa->SetBinContent(2308,0.018962); + ssigpTa->SetBinContent(2309,0.0188854); + ssigpTa->SetBinContent(2310,0.017985); + ssigpTa->SetBinContent(2311,0.0162774); + ssigpTa->SetBinContent(2312,0.0155096); + ssigpTa->SetBinContent(2313,0.015624); + ssigpTa->SetBinContent(2314,0.0159098); + ssigpTa->SetBinContent(2315,0.0161998); + ssigpTa->SetBinContent(2316,0.0164928); + ssigpTa->SetBinContent(2317,0.016787); + ssigpTa->SetBinContent(2318,0.0170188); + ssigpTa->SetBinContent(2319,0.0169014); + ssigpTa->SetBinContent(2320,0.016406); + ssigpTa->SetBinContent(2321,0.016155); + ssigpTa->SetBinContent(2322,0.0161296); + ssigpTa->SetBinContent(2323,0.0163022); + ssigpTa->SetBinContent(2324,0.0165952); + ssigpTa->SetBinContent(2325,0.0169058); + ssigpTa->SetBinContent(2326,0.0172192); + ssigpTa->SetBinContent(2327,0.0175358); + ssigpTa->SetBinContent(2328,0.0178584); + ssigpTa->SetBinContent(2329,0.0180792); + ssigpTa->SetBinContent(2330,0.0178076); + ssigpTa->SetBinContent(2331,0.0170452); + ssigpTa->SetBinContent(2332,0.016771); + ssigpTa->SetBinContent(2333,0.017); + ssigpTa->SetBinContent(2334,0.0173382); + ssigpTa->SetBinContent(2335,0.0176782); + ssigpTa->SetBinContent(2336,0.0180206); + ssigpTa->SetBinContent(2337,0.0183682); + ssigpTa->SetBinContent(2338,0.018723); + ssigpTa->SetBinContent(2339,0.0190812); + ssigpTa->SetBinContent(2340,0.0193678); + ssigpTa->SetBinContent(2341,0.0192786); + ssigpTa->SetBinContent(2342,0.0188018); + ssigpTa->SetBinContent(2343,0.0187082); + ssigpTa->SetBinContent(2344,0.0189916); + ssigpTa->SetBinContent(2345,0.019359); + ssigpTa->SetBinContent(2346,0.0197282); + ssigpTa->SetBinContent(2347,0.0201054); + ssigpTa->SetBinContent(2348,0.0204856); + ssigpTa->SetBinContent(2349,0.0208726); + ssigpTa->SetBinContent(2350,0.0212616); + ssigpTa->SetBinContent(2351,0.021654); + ssigpTa->SetBinContent(2352,0.0219888); + ssigpTa->SetBinContent(2353,0.0220006); + ssigpTa->SetBinContent(2354,0.0216828); + ssigpTa->SetBinContent(2355,0.0215594); + ssigpTa->SetBinContent(2356,0.021165); + ssigpTa->SetBinContent(2357,0.0202292); + ssigpTa->SetBinContent(2358,0.0198858); + ssigpTa->SetBinContent(2359,0.020138); + ssigpTa->SetBinContent(2360,0.0205292); + ssigpTa->SetBinContent(2361,0.020926); + ssigpTa->SetBinContent(2362,0.0213276); + ssigpTa->SetBinContent(2363,0.0217334); + ssigpTa->SetBinContent(2364,0.0221526); + ssigpTa->SetBinContent(2365,0.0225808); + ssigpTa->SetBinContent(2366,0.023056); + ssigpTa->SetBinContent(2367,0.023725); + ssigpTa->SetBinContent(2368,0.0245924); + ssigpTa->SetBinContent(2369,0.0252864); + ssigpTa->SetBinContent(2370,0.0256982); + ssigpTa->SetBinContent(2371,0.025552); + ssigpTa->SetBinContent(2372,0.0248712); + ssigpTa->SetBinContent(2373,0.0246626); + ssigpTa->SetBinContent(2374,0.0249464); + ssigpTa->SetBinContent(2375,0.025328); + ssigpTa->SetBinContent(2376,0.025679); + ssigpTa->SetBinContent(2377,0.0258558); + ssigpTa->SetBinContent(2378,0.0256062); + ssigpTa->SetBinContent(2379,0.0244462); + ssigpTa->SetBinContent(2380,0.02236); + ssigpTa->SetBinContent(2381,0.0213694); + ssigpTa->SetBinContent(2382,0.0214728); + ssigpTa->SetBinContent(2383,0.0218098); + ssigpTa->SetBinContent(2384,0.022236); + ssigpTa->SetBinContent(2385,0.02306); + ssigpTa->SetBinContent(2386,0.024277); + ssigpTa->SetBinContent(2387,0.02511); + ssigpTa->SetBinContent(2388,0.0255576); + ssigpTa->SetBinContent(2389,0.0259426); + ssigpTa->SetBinContent(2390,0.0263368); + ssigpTa->SetBinContent(2391,0.026734); + ssigpTa->SetBinContent(2392,0.027133); + ssigpTa->SetBinContent(2393,0.0274656); + ssigpTa->SetBinContent(2394,0.0274486); + ssigpTa->SetBinContent(2395,0.0270918); + ssigpTa->SetBinContent(2396,0.0270898); + ssigpTa->SetBinContent(2397,0.0275396); + ssigpTa->SetBinContent(2398,0.0285318); + ssigpTa->SetBinContent(2399,0.0299928); + ssigpTa->SetBinContent(2400,0.0310166); + ssigpTa->SetBinContent(2401,0.0315914); + ssigpTa->SetBinContent(2402,0.0320794); + ssigpTa->SetBinContent(2403,0.0325708); + ssigpTa->SetBinContent(2404,0.0329998); + ssigpTa->SetBinContent(2405,0.0330864); + ssigpTa->SetBinContent(2406,0.0328378); + ssigpTa->SetBinContent(2407,0.0329454); + ssigpTa->SetBinContent(2408,0.033514); + ssigpTa->SetBinContent(2409,0.0346748); + ssigpTa->SetBinContent(2410,0.0363372); + ssigpTa->SetBinContent(2411,0.0375142); + ssigpTa->SetBinContent(2412,0.038194); + ssigpTa->SetBinContent(2413,0.0387868); + ssigpTa->SetBinContent(2414,0.0394024); + ssigpTa->SetBinContent(2415,0.0400384); + ssigpTa->SetBinContent(2416,0.0404596); + ssigpTa->SetBinContent(2417,0.0397296); + ssigpTa->SetBinContent(2418,0.0378284); + ssigpTa->SetBinContent(2419,0.0371136); + ssigpTa->SetBinContent(2420,0.0380368); + ssigpTa->SetBinContent(2421,0.0396968); + ssigpTa->SetBinContent(2422,0.0408992); + ssigpTa->SetBinContent(2423,0.0416128); + ssigpTa->SetBinContent(2424,0.0422242); + ssigpTa->SetBinContent(2425,0.04284); + ssigpTa->SetBinContent(2426,0.0434556); + ssigpTa->SetBinContent(2427,0.0440708); + ssigpTa->SetBinContent(2428,0.0446514); + ssigpTa->SetBinContent(2429,0.045144); + ssigpTa->SetBinContent(2430,0.0459434); + ssigpTa->SetBinContent(2431,0.0474436); + ssigpTa->SetBinContent(2432,0.04871); + ssigpTa->SetBinContent(2433,0.0495388); + ssigpTa->SetBinContent(2434,0.050267); + ssigpTa->SetBinContent(2435,0.0509978); + ssigpTa->SetBinContent(2436,0.051744); + ssigpTa->SetBinContent(2437,0.0525082); + ssigpTa->SetBinContent(2438,0.0532426); + ssigpTa->SetBinContent(2439,0.0537144); + ssigpTa->SetBinContent(2440,0.0539188); + ssigpTa->SetBinContent(2441,0.0543858); + ssigpTa->SetBinContent(2442,0.0550092); + ssigpTa->SetBinContent(2443,0.0555508); + ssigpTa->SetBinContent(2444,0.05624); + ssigpTa->SetBinContent(2445,0.0570726); + ssigpTa->SetBinContent(2446,0.057936); + ssigpTa->SetBinContent(2447,0.0588268); + ssigpTa->SetBinContent(2448,0.0597854); + ssigpTa->SetBinContent(2449,0.060796); + ssigpTa->SetBinContent(2450,0.0618174); + ssigpTa->SetBinContent(2451,0.062838); + ssigpTa->SetBinContent(2452,0.0638658); + ssigpTa->SetBinContent(2453,0.0649152); + ssigpTa->SetBinContent(2454,0.0659828); + ssigpTa->SetBinContent(2455,0.0670678); + ssigpTa->SetBinContent(2456,0.0681546); + ssigpTa->SetBinContent(2457,0.0691648); + ssigpTa->SetBinContent(2458,0.0697766); + ssigpTa->SetBinContent(2459,0.070027); + ssigpTa->SetBinContent(2460,0.0707496); + ssigpTa->SetBinContent(2461,0.0719462); + ssigpTa->SetBinContent(2462,0.0732532); + ssigpTa->SetBinContent(2463,0.0745431); + ssigpTa->SetBinContent(2464,0.0755447); + ssigpTa->SetBinContent(2467,0.0116561); + ssigpTa->SetBinContent(2468,0.0116521); + ssigpTa->SetBinContent(2469,0.0116492); + ssigpTa->SetBinContent(2470,0.0116492); + ssigpTa->SetBinContent(2471,0.0116492); + ssigpTa->SetBinContent(2472,0.0116504); + ssigpTa->SetBinContent(2473,0.0116528); + ssigpTa->SetBinContent(2474,0.0116624); + ssigpTa->SetBinContent(2475,0.0116696); + ssigpTa->SetBinContent(2476,0.011676); + ssigpTa->SetBinContent(2477,0.0116776); + ssigpTa->SetBinContent(2478,0.011678); + ssigpTa->SetBinContent(2479,0.0116808); + ssigpTa->SetBinContent(2480,0.0116852); + ssigpTa->SetBinContent(2481,0.0116928); + ssigpTa->SetBinContent(2482,0.0117004); + ssigpTa->SetBinContent(2483,0.01171); + ssigpTa->SetBinContent(2484,0.0117192); + ssigpTa->SetBinContent(2485,0.0117272); + ssigpTa->SetBinContent(2486,0.0117344); + ssigpTa->SetBinContent(2487,0.0117432); + ssigpTa->SetBinContent(2488,0.011756); + ssigpTa->SetBinContent(2489,0.0117668); + ssigpTa->SetBinContent(2490,0.011774); + ssigpTa->SetBinContent(2491,0.0117864); + ssigpTa->SetBinContent(2492,0.011798); + ssigpTa->SetBinContent(2493,0.0118124); + ssigpTa->SetBinContent(2494,0.0118248); + ssigpTa->SetBinContent(2495,0.0118352); + ssigpTa->SetBinContent(2496,0.0118496); + ssigpTa->SetBinContent(2497,0.0118628); + ssigpTa->SetBinContent(2498,0.011882); + ssigpTa->SetBinContent(2499,0.0118936); + ssigpTa->SetBinContent(2500,0.0119092); + ssigpTa->SetBinContent(2501,0.0119224); + ssigpTa->SetBinContent(2502,0.0119456); + ssigpTa->SetBinContent(2503,0.011964); + ssigpTa->SetBinContent(2504,0.0119788); + ssigpTa->SetBinContent(2505,0.011998); + ssigpTa->SetBinContent(2506,0.0120128); + ssigpTa->SetBinContent(2507,0.0120344); + ssigpTa->SetBinContent(2508,0.0120548); + ssigpTa->SetBinContent(2509,0.012074); + ssigpTa->SetBinContent(2510,0.0120936); + ssigpTa->SetBinContent(2511,0.0121184); + ssigpTa->SetBinContent(2512,0.0121384); + ssigpTa->SetBinContent(2513,0.0121612); + ssigpTa->SetBinContent(2514,0.0121824); + ssigpTa->SetBinContent(2515,0.0122072); + ssigpTa->SetBinContent(2516,0.012232); + ssigpTa->SetBinContent(2517,0.0122532); + ssigpTa->SetBinContent(2518,0.0122796); + ssigpTa->SetBinContent(2519,0.0123024); + ssigpTa->SetBinContent(2520,0.0123316); + ssigpTa->SetBinContent(2521,0.0123584); + ssigpTa->SetBinContent(2522,0.0123876); + ssigpTa->SetBinContent(2523,0.0124148); + ssigpTa->SetBinContent(2524,0.012444); + ssigpTa->SetBinContent(2525,0.0124728); + ssigpTa->SetBinContent(2526,0.012502); + ssigpTa->SetBinContent(2527,0.0125308); + ssigpTa->SetBinContent(2528,0.0125648); + ssigpTa->SetBinContent(2529,0.0125936); + ssigpTa->SetBinContent(2530,0.0126248); + ssigpTa->SetBinContent(2531,0.012654); + ssigpTa->SetBinContent(2532,0.012686); + ssigpTa->SetBinContent(2533,0.0127204); + ssigpTa->SetBinContent(2534,0.0127508); + ssigpTa->SetBinContent(2535,0.0127832); + ssigpTa->SetBinContent(2536,0.0128164); + ssigpTa->SetBinContent(2537,0.0128548); + ssigpTa->SetBinContent(2538,0.0128932); + ssigpTa->SetBinContent(2539,0.0129316); + ssigpTa->SetBinContent(2540,0.0129676); + ssigpTa->SetBinContent(2541,0.0130096); + ssigpTa->SetBinContent(2542,0.0130492); + ssigpTa->SetBinContent(2543,0.0130868); + ssigpTa->SetBinContent(2544,0.0131288); + ssigpTa->SetBinContent(2545,0.0131684); + ssigpTa->SetBinContent(2546,0.0132084); + ssigpTa->SetBinContent(2547,0.0132532); + ssigpTa->SetBinContent(2548,0.0132936); + ssigpTa->SetBinContent(2549,0.01334); + ssigpTa->SetBinContent(2550,0.0133808); + ssigpTa->SetBinContent(2551,0.0134272); + ssigpTa->SetBinContent(2552,0.0134696); + ssigpTa->SetBinContent(2553,0.013514); + ssigpTa->SetBinContent(2554,0.0135568); + ssigpTa->SetBinContent(2555,0.0136064); + ssigpTa->SetBinContent(2556,0.0136552); + ssigpTa->SetBinContent(2557,0.013706); + ssigpTa->SetBinContent(2558,0.0137552); + ssigpTa->SetBinContent(2559,0.0138004); + ssigpTa->SetBinContent(2560,0.013854); + ssigpTa->SetBinContent(2561,0.0139088); + ssigpTa->SetBinContent(2562,0.013964); + ssigpTa->SetBinContent(2563,0.0140176); + ssigpTa->SetBinContent(2564,0.014068); + ssigpTa->SetBinContent(2565,0.0141232); + ssigpTa->SetBinContent(2566,0.01418); + ssigpTa->SetBinContent(2567,0.014238); + ssigpTa->SetBinContent(2568,0.0142992); + ssigpTa->SetBinContent(2569,0.0143572); + ssigpTa->SetBinContent(2570,0.0144204); + ssigpTa->SetBinContent(2571,0.0144784); + ssigpTa->SetBinContent(2572,0.0147568); + ssigpTa->SetBinContent(2573,0.0161484); + ssigpTa->SetBinContent(2574,0.0186852); + ssigpTa->SetBinContent(2575,0.0200852); + ssigpTa->SetBinContent(2576,0.0203712); + ssigpTa->SetBinContent(2577,0.0204416); + ssigpTa->SetBinContent(2578,0.0205176); + ssigpTa->SetBinContent(2579,0.0205892); + ssigpTa->SetBinContent(2580,0.0206644); + ssigpTa->SetBinContent(2581,0.0207412); + ssigpTa->SetBinContent(2582,0.02082); + ssigpTa->SetBinContent(2583,0.0207076); + ssigpTa->SetBinContent(2584,0.0196416); + ssigpTa->SetBinContent(2585,0.0176312); + ssigpTa->SetBinContent(2586,0.0167192); + ssigpTa->SetBinContent(2587,0.0168344); + ssigpTa->SetBinContent(2588,0.017156); + ssigpTa->SetBinContent(2589,0.0174804); + ssigpTa->SetBinContent(2590,0.0178028); + ssigpTa->SetBinContent(2591,0.0181328); + ssigpTa->SetBinContent(2592,0.0183824); + ssigpTa->SetBinContent(2593,0.0182072); + ssigpTa->SetBinContent(2594,0.0175964); + ssigpTa->SetBinContent(2595,0.0173444); + ssigpTa->SetBinContent(2596,0.017446); + ssigpTa->SetBinContent(2597,0.0177044); + ssigpTa->SetBinContent(2598,0.018022); + ssigpTa->SetBinContent(2599,0.018354); + ssigpTa->SetBinContent(2600,0.0186892); + ssigpTa->SetBinContent(2601,0.0190288); + ssigpTa->SetBinContent(2602,0.0193708); + ssigpTa->SetBinContent(2603,0.0196124); + ssigpTa->SetBinContent(2604,0.0192912); + ssigpTa->SetBinContent(2605,0.0184052); + ssigpTa->SetBinContent(2606,0.0180776); + ssigpTa->SetBinContent(2607,0.01832); + ssigpTa->SetBinContent(2608,0.01868); + ssigpTa->SetBinContent(2609,0.0190468); + ssigpTa->SetBinContent(2610,0.0194128); + ssigpTa->SetBinContent(2611,0.0197852); + ssigpTa->SetBinContent(2612,0.020164); + ssigpTa->SetBinContent(2613,0.0205488); + ssigpTa->SetBinContent(2614,0.0208408); + ssigpTa->SetBinContent(2615,0.0206732); + ssigpTa->SetBinContent(2616,0.020034); + ssigpTa->SetBinContent(2617,0.0198608); + ssigpTa->SetBinContent(2618,0.0201584); + ssigpTa->SetBinContent(2619,0.0205528); + ssigpTa->SetBinContent(2620,0.0209552); + ssigpTa->SetBinContent(2621,0.0213616); + ssigpTa->SetBinContent(2622,0.0217744); + ssigpTa->SetBinContent(2623,0.0221936); + ssigpTa->SetBinContent(2624,0.0226156); + ssigpTa->SetBinContent(2625,0.0230424); + ssigpTa->SetBinContent(2626,0.0233956); + ssigpTa->SetBinContent(2627,0.0233652); + ssigpTa->SetBinContent(2628,0.022926); + ssigpTa->SetBinContent(2629,0.0227556); + ssigpTa->SetBinContent(2630,0.0223308); + ssigpTa->SetBinContent(2631,0.0213608); + ssigpTa->SetBinContent(2632,0.0209964); + ssigpTa->SetBinContent(2633,0.0212784); + ssigpTa->SetBinContent(2634,0.0217004); + ssigpTa->SetBinContent(2635,0.0221348); + ssigpTa->SetBinContent(2636,0.0225712); + ssigpTa->SetBinContent(2637,0.0230172); + ssigpTa->SetBinContent(2638,0.0234708); + ssigpTa->SetBinContent(2639,0.0239392); + ssigpTa->SetBinContent(2640,0.0244512); + ssigpTa->SetBinContent(2641,0.0251556); + ssigpTa->SetBinContent(2642,0.0260444); + ssigpTa->SetBinContent(2643,0.0267704); + ssigpTa->SetBinContent(2644,0.0272304); + ssigpTa->SetBinContent(2645,0.0272056); + ssigpTa->SetBinContent(2646,0.0267148); + ssigpTa->SetBinContent(2647,0.0266436); + ssigpTa->SetBinContent(2648,0.027008); + ssigpTa->SetBinContent(2649,0.0274596); + ssigpTa->SetBinContent(2650,0.0278524); + ssigpTa->SetBinContent(2651,0.0279328); + ssigpTa->SetBinContent(2652,0.0274424); + ssigpTa->SetBinContent(2653,0.0261312); + ssigpTa->SetBinContent(2654,0.023996); + ssigpTa->SetBinContent(2655,0.0229996); + ssigpTa->SetBinContent(2656,0.023132); + ssigpTa->SetBinContent(2657,0.0235072); + ssigpTa->SetBinContent(2658,0.0239488); + ssigpTa->SetBinContent(2659,0.0247); + ssigpTa->SetBinContent(2660,0.0257588); + ssigpTa->SetBinContent(2661,0.0265144); + ssigpTa->SetBinContent(2662,0.02698); + ssigpTa->SetBinContent(2663,0.0274012); + ssigpTa->SetBinContent(2664,0.0278364); + ssigpTa->SetBinContent(2665,0.028272); + ssigpTa->SetBinContent(2666,0.0287116); + ssigpTa->SetBinContent(2667,0.0290948); + ssigpTa->SetBinContent(2668,0.0291968); + ssigpTa->SetBinContent(2669,0.0290196); + ssigpTa->SetBinContent(2670,0.0291476); + ssigpTa->SetBinContent(2671,0.0296516); + ssigpTa->SetBinContent(2672,0.030598); + ssigpTa->SetBinContent(2673,0.0319304); + ssigpTa->SetBinContent(2674,0.0329044); + ssigpTa->SetBinContent(2675,0.0335176); + ssigpTa->SetBinContent(2676,0.0340648); + ssigpTa->SetBinContent(2677,0.0346168); + ssigpTa->SetBinContent(2678,0.0351224); + ssigpTa->SetBinContent(2679,0.0353648); + ssigpTa->SetBinContent(2680,0.0353512); + ssigpTa->SetBinContent(2681,0.0356228); + ssigpTa->SetBinContent(2682,0.036272); + ssigpTa->SetBinContent(2683,0.037394); + ssigpTa->SetBinContent(2684,0.0389276); + ssigpTa->SetBinContent(2685,0.0400636); + ssigpTa->SetBinContent(2686,0.0408036); + ssigpTa->SetBinContent(2687,0.0414808); + ssigpTa->SetBinContent(2688,0.0421808); + ssigpTa->SetBinContent(2689,0.0429068); + ssigpTa->SetBinContent(2690,0.043444); + ssigpTa->SetBinContent(2691,0.0429548); + ssigpTa->SetBinContent(2692,0.0414104); + ssigpTa->SetBinContent(2693,0.0409328); + ssigpTa->SetBinContent(2694,0.0418968); + ssigpTa->SetBinContent(2695,0.0435064); + ssigpTa->SetBinContent(2696,0.0447256); + ssigpTa->SetBinContent(2697,0.0455252); + ssigpTa->SetBinContent(2698,0.0462516); + ssigpTa->SetBinContent(2699,0.04698); + ssigpTa->SetBinContent(2700,0.0477164); + ssigpTa->SetBinContent(2701,0.0484532); + ssigpTa->SetBinContent(2702,0.0491644); + ssigpTa->SetBinContent(2703,0.0498036); + ssigpTa->SetBinContent(2704,0.0507136); + ssigpTa->SetBinContent(2705,0.0522444); + ssigpTa->SetBinContent(2706,0.0535696); + ssigpTa->SetBinContent(2707,0.0545268); + ssigpTa->SetBinContent(2708,0.0553944); + ssigpTa->SetBinContent(2709,0.0562728); + ssigpTa->SetBinContent(2710,0.0571652); + ssigpTa->SetBinContent(2711,0.058084); + ssigpTa->SetBinContent(2712,0.058988); + ssigpTa->SetBinContent(2713,0.0596852); + ssigpTa->SetBinContent(2714,0.0601592); + ssigpTa->SetBinContent(2715,0.060866); + ssigpTa->SetBinContent(2716,0.0616968); + ssigpTa->SetBinContent(2717,0.0624648); + ssigpTa->SetBinContent(2718,0.0633684); + ssigpTa->SetBinContent(2719,0.0644116); + ssigpTa->SetBinContent(2720,0.0654828); + ssigpTa->SetBinContent(2721,0.066592); + ssigpTa->SetBinContent(2722,0.0677824); + ssigpTa->SetBinContent(2723,0.0690388); + ssigpTa->SetBinContent(2724,0.0703116); + ssigpTa->SetBinContent(2725,0.0715832); + ssigpTa->SetBinContent(2726,0.0728716); + ssigpTa->SetBinContent(2727,0.07419); + ssigpTa->SetBinContent(2728,0.0755392); + ssigpTa->SetBinContent(2729,0.076908); + ssigpTa->SetBinContent(2730,0.0782864); + ssigpTa->SetBinContent(2731,0.0796244); + ssigpTa->SetBinContent(2732,0.0807492); + ssigpTa->SetBinContent(2733,0.0816836); + ssigpTa->SetBinContent(2734,0.0829608); + ssigpTa->SetBinContent(2735,0.084564); + ssigpTa->SetBinContent(2736,0.0862444); + ssigpTa->SetBinContent(2737,0.0878608); + ssigpTa->SetBinContent(2738,0.0890528); + ssigpTa->SetBinContent(2741,0.0129211); + ssigpTa->SetBinContent(2742,0.0129175); + ssigpTa->SetBinContent(2743,0.0129144); + ssigpTa->SetBinContent(2744,0.0129144); + ssigpTa->SetBinContent(2745,0.0129144); + ssigpTa->SetBinContent(2746,0.0129144); + ssigpTa->SetBinContent(2747,0.0129184); + ssigpTa->SetBinContent(2748,0.012924); + ssigpTa->SetBinContent(2749,0.0129344); + ssigpTa->SetBinContent(2750,0.0129384); + ssigpTa->SetBinContent(2751,0.01294); + ssigpTa->SetBinContent(2752,0.01294); + ssigpTa->SetBinContent(2753,0.01294); + ssigpTa->SetBinContent(2754,0.0129432); + ssigpTa->SetBinContent(2755,0.0129496); + ssigpTa->SetBinContent(2756,0.0129592); + ssigpTa->SetBinContent(2757,0.012972); + ssigpTa->SetBinContent(2758,0.0129816); + ssigpTa->SetBinContent(2759,0.0129864); + ssigpTa->SetBinContent(2760,0.0129904); + ssigpTa->SetBinContent(2761,0.0129968); + ssigpTa->SetBinContent(2762,0.0130112); + ssigpTa->SetBinContent(2763,0.0130216); + ssigpTa->SetBinContent(2764,0.0130336); + ssigpTa->SetBinContent(2765,0.01304); + ssigpTa->SetBinContent(2766,0.0130528); + ssigpTa->SetBinContent(2767,0.0130648); + ssigpTa->SetBinContent(2768,0.0130768); + ssigpTa->SetBinContent(2769,0.0130912); + ssigpTa->SetBinContent(2770,0.0131016); + ssigpTa->SetBinContent(2771,0.013116); + ssigpTa->SetBinContent(2772,0.0131312); + ssigpTa->SetBinContent(2773,0.0131456); + ssigpTa->SetBinContent(2774,0.0131528); + ssigpTa->SetBinContent(2775,0.0131744); + ssigpTa->SetBinContent(2776,0.0131904); + ssigpTa->SetBinContent(2777,0.0132096); + ssigpTa->SetBinContent(2778,0.013224); + ssigpTa->SetBinContent(2779,0.0132384); + ssigpTa->SetBinContent(2780,0.0132576); + ssigpTa->SetBinContent(2781,0.0132736); + ssigpTa->SetBinContent(2782,0.0132944); + ssigpTa->SetBinContent(2783,0.0133128); + ssigpTa->SetBinContent(2784,0.0133336); + ssigpTa->SetBinContent(2785,0.013352); + ssigpTa->SetBinContent(2786,0.0133792); + ssigpTa->SetBinContent(2787,0.0133952); + ssigpTa->SetBinContent(2788,0.0134168); + ssigpTa->SetBinContent(2789,0.0134392); + ssigpTa->SetBinContent(2790,0.0134616); + ssigpTa->SetBinContent(2791,0.013488); + ssigpTa->SetBinContent(2792,0.0135088); + ssigpTa->SetBinContent(2793,0.013536); + ssigpTa->SetBinContent(2794,0.013556); + ssigpTa->SetBinContent(2795,0.013588); + ssigpTa->SetBinContent(2796,0.0136128); + ssigpTa->SetBinContent(2797,0.0136408); + ssigpTa->SetBinContent(2798,0.0136664); + ssigpTa->SetBinContent(2799,0.0136952); + ssigpTa->SetBinContent(2800,0.01372); + ssigpTa->SetBinContent(2801,0.0137504); + ssigpTa->SetBinContent(2802,0.01378); + ssigpTa->SetBinContent(2803,0.0138112); + ssigpTa->SetBinContent(2804,0.0138392); + ssigpTa->SetBinContent(2805,0.0138704); + ssigpTa->SetBinContent(2806,0.0139048); + ssigpTa->SetBinContent(2807,0.0139336); + ssigpTa->SetBinContent(2808,0.0139648); + ssigpTa->SetBinContent(2809,0.0139936); + ssigpTa->SetBinContent(2810,0.0140264); + ssigpTa->SetBinContent(2811,0.014064); + ssigpTa->SetBinContent(2812,0.0141032); + ssigpTa->SetBinContent(2813,0.0141376); + ssigpTa->SetBinContent(2814,0.0141768); + ssigpTa->SetBinContent(2815,0.0142136); + ssigpTa->SetBinContent(2816,0.0142528); + ssigpTa->SetBinContent(2817,0.0142896); + ssigpTa->SetBinContent(2818,0.0143288); + ssigpTa->SetBinContent(2819,0.014372); + ssigpTa->SetBinContent(2820,0.0144128); + ssigpTa->SetBinContent(2821,0.014452); + ssigpTa->SetBinContent(2822,0.014492); + ssigpTa->SetBinContent(2823,0.0145312); + ssigpTa->SetBinContent(2824,0.0145768); + ssigpTa->SetBinContent(2825,0.0146176); + ssigpTa->SetBinContent(2826,0.01466); + ssigpTa->SetBinContent(2827,0.0146992); + ssigpTa->SetBinContent(2828,0.01474); + ssigpTa->SetBinContent(2829,0.0147872); + ssigpTa->SetBinContent(2830,0.0148408); + ssigpTa->SetBinContent(2831,0.0148904); + ssigpTa->SetBinContent(2832,0.0149352); + ssigpTa->SetBinContent(2833,0.0149832); + ssigpTa->SetBinContent(2834,0.015032); + ssigpTa->SetBinContent(2835,0.0150888); + ssigpTa->SetBinContent(2836,0.01514); + ssigpTa->SetBinContent(2837,0.0151904); + ssigpTa->SetBinContent(2838,0.0152448); + ssigpTa->SetBinContent(2839,0.015296); + ssigpTa->SetBinContent(2840,0.0153496); + ssigpTa->SetBinContent(2841,0.015408); + ssigpTa->SetBinContent(2842,0.0154632); + ssigpTa->SetBinContent(2843,0.0155272); + ssigpTa->SetBinContent(2844,0.0155864); + ssigpTa->SetBinContent(2845,0.015648); + ssigpTa->SetBinContent(2846,0.0159704); + ssigpTa->SetBinContent(2847,0.0176472); + ssigpTa->SetBinContent(2848,0.0206952); + ssigpTa->SetBinContent(2849,0.0223784); + ssigpTa->SetBinContent(2850,0.0227096); + ssigpTa->SetBinContent(2851,0.0227784); + ssigpTa->SetBinContent(2852,0.0228472); + ssigpTa->SetBinContent(2853,0.0229152); + ssigpTa->SetBinContent(2854,0.0229856); + ssigpTa->SetBinContent(2855,0.02306); + ssigpTa->SetBinContent(2856,0.0231336); + ssigpTa->SetBinContent(2857,0.02298); + ssigpTa->SetBinContent(2858,0.0216608); + ssigpTa->SetBinContent(2859,0.0192192); + ssigpTa->SetBinContent(2860,0.0180824); + ssigpTa->SetBinContent(2861,0.0181952); + ssigpTa->SetBinContent(2862,0.0185528); + ssigpTa->SetBinContent(2863,0.0189152); + ssigpTa->SetBinContent(2864,0.0192792); + ssigpTa->SetBinContent(2865,0.0196464); + ssigpTa->SetBinContent(2866,0.0199184); + ssigpTa->SetBinContent(2867,0.019688); + ssigpTa->SetBinContent(2868,0.0189272); + ssigpTa->SetBinContent(2869,0.0186384); + ssigpTa->SetBinContent(2870,0.0188064); + ssigpTa->SetBinContent(2871,0.0191144); + ssigpTa->SetBinContent(2872,0.0194632); + ssigpTa->SetBinContent(2873,0.019828); + ssigpTa->SetBinContent(2874,0.0201984); + ssigpTa->SetBinContent(2875,0.0205688); + ssigpTa->SetBinContent(2876,0.0209504); + ssigpTa->SetBinContent(2877,0.0212112); + ssigpTa->SetBinContent(2878,0.0208504); + ssigpTa->SetBinContent(2879,0.0198376); + ssigpTa->SetBinContent(2880,0.0194552); + ssigpTa->SetBinContent(2881,0.0197056); + ssigpTa->SetBinContent(2882,0.020096); + ssigpTa->SetBinContent(2883,0.0204896); + ssigpTa->SetBinContent(2884,0.0208888); + ssigpTa->SetBinContent(2885,0.0212904); + ssigpTa->SetBinContent(2886,0.0217008); + ssigpTa->SetBinContent(2887,0.0221128); + ssigpTa->SetBinContent(2888,0.0224256); + ssigpTa->SetBinContent(2889,0.0221728); + ssigpTa->SetBinContent(2890,0.021352); + ssigpTa->SetBinContent(2891,0.0210928); + ssigpTa->SetBinContent(2892,0.0214008); + ssigpTa->SetBinContent(2893,0.0218232); + ssigpTa->SetBinContent(2894,0.0222576); + ssigpTa->SetBinContent(2895,0.0226944); + ssigpTa->SetBinContent(2896,0.0231408); + ssigpTa->SetBinContent(2897,0.023592); + ssigpTa->SetBinContent(2898,0.0240528); + ssigpTa->SetBinContent(2899,0.0245128); + ssigpTa->SetBinContent(2900,0.0248912); + ssigpTa->SetBinContent(2901,0.024792); + ssigpTa->SetBinContent(2902,0.024204); + ssigpTa->SetBinContent(2903,0.0239632); + ssigpTa->SetBinContent(2904,0.0235752); + ssigpTa->SetBinContent(2905,0.022644); + ssigpTa->SetBinContent(2906,0.0223304); + ssigpTa->SetBinContent(2907,0.0226456); + ssigpTa->SetBinContent(2908,0.0231048); + ssigpTa->SetBinContent(2909,0.0235744); + ssigpTa->SetBinContent(2910,0.0240512); + ssigpTa->SetBinContent(2911,0.0245312); + ssigpTa->SetBinContent(2912,0.0250264); + ssigpTa->SetBinContent(2913,0.0255344); + ssigpTa->SetBinContent(2914,0.026084); + ssigpTa->SetBinContent(2915,0.0267936); + ssigpTa->SetBinContent(2916,0.0276592); + ssigpTa->SetBinContent(2917,0.0283824); + ssigpTa->SetBinContent(2918,0.0288856); + ssigpTa->SetBinContent(2919,0.0289744); + ssigpTa->SetBinContent(2920,0.0286608); + ssigpTa->SetBinContent(2921,0.02872); + ssigpTa->SetBinContent(2922,0.029164); + ssigpTa->SetBinContent(2923,0.0296864); + ssigpTa->SetBinContent(2924,0.0301176); + ssigpTa->SetBinContent(2925,0.0300488); + ssigpTa->SetBinContent(2926,0.02924); + ssigpTa->SetBinContent(2927,0.027812); + ssigpTa->SetBinContent(2928,0.0257592); + ssigpTa->SetBinContent(2929,0.0248496); + ssigpTa->SetBinContent(2930,0.02504); + ssigpTa->SetBinContent(2931,0.0254536); + ssigpTa->SetBinContent(2932,0.0259312); + ssigpTa->SetBinContent(2933,0.026632); + ssigpTa->SetBinContent(2934,0.0275624); + ssigpTa->SetBinContent(2935,0.0282712); + ssigpTa->SetBinContent(2936,0.0287672); + ssigpTa->SetBinContent(2937,0.0292376); + ssigpTa->SetBinContent(2938,0.0297184); + ssigpTa->SetBinContent(2939,0.0302064); + ssigpTa->SetBinContent(2940,0.0306968); + ssigpTa->SetBinContent(2941,0.031148); + ssigpTa->SetBinContent(2942,0.0313872); + ssigpTa->SetBinContent(2943,0.0314216); + ssigpTa->SetBinContent(2944,0.0316992); + ssigpTa->SetBinContent(2945,0.032272); + ssigpTa->SetBinContent(2946,0.03318); + ssigpTa->SetBinContent(2947,0.0343824); + ssigpTa->SetBinContent(2948,0.0353112); + ssigpTa->SetBinContent(2949,0.0359792); + ssigpTa->SetBinContent(2950,0.0366); + ssigpTa->SetBinContent(2951,0.0372304); + ssigpTa->SetBinContent(2952,0.0378296); + ssigpTa->SetBinContent(2953,0.0382472); + ssigpTa->SetBinContent(2954,0.0384856); + ssigpTa->SetBinContent(2955,0.0389464); + ssigpTa->SetBinContent(2956,0.0396848); + ssigpTa->SetBinContent(2957,0.0407776); + ssigpTa->SetBinContent(2958,0.0421672); + ssigpTa->SetBinContent(2959,0.0432664); + ssigpTa->SetBinContent(2960,0.0440856); + ssigpTa->SetBinContent(2961,0.0448592); + ssigpTa->SetBinContent(2962,0.0456648); + ssigpTa->SetBinContent(2963,0.0464944); + ssigpTa->SetBinContent(2964,0.0471656); + ssigpTa->SetBinContent(2965,0.0469496); + ssigpTa->SetBinContent(2966,0.0458208); + ssigpTa->SetBinContent(2967,0.0456072); + ssigpTa->SetBinContent(2968,0.0466008); + ssigpTa->SetBinContent(2969,0.0481024); + ssigpTa->SetBinContent(2970,0.0493144); + ssigpTa->SetBinContent(2971,0.050236); + ssigpTa->SetBinContent(2972,0.0510984); + ssigpTa->SetBinContent(2973,0.0519792); + ssigpTa->SetBinContent(2974,0.052864); + ssigpTa->SetBinContent(2975,0.0537552); + ssigpTa->SetBinContent(2976,0.054628); + ssigpTa->SetBinContent(2977,0.0554464); + ssigpTa->SetBinContent(2978,0.0564784); + ssigpTa->SetBinContent(2979,0.0580048); + ssigpTa->SetBinContent(2980,0.059392); + ssigpTa->SetBinContent(2981,0.0605); + ssigpTa->SetBinContent(2982,0.0615512); + ssigpTa->SetBinContent(2983,0.062612); + ssigpTa->SetBinContent(2984,0.0636936); + ssigpTa->SetBinContent(2985,0.0648064); + ssigpTa->SetBinContent(2986,0.0659264); + ssigpTa->SetBinContent(2987,0.0668928); + ssigpTa->SetBinContent(2988,0.0676896); + ssigpTa->SetBinContent(2989,0.068684); + ssigpTa->SetBinContent(2990,0.0697888); + ssigpTa->SetBinContent(2991,0.0708456); + ssigpTa->SetBinContent(2992,0.0720296); + ssigpTa->SetBinContent(2993,0.0733312); + ssigpTa->SetBinContent(2994,0.07466); + ssigpTa->SetBinContent(2995,0.076032); + ssigpTa->SetBinContent(2996,0.0775088); + ssigpTa->SetBinContent(2997,0.0790584); + ssigpTa->SetBinContent(2998,0.0806376); + ssigpTa->SetBinContent(2999,0.0822208); + ssigpTa->SetBinContent(3000,0.0838232); + ssigpTa->SetBinContent(3001,0.085468); + ssigpTa->SetBinContent(3002,0.0871544); + ssigpTa->SetBinContent(3003,0.088868); + ssigpTa->SetBinContent(3004,0.0905888); + ssigpTa->SetBinContent(3005,0.09232); + ssigpTa->SetBinContent(3006,0.0940224); + ssigpTa->SetBinContent(3007,0.095724); + ssigpTa->SetBinContent(3008,0.0976352); + ssigpTa->SetBinContent(3009,0.0997); + ssigpTa->SetBinContent(3010,0.101825); + ssigpTa->SetBinContent(3011,0.103833); + ssigpTa->SetBinContent(3012,0.105288); + ssigpTa->SetBinContent(3015,0.0143444); + ssigpTa->SetBinContent(3016,0.01434); + ssigpTa->SetBinContent(3017,0.0143384); + ssigpTa->SetBinContent(3018,0.0143384); + ssigpTa->SetBinContent(3019,0.0143384); + ssigpTa->SetBinContent(3020,0.0143384); + ssigpTa->SetBinContent(3021,0.0143384); + ssigpTa->SetBinContent(3022,0.0143428); + ssigpTa->SetBinContent(3023,0.014346); + ssigpTa->SetBinContent(3024,0.0143492); + ssigpTa->SetBinContent(3025,0.0143492); + ssigpTa->SetBinContent(3026,0.0143492); + ssigpTa->SetBinContent(3027,0.0143492); + ssigpTa->SetBinContent(3028,0.014354); + ssigpTa->SetBinContent(3029,0.014362); + ssigpTa->SetBinContent(3030,0.014374); + ssigpTa->SetBinContent(3031,0.0143872); + ssigpTa->SetBinContent(3032,0.0143972); + ssigpTa->SetBinContent(3033,0.0144004); + ssigpTa->SetBinContent(3034,0.0144004); + ssigpTa->SetBinContent(3035,0.0144056); + ssigpTa->SetBinContent(3036,0.014414); + ssigpTa->SetBinContent(3037,0.014432); + ssigpTa->SetBinContent(3038,0.0144408); + ssigpTa->SetBinContent(3039,0.014452); + ssigpTa->SetBinContent(3040,0.0144572); + ssigpTa->SetBinContent(3041,0.0144684); + ssigpTa->SetBinContent(3042,0.0144816); + ssigpTa->SetBinContent(3043,0.0144936); + ssigpTa->SetBinContent(3044,0.0145068); + ssigpTa->SetBinContent(3045,0.0145188); + ssigpTa->SetBinContent(3046,0.0145332); + ssigpTa->SetBinContent(3047,0.0145432); + ssigpTa->SetBinContent(3048,0.0145564); + ssigpTa->SetBinContent(3049,0.0145684); + ssigpTa->SetBinContent(3050,0.0145908); + ssigpTa->SetBinContent(3051,0.0146012); + ssigpTa->SetBinContent(3052,0.014618); + ssigpTa->SetBinContent(3053,0.0146372); + ssigpTa->SetBinContent(3054,0.0146512); + ssigpTa->SetBinContent(3055,0.0146648); + ssigpTa->SetBinContent(3056,0.014684); + ssigpTa->SetBinContent(3057,0.014704); + ssigpTa->SetBinContent(3058,0.0147192); + ssigpTa->SetBinContent(3059,0.0147436); + ssigpTa->SetBinContent(3060,0.0147608); + ssigpTa->SetBinContent(3061,0.0147868); + ssigpTa->SetBinContent(3062,0.014802); + ssigpTa->SetBinContent(3063,0.0148204); + ssigpTa->SetBinContent(3064,0.0148448); + ssigpTa->SetBinContent(3065,0.0148668); + ssigpTa->SetBinContent(3066,0.0148932); + ssigpTa->SetBinContent(3067,0.0149104); + ssigpTa->SetBinContent(3068,0.0149396); + ssigpTa->SetBinContent(3069,0.01496); + ssigpTa->SetBinContent(3070,0.0149912); + ssigpTa->SetBinContent(3071,0.0150116); + ssigpTa->SetBinContent(3072,0.0150408); + ssigpTa->SetBinContent(3073,0.0150612); + ssigpTa->SetBinContent(3074,0.0150876); + ssigpTa->SetBinContent(3075,0.0151156); + ssigpTa->SetBinContent(3076,0.0151452); + ssigpTa->SetBinContent(3077,0.0151752); + ssigpTa->SetBinContent(3078,0.0152036); + ssigpTa->SetBinContent(3079,0.0152368); + ssigpTa->SetBinContent(3080,0.0152652); + ssigpTa->SetBinContent(3081,0.0152948); + ssigpTa->SetBinContent(3082,0.0153172); + ssigpTa->SetBinContent(3083,0.0153484); + ssigpTa->SetBinContent(3084,0.0153816); + ssigpTa->SetBinContent(3085,0.015418); + ssigpTa->SetBinContent(3086,0.0154544); + ssigpTa->SetBinContent(3087,0.0154936); + ssigpTa->SetBinContent(3088,0.0155212); + ssigpTa->SetBinContent(3089,0.0155616); + ssigpTa->SetBinContent(3090,0.0155932); + ssigpTa->SetBinContent(3091,0.0156256); + ssigpTa->SetBinContent(3092,0.015668); + ssigpTa->SetBinContent(3093,0.0157084); + ssigpTa->SetBinContent(3094,0.0157516); + ssigpTa->SetBinContent(3095,0.0157864); + ssigpTa->SetBinContent(3096,0.0158216); + ssigpTa->SetBinContent(3097,0.015864); + ssigpTa->SetBinContent(3098,0.0159044); + ssigpTa->SetBinContent(3099,0.0159488); + ssigpTa->SetBinContent(3100,0.0159872); + ssigpTa->SetBinContent(3101,0.0160236); + ssigpTa->SetBinContent(3102,0.016062); + ssigpTa->SetBinContent(3103,0.0161096); + ssigpTa->SetBinContent(3104,0.0161628); + ssigpTa->SetBinContent(3105,0.0162096); + ssigpTa->SetBinContent(3106,0.016256); + ssigpTa->SetBinContent(3107,0.0162984); + ssigpTa->SetBinContent(3108,0.0163528); + ssigpTa->SetBinContent(3109,0.0164024); + ssigpTa->SetBinContent(3110,0.0164492); + ssigpTa->SetBinContent(3111,0.0164988); + ssigpTa->SetBinContent(3112,0.016552); + ssigpTa->SetBinContent(3113,0.0166036); + ssigpTa->SetBinContent(3114,0.016658); + ssigpTa->SetBinContent(3115,0.0167124); + ssigpTa->SetBinContent(3116,0.016772); + ssigpTa->SetBinContent(3117,0.0168276); + ssigpTa->SetBinContent(3118,0.0168904); + ssigpTa->SetBinContent(3119,0.016944); + ssigpTa->SetBinContent(3120,0.0173228); + ssigpTa->SetBinContent(3121,0.0193344); + ssigpTa->SetBinContent(3122,0.0229884); + ssigpTa->SetBinContent(3123,0.0250092); + ssigpTa->SetBinContent(3124,0.0253968); + ssigpTa->SetBinContent(3125,0.0254604); + ssigpTa->SetBinContent(3126,0.0255292); + ssigpTa->SetBinContent(3127,0.02559); + ssigpTa->SetBinContent(3128,0.0256548); + ssigpTa->SetBinContent(3129,0.0257256); + ssigpTa->SetBinContent(3130,0.0257984); + ssigpTa->SetBinContent(3131,0.025588); + ssigpTa->SetBinContent(3132,0.0239788); + ssigpTa->SetBinContent(3133,0.0210056); + ssigpTa->SetBinContent(3134,0.0196136); + ssigpTa->SetBinContent(3135,0.019714); + ssigpTa->SetBinContent(3136,0.0201196); + ssigpTa->SetBinContent(3137,0.0205224); + ssigpTa->SetBinContent(3138,0.0209336); + ssigpTa->SetBinContent(3139,0.0213492); + ssigpTa->SetBinContent(3140,0.0216516); + ssigpTa->SetBinContent(3141,0.0213464); + ssigpTa->SetBinContent(3142,0.0204292); + ssigpTa->SetBinContent(3143,0.0200752); + ssigpTa->SetBinContent(3144,0.020288); + ssigpTa->SetBinContent(3145,0.020646); + ssigpTa->SetBinContent(3146,0.0210328); + ssigpTa->SetBinContent(3147,0.0214384); + ssigpTa->SetBinContent(3148,0.0218548); + ssigpTa->SetBinContent(3149,0.0222696); + ssigpTa->SetBinContent(3150,0.0226892); + ssigpTa->SetBinContent(3151,0.022984); + ssigpTa->SetBinContent(3152,0.0225588); + ssigpTa->SetBinContent(3153,0.0213928); + ssigpTa->SetBinContent(3154,0.020934); + ssigpTa->SetBinContent(3155,0.0211992); + ssigpTa->SetBinContent(3156,0.0216164); + ssigpTa->SetBinContent(3157,0.0220524); + ssigpTa->SetBinContent(3158,0.0224836); + ssigpTa->SetBinContent(3159,0.0229256); + ssigpTa->SetBinContent(3160,0.0233708); + ssigpTa->SetBinContent(3161,0.023828); + ssigpTa->SetBinContent(3162,0.0241568); + ssigpTa->SetBinContent(3163,0.0238212); + ssigpTa->SetBinContent(3164,0.0227936); + ssigpTa->SetBinContent(3165,0.0224364); + ssigpTa->SetBinContent(3166,0.02275); + ssigpTa->SetBinContent(3167,0.0232104); + ssigpTa->SetBinContent(3168,0.023674); + ssigpTa->SetBinContent(3169,0.0241524); + ssigpTa->SetBinContent(3170,0.02463); + ssigpTa->SetBinContent(3171,0.0251236); + ssigpTa->SetBinContent(3172,0.025622); + ssigpTa->SetBinContent(3173,0.0261248); + ssigpTa->SetBinContent(3174,0.0265212); + ssigpTa->SetBinContent(3175,0.02634); + ssigpTa->SetBinContent(3176,0.0255556); + ssigpTa->SetBinContent(3177,0.0252404); + ssigpTa->SetBinContent(3178,0.024908); + ssigpTa->SetBinContent(3179,0.0241052); + ssigpTa->SetBinContent(3180,0.0238668); + ssigpTa->SetBinContent(3181,0.0242324); + ssigpTa->SetBinContent(3182,0.024728); + ssigpTa->SetBinContent(3183,0.0252396); + ssigpTa->SetBinContent(3184,0.0257524); + ssigpTa->SetBinContent(3185,0.0262772); + ssigpTa->SetBinContent(3186,0.02681); + ssigpTa->SetBinContent(3187,0.027362); + ssigpTa->SetBinContent(3188,0.0279508); + ssigpTa->SetBinContent(3189,0.0286508); + ssigpTa->SetBinContent(3190,0.0294652); + ssigpTa->SetBinContent(3191,0.0301792); + ssigpTa->SetBinContent(3192,0.0307284); + ssigpTa->SetBinContent(3193,0.0309304); + ssigpTa->SetBinContent(3194,0.0307928); + ssigpTa->SetBinContent(3195,0.0309828); + ssigpTa->SetBinContent(3196,0.031506); + ssigpTa->SetBinContent(3197,0.0321068); + ssigpTa->SetBinContent(3198,0.0325676); + ssigpTa->SetBinContent(3199,0.0323144); + ssigpTa->SetBinContent(3200,0.0311012); + ssigpTa->SetBinContent(3201,0.0295596); + ssigpTa->SetBinContent(3202,0.0276608); + ssigpTa->SetBinContent(3203,0.0268964); + ssigpTa->SetBinContent(3204,0.0271452); + ssigpTa->SetBinContent(3205,0.0276236); + ssigpTa->SetBinContent(3206,0.0281316); + ssigpTa->SetBinContent(3207,0.0288084); + ssigpTa->SetBinContent(3208,0.0296368); + ssigpTa->SetBinContent(3209,0.0303176); + ssigpTa->SetBinContent(3210,0.0308584); + ssigpTa->SetBinContent(3211,0.0313824); + ssigpTa->SetBinContent(3212,0.0319236); + ssigpTa->SetBinContent(3213,0.0324724); + ssigpTa->SetBinContent(3214,0.0330264); + ssigpTa->SetBinContent(3215,0.0335592); + ssigpTa->SetBinContent(3216,0.0339548); + ssigpTa->SetBinContent(3217,0.0342252); + ssigpTa->SetBinContent(3218,0.0346688); + ssigpTa->SetBinContent(3219,0.0353188); + ssigpTa->SetBinContent(3220,0.0361992); + ssigpTa->SetBinContent(3221,0.0372724); + ssigpTa->SetBinContent(3222,0.0381712); + ssigpTa->SetBinContent(3223,0.0389004); + ssigpTa->SetBinContent(3224,0.0396088); + ssigpTa->SetBinContent(3225,0.040326); + ssigpTa->SetBinContent(3226,0.0410324); + ssigpTa->SetBinContent(3227,0.0416316); + ssigpTa->SetBinContent(3228,0.0421468); + ssigpTa->SetBinContent(3229,0.0428028); + ssigpTa->SetBinContent(3230,0.0436528); + ssigpTa->SetBinContent(3231,0.0447204); + ssigpTa->SetBinContent(3232,0.0459696); + ssigpTa->SetBinContent(3233,0.0470416); + ssigpTa->SetBinContent(3234,0.0479432); + ssigpTa->SetBinContent(3235,0.0488368); + ssigpTa->SetBinContent(3236,0.0497536); + ssigpTa->SetBinContent(3237,0.0507016); + ssigpTa->SetBinContent(3238,0.0515208); + ssigpTa->SetBinContent(3239,0.0515976); + ssigpTa->SetBinContent(3240,0.0508988); + ssigpTa->SetBinContent(3241,0.0509764); + ssigpTa->SetBinContent(3242,0.0519916); + ssigpTa->SetBinContent(3243,0.0533672); + ssigpTa->SetBinContent(3244,0.0545868); + ssigpTa->SetBinContent(3245,0.0556352); + ssigpTa->SetBinContent(3246,0.05667); + ssigpTa->SetBinContent(3247,0.0577096); + ssigpTa->SetBinContent(3248,0.0587664); + ssigpTa->SetBinContent(3249,0.0598288); + ssigpTa->SetBinContent(3250,0.0608844); + ssigpTa->SetBinContent(3251,0.0619036); + ssigpTa->SetBinContent(3252,0.0630628); + ssigpTa->SetBinContent(3253,0.0645864); + ssigpTa->SetBinContent(3254,0.0660396); + ssigpTa->SetBinContent(3255,0.0673228); + ssigpTa->SetBinContent(3256,0.0685784); + ssigpTa->SetBinContent(3257,0.0698444); + ssigpTa->SetBinContent(3258,0.07114); + ssigpTa->SetBinContent(3259,0.0724728); + ssigpTa->SetBinContent(3260,0.0738288); + ssigpTa->SetBinContent(3261,0.0750868); + ssigpTa->SetBinContent(3262,0.076236); + ssigpTa->SetBinContent(3263,0.0775408); + ssigpTa->SetBinContent(3264,0.0789496); + ssigpTa->SetBinContent(3265,0.0803296); + ssigpTa->SetBinContent(3266,0.0818204); + ssigpTa->SetBinContent(3267,0.0834032); + ssigpTa->SetBinContent(3268,0.0850136); + ssigpTa->SetBinContent(3269,0.086682); + ssigpTa->SetBinContent(3270,0.0884636); + ssigpTa->SetBinContent(3271,0.090338); + ssigpTa->SetBinContent(3272,0.0922488); + ssigpTa->SetBinContent(3273,0.0941704); + ssigpTa->SetBinContent(3274,0.09612); + ssigpTa->SetBinContent(3275,0.0981216); + ssigpTa->SetBinContent(3276,0.10017); + ssigpTa->SetBinContent(3277,0.102253); + ssigpTa->SetBinContent(3278,0.104352); + ssigpTa->SetBinContent(3279,0.106492); + ssigpTa->SetBinContent(3280,0.108796); + ssigpTa->SetBinContent(3281,0.111281); + ssigpTa->SetBinContent(3282,0.113833); + ssigpTa->SetBinContent(3283,0.116399); + ssigpTa->SetBinContent(3284,0.118991); + ssigpTa->SetBinContent(3285,0.12143); + ssigpTa->SetBinContent(3286,0.123172); + ssigpTa->SetBinContent(3289,0.0158867); + ssigpTa->SetBinContent(3290,0.015885); + ssigpTa->SetBinContent(3291,0.0158832); + ssigpTa->SetBinContent(3292,0.0158832); + ssigpTa->SetBinContent(3293,0.0158832); + ssigpTa->SetBinContent(3294,0.0158832); + ssigpTa->SetBinContent(3295,0.0158832); + ssigpTa->SetBinContent(3296,0.0158832); + ssigpTa->SetBinContent(3297,0.0158848); + ssigpTa->SetBinContent(3298,0.0158848); + ssigpTa->SetBinContent(3299,0.0158848); + ssigpTa->SetBinContent(3300,0.0158848); + ssigpTa->SetBinContent(3301,0.0158904); + ssigpTa->SetBinContent(3302,0.0158952); + ssigpTa->SetBinContent(3303,0.0159072); + ssigpTa->SetBinContent(3304,0.015916); + ssigpTa->SetBinContent(3305,0.0159296); + ssigpTa->SetBinContent(3306,0.0159392); + ssigpTa->SetBinContent(3307,0.0159448); + ssigpTa->SetBinContent(3308,0.0159448); + ssigpTa->SetBinContent(3309,0.0159448); + ssigpTa->SetBinContent(3310,0.0159528); + ssigpTa->SetBinContent(3311,0.0159616); + ssigpTa->SetBinContent(3312,0.0159776); + ssigpTa->SetBinContent(3313,0.0159824); + ssigpTa->SetBinContent(3314,0.0159952); + ssigpTa->SetBinContent(3315,0.0160048); + ssigpTa->SetBinContent(3316,0.0160168); + ssigpTa->SetBinContent(3317,0.0160272); + ssigpTa->SetBinContent(3318,0.0160392); + ssigpTa->SetBinContent(3319,0.016048); + ssigpTa->SetBinContent(3320,0.0160616); + ssigpTa->SetBinContent(3321,0.0160736); + ssigpTa->SetBinContent(3322,0.0160872); + ssigpTa->SetBinContent(3323,0.0161048); + ssigpTa->SetBinContent(3324,0.0161136); + ssigpTa->SetBinContent(3325,0.0161296); + ssigpTa->SetBinContent(3326,0.016144); + ssigpTa->SetBinContent(3327,0.0161656); + ssigpTa->SetBinContent(3328,0.0161792); + ssigpTa->SetBinContent(3329,0.016188); + ssigpTa->SetBinContent(3330,0.016204); + ssigpTa->SetBinContent(3331,0.0162256); + ssigpTa->SetBinContent(3332,0.016244); + ssigpTa->SetBinContent(3333,0.0162584); + ssigpTa->SetBinContent(3334,0.0162856); + ssigpTa->SetBinContent(3335,0.0163024); + ssigpTa->SetBinContent(3336,0.0163208); + ssigpTa->SetBinContent(3337,0.0163368); + ssigpTa->SetBinContent(3338,0.0163584); + ssigpTa->SetBinContent(3339,0.0163808); + ssigpTa->SetBinContent(3340,0.0164024); + ssigpTa->SetBinContent(3341,0.0164248); + ssigpTa->SetBinContent(3342,0.0164448); + ssigpTa->SetBinContent(3343,0.0164744); + ssigpTa->SetBinContent(3344,0.0164896); + ssigpTa->SetBinContent(3345,0.0165176); + ssigpTa->SetBinContent(3346,0.0165392); + ssigpTa->SetBinContent(3347,0.0165616); + ssigpTa->SetBinContent(3348,0.0165856); + ssigpTa->SetBinContent(3349,0.0166136); + ssigpTa->SetBinContent(3350,0.0166472); + ssigpTa->SetBinContent(3351,0.016672); + ssigpTa->SetBinContent(3352,0.0167024); + ssigpTa->SetBinContent(3353,0.0167304); + ssigpTa->SetBinContent(3354,0.01676); + ssigpTa->SetBinContent(3355,0.0167784); + ssigpTa->SetBinContent(3356,0.016804); + ssigpTa->SetBinContent(3357,0.016832); + ssigpTa->SetBinContent(3358,0.0168648); + ssigpTa->SetBinContent(3359,0.0169024); + ssigpTa->SetBinContent(3360,0.0169424); + ssigpTa->SetBinContent(3361,0.0169728); + ssigpTa->SetBinContent(3362,0.0170104); + ssigpTa->SetBinContent(3363,0.0170352); + ssigpTa->SetBinContent(3364,0.0170704); + ssigpTa->SetBinContent(3365,0.0170976); + ssigpTa->SetBinContent(3366,0.0171352); + ssigpTa->SetBinContent(3367,0.0171792); + ssigpTa->SetBinContent(3368,0.0172104); + ssigpTa->SetBinContent(3369,0.0172512); + ssigpTa->SetBinContent(3370,0.017284); + ssigpTa->SetBinContent(3371,0.0173272); + ssigpTa->SetBinContent(3372,0.0173712); + ssigpTa->SetBinContent(3373,0.017408); + ssigpTa->SetBinContent(3374,0.017448); + ssigpTa->SetBinContent(3375,0.0174856); + ssigpTa->SetBinContent(3376,0.0175208); + ssigpTa->SetBinContent(3377,0.0175704); + ssigpTa->SetBinContent(3378,0.0176184); + ssigpTa->SetBinContent(3379,0.017668); + ssigpTa->SetBinContent(3380,0.0177016); + ssigpTa->SetBinContent(3381,0.0177512); + ssigpTa->SetBinContent(3382,0.0177976); + ssigpTa->SetBinContent(3383,0.0178488); + ssigpTa->SetBinContent(3384,0.017888); + ssigpTa->SetBinContent(3385,0.0179376); + ssigpTa->SetBinContent(3386,0.0179912); + ssigpTa->SetBinContent(3387,0.0180424); + ssigpTa->SetBinContent(3388,0.0180968); + ssigpTa->SetBinContent(3389,0.0181552); + ssigpTa->SetBinContent(3390,0.0182096); + ssigpTa->SetBinContent(3391,0.0182672); + ssigpTa->SetBinContent(3392,0.0183176); + ssigpTa->SetBinContent(3393,0.0183712); + ssigpTa->SetBinContent(3394,0.0188128); + ssigpTa->SetBinContent(3395,0.0211856); + ssigpTa->SetBinContent(3396,0.025508); + ssigpTa->SetBinContent(3397,0.0278904); + ssigpTa->SetBinContent(3398,0.0283408); + ssigpTa->SetBinContent(3399,0.0284032); + ssigpTa->SetBinContent(3400,0.0284632); + ssigpTa->SetBinContent(3401,0.0285216); + ssigpTa->SetBinContent(3402,0.0285816); + ssigpTa->SetBinContent(3403,0.0286464); + ssigpTa->SetBinContent(3404,0.0287168); + ssigpTa->SetBinContent(3405,0.0284584); + ssigpTa->SetBinContent(3406,0.0265176); + ssigpTa->SetBinContent(3407,0.0229816); + ssigpTa->SetBinContent(3408,0.021292); + ssigpTa->SetBinContent(3409,0.0213968); + ssigpTa->SetBinContent(3410,0.0218448); + ssigpTa->SetBinContent(3411,0.0223024); + ssigpTa->SetBinContent(3412,0.0227592); + ssigpTa->SetBinContent(3413,0.0232312); + ssigpTa->SetBinContent(3414,0.0235584); + ssigpTa->SetBinContent(3415,0.023184); + ssigpTa->SetBinContent(3416,0.0220808); + ssigpTa->SetBinContent(3417,0.0216568); + ssigpTa->SetBinContent(3418,0.021912); + ssigpTa->SetBinContent(3419,0.02232); + ssigpTa->SetBinContent(3420,0.022756); + ssigpTa->SetBinContent(3421,0.0232136); + ssigpTa->SetBinContent(3422,0.0236776); + ssigpTa->SetBinContent(3423,0.0241424); + ssigpTa->SetBinContent(3424,0.024616); + ssigpTa->SetBinContent(3425,0.0249336); + ssigpTa->SetBinContent(3426,0.0244328); + ssigpTa->SetBinContent(3427,0.0230768); + ssigpTa->SetBinContent(3428,0.0225336); + ssigpTa->SetBinContent(3429,0.0228128); + ssigpTa->SetBinContent(3430,0.0232784); + ssigpTa->SetBinContent(3431,0.0237488); + ssigpTa->SetBinContent(3432,0.0242312); + ssigpTa->SetBinContent(3433,0.0247136); + ssigpTa->SetBinContent(3434,0.0252112); + ssigpTa->SetBinContent(3435,0.0257104); + ssigpTa->SetBinContent(3436,0.0260696); + ssigpTa->SetBinContent(3437,0.0256312); + ssigpTa->SetBinContent(3438,0.0243776); + ssigpTa->SetBinContent(3439,0.0239064); + ssigpTa->SetBinContent(3440,0.0242328); + ssigpTa->SetBinContent(3441,0.024724); + ssigpTa->SetBinContent(3442,0.0252392); + ssigpTa->SetBinContent(3443,0.0257488); + ssigpTa->SetBinContent(3444,0.0262752); + ssigpTa->SetBinContent(3445,0.0268096); + ssigpTa->SetBinContent(3446,0.027352); + ssigpTa->SetBinContent(3447,0.0279008); + ssigpTa->SetBinContent(3448,0.0283192); + ssigpTa->SetBinContent(3449,0.0280376); + ssigpTa->SetBinContent(3450,0.0270312); + ssigpTa->SetBinContent(3451,0.0266176); + ssigpTa->SetBinContent(3452,0.0263792); + ssigpTa->SetBinContent(3453,0.0257248); + ssigpTa->SetBinContent(3454,0.025608); + ssigpTa->SetBinContent(3455,0.026016); + ssigpTa->SetBinContent(3456,0.0265568); + ssigpTa->SetBinContent(3457,0.0271088); + ssigpTa->SetBinContent(3458,0.027668); + ssigpTa->SetBinContent(3459,0.0282328); + ssigpTa->SetBinContent(3460,0.0288136); + ssigpTa->SetBinContent(3461,0.0294136); + ssigpTa->SetBinContent(3462,0.0300344); + ssigpTa->SetBinContent(3463,0.0307232); + ssigpTa->SetBinContent(3464,0.031476); + ssigpTa->SetBinContent(3465,0.0321776); + ssigpTa->SetBinContent(3466,0.0327824); + ssigpTa->SetBinContent(3467,0.0330992); + ssigpTa->SetBinContent(3468,0.033144); + ssigpTa->SetBinContent(3469,0.0334616); + ssigpTa->SetBinContent(3470,0.0340792); + ssigpTa->SetBinContent(3471,0.0347504); + ssigpTa->SetBinContent(3472,0.0352448); + ssigpTa->SetBinContent(3473,0.0347656); + ssigpTa->SetBinContent(3474,0.0331008); + ssigpTa->SetBinContent(3475,0.0314216); + ssigpTa->SetBinContent(3476,0.0297272); + ssigpTa->SetBinContent(3477,0.02912); + ssigpTa->SetBinContent(3478,0.0294568); + ssigpTa->SetBinContent(3479,0.0299784); + ssigpTa->SetBinContent(3480,0.030548); + ssigpTa->SetBinContent(3481,0.0312008); + ssigpTa->SetBinContent(3482,0.0319496); + ssigpTa->SetBinContent(3483,0.0326136); + ssigpTa->SetBinContent(3484,0.0332048); + ssigpTa->SetBinContent(3485,0.0337984); + ssigpTa->SetBinContent(3486,0.0344032); + ssigpTa->SetBinContent(3487,0.0350232); + ssigpTa->SetBinContent(3488,0.0356528); + ssigpTa->SetBinContent(3489,0.0362696); + ssigpTa->SetBinContent(3490,0.0368368); + ssigpTa->SetBinContent(3491,0.0373512); + ssigpTa->SetBinContent(3492,0.0379768); + ssigpTa->SetBinContent(3493,0.038708); + ssigpTa->SetBinContent(3494,0.0395624); + ssigpTa->SetBinContent(3495,0.0405224); + ssigpTa->SetBinContent(3496,0.041396); + ssigpTa->SetBinContent(3497,0.0421992); + ssigpTa->SetBinContent(3498,0.0430064); + ssigpTa->SetBinContent(3499,0.0438192); + ssigpTa->SetBinContent(3500,0.0446344); + ssigpTa->SetBinContent(3501,0.0454352); + ssigpTa->SetBinContent(3502,0.0462208); + ssigpTa->SetBinContent(3503,0.0470936); + ssigpTa->SetBinContent(3504,0.0480536); + ssigpTa->SetBinContent(3505,0.0491088); + ssigpTa->SetBinContent(3506,0.050224); + ssigpTa->SetBinContent(3507,0.0512712); + ssigpTa->SetBinContent(3508,0.052272); + ssigpTa->SetBinContent(3509,0.0532816); + ssigpTa->SetBinContent(3510,0.054328); + ssigpTa->SetBinContent(3511,0.055404); + ssigpTa->SetBinContent(3512,0.0563872); + ssigpTa->SetBinContent(3513,0.0567608); + ssigpTa->SetBinContent(3514,0.0564992); + ssigpTa->SetBinContent(3515,0.0568592); + ssigpTa->SetBinContent(3516,0.0579072); + ssigpTa->SetBinContent(3517,0.0591632); + ssigpTa->SetBinContent(3518,0.0603896); + ssigpTa->SetBinContent(3519,0.061596); + ssigpTa->SetBinContent(3520,0.0627984); + ssigpTa->SetBinContent(3521,0.0640184); + ssigpTa->SetBinContent(3522,0.0652536); + ssigpTa->SetBinContent(3523,0.0665016); + ssigpTa->SetBinContent(3524,0.0677552); + ssigpTa->SetBinContent(3525,0.0689816); + ssigpTa->SetBinContent(3526,0.0702752); + ssigpTa->SetBinContent(3527,0.0718056); + ssigpTa->SetBinContent(3528,0.07334); + ssigpTa->SetBinContent(3529,0.07482); + ssigpTa->SetBinContent(3530,0.0762848); + ssigpTa->SetBinContent(3531,0.0777736); + ssigpTa->SetBinContent(3532,0.079292); + ssigpTa->SetBinContent(3533,0.0808552); + ssigpTa->SetBinContent(3534,0.0824592); + ssigpTa->SetBinContent(3535,0.0840232); + ssigpTa->SetBinContent(3536,0.0855256); + ssigpTa->SetBinContent(3537,0.087168); + ssigpTa->SetBinContent(3538,0.0888856); + ssigpTa->SetBinContent(3539,0.0906032); + ssigpTa->SetBinContent(3540,0.092404); + ssigpTa->SetBinContent(3541,0.0942816); + ssigpTa->SetBinContent(3542,0.096184); + ssigpTa->SetBinContent(3543,0.0981632); + ssigpTa->SetBinContent(3544,0.100271); + ssigpTa->SetBinContent(3545,0.102483); + ssigpTa->SetBinContent(3546,0.104737); + ssigpTa->SetBinContent(3547,0.107014); + ssigpTa->SetBinContent(3548,0.109325); + ssigpTa->SetBinContent(3549,0.111693); + ssigpTa->SetBinContent(3550,0.114123); + ssigpTa->SetBinContent(3551,0.116586); + ssigpTa->SetBinContent(3552,0.119067); + ssigpTa->SetBinContent(3553,0.121645); + ssigpTa->SetBinContent(3554,0.124537); + ssigpTa->SetBinContent(3555,0.127799); + ssigpTa->SetBinContent(3556,0.130998); + ssigpTa->SetBinContent(3557,0.134066); + ssigpTa->SetBinContent(3558,0.137144); + ssigpTa->SetBinContent(3559,0.14003); + ssigpTa->SetBinContent(3560,0.142077); + ssigpTa->SetBinContent(3563,0.0175239); + ssigpTa->SetBinContent(3564,0.0175212); + ssigpTa->SetBinContent(3565,0.0175204); + ssigpTa->SetBinContent(3566,0.0175204); + ssigpTa->SetBinContent(3567,0.0175204); + ssigpTa->SetBinContent(3568,0.0175204); + ssigpTa->SetBinContent(3569,0.0175204); + ssigpTa->SetBinContent(3570,0.0175204); + ssigpTa->SetBinContent(3571,0.017524); + ssigpTa->SetBinContent(3572,0.017524); + ssigpTa->SetBinContent(3573,0.017524); + ssigpTa->SetBinContent(3574,0.0175304); + ssigpTa->SetBinContent(3575,0.0175368); + ssigpTa->SetBinContent(3576,0.017548); + ssigpTa->SetBinContent(3577,0.0175528); + ssigpTa->SetBinContent(3578,0.0175604); + ssigpTa->SetBinContent(3579,0.017568); + ssigpTa->SetBinContent(3580,0.017582); + ssigpTa->SetBinContent(3581,0.0175876); + ssigpTa->SetBinContent(3582,0.0175904); + ssigpTa->SetBinContent(3583,0.0175904); + ssigpTa->SetBinContent(3584,0.0175904); + ssigpTa->SetBinContent(3585,0.0175972); + ssigpTa->SetBinContent(3586,0.017602); + ssigpTa->SetBinContent(3587,0.017616); + ssigpTa->SetBinContent(3588,0.0176316); + ssigpTa->SetBinContent(3589,0.017652); + ssigpTa->SetBinContent(3590,0.0176596); + ssigpTa->SetBinContent(3591,0.0176672); + ssigpTa->SetBinContent(3592,0.017672); + ssigpTa->SetBinContent(3593,0.0176796); + ssigpTa->SetBinContent(3594,0.0176872); + ssigpTa->SetBinContent(3595,0.0177076); + ssigpTa->SetBinContent(3596,0.0177244); + ssigpTa->SetBinContent(3597,0.017742); + ssigpTa->SetBinContent(3598,0.0177516); + ssigpTa->SetBinContent(3599,0.0177572); + ssigpTa->SetBinContent(3600,0.017776); + ssigpTa->SetBinContent(3601,0.0177948); + ssigpTa->SetBinContent(3602,0.0178088); + ssigpTa->SetBinContent(3603,0.017818); + ssigpTa->SetBinContent(3604,0.017834); + ssigpTa->SetBinContent(3605,0.0178528); + ssigpTa->SetBinContent(3606,0.0178696); + ssigpTa->SetBinContent(3607,0.0178884); + ssigpTa->SetBinContent(3608,0.0179052); + ssigpTa->SetBinContent(3609,0.017926); + ssigpTa->SetBinContent(3610,0.01794); + ssigpTa->SetBinContent(3611,0.0179568); + ssigpTa->SetBinContent(3612,0.0179756); + ssigpTa->SetBinContent(3613,0.0180008); + ssigpTa->SetBinContent(3614,0.018016); + ssigpTa->SetBinContent(3615,0.0180392); + ssigpTa->SetBinContent(3616,0.0180664); + ssigpTa->SetBinContent(3617,0.0180832); + ssigpTa->SetBinContent(3618,0.0181004); + ssigpTa->SetBinContent(3619,0.0181208); + ssigpTa->SetBinContent(3620,0.018148); + ssigpTa->SetBinContent(3621,0.0181676); + ssigpTa->SetBinContent(3622,0.0181892); + ssigpTa->SetBinContent(3623,0.0182256); + ssigpTa->SetBinContent(3624,0.01825); + ssigpTa->SetBinContent(3625,0.0182764); + ssigpTa->SetBinContent(3626,0.018298); + ssigpTa->SetBinContent(3627,0.018328); + ssigpTa->SetBinContent(3628,0.0183532); + ssigpTa->SetBinContent(3629,0.0183748); + ssigpTa->SetBinContent(3630,0.0183944); + ssigpTa->SetBinContent(3631,0.018428); + ssigpTa->SetBinContent(3632,0.0184572); + ssigpTa->SetBinContent(3633,0.0184928); + ssigpTa->SetBinContent(3634,0.018532); + ssigpTa->SetBinContent(3635,0.0185696); + ssigpTa->SetBinContent(3636,0.018592); + ssigpTa->SetBinContent(3637,0.0186304); + ssigpTa->SetBinContent(3638,0.018652); + ssigpTa->SetBinContent(3639,0.0186828); + ssigpTa->SetBinContent(3640,0.0187212); + ssigpTa->SetBinContent(3641,0.0187504); + ssigpTa->SetBinContent(3642,0.018788); + ssigpTa->SetBinContent(3643,0.0188188); + ssigpTa->SetBinContent(3644,0.0188636); + ssigpTa->SetBinContent(3645,0.0189076); + ssigpTa->SetBinContent(3646,0.018946); + ssigpTa->SetBinContent(3647,0.0189836); + ssigpTa->SetBinContent(3648,0.0190228); + ssigpTa->SetBinContent(3649,0.0190584); + ssigpTa->SetBinContent(3650,0.0191004); + ssigpTa->SetBinContent(3651,0.0191408); + ssigpTa->SetBinContent(3652,0.0191924); + ssigpTa->SetBinContent(3653,0.019228); + ssigpTa->SetBinContent(3654,0.019272); + ssigpTa->SetBinContent(3655,0.0193076); + ssigpTa->SetBinContent(3656,0.0193592); + ssigpTa->SetBinContent(3657,0.0194032); + ssigpTa->SetBinContent(3658,0.0194444); + ssigpTa->SetBinContent(3659,0.0194948); + ssigpTa->SetBinContent(3660,0.0195464); + ssigpTa->SetBinContent(3661,0.019596); + ssigpTa->SetBinContent(3662,0.019644); + ssigpTa->SetBinContent(3663,0.019702); + ssigpTa->SetBinContent(3664,0.01976); + ssigpTa->SetBinContent(3665,0.019806); + ssigpTa->SetBinContent(3666,0.0198612); + ssigpTa->SetBinContent(3667,0.0199136); + ssigpTa->SetBinContent(3668,0.0204204); + ssigpTa->SetBinContent(3669,0.0231832); + ssigpTa->SetBinContent(3670,0.0281936); + ssigpTa->SetBinContent(3671,0.0309612); + ssigpTa->SetBinContent(3672,0.0314728); + ssigpTa->SetBinContent(3673,0.0315336); + ssigpTa->SetBinContent(3674,0.03159); + ssigpTa->SetBinContent(3675,0.031646); + ssigpTa->SetBinContent(3676,0.031704); + ssigpTa->SetBinContent(3677,0.0317632); + ssigpTa->SetBinContent(3678,0.0318316); + ssigpTa->SetBinContent(3679,0.0315116); + ssigpTa->SetBinContent(3680,0.0292404); + ssigpTa->SetBinContent(3681,0.0250856); + ssigpTa->SetBinContent(3682,0.0231084); + ssigpTa->SetBinContent(3683,0.0231992); + ssigpTa->SetBinContent(3684,0.0237128); + ssigpTa->SetBinContent(3685,0.0242216); + ssigpTa->SetBinContent(3686,0.02474); + ssigpTa->SetBinContent(3687,0.0252548); + ssigpTa->SetBinContent(3688,0.025622); + ssigpTa->SetBinContent(3689,0.0251612); + ssigpTa->SetBinContent(3690,0.023876); + ssigpTa->SetBinContent(3691,0.0233768); + ssigpTa->SetBinContent(3692,0.0236688); + ssigpTa->SetBinContent(3693,0.024134); + ssigpTa->SetBinContent(3694,0.0246224); + ssigpTa->SetBinContent(3695,0.025126); + ssigpTa->SetBinContent(3696,0.0256464); + ssigpTa->SetBinContent(3697,0.0261656); + ssigpTa->SetBinContent(3698,0.0266932); + ssigpTa->SetBinContent(3699,0.0270464); + ssigpTa->SetBinContent(3700,0.0264512); + ssigpTa->SetBinContent(3701,0.0248884); + ssigpTa->SetBinContent(3702,0.0242492); + ssigpTa->SetBinContent(3703,0.0245612); + ssigpTa->SetBinContent(3704,0.0250648); + ssigpTa->SetBinContent(3705,0.02559); + ssigpTa->SetBinContent(3706,0.0261104); + ssigpTa->SetBinContent(3707,0.0266504); + ssigpTa->SetBinContent(3708,0.0271968); + ssigpTa->SetBinContent(3709,0.0277536); + ssigpTa->SetBinContent(3710,0.028134); + ssigpTa->SetBinContent(3711,0.0275896); + ssigpTa->SetBinContent(3712,0.0260932); + ssigpTa->SetBinContent(3713,0.0255004); + ssigpTa->SetBinContent(3714,0.0258352); + ssigpTa->SetBinContent(3715,0.0263772); + ssigpTa->SetBinContent(3716,0.0269248); + ssigpTa->SetBinContent(3717,0.027492); + ssigpTa->SetBinContent(3718,0.0280564); + ssigpTa->SetBinContent(3719,0.0286404); + ssigpTa->SetBinContent(3720,0.029232); + ssigpTa->SetBinContent(3721,0.0298308); + ssigpTa->SetBinContent(3722,0.0302776); + ssigpTa->SetBinContent(3723,0.0298884); + ssigpTa->SetBinContent(3724,0.0286376); + ssigpTa->SetBinContent(3725,0.0281236); + ssigpTa->SetBinContent(3726,0.0279696); + ssigpTa->SetBinContent(3727,0.0275152); + ssigpTa->SetBinContent(3728,0.0275048); + ssigpTa->SetBinContent(3729,0.0279788); + ssigpTa->SetBinContent(3730,0.0285564); + ssigpTa->SetBinContent(3731,0.0291564); + ssigpTa->SetBinContent(3732,0.0297564); + ssigpTa->SetBinContent(3733,0.0303732); + ssigpTa->SetBinContent(3734,0.0310084); + ssigpTa->SetBinContent(3735,0.0316524); + ssigpTa->SetBinContent(3736,0.0323196); + ssigpTa->SetBinContent(3737,0.032988); + ssigpTa->SetBinContent(3738,0.0336736); + ssigpTa->SetBinContent(3739,0.0343708); + ssigpTa->SetBinContent(3740,0.0350232); + ssigpTa->SetBinContent(3741,0.035464); + ssigpTa->SetBinContent(3742,0.0356808); + ssigpTa->SetBinContent(3743,0.03615); + ssigpTa->SetBinContent(3744,0.036844); + ssigpTa->SetBinContent(3745,0.0376052); + ssigpTa->SetBinContent(3746,0.0381164); + ssigpTa->SetBinContent(3747,0.0373984); + ssigpTa->SetBinContent(3748,0.0352348); + ssigpTa->SetBinContent(3749,0.033416); + ssigpTa->SetBinContent(3750,0.031936); + ssigpTa->SetBinContent(3751,0.031514); + ssigpTa->SetBinContent(3752,0.0319176); + ssigpTa->SetBinContent(3753,0.0325228); + ssigpTa->SetBinContent(3754,0.0331316); + ssigpTa->SetBinContent(3755,0.0337884); + ssigpTa->SetBinContent(3756,0.034462); + ssigpTa->SetBinContent(3757,0.0351144); + ssigpTa->SetBinContent(3758,0.0357644); + ssigpTa->SetBinContent(3759,0.0364256); + ssigpTa->SetBinContent(3760,0.0371128); + ssigpTa->SetBinContent(3761,0.0378068); + ssigpTa->SetBinContent(3762,0.0385136); + ssigpTa->SetBinContent(3763,0.0392308); + ssigpTa->SetBinContent(3764,0.039958); + ssigpTa->SetBinContent(3765,0.0407368); + ssigpTa->SetBinContent(3766,0.0415384); + ssigpTa->SetBinContent(3767,0.0423648); + ssigpTa->SetBinContent(3768,0.0432024); + ssigpTa->SetBinContent(3769,0.0440504); + ssigpTa->SetBinContent(3770,0.0449104); + ssigpTa->SetBinContent(3771,0.0457976); + ssigpTa->SetBinContent(3772,0.0467052); + ssigpTa->SetBinContent(3773,0.0476232); + ssigpTa->SetBinContent(3774,0.0485608); + ssigpTa->SetBinContent(3775,0.0495548); + ssigpTa->SetBinContent(3776,0.0506328); + ssigpTa->SetBinContent(3777,0.0517108); + ssigpTa->SetBinContent(3778,0.0527932); + ssigpTa->SetBinContent(3779,0.0538428); + ssigpTa->SetBinContent(3780,0.0548336); + ssigpTa->SetBinContent(3781,0.0558676); + ssigpTa->SetBinContent(3782,0.056964); + ssigpTa->SetBinContent(3783,0.0581016); + ssigpTa->SetBinContent(3784,0.0592764); + ssigpTa->SetBinContent(3785,0.0604932); + ssigpTa->SetBinContent(3786,0.0616464); + ssigpTa->SetBinContent(3787,0.0623164); + ssigpTa->SetBinContent(3788,0.0624724); + ssigpTa->SetBinContent(3789,0.0631168); + ssigpTa->SetBinContent(3790,0.0642028); + ssigpTa->SetBinContent(3791,0.065346); + ssigpTa->SetBinContent(3792,0.066602); + ssigpTa->SetBinContent(3793,0.0679556); + ssigpTa->SetBinContent(3794,0.0693484); + ssigpTa->SetBinContent(3795,0.070746); + ssigpTa->SetBinContent(3796,0.0721732); + ssigpTa->SetBinContent(3797,0.07362); + ssigpTa->SetBinContent(3798,0.0750788); + ssigpTa->SetBinContent(3799,0.076514); + ssigpTa->SetBinContent(3800,0.0779488); + ssigpTa->SetBinContent(3801,0.07949); + ssigpTa->SetBinContent(3802,0.0811312); + ssigpTa->SetBinContent(3803,0.0828004); + ssigpTa->SetBinContent(3804,0.0844948); + ssigpTa->SetBinContent(3805,0.0862076); + ssigpTa->SetBinContent(3806,0.087958); + ssigpTa->SetBinContent(3807,0.0897624); + ssigpTa->SetBinContent(3808,0.0916192); + ssigpTa->SetBinContent(3809,0.0934944); + ssigpTa->SetBinContent(3810,0.0953668); + ssigpTa->SetBinContent(3811,0.0973344); + ssigpTa->SetBinContent(3812,0.0993764); + ssigpTa->SetBinContent(3813,0.101426); + ssigpTa->SetBinContent(3814,0.103546); + ssigpTa->SetBinContent(3815,0.105717); + ssigpTa->SetBinContent(3816,0.107925); + ssigpTa->SetBinContent(3817,0.110214); + ssigpTa->SetBinContent(3818,0.112663); + ssigpTa->SetBinContent(3819,0.11521); + ssigpTa->SetBinContent(3820,0.117824); + ssigpTa->SetBinContent(3821,0.120454); + ssigpTa->SetBinContent(3822,0.123128); + ssigpTa->SetBinContent(3823,0.125882); + ssigpTa->SetBinContent(3824,0.128688); + ssigpTa->SetBinContent(3825,0.131546); + ssigpTa->SetBinContent(3826,0.134428); + ssigpTa->SetBinContent(3827,0.137432); + ssigpTa->SetBinContent(3828,0.140926); + ssigpTa->SetBinContent(3829,0.144945); + ssigpTa->SetBinContent(3830,0.148783); + ssigpTa->SetBinContent(3831,0.152362); + ssigpTa->SetBinContent(3832,0.15593); + ssigpTa->SetBinContent(3833,0.159265); + ssigpTa->SetBinContent(3834,0.161633); + ssigpTa->SetBinContent(3837,0.0192289); + ssigpTa->SetBinContent(3838,0.0192275); + ssigpTa->SetBinContent(3839,0.0192264); + ssigpTa->SetBinContent(3840,0.0192264); + ssigpTa->SetBinContent(3841,0.0192264); + ssigpTa->SetBinContent(3842,0.0192264); + ssigpTa->SetBinContent(3843,0.0192264); + ssigpTa->SetBinContent(3844,0.0192336); + ssigpTa->SetBinContent(3845,0.0192408); + ssigpTa->SetBinContent(3846,0.019252); + ssigpTa->SetBinContent(3847,0.0192552); + ssigpTa->SetBinContent(3848,0.0192616); + ssigpTa->SetBinContent(3849,0.0192776); + ssigpTa->SetBinContent(3850,0.019284); + ssigpTa->SetBinContent(3851,0.0192896); + ssigpTa->SetBinContent(3852,0.0192896); + ssigpTa->SetBinContent(3853,0.0192952); + ssigpTa->SetBinContent(3854,0.0193008); + ssigpTa->SetBinContent(3855,0.0193064); + ssigpTa->SetBinContent(3856,0.0193064); + ssigpTa->SetBinContent(3857,0.0193064); + ssigpTa->SetBinContent(3858,0.0193064); + ssigpTa->SetBinContent(3859,0.0193064); + ssigpTa->SetBinContent(3860,0.019312); + ssigpTa->SetBinContent(3861,0.0193256); + ssigpTa->SetBinContent(3862,0.0193544); + ssigpTa->SetBinContent(3863,0.0193736); + ssigpTa->SetBinContent(3864,0.0193864); + ssigpTa->SetBinContent(3865,0.0193864); + ssigpTa->SetBinContent(3866,0.0193888); + ssigpTa->SetBinContent(3867,0.0193888); + ssigpTa->SetBinContent(3868,0.0193976); + ssigpTa->SetBinContent(3869,0.0194096); + ssigpTa->SetBinContent(3870,0.0194384); + ssigpTa->SetBinContent(3871,0.0194544); + ssigpTa->SetBinContent(3872,0.0194648); + ssigpTa->SetBinContent(3873,0.0194744); + ssigpTa->SetBinContent(3874,0.0194832); + ssigpTa->SetBinContent(3875,0.0194976); + ssigpTa->SetBinContent(3876,0.0195136); + ssigpTa->SetBinContent(3877,0.0195272); + ssigpTa->SetBinContent(3878,0.0195432); + ssigpTa->SetBinContent(3879,0.0195616); + ssigpTa->SetBinContent(3880,0.0195736); + ssigpTa->SetBinContent(3881,0.0195936); + ssigpTa->SetBinContent(3882,0.019608); + ssigpTa->SetBinContent(3883,0.019624); + ssigpTa->SetBinContent(3884,0.01964); + ssigpTa->SetBinContent(3885,0.019656); + ssigpTa->SetBinContent(3886,0.0196776); + ssigpTa->SetBinContent(3887,0.0196936); + ssigpTa->SetBinContent(3888,0.0197152); + ssigpTa->SetBinContent(3889,0.0197344); + ssigpTa->SetBinContent(3890,0.0197632); + ssigpTa->SetBinContent(3891,0.0197776); + ssigpTa->SetBinContent(3892,0.0197952); + ssigpTa->SetBinContent(3893,0.0198168); + ssigpTa->SetBinContent(3894,0.0198456); + ssigpTa->SetBinContent(3895,0.0198608); + ssigpTa->SetBinContent(3896,0.0198856); + ssigpTa->SetBinContent(3897,0.0199184); + ssigpTa->SetBinContent(3898,0.0199456); + ssigpTa->SetBinContent(3899,0.0199576); + ssigpTa->SetBinContent(3900,0.0199792); + ssigpTa->SetBinContent(3901,0.020008); + ssigpTa->SetBinContent(3902,0.0200368); + ssigpTa->SetBinContent(3903,0.020052); + ssigpTa->SetBinContent(3904,0.0200808); + ssigpTa->SetBinContent(3905,0.0201056); + ssigpTa->SetBinContent(3906,0.0201376); + ssigpTa->SetBinContent(3907,0.020172); + ssigpTa->SetBinContent(3908,0.0202056); + ssigpTa->SetBinContent(3909,0.0202416); + ssigpTa->SetBinContent(3910,0.020272); + ssigpTa->SetBinContent(3911,0.0202944); + ssigpTa->SetBinContent(3912,0.0203288); + ssigpTa->SetBinContent(3913,0.0203584); + ssigpTa->SetBinContent(3914,0.0203928); + ssigpTa->SetBinContent(3915,0.0204232); + ssigpTa->SetBinContent(3916,0.0204496); + ssigpTa->SetBinContent(3917,0.0204896); + ssigpTa->SetBinContent(3918,0.020528); + ssigpTa->SetBinContent(3919,0.0205752); + ssigpTa->SetBinContent(3920,0.0206088); + ssigpTa->SetBinContent(3921,0.020644); + ssigpTa->SetBinContent(3922,0.0206816); + ssigpTa->SetBinContent(3923,0.0207264); + ssigpTa->SetBinContent(3924,0.0207616); + ssigpTa->SetBinContent(3925,0.0208048); + ssigpTa->SetBinContent(3926,0.0208384); + ssigpTa->SetBinContent(3927,0.0208856); + ssigpTa->SetBinContent(3928,0.0209184); + ssigpTa->SetBinContent(3929,0.0209656); + ssigpTa->SetBinContent(3930,0.0210064); + ssigpTa->SetBinContent(3931,0.0210496); + ssigpTa->SetBinContent(3932,0.0210952); + ssigpTa->SetBinContent(3933,0.0211416); + ssigpTa->SetBinContent(3934,0.0211992); + ssigpTa->SetBinContent(3935,0.021236); + ssigpTa->SetBinContent(3936,0.0212904); + ssigpTa->SetBinContent(3937,0.02134); + ssigpTa->SetBinContent(3938,0.0213976); + ssigpTa->SetBinContent(3939,0.0214512); + ssigpTa->SetBinContent(3940,0.0214952); + ssigpTa->SetBinContent(3941,0.021552); + ssigpTa->SetBinContent(3942,0.0221304); + ssigpTa->SetBinContent(3943,0.025276); + ssigpTa->SetBinContent(3944,0.031008); + ssigpTa->SetBinContent(3945,0.03416); + ssigpTa->SetBinContent(3946,0.0347376); + ssigpTa->SetBinContent(3947,0.0347944); + ssigpTa->SetBinContent(3948,0.0348512); + ssigpTa->SetBinContent(3949,0.034912); + ssigpTa->SetBinContent(3950,0.0349728); + ssigpTa->SetBinContent(3951,0.0350256); + ssigpTa->SetBinContent(3952,0.035092); + ssigpTa->SetBinContent(3953,0.0347088); + ssigpTa->SetBinContent(3954,0.0320832); + ssigpTa->SetBinContent(3955,0.0273136); + ssigpTa->SetBinContent(3956,0.0250176); + ssigpTa->SetBinContent(3957,0.0251152); + ssigpTa->SetBinContent(3958,0.025688); + ssigpTa->SetBinContent(3959,0.0262624); + ssigpTa->SetBinContent(3960,0.0268272); + ssigpTa->SetBinContent(3961,0.027404); + ssigpTa->SetBinContent(3962,0.0277968); + ssigpTa->SetBinContent(3963,0.0272672); + ssigpTa->SetBinContent(3964,0.0257848); + ssigpTa->SetBinContent(3965,0.0252192); + ssigpTa->SetBinContent(3966,0.025556); + ssigpTa->SetBinContent(3967,0.0260768); + ssigpTa->SetBinContent(3968,0.0266088); + ssigpTa->SetBinContent(3969,0.0271664); + ssigpTa->SetBinContent(3970,0.0277304); + ssigpTa->SetBinContent(3971,0.028308); + ssigpTa->SetBinContent(3972,0.0289024); + ssigpTa->SetBinContent(3973,0.0292888); + ssigpTa->SetBinContent(3974,0.0286104); + ssigpTa->SetBinContent(3975,0.0268216); + ssigpTa->SetBinContent(3976,0.0260872); + ssigpTa->SetBinContent(3977,0.0264184); + ssigpTa->SetBinContent(3978,0.0269752); + ssigpTa->SetBinContent(3979,0.027536); + ssigpTa->SetBinContent(3980,0.0281128); + ssigpTa->SetBinContent(3981,0.0287); + ssigpTa->SetBinContent(3982,0.0293056); + ssigpTa->SetBinContent(3983,0.0299152); + ssigpTa->SetBinContent(3984,0.0303296); + ssigpTa->SetBinContent(3985,0.0296736); + ssigpTa->SetBinContent(3986,0.0279224); + ssigpTa->SetBinContent(3987,0.027208); + ssigpTa->SetBinContent(3988,0.0275608); + ssigpTa->SetBinContent(3989,0.0281408); + ssigpTa->SetBinContent(3990,0.0287448); + ssigpTa->SetBinContent(3991,0.0293472); + ssigpTa->SetBinContent(3992,0.029976); + ssigpTa->SetBinContent(3993,0.0306024); + ssigpTa->SetBinContent(3994,0.0312464); + ssigpTa->SetBinContent(3995,0.0318952); + ssigpTa->SetBinContent(3996,0.0323768); + ssigpTa->SetBinContent(3997,0.031872); + ssigpTa->SetBinContent(3998,0.0303656); + ssigpTa->SetBinContent(3999,0.0297392); + ssigpTa->SetBinContent(4000,0.0296896); + ssigpTa->SetBinContent(4001,0.0294176); + ssigpTa->SetBinContent(4002,0.0295472); + ssigpTa->SetBinContent(4003,0.0300696); + ssigpTa->SetBinContent(4004,0.030704); + ssigpTa->SetBinContent(4005,0.0313432); + ssigpTa->SetBinContent(4006,0.031996); + ssigpTa->SetBinContent(4007,0.0326688); + ssigpTa->SetBinContent(4008,0.0333536); + ssigpTa->SetBinContent(4009,0.034064); + ssigpTa->SetBinContent(4010,0.0347608); + ssigpTa->SetBinContent(4011,0.0354248); + ssigpTa->SetBinContent(4012,0.0360416); + ssigpTa->SetBinContent(4013,0.0367208); + ssigpTa->SetBinContent(4014,0.0374368); + ssigpTa->SetBinContent(4015,0.0379912); + ssigpTa->SetBinContent(4016,0.0384016); + ssigpTa->SetBinContent(4017,0.038996); + ssigpTa->SetBinContent(4018,0.039796); + ssigpTa->SetBinContent(4019,0.0406224); + ssigpTa->SetBinContent(4020,0.0411672); + ssigpTa->SetBinContent(4021,0.0401888); + ssigpTa->SetBinContent(4022,0.0375112); + ssigpTa->SetBinContent(4023,0.0355408); + ssigpTa->SetBinContent(4024,0.0342832); + ssigpTa->SetBinContent(4025,0.0340352); + ssigpTa->SetBinContent(4026,0.0345352); + ssigpTa->SetBinContent(4027,0.0351944); + ssigpTa->SetBinContent(4028,0.0358808); + ssigpTa->SetBinContent(4029,0.0365264); + ssigpTa->SetBinContent(4030,0.0371376); + ssigpTa->SetBinContent(4031,0.0377864); + ssigpTa->SetBinContent(4032,0.038488); + ssigpTa->SetBinContent(4033,0.0392392); + ssigpTa->SetBinContent(4034,0.039996); + ssigpTa->SetBinContent(4035,0.0407824); + ssigpTa->SetBinContent(4036,0.0415704); + ssigpTa->SetBinContent(4037,0.0423792); + ssigpTa->SetBinContent(4038,0.0432888); + ssigpTa->SetBinContent(4039,0.0443056); + ssigpTa->SetBinContent(4040,0.0453096); + ssigpTa->SetBinContent(4041,0.0462272); + ssigpTa->SetBinContent(4042,0.047052); + ssigpTa->SetBinContent(4043,0.0478032); + ssigpTa->SetBinContent(4044,0.0486504); + ssigpTa->SetBinContent(4045,0.0496216); + ssigpTa->SetBinContent(4046,0.05064); + ssigpTa->SetBinContent(4047,0.0516656); + ssigpTa->SetBinContent(4048,0.0527264); + ssigpTa->SetBinContent(4049,0.0539304); + ssigpTa->SetBinContent(4050,0.0552816); + ssigpTa->SetBinContent(4051,0.0565744); + ssigpTa->SetBinContent(4052,0.0577824); + ssigpTa->SetBinContent(4053,0.0588264); + ssigpTa->SetBinContent(4054,0.059716); + ssigpTa->SetBinContent(4055,0.0607448); + ssigpTa->SetBinContent(4056,0.0619488); + ssigpTa->SetBinContent(4057,0.0632168); + ssigpTa->SetBinContent(4058,0.0645296); + ssigpTa->SetBinContent(4059,0.0658904); + ssigpTa->SetBinContent(4060,0.067212); + ssigpTa->SetBinContent(4061,0.0681616); + ssigpTa->SetBinContent(4062,0.0687208); + ssigpTa->SetBinContent(4063,0.0696456); + ssigpTa->SetBinContent(4064,0.0707816); + ssigpTa->SetBinContent(4065,0.0718352); + ssigpTa->SetBinContent(4066,0.0731176); + ssigpTa->SetBinContent(4067,0.074636); + ssigpTa->SetBinContent(4068,0.0761984); + ssigpTa->SetBinContent(4069,0.0777952); + ssigpTa->SetBinContent(4070,0.0794096); + ssigpTa->SetBinContent(4071,0.0810648); + ssigpTa->SetBinContent(4072,0.0827272); + ssigpTa->SetBinContent(4073,0.0843808); + ssigpTa->SetBinContent(4074,0.0859584); + ssigpTa->SetBinContent(4075,0.0875368); + ssigpTa->SetBinContent(4076,0.0892704); + ssigpTa->SetBinContent(4077,0.0911456); + ssigpTa->SetBinContent(4078,0.0930656); + ssigpTa->SetBinContent(4079,0.0950176); + ssigpTa->SetBinContent(4080,0.0970144); + ssigpTa->SetBinContent(4081,0.0990544); + ssigpTa->SetBinContent(4082,0.101182); + ssigpTa->SetBinContent(4083,0.103363); + ssigpTa->SetBinContent(4084,0.105593); + ssigpTa->SetBinContent(4085,0.107896); + ssigpTa->SetBinContent(4086,0.110249); + ssigpTa->SetBinContent(4087,0.112635); + ssigpTa->SetBinContent(4088,0.115075); + ssigpTa->SetBinContent(4089,0.117554); + ssigpTa->SetBinContent(4090,0.120059); + ssigpTa->SetBinContent(4091,0.122676); + ssigpTa->SetBinContent(4092,0.125446); + ssigpTa->SetBinContent(4093,0.128364); + ssigpTa->SetBinContent(4094,0.131323); + ssigpTa->SetBinContent(4095,0.134317); + ssigpTa->SetBinContent(4096,0.137366); + ssigpTa->SetBinContent(4097,0.140484); + ssigpTa->SetBinContent(4098,0.143685); + ssigpTa->SetBinContent(4099,0.146932); + ssigpTa->SetBinContent(4100,0.150218); + ssigpTa->SetBinContent(4101,0.153663); + ssigpTa->SetBinContent(4102,0.157744); + ssigpTa->SetBinContent(4103,0.16251); + ssigpTa->SetBinContent(4104,0.166987); + ssigpTa->SetBinContent(4105,0.171075); + ssigpTa->SetBinContent(4106,0.175131); + ssigpTa->SetBinContent(4107,0.17893); + ssigpTa->SetBinContent(4108,0.181618); + ssigpTa->SetBinContent(4111,0.02197); + ssigpTa->SetBinContent(4112,0.021725); + ssigpTa->SetBinContent(4113,0.0216948); + ssigpTa->SetBinContent(4114,0.0216948); + ssigpTa->SetBinContent(4115,0.0216948); + ssigpTa->SetBinContent(4116,0.0216948); + ssigpTa->SetBinContent(4117,0.0216984); + ssigpTa->SetBinContent(4118,0.0217136); + ssigpTa->SetBinContent(4119,0.0217396); + ssigpTa->SetBinContent(4120,0.0217548); + ssigpTa->SetBinContent(4121,0.0217664); + ssigpTa->SetBinContent(4122,0.0217728); + ssigpTa->SetBinContent(4123,0.0217792); + ssigpTa->SetBinContent(4124,0.0217856); + ssigpTa->SetBinContent(4125,0.0217856); + ssigpTa->SetBinContent(4126,0.0217856); + ssigpTa->SetBinContent(4127,0.0217856); + ssigpTa->SetBinContent(4128,0.0217884); + ssigpTa->SetBinContent(4129,0.0217884); + ssigpTa->SetBinContent(4130,0.0217884); + ssigpTa->SetBinContent(4131,0.0217884); + ssigpTa->SetBinContent(4132,0.0217884); + ssigpTa->SetBinContent(4133,0.0217884); + ssigpTa->SetBinContent(4134,0.021792); + ssigpTa->SetBinContent(4135,0.0218056); + ssigpTa->SetBinContent(4136,0.02183); + ssigpTa->SetBinContent(4137,0.0218544); + ssigpTa->SetBinContent(4138,0.021866); + ssigpTa->SetBinContent(4139,0.021874); + ssigpTa->SetBinContent(4140,0.021874); + ssigpTa->SetBinContent(4141,0.021874); + ssigpTa->SetBinContent(4142,0.021874); + ssigpTa->SetBinContent(4143,0.0218868); + ssigpTa->SetBinContent(4144,0.0219004); + ssigpTa->SetBinContent(4145,0.0219248); + ssigpTa->SetBinContent(4146,0.02194); + ssigpTa->SetBinContent(4147,0.0219516); + ssigpTa->SetBinContent(4148,0.0219624); + ssigpTa->SetBinContent(4149,0.0219768); + ssigpTa->SetBinContent(4150,0.0219868); + ssigpTa->SetBinContent(4151,0.0220004); + ssigpTa->SetBinContent(4152,0.0220184); + ssigpTa->SetBinContent(4153,0.0220284); + ssigpTa->SetBinContent(4154,0.0220464); + ssigpTa->SetBinContent(4155,0.0220608); + ssigpTa->SetBinContent(4156,0.0220788); + ssigpTa->SetBinContent(4157,0.0220888); + ssigpTa->SetBinContent(4158,0.0221068); + ssigpTa->SetBinContent(4159,0.0221204); + ssigpTa->SetBinContent(4160,0.0221384); + ssigpTa->SetBinContent(4161,0.0221592); + ssigpTa->SetBinContent(4162,0.0221744); + ssigpTa->SetBinContent(4163,0.0222068); + ssigpTa->SetBinContent(4164,0.0222232); + ssigpTa->SetBinContent(4165,0.0222448); + ssigpTa->SetBinContent(4166,0.02226); + ssigpTa->SetBinContent(4167,0.0222924); + ssigpTa->SetBinContent(4168,0.0223088); + ssigpTa->SetBinContent(4169,0.0223224); + ssigpTa->SetBinContent(4170,0.022344); + ssigpTa->SetBinContent(4171,0.0223792); + ssigpTa->SetBinContent(4172,0.0224008); + ssigpTa->SetBinContent(4173,0.0224188); + ssigpTa->SetBinContent(4174,0.0224324); + ssigpTa->SetBinContent(4175,0.0224648); + ssigpTa->SetBinContent(4176,0.0224892); + ssigpTa->SetBinContent(4177,0.0225108); + ssigpTa->SetBinContent(4178,0.0225244); + ssigpTa->SetBinContent(4179,0.0225596); + ssigpTa->SetBinContent(4180,0.0225848); + ssigpTa->SetBinContent(4181,0.0226208); + ssigpTa->SetBinContent(4182,0.0226596); + ssigpTa->SetBinContent(4183,0.0226876); + ssigpTa->SetBinContent(4184,0.0227128); + ssigpTa->SetBinContent(4185,0.02274); + ssigpTa->SetBinContent(4186,0.0227652); + ssigpTa->SetBinContent(4187,0.0227968); + ssigpTa->SetBinContent(4188,0.02284); + ssigpTa->SetBinContent(4189,0.0228652); + ssigpTa->SetBinContent(4190,0.0228932); + ssigpTa->SetBinContent(4191,0.0229292); + ssigpTa->SetBinContent(4192,0.0229672); + ssigpTa->SetBinContent(4193,0.023006); + ssigpTa->SetBinContent(4194,0.0230456); + ssigpTa->SetBinContent(4195,0.0230736); + ssigpTa->SetBinContent(4196,0.023116); + ssigpTa->SetBinContent(4197,0.0231556); + ssigpTa->SetBinContent(4198,0.023198); + ssigpTa->SetBinContent(4199,0.023234); + ssigpTa->SetBinContent(4200,0.0232684); + ssigpTa->SetBinContent(4201,0.0233044); + ssigpTa->SetBinContent(4202,0.0233504); + ssigpTa->SetBinContent(4203,0.02339); + ssigpTa->SetBinContent(4204,0.023436); + ssigpTa->SetBinContent(4205,0.0234784); + ssigpTa->SetBinContent(4206,0.0235136); + ssigpTa->SetBinContent(4207,0.0235704); + ssigpTa->SetBinContent(4208,0.0236164); + ssigpTa->SetBinContent(4209,0.0236704); + ssigpTa->SetBinContent(4210,0.0237056); + ssigpTa->SetBinContent(4211,0.023766); + ssigpTa->SetBinContent(4212,0.0238264); + ssigpTa->SetBinContent(4213,0.0238732); + ssigpTa->SetBinContent(4214,0.023922); + ssigpTa->SetBinContent(4215,0.0239796); + ssigpTa->SetBinContent(4216,0.0246152); + ssigpTa->SetBinContent(4217,0.0281648); + ssigpTa->SetBinContent(4218,0.0352292); + ssigpTa->SetBinContent(4219,0.0387744); + ssigpTa->SetBinContent(4220,0.0394144); + ssigpTa->SetBinContent(4221,0.0394748); + ssigpTa->SetBinContent(4222,0.039528); + ssigpTa->SetBinContent(4223,0.039592); + ssigpTa->SetBinContent(4224,0.0396604); + ssigpTa->SetBinContent(4225,0.0397136); + ssigpTa->SetBinContent(4226,0.039766); + ssigpTa->SetBinContent(4227,0.0393296); + ssigpTa->SetBinContent(4228,0.036342); + ssigpTa->SetBinContent(4229,0.030408); + ssigpTa->SetBinContent(4230,0.027828); + ssigpTa->SetBinContent(4231,0.0279504); + ssigpTa->SetBinContent(4232,0.028604); + ssigpTa->SetBinContent(4233,0.0292576); + ssigpTa->SetBinContent(4234,0.0299076); + ssigpTa->SetBinContent(4235,0.0305548); + ssigpTa->SetBinContent(4236,0.0310184); + ssigpTa->SetBinContent(4237,0.0304272); + ssigpTa->SetBinContent(4238,0.0285592); + ssigpTa->SetBinContent(4239,0.0279356); + ssigpTa->SetBinContent(4240,0.0283592); + ssigpTa->SetBinContent(4241,0.028956); + ssigpTa->SetBinContent(4242,0.0295664); + ssigpTa->SetBinContent(4243,0.030184); + ssigpTa->SetBinContent(4244,0.0308348); + ssigpTa->SetBinContent(4245,0.0314884); + ssigpTa->SetBinContent(4246,0.0321636); + ssigpTa->SetBinContent(4247,0.0326236); + ssigpTa->SetBinContent(4248,0.0318704); + ssigpTa->SetBinContent(4249,0.0296412); + ssigpTa->SetBinContent(4250,0.0288152); + ssigpTa->SetBinContent(4251,0.0291908); + ssigpTa->SetBinContent(4252,0.0298084); + ssigpTa->SetBinContent(4253,0.0304432); + ssigpTa->SetBinContent(4254,0.0310904); + ssigpTa->SetBinContent(4255,0.031762); + ssigpTa->SetBinContent(4256,0.03244); + ssigpTa->SetBinContent(4257,0.0331368); + ssigpTa->SetBinContent(4258,0.0336032); + ssigpTa->SetBinContent(4259,0.0328708); + ssigpTa->SetBinContent(4260,0.0306056); + ssigpTa->SetBinContent(4261,0.0297896); + ssigpTa->SetBinContent(4262,0.0301804); + ssigpTa->SetBinContent(4263,0.0308288); + ssigpTa->SetBinContent(4264,0.0314844); + ssigpTa->SetBinContent(4265,0.0321688); + ssigpTa->SetBinContent(4266,0.032862); + ssigpTa->SetBinContent(4267,0.0335804); + ssigpTa->SetBinContent(4268,0.0342864); + ssigpTa->SetBinContent(4269,0.035022); + ssigpTa->SetBinContent(4270,0.0355408); + ssigpTa->SetBinContent(4271,0.0349492); + ssigpTa->SetBinContent(4272,0.0329124); + ssigpTa->SetBinContent(4273,0.0321904); + ssigpTa->SetBinContent(4274,0.0322624); + ssigpTa->SetBinContent(4275,0.032316); + ssigpTa->SetBinContent(4276,0.032594); + ssigpTa->SetBinContent(4277,0.0332108); + ssigpTa->SetBinContent(4278,0.0339148); + ssigpTa->SetBinContent(4279,0.0346316); + ssigpTa->SetBinContent(4280,0.0353564); + ssigpTa->SetBinContent(4281,0.0361064); + ssigpTa->SetBinContent(4282,0.0368808); + ssigpTa->SetBinContent(4283,0.0376596); + ssigpTa->SetBinContent(4284,0.0384368); + ssigpTa->SetBinContent(4285,0.0391072); + ssigpTa->SetBinContent(4286,0.039586); + ssigpTa->SetBinContent(4287,0.0402836); + ssigpTa->SetBinContent(4288,0.041068); + ssigpTa->SetBinContent(4289,0.041784); + ssigpTa->SetBinContent(4290,0.0424696); + ssigpTa->SetBinContent(4291,0.0432424); + ssigpTa->SetBinContent(4292,0.0441436); + ssigpTa->SetBinContent(4293,0.0450988); + ssigpTa->SetBinContent(4294,0.0456912); + ssigpTa->SetBinContent(4295,0.0444972); + ssigpTa->SetBinContent(4296,0.0408128); + ssigpTa->SetBinContent(4297,0.0387036); + ssigpTa->SetBinContent(4298,0.037818); + ssigpTa->SetBinContent(4299,0.0377732); + ssigpTa->SetBinContent(4300,0.0383816); + ssigpTa->SetBinContent(4301,0.039154); + ssigpTa->SetBinContent(4302,0.0399164); + ssigpTa->SetBinContent(4303,0.0405976); + ssigpTa->SetBinContent(4304,0.0410932); + ssigpTa->SetBinContent(4305,0.0417688); + ssigpTa->SetBinContent(4306,0.042578); + ssigpTa->SetBinContent(4307,0.0434144); + ssigpTa->SetBinContent(4308,0.044302); + ssigpTa->SetBinContent(4309,0.045194); + ssigpTa->SetBinContent(4310,0.0461032); + ssigpTa->SetBinContent(4311,0.0470448); + ssigpTa->SetBinContent(4312,0.0481548); + ssigpTa->SetBinContent(4313,0.049586); + ssigpTa->SetBinContent(4314,0.0508076); + ssigpTa->SetBinContent(4315,0.051868); + ssigpTa->SetBinContent(4316,0.052732); + ssigpTa->SetBinContent(4317,0.0532872); + ssigpTa->SetBinContent(4318,0.0541764); + ssigpTa->SetBinContent(4319,0.0552764); + ssigpTa->SetBinContent(4320,0.0564448); + ssigpTa->SetBinContent(4321,0.057624); + ssigpTa->SetBinContent(4322,0.0588572); + ssigpTa->SetBinContent(4323,0.0603084); + ssigpTa->SetBinContent(4324,0.0620972); + ssigpTa->SetBinContent(4325,0.063652); + ssigpTa->SetBinContent(4326,0.0650212); + ssigpTa->SetBinContent(4327,0.0661392); + ssigpTa->SetBinContent(4328,0.0668144); + ssigpTa->SetBinContent(4329,0.067908); + ssigpTa->SetBinContent(4330,0.069278); + ssigpTa->SetBinContent(4331,0.07073); + ssigpTa->SetBinContent(4332,0.072244); + ssigpTa->SetBinContent(4333,0.0738084); + ssigpTa->SetBinContent(4334,0.0753496); + ssigpTa->SetBinContent(4335,0.0766292); + ssigpTa->SetBinContent(4336,0.0777624); + ssigpTa->SetBinContent(4337,0.0790192); + ssigpTa->SetBinContent(4338,0.0802828); + ssigpTa->SetBinContent(4339,0.081156); + ssigpTa->SetBinContent(4340,0.082544); + ssigpTa->SetBinContent(4341,0.084274); + ssigpTa->SetBinContent(4342,0.0861092); + ssigpTa->SetBinContent(4343,0.0879444); + ssigpTa->SetBinContent(4344,0.0898532); + ssigpTa->SetBinContent(4345,0.0917632); + ssigpTa->SetBinContent(4346,0.0937092); + ssigpTa->SetBinContent(4347,0.0956556); + ssigpTa->SetBinContent(4348,0.0975012); + ssigpTa->SetBinContent(4349,0.099056); + ssigpTa->SetBinContent(4350,0.100988); + ssigpTa->SetBinContent(4351,0.103148); + ssigpTa->SetBinContent(4352,0.105386); + ssigpTa->SetBinContent(4353,0.107672); + ssigpTa->SetBinContent(4354,0.10999); + ssigpTa->SetBinContent(4355,0.112379); + ssigpTa->SetBinContent(4356,0.114856); + ssigpTa->SetBinContent(4357,0.11745); + ssigpTa->SetBinContent(4358,0.120175); + ssigpTa->SetBinContent(4359,0.122906); + ssigpTa->SetBinContent(4360,0.125678); + ssigpTa->SetBinContent(4361,0.128528); + ssigpTa->SetBinContent(4362,0.131406); + ssigpTa->SetBinContent(4363,0.134304); + ssigpTa->SetBinContent(4364,0.137238); + ssigpTa->SetBinContent(4365,0.140268); + ssigpTa->SetBinContent(4366,0.143526); + ssigpTa->SetBinContent(4367,0.146918); + ssigpTa->SetBinContent(4368,0.150391); + ssigpTa->SetBinContent(4369,0.153883); + ssigpTa->SetBinContent(4370,0.157424); + ssigpTa->SetBinContent(4371,0.161073); + ssigpTa->SetBinContent(4372,0.164791); + ssigpTa->SetBinContent(4373,0.16858); + ssigpTa->SetBinContent(4374,0.172418); + ssigpTa->SetBinContent(4375,0.176449); + ssigpTa->SetBinContent(4376,0.181259); + ssigpTa->SetBinContent(4377,0.187122); + ssigpTa->SetBinContent(4378,0.192396); + ssigpTa->SetBinContent(4379,0.19718); + ssigpTa->SetBinContent(4380,0.201913); + ssigpTa->SetBinContent(4381,0.206665); + ssigpTa->SetBinContent(4382,0.212544); + ssigpTa->SetBinContent(4385,0.03096); + ssigpTa->SetBinContent(4386,0.0303842); + ssigpTa->SetBinContent(4387,0.0300808); + ssigpTa->SetBinContent(4388,0.0300808); + ssigpTa->SetBinContent(4389,0.0300808); + ssigpTa->SetBinContent(4390,0.0300808); + ssigpTa->SetBinContent(4391,0.0300968); + ssigpTa->SetBinContent(4392,0.030124); + ssigpTa->SetBinContent(4393,0.0301752); + ssigpTa->SetBinContent(4394,0.0302024); + ssigpTa->SetBinContent(4395,0.0302104); + ssigpTa->SetBinContent(4396,0.0302144); + ssigpTa->SetBinContent(4397,0.0302176); + ssigpTa->SetBinContent(4398,0.0302176); + ssigpTa->SetBinContent(4399,0.0302176); + ssigpTa->SetBinContent(4400,0.0302176); + ssigpTa->SetBinContent(4401,0.0302176); + ssigpTa->SetBinContent(4402,0.0302176); + ssigpTa->SetBinContent(4403,0.0302176); + ssigpTa->SetBinContent(4404,0.0302176); + ssigpTa->SetBinContent(4405,0.0302176); + ssigpTa->SetBinContent(4406,0.0302176); + ssigpTa->SetBinContent(4407,0.0302176); + ssigpTa->SetBinContent(4408,0.0302176); + ssigpTa->SetBinContent(4409,0.0302248); + ssigpTa->SetBinContent(4410,0.0302392); + ssigpTa->SetBinContent(4411,0.0302544); + ssigpTa->SetBinContent(4412,0.0302744); + ssigpTa->SetBinContent(4413,0.0302824); + ssigpTa->SetBinContent(4414,0.0302864); + ssigpTa->SetBinContent(4415,0.0302864); + ssigpTa->SetBinContent(4416,0.0302864); + ssigpTa->SetBinContent(4417,0.0302864); + ssigpTa->SetBinContent(4418,0.0302968); + ssigpTa->SetBinContent(4419,0.030308); + ssigpTa->SetBinContent(4420,0.0303232); + ssigpTa->SetBinContent(4421,0.0303432); + ssigpTa->SetBinContent(4422,0.0303672); + ssigpTa->SetBinContent(4423,0.0303872); + ssigpTa->SetBinContent(4424,0.0304064); + ssigpTa->SetBinContent(4425,0.0304136); + ssigpTa->SetBinContent(4426,0.0304208); + ssigpTa->SetBinContent(4427,0.030432); + ssigpTa->SetBinContent(4428,0.03044); + ssigpTa->SetBinContent(4429,0.0304632); + ssigpTa->SetBinContent(4430,0.0304712); + ssigpTa->SetBinContent(4431,0.0304824); + ssigpTa->SetBinContent(4432,0.0305096); + ssigpTa->SetBinContent(4433,0.0305208); + ssigpTa->SetBinContent(4434,0.030532); + ssigpTa->SetBinContent(4435,0.030552); + ssigpTa->SetBinContent(4436,0.0305832); + ssigpTa->SetBinContent(4437,0.0306104); + ssigpTa->SetBinContent(4438,0.0306408); + ssigpTa->SetBinContent(4439,0.0306488); + ssigpTa->SetBinContent(4440,0.030676); + ssigpTa->SetBinContent(4441,0.0306912); + ssigpTa->SetBinContent(4442,0.0307056); + ssigpTa->SetBinContent(4443,0.0307096); + ssigpTa->SetBinContent(4444,0.0307248); + ssigpTa->SetBinContent(4445,0.0307552); + ssigpTa->SetBinContent(4446,0.0307864); + ssigpTa->SetBinContent(4447,0.0308064); + ssigpTa->SetBinContent(4448,0.0308536); + ssigpTa->SetBinContent(4449,0.030872); + ssigpTa->SetBinContent(4450,0.0308992); + ssigpTa->SetBinContent(4451,0.0309072); + ssigpTa->SetBinContent(4452,0.0309256); + ssigpTa->SetBinContent(4453,0.0309408); + ssigpTa->SetBinContent(4454,0.030984); + ssigpTa->SetBinContent(4455,0.0310224); + ssigpTa->SetBinContent(4456,0.0310576); + ssigpTa->SetBinContent(4457,0.031088); + ssigpTa->SetBinContent(4458,0.0311032); + ssigpTa->SetBinContent(4459,0.0311384); + ssigpTa->SetBinContent(4460,0.0311568); + ssigpTa->SetBinContent(4461,0.0312); + ssigpTa->SetBinContent(4462,0.0312384); + ssigpTa->SetBinContent(4463,0.0312736); + ssigpTa->SetBinContent(4464,0.0313008); + ssigpTa->SetBinContent(4465,0.0313232); + ssigpTa->SetBinContent(4466,0.0313496); + ssigpTa->SetBinContent(4467,0.031396); + ssigpTa->SetBinContent(4468,0.0314512); + ssigpTa->SetBinContent(4469,0.0314896); + ssigpTa->SetBinContent(4470,0.0315208); + ssigpTa->SetBinContent(4471,0.0315544); + ssigpTa->SetBinContent(4472,0.0316016); + ssigpTa->SetBinContent(4473,0.03164); + ssigpTa->SetBinContent(4474,0.0316752); + ssigpTa->SetBinContent(4475,0.0317296); + ssigpTa->SetBinContent(4476,0.03176); + ssigpTa->SetBinContent(4477,0.0318104); + ssigpTa->SetBinContent(4478,0.0318528); + ssigpTa->SetBinContent(4479,0.0318912); + ssigpTa->SetBinContent(4480,0.0319296); + ssigpTa->SetBinContent(4481,0.031972); + ssigpTa->SetBinContent(4482,0.0320536); + ssigpTa->SetBinContent(4483,0.0320928); + ssigpTa->SetBinContent(4484,0.0321384); + ssigpTa->SetBinContent(4485,0.0321848); + ssigpTa->SetBinContent(4486,0.0322464); + ssigpTa->SetBinContent(4487,0.032316); + ssigpTa->SetBinContent(4488,0.0323672); + ssigpTa->SetBinContent(4489,0.0324168); + ssigpTa->SetBinContent(4490,0.0331264); + ssigpTa->SetBinContent(4491,0.0382992); + ssigpTa->SetBinContent(4492,0.0492392); + ssigpTa->SetBinContent(4493,0.0544); + ssigpTa->SetBinContent(4494,0.0551216); + ssigpTa->SetBinContent(4495,0.05518); + ssigpTa->SetBinContent(4496,0.0552336); + ssigpTa->SetBinContent(4497,0.0552992); + ssigpTa->SetBinContent(4498,0.0553848); + ssigpTa->SetBinContent(4499,0.0554352); + ssigpTa->SetBinContent(4500,0.0554968); + ssigpTa->SetBinContent(4501,0.0549984); + ssigpTa->SetBinContent(4502,0.0506056); + ssigpTa->SetBinContent(4503,0.0412808); + ssigpTa->SetBinContent(4504,0.0375056); + ssigpTa->SetBinContent(4505,0.0378152); + ssigpTa->SetBinContent(4506,0.038756); + ssigpTa->SetBinContent(4507,0.0396696); + ssigpTa->SetBinContent(4508,0.0405952); + ssigpTa->SetBinContent(4509,0.0415168); + ssigpTa->SetBinContent(4510,0.0422384); + ssigpTa->SetBinContent(4511,0.0413576); + ssigpTa->SetBinContent(4512,0.03834); + ssigpTa->SetBinContent(4513,0.037424); + ssigpTa->SetBinContent(4514,0.0381272); + ssigpTa->SetBinContent(4515,0.0390104); + ssigpTa->SetBinContent(4516,0.0398576); + ssigpTa->SetBinContent(4517,0.040744); + ssigpTa->SetBinContent(4518,0.0416584); + ssigpTa->SetBinContent(4519,0.04258); + ssigpTa->SetBinContent(4520,0.043536); + ssigpTa->SetBinContent(4521,0.044248); + ssigpTa->SetBinContent(4522,0.0431488); + ssigpTa->SetBinContent(4523,0.0396216); + ssigpTa->SetBinContent(4524,0.0384096); + ssigpTa->SetBinContent(4525,0.0389808); + ssigpTa->SetBinContent(4526,0.0398392); + ssigpTa->SetBinContent(4527,0.0407136); + ssigpTa->SetBinContent(4528,0.0416352); + ssigpTa->SetBinContent(4529,0.042548); + ssigpTa->SetBinContent(4530,0.043504); + ssigpTa->SetBinContent(4531,0.044448); + ssigpTa->SetBinContent(4532,0.0451912); + ssigpTa->SetBinContent(4533,0.044016); + ssigpTa->SetBinContent(4534,0.040344); + ssigpTa->SetBinContent(4535,0.039032); + ssigpTa->SetBinContent(4536,0.0396344); + ssigpTa->SetBinContent(4537,0.040512); + ssigpTa->SetBinContent(4538,0.041396); + ssigpTa->SetBinContent(4539,0.0423088); + ssigpTa->SetBinContent(4540,0.043268); + ssigpTa->SetBinContent(4541,0.044252); + ssigpTa->SetBinContent(4542,0.0452352); + ssigpTa->SetBinContent(4543,0.0462304); + ssigpTa->SetBinContent(4544,0.0470032); + ssigpTa->SetBinContent(4545,0.0459472); + ssigpTa->SetBinContent(4546,0.0423808); + ssigpTa->SetBinContent(4547,0.0411784); + ssigpTa->SetBinContent(4548,0.0417368); + ssigpTa->SetBinContent(4549,0.042644); + ssigpTa->SetBinContent(4550,0.0434512); + ssigpTa->SetBinContent(4551,0.044336); + ssigpTa->SetBinContent(4552,0.0453032); + ssigpTa->SetBinContent(4553,0.0462624); + ssigpTa->SetBinContent(4554,0.0472576); + ssigpTa->SetBinContent(4555,0.0482632); + ssigpTa->SetBinContent(4556,0.0493128); + ssigpTa->SetBinContent(4557,0.0503768); + ssigpTa->SetBinContent(4558,0.0514216); + ssigpTa->SetBinContent(4559,0.0521424); + ssigpTa->SetBinContent(4560,0.0523456); + ssigpTa->SetBinContent(4561,0.0530496); + ssigpTa->SetBinContent(4562,0.054144); + ssigpTa->SetBinContent(4563,0.055344); + ssigpTa->SetBinContent(4564,0.0568032); + ssigpTa->SetBinContent(4565,0.0581048); + ssigpTa->SetBinContent(4566,0.05942); + ssigpTa->SetBinContent(4567,0.060736); + ssigpTa->SetBinContent(4568,0.0616664); + ssigpTa->SetBinContent(4569,0.0594976); + ssigpTa->SetBinContent(4570,0.0529528); + ssigpTa->SetBinContent(4571,0.0501328); + ssigpTa->SetBinContent(4572,0.050212); + ssigpTa->SetBinContent(4573,0.050844); + ssigpTa->SetBinContent(4574,0.0517984); + ssigpTa->SetBinContent(4575,0.0529048); + ssigpTa->SetBinContent(4576,0.0539928); + ssigpTa->SetBinContent(4577,0.0547576); + ssigpTa->SetBinContent(4578,0.0550488); + ssigpTa->SetBinContent(4579,0.0558424); + ssigpTa->SetBinContent(4580,0.0569824); + ssigpTa->SetBinContent(4581,0.058184); + ssigpTa->SetBinContent(4582,0.0594264); + ssigpTa->SetBinContent(4583,0.0607152); + ssigpTa->SetBinContent(4584,0.06202); + ssigpTa->SetBinContent(4585,0.0633648); + ssigpTa->SetBinContent(4586,0.0651824); + ssigpTa->SetBinContent(4587,0.0677304); + ssigpTa->SetBinContent(4588,0.0697192); + ssigpTa->SetBinContent(4589,0.0712384); + ssigpTa->SetBinContent(4590,0.0721896); + ssigpTa->SetBinContent(4591,0.0724048); + ssigpTa->SetBinContent(4592,0.0733912); + ssigpTa->SetBinContent(4593,0.074972); + ssigpTa->SetBinContent(4594,0.076624); + ssigpTa->SetBinContent(4595,0.0783032); + ssigpTa->SetBinContent(4596,0.0800664); + ssigpTa->SetBinContent(4597,0.082364); + ssigpTa->SetBinContent(4598,0.0853984); + ssigpTa->SetBinContent(4599,0.0878128); + ssigpTa->SetBinContent(4600,0.0898); + ssigpTa->SetBinContent(4601,0.0910552); + ssigpTa->SetBinContent(4602,0.0913696); + ssigpTa->SetBinContent(4603,0.0926216); + ssigpTa->SetBinContent(4604,0.0945608); + ssigpTa->SetBinContent(4605,0.0966464); + ssigpTa->SetBinContent(4606,0.0987904); + ssigpTa->SetBinContent(4607,0.101025); + ssigpTa->SetBinContent(4608,0.103262); + ssigpTa->SetBinContent(4609,0.105606); + ssigpTa->SetBinContent(4610,0.108194); + ssigpTa->SetBinContent(4611,0.11053); + ssigpTa->SetBinContent(4612,0.112106); + ssigpTa->SetBinContent(4613,0.112702); + ssigpTa->SetBinContent(4614,0.114396); + ssigpTa->SetBinContent(4615,0.116922); + ssigpTa->SetBinContent(4616,0.119576); + ssigpTa->SetBinContent(4617,0.122284); + ssigpTa->SetBinContent(4618,0.125024); + ssigpTa->SetBinContent(4619,0.127838); + ssigpTa->SetBinContent(4620,0.130651); + ssigpTa->SetBinContent(4621,0.133571); + ssigpTa->SetBinContent(4622,0.136167); + ssigpTa->SetBinContent(4623,0.137936); + ssigpTa->SetBinContent(4624,0.140479); + ssigpTa->SetBinContent(4625,0.143624); + ssigpTa->SetBinContent(4626,0.146899); + ssigpTa->SetBinContent(4627,0.150205); + ssigpTa->SetBinContent(4628,0.153589); + ssigpTa->SetBinContent(4629,0.157052); + ssigpTa->SetBinContent(4630,0.160671); + ssigpTa->SetBinContent(4631,0.164558); + ssigpTa->SetBinContent(4632,0.168788); + ssigpTa->SetBinContent(4633,0.17287); + ssigpTa->SetBinContent(4634,0.176987); + ssigpTa->SetBinContent(4635,0.181279); + ssigpTa->SetBinContent(4636,0.185533); + ssigpTa->SetBinContent(4637,0.189778); + ssigpTa->SetBinContent(4638,0.194042); + ssigpTa->SetBinContent(4639,0.198482); + ssigpTa->SetBinContent(4640,0.203208); + ssigpTa->SetBinContent(4641,0.208174); + ssigpTa->SetBinContent(4642,0.213232); + ssigpTa->SetBinContent(4643,0.218317); + ssigpTa->SetBinContent(4644,0.223479); + ssigpTa->SetBinContent(4645,0.228783); + ssigpTa->SetBinContent(4646,0.234215); + ssigpTa->SetBinContent(4647,0.239734); + ssigpTa->SetBinContent(4648,0.245326); + ssigpTa->SetBinContent(4649,0.251166); + ssigpTa->SetBinContent(4650,0.258366); + ssigpTa->SetBinContent(4651,0.267423); + ssigpTa->SetBinContent(4652,0.275315); + ssigpTa->SetBinContent(4653,0.282244); + ssigpTa->SetBinContent(4654,0.289138); + ssigpTa->SetBinContent(4655,0.298959); + ssigpTa->SetBinContent(4656,0.309827); + ssigpTa->SetBinContent(4659,0.0593206); + ssigpTa->SetBinContent(4660,0.0584904); + ssigpTa->SetBinContent(4661,0.0578388); + ssigpTa->SetBinContent(4662,0.0578388); + ssigpTa->SetBinContent(4663,0.0578388); + ssigpTa->SetBinContent(4664,0.0578468); + ssigpTa->SetBinContent(4665,0.0578628); + ssigpTa->SetBinContent(4666,0.0579428); + ssigpTa->SetBinContent(4667,0.0580104); + ssigpTa->SetBinContent(4668,0.0580664); + ssigpTa->SetBinContent(4669,0.0580744); + ssigpTa->SetBinContent(4670,0.0580744); + ssigpTa->SetBinContent(4671,0.0580744); + ssigpTa->SetBinContent(4672,0.0580744); + ssigpTa->SetBinContent(4673,0.0580744); + ssigpTa->SetBinContent(4674,0.0580744); + ssigpTa->SetBinContent(4675,0.0580744); + ssigpTa->SetBinContent(4676,0.0580744); + ssigpTa->SetBinContent(4677,0.0580744); + ssigpTa->SetBinContent(4678,0.0580744); + ssigpTa->SetBinContent(4679,0.0580744); + ssigpTa->SetBinContent(4680,0.0580744); + ssigpTa->SetBinContent(4681,0.0580744); + ssigpTa->SetBinContent(4682,0.0580744); + ssigpTa->SetBinContent(4683,0.0580744); + ssigpTa->SetBinContent(4684,0.058078); + ssigpTa->SetBinContent(4685,0.058086); + ssigpTa->SetBinContent(4686,0.058094); + ssigpTa->SetBinContent(4687,0.058102); + ssigpTa->SetBinContent(4688,0.058102); + ssigpTa->SetBinContent(4689,0.058102); + ssigpTa->SetBinContent(4690,0.058102); + ssigpTa->SetBinContent(4691,0.058102); + ssigpTa->SetBinContent(4692,0.058102); + ssigpTa->SetBinContent(4693,0.0581056); + ssigpTa->SetBinContent(4694,0.0581136); + ssigpTa->SetBinContent(4695,0.0581296); + ssigpTa->SetBinContent(4696,0.0581536); + ssigpTa->SetBinContent(4697,0.0581936); + ssigpTa->SetBinContent(4698,0.0582096); + ssigpTa->SetBinContent(4699,0.0582176); + ssigpTa->SetBinContent(4700,0.0582212); + ssigpTa->SetBinContent(4701,0.0582612); + ssigpTa->SetBinContent(4702,0.0582692); + ssigpTa->SetBinContent(4703,0.0582772); + ssigpTa->SetBinContent(4704,0.0582852); + ssigpTa->SetBinContent(4705,0.0583252); + ssigpTa->SetBinContent(4706,0.0583688); + ssigpTa->SetBinContent(4707,0.0584088); + ssigpTa->SetBinContent(4708,0.0584168); + ssigpTa->SetBinContent(4709,0.0584328); + ssigpTa->SetBinContent(4710,0.0584568); + ssigpTa->SetBinContent(4711,0.0585004); + ssigpTa->SetBinContent(4712,0.0585164); + ssigpTa->SetBinContent(4713,0.0585324); + ssigpTa->SetBinContent(4714,0.0585404); + ssigpTa->SetBinContent(4715,0.058552); + ssigpTa->SetBinContent(4716,0.058552); + ssigpTa->SetBinContent(4717,0.058552); + ssigpTa->SetBinContent(4718,0.05856); + ssigpTa->SetBinContent(4719,0.0585796); + ssigpTa->SetBinContent(4720,0.0586436); + ssigpTa->SetBinContent(4721,0.0587236); + ssigpTa->SetBinContent(4722,0.0587796); + ssigpTa->SetBinContent(4723,0.0588392); + ssigpTa->SetBinContent(4724,0.0588472); + ssigpTa->SetBinContent(4725,0.0588552); + ssigpTa->SetBinContent(4726,0.0588552); + ssigpTa->SetBinContent(4727,0.0588748); + ssigpTa->SetBinContent(4728,0.0588988); + ssigpTa->SetBinContent(4729,0.0589468); + ssigpTa->SetBinContent(4730,0.0589744); + ssigpTa->SetBinContent(4731,0.0589904); + ssigpTa->SetBinContent(4732,0.0590384); + ssigpTa->SetBinContent(4733,0.059122); + ssigpTa->SetBinContent(4734,0.059178); + ssigpTa->SetBinContent(4735,0.059202); + ssigpTa->SetBinContent(4736,0.0592536); + ssigpTa->SetBinContent(4737,0.0592776); + ssigpTa->SetBinContent(4738,0.0592936); + ssigpTa->SetBinContent(4739,0.0593052); + ssigpTa->SetBinContent(4740,0.0593212); + ssigpTa->SetBinContent(4741,0.0593888); + ssigpTa->SetBinContent(4742,0.0595168); + ssigpTa->SetBinContent(4743,0.0595808); + ssigpTa->SetBinContent(4744,0.0596004); + ssigpTa->SetBinContent(4745,0.0596244); + ssigpTa->SetBinContent(4746,0.059652); + ssigpTa->SetBinContent(4747,0.0597); + ssigpTa->SetBinContent(4748,0.059764); + ssigpTa->SetBinContent(4749,0.0598236); + ssigpTa->SetBinContent(4750,0.0599276); + ssigpTa->SetBinContent(4751,0.0599552); + ssigpTa->SetBinContent(4752,0.0600032); + ssigpTa->SetBinContent(4753,0.0600308); + ssigpTa->SetBinContent(4754,0.0600548); + ssigpTa->SetBinContent(4755,0.0601304); + ssigpTa->SetBinContent(4756,0.0602584); + ssigpTa->SetBinContent(4757,0.060334); + ssigpTa->SetBinContent(4758,0.060358); + ssigpTa->SetBinContent(4759,0.0603936); + ssigpTa->SetBinContent(4760,0.0604852); + ssigpTa->SetBinContent(4761,0.0605652); + ssigpTa->SetBinContent(4762,0.0606808); + ssigpTa->SetBinContent(4763,0.0607368); + ssigpTa->SetBinContent(4764,0.0621324); + ssigpTa->SetBinContent(4765,0.072792); + ssigpTa->SetBinContent(4766,0.0946872); + ssigpTa->SetBinContent(4767,0.105343); + ssigpTa->SetBinContent(4768,0.106787); + ssigpTa->SetBinContent(4769,0.106878); + ssigpTa->SetBinContent(4770,0.106918); + ssigpTa->SetBinContent(4771,0.107002); + ssigpTa->SetBinContent(4772,0.107142); + ssigpTa->SetBinContent(4773,0.107222); + ssigpTa->SetBinContent(4774,0.107297); + ssigpTa->SetBinContent(4775,0.106237); + ssigpTa->SetBinContent(4776,0.0970528); + ssigpTa->SetBinContent(4777,0.0783532); + ssigpTa->SetBinContent(4778,0.0703144); + ssigpTa->SetBinContent(4779,0.0709556); + ssigpTa->SetBinContent(4780,0.0727168); + ssigpTa->SetBinContent(4781,0.074574); + ssigpTa->SetBinContent(4782,0.0763512); + ssigpTa->SetBinContent(4783,0.0782004); + ssigpTa->SetBinContent(4784,0.0796016); + ssigpTa->SetBinContent(4785,0.0776108); + ssigpTa->SetBinContent(4786,0.0715312); + ssigpTa->SetBinContent(4787,0.0695164); + ssigpTa->SetBinContent(4788,0.0709976); + ssigpTa->SetBinContent(4789,0.0727712); + ssigpTa->SetBinContent(4790,0.0744604); + ssigpTa->SetBinContent(4791,0.076186); + ssigpTa->SetBinContent(4792,0.0779552); + ssigpTa->SetBinContent(4793,0.0797964); + ssigpTa->SetBinContent(4794,0.0816296); + ssigpTa->SetBinContent(4795,0.0830264); + ssigpTa->SetBinContent(4796,0.0806712); + ssigpTa->SetBinContent(4797,0.0735992); + ssigpTa->SetBinContent(4798,0.0709648); + ssigpTa->SetBinContent(4799,0.072062); + ssigpTa->SetBinContent(4800,0.0736916); + ssigpTa->SetBinContent(4801,0.0754128); + ssigpTa->SetBinContent(4802,0.07715); + ssigpTa->SetBinContent(4803,0.0789592); + ssigpTa->SetBinContent(4804,0.080764); + ssigpTa->SetBinContent(4805,0.0826132); + ssigpTa->SetBinContent(4806,0.083946); + ssigpTa->SetBinContent(4807,0.0813908); + ssigpTa->SetBinContent(4808,0.0737268); + ssigpTa->SetBinContent(4809,0.0708604); + ssigpTa->SetBinContent(4810,0.0719256); + ssigpTa->SetBinContent(4811,0.0735588); + ssigpTa->SetBinContent(4812,0.07524); + ssigpTa->SetBinContent(4813,0.0769488); + ssigpTa->SetBinContent(4814,0.078782); + ssigpTa->SetBinContent(4815,0.0806028); + ssigpTa->SetBinContent(4816,0.0825); + ssigpTa->SetBinContent(4817,0.0844088); + ssigpTa->SetBinContent(4818,0.0858296); + ssigpTa->SetBinContent(4819,0.083174); + ssigpTa->SetBinContent(4820,0.075528); + ssigpTa->SetBinContent(4821,0.0727132); + ssigpTa->SetBinContent(4822,0.07455); + ssigpTa->SetBinContent(4823,0.0777344); + ssigpTa->SetBinContent(4824,0.0801356); + ssigpTa->SetBinContent(4825,0.0819608); + ssigpTa->SetBinContent(4826,0.0837896); + ssigpTa->SetBinContent(4827,0.0856104); + ssigpTa->SetBinContent(4828,0.0874596); + ssigpTa->SetBinContent(4829,0.0893364); + ssigpTa->SetBinContent(4830,0.0912728); + ssigpTa->SetBinContent(4831,0.0932776); + ssigpTa->SetBinContent(4832,0.095182); + ssigpTa->SetBinContent(4833,0.0961068); + ssigpTa->SetBinContent(4834,0.0957816); + ssigpTa->SetBinContent(4835,0.09671); + ssigpTa->SetBinContent(4836,0.0987424); + ssigpTa->SetBinContent(4837,0.101567); + ssigpTa->SetBinContent(4838,0.10509); + ssigpTa->SetBinContent(4839,0.108166); + ssigpTa->SetBinContent(4840,0.110746); + ssigpTa->SetBinContent(4841,0.113342); + ssigpTa->SetBinContent(4842,0.114986); + ssigpTa->SetBinContent(4843,0.109569); + ssigpTa->SetBinContent(4844,0.0953252); + ssigpTa->SetBinContent(4845,0.0898936); + ssigpTa->SetBinContent(4846,0.0921048); + ssigpTa->SetBinContent(4847,0.0946536); + ssigpTa->SetBinContent(4848,0.0968308); + ssigpTa->SetBinContent(4849,0.0990312); + ssigpTa->SetBinContent(4850,0.101116); + ssigpTa->SetBinContent(4851,0.102252); + ssigpTa->SetBinContent(4852,0.102239); + ssigpTa->SetBinContent(4853,0.103436); + ssigpTa->SetBinContent(4854,0.10562); + ssigpTa->SetBinContent(4855,0.108013); + ssigpTa->SetBinContent(4856,0.110465); + ssigpTa->SetBinContent(4857,0.113025); + ssigpTa->SetBinContent(4858,0.115589); + ssigpTa->SetBinContent(4859,0.118329); + ssigpTa->SetBinContent(4860,0.12241); + ssigpTa->SetBinContent(4861,0.128158); + ssigpTa->SetBinContent(4862,0.132553); + ssigpTa->SetBinContent(4863,0.135553); + ssigpTa->SetBinContent(4864,0.136932); + ssigpTa->SetBinContent(4865,0.13648); + ssigpTa->SetBinContent(4866,0.137931); + ssigpTa->SetBinContent(4867,0.140934); + ssigpTa->SetBinContent(4868,0.144205); + ssigpTa->SetBinContent(4869,0.147496); + ssigpTa->SetBinContent(4870,0.151063); + ssigpTa->SetBinContent(4871,0.156006); + ssigpTa->SetBinContent(4872,0.162636); + ssigpTa->SetBinContent(4873,0.167894); + ssigpTa->SetBinContent(4874,0.171708); + ssigpTa->SetBinContent(4875,0.173678); + ssigpTa->SetBinContent(4876,0.17331); + ssigpTa->SetBinContent(4877,0.17518); + ssigpTa->SetBinContent(4878,0.178914); + ssigpTa->SetBinContent(4879,0.182996); + ssigpTa->SetBinContent(4880,0.187245); + ssigpTa->SetBinContent(4881,0.191626); + ssigpTa->SetBinContent(4882,0.196232); + ssigpTa->SetBinContent(4883,0.201749); + ssigpTa->SetBinContent(4884,0.208476); + ssigpTa->SetBinContent(4885,0.213949); + ssigpTa->SetBinContent(4886,0.216718); + ssigpTa->SetBinContent(4887,0.217017); + ssigpTa->SetBinContent(4888,0.219838); + ssigpTa->SetBinContent(4889,0.224794); + ssigpTa->SetBinContent(4890,0.23017); + ssigpTa->SetBinContent(4891,0.235558); + ssigpTa->SetBinContent(4892,0.241146); + ssigpTa->SetBinContent(4893,0.24673); + ssigpTa->SetBinContent(4894,0.25243); + ssigpTa->SetBinContent(4895,0.258401); + ssigpTa->SetBinContent(4896,0.263376); + ssigpTa->SetBinContent(4897,0.266252); + ssigpTa->SetBinContent(4898,0.270894); + ssigpTa->SetBinContent(4899,0.277169); + ssigpTa->SetBinContent(4900,0.283728); + ssigpTa->SetBinContent(4901,0.290402); + ssigpTa->SetBinContent(4902,0.297156); + ssigpTa->SetBinContent(4903,0.304126); + ssigpTa->SetBinContent(4904,0.311443); + ssigpTa->SetBinContent(4905,0.319464); + ssigpTa->SetBinContent(4906,0.328288); + ssigpTa->SetBinContent(4907,0.336753); + ssigpTa->SetBinContent(4908,0.345197); + ssigpTa->SetBinContent(4909,0.354033); + ssigpTa->SetBinContent(4910,0.362688); + ssigpTa->SetBinContent(4911,0.371256); + ssigpTa->SetBinContent(4912,0.37984); + ssigpTa->SetBinContent(4913,0.388775); + ssigpTa->SetBinContent(4914,0.398289); + ssigpTa->SetBinContent(4915,0.408226); + ssigpTa->SetBinContent(4916,0.418371); + ssigpTa->SetBinContent(4917,0.428592); + ssigpTa->SetBinContent(4918,0.43895); + ssigpTa->SetBinContent(4919,0.44963); + ssigpTa->SetBinContent(4920,0.46057); + ssigpTa->SetBinContent(4921,0.471702); + ssigpTa->SetBinContent(4922,0.482913); + ssigpTa->SetBinContent(4923,0.494733); + ssigpTa->SetBinContent(4924,0.509616); + ssigpTa->SetBinContent(4925,0.528387); + ssigpTa->SetBinContent(4926,0.54458); + ssigpTa->SetBinContent(4927,0.558592); + ssigpTa->SetBinContent(4928,0.57246); + ssigpTa->SetBinContent(4929,0.592432); + ssigpTa->SetBinContent(4930,0.610786); + ssigpTa->SetBinContent(4933,0.182311); + ssigpTa->SetBinContent(4934,0.166); + ssigpTa->SetBinContent(4935,0.16348); + ssigpTa->SetBinContent(4936,0.16348); + ssigpTa->SetBinContent(4937,0.16348); + ssigpTa->SetBinContent(4938,0.16348); + ssigpTa->SetBinContent(4939,0.163516); + ssigpTa->SetBinContent(4940,0.163572); + ssigpTa->SetBinContent(4941,0.163688); + ssigpTa->SetBinContent(4942,0.163732); + ssigpTa->SetBinContent(4943,0.163752); + ssigpTa->SetBinContent(4944,0.163752); + ssigpTa->SetBinContent(4945,0.163752); + ssigpTa->SetBinContent(4946,0.163752); + ssigpTa->SetBinContent(4947,0.163752); + ssigpTa->SetBinContent(4948,0.163752); + ssigpTa->SetBinContent(4949,0.163752); + ssigpTa->SetBinContent(4950,0.163752); + ssigpTa->SetBinContent(4951,0.163752); + ssigpTa->SetBinContent(4952,0.163752); + ssigpTa->SetBinContent(4953,0.163752); + ssigpTa->SetBinContent(4954,0.163752); + ssigpTa->SetBinContent(4955,0.163752); + ssigpTa->SetBinContent(4956,0.163752); + ssigpTa->SetBinContent(4957,0.163752); + ssigpTa->SetBinContent(4958,0.163752); + ssigpTa->SetBinContent(4959,0.163752); + ssigpTa->SetBinContent(4960,0.163756); + ssigpTa->SetBinContent(4961,0.163756); + ssigpTa->SetBinContent(4962,0.163756); + ssigpTa->SetBinContent(4963,0.163756); + ssigpTa->SetBinContent(4964,0.163756); + ssigpTa->SetBinContent(4965,0.163756); + ssigpTa->SetBinContent(4966,0.163756); + ssigpTa->SetBinContent(4967,0.163756); + ssigpTa->SetBinContent(4968,0.163756); + ssigpTa->SetBinContent(4969,0.16376); + ssigpTa->SetBinContent(4970,0.163776); + ssigpTa->SetBinContent(4971,0.163792); + ssigpTa->SetBinContent(4972,0.163808); + ssigpTa->SetBinContent(4973,0.163808); + ssigpTa->SetBinContent(4974,0.163888); + ssigpTa->SetBinContent(4975,0.163968); + ssigpTa->SetBinContent(4976,0.164048); + ssigpTa->SetBinContent(4977,0.164052); + ssigpTa->SetBinContent(4978,0.164072); + ssigpTa->SetBinContent(4979,0.164112); + ssigpTa->SetBinContent(4980,0.164212); + ssigpTa->SetBinContent(4981,0.164532); + ssigpTa->SetBinContent(4982,0.164552); + ssigpTa->SetBinContent(4983,0.164556); + ssigpTa->SetBinContent(4984,0.164572); + ssigpTa->SetBinContent(4985,0.164588); + ssigpTa->SetBinContent(4986,0.164604); + ssigpTa->SetBinContent(4987,0.164604); + ssigpTa->SetBinContent(4988,0.164608); + ssigpTa->SetBinContent(4989,0.164608); + ssigpTa->SetBinContent(4990,0.164608); + ssigpTa->SetBinContent(4991,0.164608); + ssigpTa->SetBinContent(4992,0.164608); + ssigpTa->SetBinContent(4993,0.164692); + ssigpTa->SetBinContent(4994,0.164808); + ssigpTa->SetBinContent(4995,0.164944); + ssigpTa->SetBinContent(4996,0.16506); + ssigpTa->SetBinContent(4997,0.1651); + ssigpTa->SetBinContent(4998,0.165124); + ssigpTa->SetBinContent(4999,0.165404); + ssigpTa->SetBinContent(5000,0.165404); + ssigpTa->SetBinContent(5001,0.165404); + ssigpTa->SetBinContent(5002,0.165424); + ssigpTa->SetBinContent(5003,0.16544); + ssigpTa->SetBinContent(5004,0.165456); + ssigpTa->SetBinContent(5005,0.16548); + ssigpTa->SetBinContent(5006,0.1656); + ssigpTa->SetBinContent(5007,0.16578); + ssigpTa->SetBinContent(5008,0.1659); + ssigpTa->SetBinContent(5009,0.16594); + ssigpTa->SetBinContent(5010,0.166236); + ssigpTa->SetBinContent(5011,0.166252); + ssigpTa->SetBinContent(5012,0.166256); + ssigpTa->SetBinContent(5013,0.166256); + ssigpTa->SetBinContent(5014,0.166276); + ssigpTa->SetBinContent(5015,0.166416); + ssigpTa->SetBinContent(5016,0.166612); + ssigpTa->SetBinContent(5017,0.166748); + ssigpTa->SetBinContent(5018,0.166772); + ssigpTa->SetBinContent(5019,0.167052); + ssigpTa->SetBinContent(5020,0.167072); + ssigpTa->SetBinContent(5021,0.167108); + ssigpTa->SetBinContent(5022,0.167164); + ssigpTa->SetBinContent(5023,0.167348); + ssigpTa->SetBinContent(5024,0.167468); + ssigpTa->SetBinContent(5025,0.167588); + ssigpTa->SetBinContent(5026,0.167604); + ssigpTa->SetBinContent(5027,0.1679); + ssigpTa->SetBinContent(5028,0.167924); + ssigpTa->SetBinContent(5029,0.16806); + ssigpTa->SetBinContent(5030,0.16826); + ssigpTa->SetBinContent(5031,0.168396); + ssigpTa->SetBinContent(5032,0.16842); + ssigpTa->SetBinContent(5033,0.168736); + ssigpTa->SetBinContent(5034,0.168796); + ssigpTa->SetBinContent(5035,0.168992); + ssigpTa->SetBinContent(5036,0.169132); + ssigpTa->SetBinContent(5037,0.169268); + ssigpTa->SetBinContent(5038,0.172928); + ssigpTa->SetBinContent(5039,0.195684); + ssigpTa->SetBinContent(5040,0.275772); + ssigpTa->SetBinContent(5041,0.298572); + ssigpTa->SetBinContent(5042,0.302088); + ssigpTa->SetBinContent(5043,0.302228); + ssigpTa->SetBinContent(5044,0.302564); + ssigpTa->SetBinContent(5045,0.302704); + ssigpTa->SetBinContent(5046,0.302904); + ssigpTa->SetBinContent(5047,0.30334); + ssigpTa->SetBinContent(5048,0.30342); + ssigpTa->SetBinContent(5049,0.300676); + ssigpTa->SetBinContent(5050,0.280996); + ssigpTa->SetBinContent(5051,0.211844); + ssigpTa->SetBinContent(5052,0.19592); + ssigpTa->SetBinContent(5053,0.197792); + ssigpTa->SetBinContent(5054,0.20316); + ssigpTa->SetBinContent(5055,0.208108); + ssigpTa->SetBinContent(5056,0.213472); + ssigpTa->SetBinContent(5057,0.2188); + ssigpTa->SetBinContent(5058,0.222712); + ssigpTa->SetBinContent(5059,0.219856); + ssigpTa->SetBinContent(5060,0.195948); + ssigpTa->SetBinContent(5061,0.192932); + ssigpTa->SetBinContent(5062,0.19752); + ssigpTa->SetBinContent(5063,0.202624); + ssigpTa->SetBinContent(5064,0.207436); + ssigpTa->SetBinContent(5065,0.212248); + ssigpTa->SetBinContent(5066,0.2175); + ssigpTa->SetBinContent(5067,0.222468); + ssigpTa->SetBinContent(5068,0.227876); + ssigpTa->SetBinContent(5069,0.23204); + ssigpTa->SetBinContent(5070,0.228336); + ssigpTa->SetBinContent(5071,0.201084); + ssigpTa->SetBinContent(5072,0.19636); + ssigpTa->SetBinContent(5073,0.199676); + ssigpTa->SetBinContent(5074,0.204408); + ssigpTa->SetBinContent(5075,0.209184); + ssigpTa->SetBinContent(5076,0.214076); + ssigpTa->SetBinContent(5077,0.219008); + ssigpTa->SetBinContent(5078,0.224296); + ssigpTa->SetBinContent(5079,0.229624); + ssigpTa->SetBinContent(5080,0.233708); + ssigpTa->SetBinContent(5081,0.229336); + ssigpTa->SetBinContent(5082,0.1998); + ssigpTa->SetBinContent(5083,0.194376); + ssigpTa->SetBinContent(5084,0.197592); + ssigpTa->SetBinContent(5085,0.202248); + ssigpTa->SetBinContent(5086,0.20664); + ssigpTa->SetBinContent(5087,0.211792); + ssigpTa->SetBinContent(5088,0.216704); + ssigpTa->SetBinContent(5089,0.221788); + ssigpTa->SetBinContent(5090,0.227136); + ssigpTa->SetBinContent(5091,0.23266); + ssigpTa->SetBinContent(5092,0.236728); + ssigpTa->SetBinContent(5093,0.23222); + ssigpTa->SetBinContent(5094,0.20176); + ssigpTa->SetBinContent(5095,0.196892); + ssigpTa->SetBinContent(5096,0.202312); + ssigpTa->SetBinContent(5097,0.215176); + ssigpTa->SetBinContent(5098,0.222096); + ssigpTa->SetBinContent(5099,0.227324); + ssigpTa->SetBinContent(5100,0.2323); + ssigpTa->SetBinContent(5101,0.237328); + ssigpTa->SetBinContent(5102,0.24262); + ssigpTa->SetBinContent(5103,0.247688); + ssigpTa->SetBinContent(5104,0.253132); + ssigpTa->SetBinContent(5105,0.258696); + ssigpTa->SetBinContent(5106,0.263916); + ssigpTa->SetBinContent(5107,0.267192); + ssigpTa->SetBinContent(5108,0.263048); + ssigpTa->SetBinContent(5109,0.26608); + ssigpTa->SetBinContent(5110,0.272084); + ssigpTa->SetBinContent(5111,0.279912); + ssigpTa->SetBinContent(5112,0.2921); + ssigpTa->SetBinContent(5113,0.300616); + ssigpTa->SetBinContent(5114,0.308064); + ssigpTa->SetBinContent(5115,0.315612); + ssigpTa->SetBinContent(5116,0.320376); + ssigpTa->SetBinContent(5117,0.31016); + ssigpTa->SetBinContent(5118,0.254048); + ssigpTa->SetBinContent(5119,0.243904); + ssigpTa->SetBinContent(5120,0.25528); + ssigpTa->SetBinContent(5121,0.263444); + ssigpTa->SetBinContent(5122,0.26968); + ssigpTa->SetBinContent(5123,0.276); + ssigpTa->SetBinContent(5124,0.281956); + ssigpTa->SetBinContent(5125,0.285756); + ssigpTa->SetBinContent(5126,0.283088); + ssigpTa->SetBinContent(5127,0.286948); + ssigpTa->SetBinContent(5128,0.29312); + ssigpTa->SetBinContent(5129,0.300032); + ssigpTa->SetBinContent(5130,0.30714); + ssigpTa->SetBinContent(5131,0.314308); + ssigpTa->SetBinContent(5132,0.321552); + ssigpTa->SetBinContent(5133,0.32934); + ssigpTa->SetBinContent(5134,0.34038); + ssigpTa->SetBinContent(5135,0.360276); + ssigpTa->SetBinContent(5136,0.372152); + ssigpTa->SetBinContent(5137,0.380764); + ssigpTa->SetBinContent(5138,0.385516); + ssigpTa->SetBinContent(5139,0.38038); + ssigpTa->SetBinContent(5140,0.385268); + ssigpTa->SetBinContent(5141,0.393716); + ssigpTa->SetBinContent(5142,0.403104); + ssigpTa->SetBinContent(5143,0.412588); + ssigpTa->SetBinContent(5144,0.422652); + ssigpTa->SetBinContent(5145,0.435784); + ssigpTa->SetBinContent(5146,0.4583); + ssigpTa->SetBinContent(5147,0.472244); + ssigpTa->SetBinContent(5148,0.483272); + ssigpTa->SetBinContent(5149,0.489984); + ssigpTa->SetBinContent(5150,0.484164); + ssigpTa->SetBinContent(5151,0.490516); + ssigpTa->SetBinContent(5152,0.501064); + ssigpTa->SetBinContent(5153,0.512824); + ssigpTa->SetBinContent(5154,0.524844); + ssigpTa->SetBinContent(5155,0.5374); + ssigpTa->SetBinContent(5156,0.550532); + ssigpTa->SetBinContent(5157,0.566168); + ssigpTa->SetBinContent(5158,0.589644); + ssigpTa->SetBinContent(5159,0.605276); + ssigpTa->SetBinContent(5160,0.614672); + ssigpTa->SetBinContent(5161,0.61046); + ssigpTa->SetBinContent(5162,0.619712); + ssigpTa->SetBinContent(5163,0.63398); + ssigpTa->SetBinContent(5164,0.649504); + ssigpTa->SetBinContent(5165,0.664964); + ssigpTa->SetBinContent(5166,0.681084); + ssigpTa->SetBinContent(5167,0.697124); + ssigpTa->SetBinContent(5168,0.713676); + ssigpTa->SetBinContent(5169,0.730628); + ssigpTa->SetBinContent(5170,0.746764); + ssigpTa->SetBinContent(5171,0.75058); + ssigpTa->SetBinContent(5172,0.76482); + ssigpTa->SetBinContent(5173,0.782968); + ssigpTa->SetBinContent(5174,0.801936); + ssigpTa->SetBinContent(5175,0.820984); + ssigpTa->SetBinContent(5176,0.840272); + ssigpTa->SetBinContent(5177,0.860228); + ssigpTa->SetBinContent(5178,0.88142); + ssigpTa->SetBinContent(5179,0.904208); + ssigpTa->SetBinContent(5180,0.931004); + ssigpTa->SetBinContent(5181,0.954904); + ssigpTa->SetBinContent(5182,0.979212); + ssigpTa->SetBinContent(5183,1.00532); + ssigpTa->SetBinContent(5184,1.03028); + ssigpTa->SetBinContent(5185,1.05481); + ssigpTa->SetBinContent(5186,1.07954); + ssigpTa->SetBinContent(5187,1.10484); + ssigpTa->SetBinContent(5188,1.13225); + ssigpTa->SetBinContent(5189,1.16072); + ssigpTa->SetBinContent(5190,1.18987); + ssigpTa->SetBinContent(5191,1.21919); + ssigpTa->SetBinContent(5192,1.24911); + ssigpTa->SetBinContent(5193,1.27956); + ssigpTa->SetBinContent(5194,1.31114); + ssigpTa->SetBinContent(5195,1.34324); + ssigpTa->SetBinContent(5196,1.37532); + ssigpTa->SetBinContent(5197,1.40902); + ssigpTa->SetBinContent(5198,1.44986); + ssigpTa->SetBinContent(5199,1.50948); + ssigpTa->SetBinContent(5200,1.55407); + ssigpTa->SetBinContent(5201,1.59428); + ssigpTa->SetBinContent(5202,1.63405); + ssigpTa->SetBinContent(5203,1.69819); + ssigpTa->SetBinContent(5204,1.90111); + ssigpTa->SetBinContent(5207,0.462953); + ssigpTa->SetBinContent(5208,0.494443); + ssigpTa->SetBinContent(5209,0.482425); + ssigpTa->SetBinContent(5210,0.482425); + ssigpTa->SetBinContent(5211,0.482425); + ssigpTa->SetBinContent(5212,0.482425); + ssigpTa->SetBinContent(5213,0.482425); + ssigpTa->SetBinContent(5214,0.482475); + ssigpTa->SetBinContent(5215,0.482517); + ssigpTa->SetBinContent(5216,0.482558); + ssigpTa->SetBinContent(5217,0.482558); + ssigpTa->SetBinContent(5218,0.482558); + ssigpTa->SetBinContent(5219,0.482558); + ssigpTa->SetBinContent(5220,0.482558); + ssigpTa->SetBinContent(5221,0.482558); + ssigpTa->SetBinContent(5222,0.482558); + ssigpTa->SetBinContent(5223,0.482558); + ssigpTa->SetBinContent(5224,0.482558); + ssigpTa->SetBinContent(5225,0.482558); + ssigpTa->SetBinContent(5226,0.482558); + ssigpTa->SetBinContent(5227,0.482558); + ssigpTa->SetBinContent(5228,0.482558); + ssigpTa->SetBinContent(5229,0.482558); + ssigpTa->SetBinContent(5230,0.482558); + ssigpTa->SetBinContent(5231,0.482558); + ssigpTa->SetBinContent(5232,0.482558); + ssigpTa->SetBinContent(5233,0.482558); + ssigpTa->SetBinContent(5234,0.482558); + ssigpTa->SetBinContent(5235,0.482558); + ssigpTa->SetBinContent(5236,0.482558); + ssigpTa->SetBinContent(5237,0.482558); + ssigpTa->SetBinContent(5238,0.482558); + ssigpTa->SetBinContent(5239,0.482558); + ssigpTa->SetBinContent(5240,0.482558); + ssigpTa->SetBinContent(5241,0.482558); + ssigpTa->SetBinContent(5242,0.482558); + ssigpTa->SetBinContent(5243,0.482558); + ssigpTa->SetBinContent(5244,0.482558); + ssigpTa->SetBinContent(5245,0.482567); + ssigpTa->SetBinContent(5246,0.482567); + ssigpTa->SetBinContent(5247,0.482608); + ssigpTa->SetBinContent(5248,0.482692); + ssigpTa->SetBinContent(5249,0.4829); + ssigpTa->SetBinContent(5250,0.482983); + ssigpTa->SetBinContent(5251,0.483025); + ssigpTa->SetBinContent(5252,0.483025); + ssigpTa->SetBinContent(5253,0.483067); + ssigpTa->SetBinContent(5254,0.483692); + ssigpTa->SetBinContent(5255,0.484317); + ssigpTa->SetBinContent(5256,0.4849); + ssigpTa->SetBinContent(5257,0.4849); + ssigpTa->SetBinContent(5258,0.4849); + ssigpTa->SetBinContent(5259,0.484908); + ssigpTa->SetBinContent(5260,0.484908); + ssigpTa->SetBinContent(5261,0.484908); + ssigpTa->SetBinContent(5262,0.484908); + ssigpTa->SetBinContent(5263,0.484908); + ssigpTa->SetBinContent(5264,0.484908); + ssigpTa->SetBinContent(5265,0.484908); + ssigpTa->SetBinContent(5266,0.48495); + ssigpTa->SetBinContent(5267,0.485033); + ssigpTa->SetBinContent(5268,0.485242); + ssigpTa->SetBinContent(5269,0.485375); + ssigpTa->SetBinContent(5270,0.485458); + ssigpTa->SetBinContent(5271,0.4855); + ssigpTa->SetBinContent(5272,0.486083); + ssigpTa->SetBinContent(5273,0.486667); + ssigpTa->SetBinContent(5274,0.48725); + ssigpTa->SetBinContent(5275,0.48725); + ssigpTa->SetBinContent(5276,0.48725); + ssigpTa->SetBinContent(5277,0.487258); + ssigpTa->SetBinContent(5278,0.487258); + ssigpTa->SetBinContent(5279,0.4873); + ssigpTa->SetBinContent(5280,0.487425); + ssigpTa->SetBinContent(5281,0.487675); + ssigpTa->SetBinContent(5282,0.4878); + ssigpTa->SetBinContent(5283,0.488425); + ssigpTa->SetBinContent(5284,0.489017); + ssigpTa->SetBinContent(5285,0.4896); + ssigpTa->SetBinContent(5286,0.4896); + ssigpTa->SetBinContent(5287,0.4896); + ssigpTa->SetBinContent(5288,0.489642); + ssigpTa->SetBinContent(5289,0.489767); + ssigpTa->SetBinContent(5290,0.490025); + ssigpTa->SetBinContent(5291,0.49015); + ssigpTa->SetBinContent(5292,0.490775); + ssigpTa->SetBinContent(5293,0.491358); + ssigpTa->SetBinContent(5294,0.491942); + ssigpTa->SetBinContent(5295,0.49195); + ssigpTa->SetBinContent(5296,0.492033); + ssigpTa->SetBinContent(5297,0.492158); + ssigpTa->SetBinContent(5298,0.492408); + ssigpTa->SetBinContent(5299,0.492492); + ssigpTa->SetBinContent(5300,0.493125); + ssigpTa->SetBinContent(5301,0.493708); + ssigpTa->SetBinContent(5302,0.494333); + ssigpTa->SetBinContent(5303,0.494458); + ssigpTa->SetBinContent(5304,0.494717); + ssigpTa->SetBinContent(5305,0.494842); + ssigpTa->SetBinContent(5306,0.495467); + ssigpTa->SetBinContent(5307,0.49605); + ssigpTa->SetBinContent(5308,0.496725); + ssigpTa->SetBinContent(5309,0.49685); + ssigpTa->SetBinContent(5310,0.4971); + ssigpTa->SetBinContent(5311,0.497775); + ssigpTa->SetBinContent(5312,0.5054); + ssigpTa->SetBinContent(5313,0.624275); + ssigpTa->SetBinContent(5314,0.764867); + ssigpTa->SetBinContent(5315,0.883242); + ssigpTa->SetBinContent(5316,0.89045); + ssigpTa->SetBinContent(5317,0.891167); + ssigpTa->SetBinContent(5318,0.891833); + ssigpTa->SetBinContent(5319,0.892542); + ssigpTa->SetBinContent(5320,0.893383); + ssigpTa->SetBinContent(5321,0.894092); + ssigpTa->SetBinContent(5322,0.8948); + ssigpTa->SetBinContent(5323,0.888808); + ssigpTa->SetBinContent(5324,0.785767); + ssigpTa->SetBinContent(5325,0.667308); + ssigpTa->SetBinContent(5326,0.573483); + ssigpTa->SetBinContent(5327,0.582083); + ssigpTa->SetBinContent(5328,0.596925); + ssigpTa->SetBinContent(5329,0.612525); + ssigpTa->SetBinContent(5330,0.628); + ssigpTa->SetBinContent(5331,0.643633); + ssigpTa->SetBinContent(5332,0.656733); + ssigpTa->SetBinContent(5333,0.629083); + ssigpTa->SetBinContent(5334,0.593433); + ssigpTa->SetBinContent(5335,0.566483); + ssigpTa->SetBinContent(5336,0.579925); + ssigpTa->SetBinContent(5337,0.595475); + ssigpTa->SetBinContent(5338,0.60965); + ssigpTa->SetBinContent(5339,0.624367); + ssigpTa->SetBinContent(5340,0.639133); + ssigpTa->SetBinContent(5341,0.654683); + ssigpTa->SetBinContent(5342,0.670242); + ssigpTa->SetBinContent(5343,0.683758); + ssigpTa->SetBinContent(5344,0.652025); + ssigpTa->SetBinContent(5345,0.609733); + ssigpTa->SetBinContent(5346,0.5757); + ssigpTa->SetBinContent(5347,0.586292); + ssigpTa->SetBinContent(5348,0.6003); + ssigpTa->SetBinContent(5349,0.614392); + ssigpTa->SetBinContent(5350,0.628525); + ssigpTa->SetBinContent(5351,0.643333); + ssigpTa->SetBinContent(5352,0.658842); + ssigpTa->SetBinContent(5353,0.674983); + ssigpTa->SetBinContent(5354,0.68825); + ssigpTa->SetBinContent(5355,0.653025); + ssigpTa->SetBinContent(5356,0.606525); + ssigpTa->SetBinContent(5357,0.56895); + ssigpTa->SetBinContent(5358,0.57925); + ssigpTa->SetBinContent(5359,0.592508); + ssigpTa->SetBinContent(5360,0.606517); + ssigpTa->SetBinContent(5361,0.620608); + ssigpTa->SetBinContent(5362,0.635542); + ssigpTa->SetBinContent(5363,0.650433); + ssigpTa->SetBinContent(5364,0.666117); + ssigpTa->SetBinContent(5365,0.682425); + ssigpTa->SetBinContent(5366,0.695733); + ssigpTa->SetBinContent(5367,0.659); + ssigpTa->SetBinContent(5368,0.611592); + ssigpTa->SetBinContent(5369,0.573975); + ssigpTa->SetBinContent(5370,0.597533); + ssigpTa->SetBinContent(5371,0.626358); + ssigpTa->SetBinContent(5372,0.653042); + ssigpTa->SetBinContent(5373,0.667925); + ssigpTa->SetBinContent(5374,0.682275); + ssigpTa->SetBinContent(5375,0.697158); + ssigpTa->SetBinContent(5376,0.712133); + ssigpTa->SetBinContent(5377,0.72765); + ssigpTa->SetBinContent(5378,0.743333); + ssigpTa->SetBinContent(5379,0.759692); + ssigpTa->SetBinContent(5380,0.775875); + ssigpTa->SetBinContent(5381,0.77815); + ssigpTa->SetBinContent(5382,0.777817); + ssigpTa->SetBinContent(5383,0.780217); + ssigpTa->SetBinContent(5384,0.797817); + ssigpTa->SetBinContent(5385,0.82505); + ssigpTa->SetBinContent(5386,0.854567); + ssigpTa->SetBinContent(5387,0.883433); + ssigpTa->SetBinContent(5388,0.905592); + ssigpTa->SetBinContent(5389,0.927425); + ssigpTa->SetBinContent(5390,0.944458); + ssigpTa->SetBinContent(5391,0.87225); + ssigpTa->SetBinContent(5392,0.780925); + ssigpTa->SetBinContent(5393,0.7174); + ssigpTa->SetBinContent(5394,0.743917); + ssigpTa->SetBinContent(5395,0.77435); + ssigpTa->SetBinContent(5396,0.793083); + ssigpTa->SetBinContent(5397,0.811192); + ssigpTa->SetBinContent(5398,0.829133); + ssigpTa->SetBinContent(5399,0.834408); + ssigpTa->SetBinContent(5400,0.837175); + ssigpTa->SetBinContent(5401,0.842533); + ssigpTa->SetBinContent(5402,0.861233); + ssigpTa->SetBinContent(5403,0.88155); + ssigpTa->SetBinContent(5404,0.902542); + ssigpTa->SetBinContent(5405,0.923667); + ssigpTa->SetBinContent(5406,0.944825); + ssigpTa->SetBinContent(5407,0.967692); + ssigpTa->SetBinContent(5408,1.00807); + ssigpTa->SetBinContent(5409,1.05316); + ssigpTa->SetBinContent(5410,1.09587); + ssigpTa->SetBinContent(5411,1.12138); + ssigpTa->SetBinContent(5412,1.12652); + ssigpTa->SetBinContent(5413,1.12773); + ssigpTa->SetBinContent(5414,1.13303); + ssigpTa->SetBinContent(5415,1.15851); + ssigpTa->SetBinContent(5416,1.18594); + ssigpTa->SetBinContent(5417,1.214); + ssigpTa->SetBinContent(5418,1.24322); + ssigpTa->SetBinContent(5419,1.29046); + ssigpTa->SetBinContent(5420,1.34192); + ssigpTa->SetBinContent(5421,1.39166); + ssigpTa->SetBinContent(5422,1.42403); + ssigpTa->SetBinContent(5423,1.43219); + ssigpTa->SetBinContent(5424,1.43543); + ssigpTa->SetBinContent(5425,1.44283); + ssigpTa->SetBinContent(5426,1.47488); + ssigpTa->SetBinContent(5427,1.50928); + ssigpTa->SetBinContent(5428,1.54512); + ssigpTa->SetBinContent(5429,1.58184); + ssigpTa->SetBinContent(5430,1.62023); + ssigpTa->SetBinContent(5431,1.67395); + ssigpTa->SetBinContent(5432,1.73133); + ssigpTa->SetBinContent(5433,1.78584); + ssigpTa->SetBinContent(5434,1.80062); + ssigpTa->SetBinContent(5435,1.81007); + ssigpTa->SetBinContent(5436,1.82542); + ssigpTa->SetBinContent(5437,1.86825); + ssigpTa->SetBinContent(5438,1.91362); + ssigpTa->SetBinContent(5439,1.96024); + ssigpTa->SetBinContent(5440,2.00721); + ssigpTa->SetBinContent(5441,2.05537); + ssigpTa->SetBinContent(5442,2.104); + ssigpTa->SetBinContent(5443,2.15693); + ssigpTa->SetBinContent(5444,2.19094); + ssigpTa->SetBinContent(5445,2.22153); + ssigpTa->SetBinContent(5446,2.25373); + ssigpTa->SetBinContent(5447,2.3078); + ssigpTa->SetBinContent(5448,2.36392); + ssigpTa->SetBinContent(5449,2.4202); + ssigpTa->SetBinContent(5450,2.47728); + ssigpTa->SetBinContent(5451,2.53657); + ssigpTa->SetBinContent(5452,2.59867); + ssigpTa->SetBinContent(5453,2.6696); + ssigpTa->SetBinContent(5454,2.7429); + ssigpTa->SetBinContent(5455,2.81723); + ssigpTa->SetBinContent(5456,2.88992); + ssigpTa->SetBinContent(5457,2.96496); + ssigpTa->SetBinContent(5458,3.04013); + ssigpTa->SetBinContent(5459,3.11293); + ssigpTa->SetBinContent(5460,3.18565); + ssigpTa->SetBinContent(5461,3.26149); + ssigpTa->SetBinContent(5462,3.34133); + ssigpTa->SetBinContent(5463,3.42551); + ssigpTa->SetBinContent(5464,3.51136); + ssigpTa->SetBinContent(5465,3.59862); + ssigpTa->SetBinContent(5466,3.68681); + ssigpTa->SetBinContent(5467,3.77742); + ssigpTa->SetBinContent(5468,3.87034); + ssigpTa->SetBinContent(5469,3.96484); + ssigpTa->SetBinContent(5470,4.06006); + ssigpTa->SetBinContent(5471,4.15907); + ssigpTa->SetBinContent(5472,4.29522); + ssigpTa->SetBinContent(5473,4.44339); + ssigpTa->SetBinContent(5474,4.59034); + ssigpTa->SetBinContent(5475,4.70792); + ssigpTa->SetBinContent(5476,4.82576); + ssigpTa->SetBinContent(5477,5.06458); + ssigpTa->SetBinContent(5478,4.80471); + ssigpTa->SetBinContent(5481,0.958692); + ssigpTa->SetBinContent(5482,0.927); + ssigpTa->SetBinContent(5483,0.955611); + ssigpTa->SetBinContent(5484,0.955611); + ssigpTa->SetBinContent(5485,0.955611); + ssigpTa->SetBinContent(5486,0.955611); + ssigpTa->SetBinContent(5487,0.955611); + ssigpTa->SetBinContent(5488,0.955611); + ssigpTa->SetBinContent(5489,0.955639); + ssigpTa->SetBinContent(5490,0.955639); + ssigpTa->SetBinContent(5491,0.955639); + ssigpTa->SetBinContent(5492,0.955639); + ssigpTa->SetBinContent(5493,0.955639); + ssigpTa->SetBinContent(5494,0.955639); + ssigpTa->SetBinContent(5495,0.955639); + ssigpTa->SetBinContent(5496,0.955639); + ssigpTa->SetBinContent(5497,0.955639); + ssigpTa->SetBinContent(5498,0.955639); + ssigpTa->SetBinContent(5499,0.955639); + ssigpTa->SetBinContent(5500,0.955639); + ssigpTa->SetBinContent(5501,0.955639); + ssigpTa->SetBinContent(5502,0.955639); + ssigpTa->SetBinContent(5503,0.955639); + ssigpTa->SetBinContent(5504,0.955639); + ssigpTa->SetBinContent(5505,0.955639); + ssigpTa->SetBinContent(5506,0.955639); + ssigpTa->SetBinContent(5507,0.955639); + ssigpTa->SetBinContent(5508,0.955639); + ssigpTa->SetBinContent(5509,0.955639); + ssigpTa->SetBinContent(5510,0.955639); + ssigpTa->SetBinContent(5511,0.955639); + ssigpTa->SetBinContent(5512,0.955639); + ssigpTa->SetBinContent(5513,0.955639); + ssigpTa->SetBinContent(5514,0.955639); + ssigpTa->SetBinContent(5515,0.955639); + ssigpTa->SetBinContent(5516,0.955639); + ssigpTa->SetBinContent(5517,0.955639); + ssigpTa->SetBinContent(5518,0.955639); + ssigpTa->SetBinContent(5519,0.955639); + ssigpTa->SetBinContent(5520,0.955639); + ssigpTa->SetBinContent(5521,0.955639); + ssigpTa->SetBinContent(5522,0.95575); + ssigpTa->SetBinContent(5523,0.955861); + ssigpTa->SetBinContent(5524,0.955972); + ssigpTa->SetBinContent(5525,0.955972); + ssigpTa->SetBinContent(5526,0.955972); + ssigpTa->SetBinContent(5527,0.956361); + ssigpTa->SetBinContent(5528,0.957167); + ssigpTa->SetBinContent(5529,0.959111); + ssigpTa->SetBinContent(5530,0.959889); + ssigpTa->SetBinContent(5531,0.960278); + ssigpTa->SetBinContent(5532,0.960278); + ssigpTa->SetBinContent(5533,0.960278); + ssigpTa->SetBinContent(5534,0.960278); + ssigpTa->SetBinContent(5535,0.960278); + ssigpTa->SetBinContent(5536,0.960278); + ssigpTa->SetBinContent(5537,0.960278); + ssigpTa->SetBinContent(5538,0.960278); + ssigpTa->SetBinContent(5539,0.960278); + ssigpTa->SetBinContent(5540,0.960278); + ssigpTa->SetBinContent(5541,0.960389); + ssigpTa->SetBinContent(5542,0.9605); + ssigpTa->SetBinContent(5543,0.960611); + ssigpTa->SetBinContent(5544,0.960639); + ssigpTa->SetBinContent(5545,0.961028); + ssigpTa->SetBinContent(5546,0.961806); + ssigpTa->SetBinContent(5547,0.96375); + ssigpTa->SetBinContent(5548,0.964528); + ssigpTa->SetBinContent(5549,0.964917); + ssigpTa->SetBinContent(5550,0.964917); + ssigpTa->SetBinContent(5551,0.964917); + ssigpTa->SetBinContent(5552,0.964917); + ssigpTa->SetBinContent(5553,0.964917); + ssigpTa->SetBinContent(5554,0.965028); + ssigpTa->SetBinContent(5555,0.965167); + ssigpTa->SetBinContent(5556,0.965667); + ssigpTa->SetBinContent(5557,0.966444); + ssigpTa->SetBinContent(5558,0.968389); + ssigpTa->SetBinContent(5559,0.969167); + ssigpTa->SetBinContent(5560,0.969556); + ssigpTa->SetBinContent(5561,0.969556); + ssigpTa->SetBinContent(5562,0.969556); + ssigpTa->SetBinContent(5563,0.969667); + ssigpTa->SetBinContent(5564,0.969806); + ssigpTa->SetBinContent(5565,0.970306); + ssigpTa->SetBinContent(5566,0.971083); + ssigpTa->SetBinContent(5567,0.973028); + ssigpTa->SetBinContent(5568,0.973806); + ssigpTa->SetBinContent(5569,0.974194); + ssigpTa->SetBinContent(5570,0.974194); + ssigpTa->SetBinContent(5571,0.974333); + ssigpTa->SetBinContent(5572,0.974444); + ssigpTa->SetBinContent(5573,0.974944); + ssigpTa->SetBinContent(5574,0.975722); + ssigpTa->SetBinContent(5575,0.977667); + ssigpTa->SetBinContent(5576,0.978444); + ssigpTa->SetBinContent(5577,0.978944); + ssigpTa->SetBinContent(5578,0.979083); + ssigpTa->SetBinContent(5579,0.979583); + ssigpTa->SetBinContent(5580,0.980361); + ssigpTa->SetBinContent(5581,0.982306); + ssigpTa->SetBinContent(5582,0.983083); + ssigpTa->SetBinContent(5583,0.983611); + ssigpTa->SetBinContent(5584,0.984111); + ssigpTa->SetBinContent(5585,0.985); + ssigpTa->SetBinContent(5586,1.05189); + ssigpTa->SetBinContent(5587,1.20114); + ssigpTa->SetBinContent(5588,1.54942); + ssigpTa->SetBinContent(5589,1.69797); + ssigpTa->SetBinContent(5590,1.76344); + ssigpTa->SetBinContent(5591,1.76433); + ssigpTa->SetBinContent(5592,1.76628); + ssigpTa->SetBinContent(5593,1.76756); + ssigpTa->SetBinContent(5594,1.76886); + ssigpTa->SetBinContent(5595,1.77092); + ssigpTa->SetBinContent(5596,1.77169); + ssigpTa->SetBinContent(5597,1.71544); + ssigpTa->SetBinContent(5598,1.588); + ssigpTa->SetBinContent(5599,1.29147); + ssigpTa->SetBinContent(5600,1.18228); + ssigpTa->SetBinContent(5601,1.15189); + ssigpTa->SetBinContent(5602,1.18231); + ssigpTa->SetBinContent(5603,1.21219); + ssigpTa->SetBinContent(5604,1.24339); + ssigpTa->SetBinContent(5605,1.27456); + ssigpTa->SetBinContent(5606,1.28125); + ssigpTa->SetBinContent(5607,1.25822); + ssigpTa->SetBinContent(5608,1.16261); + ssigpTa->SetBinContent(5609,1.13939); + ssigpTa->SetBinContent(5610,1.14817); + ssigpTa->SetBinContent(5611,1.17789); + ssigpTa->SetBinContent(5612,1.20689); + ssigpTa->SetBinContent(5613,1.2355); + ssigpTa->SetBinContent(5614,1.26581); + ssigpTa->SetBinContent(5615,1.29569); + ssigpTa->SetBinContent(5616,1.32728); + ssigpTa->SetBinContent(5617,1.33292); + ssigpTa->SetBinContent(5618,1.30417); + ssigpTa->SetBinContent(5619,1.19292); + ssigpTa->SetBinContent(5620,1.15953); + ssigpTa->SetBinContent(5621,1.1605); + ssigpTa->SetBinContent(5622,1.18794); + ssigpTa->SetBinContent(5623,1.21578); + ssigpTa->SetBinContent(5624,1.24403); + ssigpTa->SetBinContent(5625,1.27314); + ssigpTa->SetBinContent(5626,1.30422); + ssigpTa->SetBinContent(5627,1.33617); + ssigpTa->SetBinContent(5628,1.34025); + ssigpTa->SetBinContent(5629,1.30706); + ssigpTa->SetBinContent(5630,1.18542); + ssigpTa->SetBinContent(5631,1.14756); + ssigpTa->SetBinContent(5632,1.14611); + ssigpTa->SetBinContent(5633,1.17306); + ssigpTa->SetBinContent(5634,1.19961); + ssigpTa->SetBinContent(5635,1.22872); + ssigpTa->SetBinContent(5636,1.25744); + ssigpTa->SetBinContent(5637,1.28708); + ssigpTa->SetBinContent(5638,1.31825); + ssigpTa->SetBinContent(5639,1.35033); + ssigpTa->SetBinContent(5640,1.35364); + ssigpTa->SetBinContent(5641,1.31908); + ssigpTa->SetBinContent(5642,1.19403); + ssigpTa->SetBinContent(5643,1.16347); + ssigpTa->SetBinContent(5644,1.17842); + ssigpTa->SetBinContent(5645,1.24358); + ssigpTa->SetBinContent(5646,1.28731); + ssigpTa->SetBinContent(5647,1.32225); + ssigpTa->SetBinContent(5648,1.35061); + ssigpTa->SetBinContent(5649,1.37944); + ssigpTa->SetBinContent(5650,1.40975); + ssigpTa->SetBinContent(5651,1.43975); + ssigpTa->SetBinContent(5652,1.47133); + ssigpTa->SetBinContent(5653,1.50381); + ssigpTa->SetBinContent(5654,1.52889); + ssigpTa->SetBinContent(5655,1.54478); + ssigpTa->SetBinContent(5656,1.53481); + ssigpTa->SetBinContent(5657,1.55039); + ssigpTa->SetBinContent(5658,1.58272); + ssigpTa->SetBinContent(5659,1.63047); + ssigpTa->SetBinContent(5660,1.69389); + ssigpTa->SetBinContent(5661,1.74539); + ssigpTa->SetBinContent(5662,1.79222); + ssigpTa->SetBinContent(5663,1.83642); + ssigpTa->SetBinContent(5664,1.82822); + ssigpTa->SetBinContent(5665,1.75317); + ssigpTa->SetBinContent(5666,1.52283); + ssigpTa->SetBinContent(5667,1.45522); + ssigpTa->SetBinContent(5668,1.47617); + ssigpTa->SetBinContent(5669,1.52747); + ssigpTa->SetBinContent(5670,1.56953); + ssigpTa->SetBinContent(5671,1.60586); + ssigpTa->SetBinContent(5672,1.63519); + ssigpTa->SetBinContent(5673,1.65542); + ssigpTa->SetBinContent(5674,1.65294); + ssigpTa->SetBinContent(5675,1.67356); + ssigpTa->SetBinContent(5676,1.70458); + ssigpTa->SetBinContent(5677,1.74503); + ssigpTa->SetBinContent(5678,1.78639); + ssigpTa->SetBinContent(5679,1.82814); + ssigpTa->SetBinContent(5680,1.87031); + ssigpTa->SetBinContent(5681,1.92306); + ssigpTa->SetBinContent(5682,1.99075); + ssigpTa->SetBinContent(5683,2.09011); + ssigpTa->SetBinContent(5684,2.16208); + ssigpTa->SetBinContent(5685,2.21117); + ssigpTa->SetBinContent(5686,2.23631); + ssigpTa->SetBinContent(5687,2.22681); + ssigpTa->SetBinContent(5688,2.25244); + ssigpTa->SetBinContent(5689,2.29361); + ssigpTa->SetBinContent(5690,2.34808); + ssigpTa->SetBinContent(5691,2.40336); + ssigpTa->SetBinContent(5692,2.46953); + ssigpTa->SetBinContent(5693,2.5495); + ssigpTa->SetBinContent(5694,2.66306); + ssigpTa->SetBinContent(5695,2.74775); + ssigpTa->SetBinContent(5696,2.80856); + ssigpTa->SetBinContent(5697,2.84317); + ssigpTa->SetBinContent(5698,2.83403); + ssigpTa->SetBinContent(5699,2.86775); + ssigpTa->SetBinContent(5700,2.91997); + ssigpTa->SetBinContent(5701,2.98867); + ssigpTa->SetBinContent(5702,3.05914); + ssigpTa->SetBinContent(5703,3.13208); + ssigpTa->SetBinContent(5704,3.21486); + ssigpTa->SetBinContent(5705,3.30983); + ssigpTa->SetBinContent(5706,3.43358); + ssigpTa->SetBinContent(5707,3.51772); + ssigpTa->SetBinContent(5708,3.57394); + ssigpTa->SetBinContent(5709,3.57622); + ssigpTa->SetBinContent(5710,3.62672); + ssigpTa->SetBinContent(5711,3.69931); + ssigpTa->SetBinContent(5712,3.78992); + ssigpTa->SetBinContent(5713,3.88111); + ssigpTa->SetBinContent(5714,3.97544); + ssigpTa->SetBinContent(5715,4.06992); + ssigpTa->SetBinContent(5716,4.16914); + ssigpTa->SetBinContent(5717,4.26072); + ssigpTa->SetBinContent(5718,4.34694); + ssigpTa->SetBinContent(5719,4.39108); + ssigpTa->SetBinContent(5720,4.47256); + ssigpTa->SetBinContent(5721,4.57014); + ssigpTa->SetBinContent(5722,4.68108); + ssigpTa->SetBinContent(5723,4.79281); + ssigpTa->SetBinContent(5724,4.90622); + ssigpTa->SetBinContent(5725,5.02347); + ssigpTa->SetBinContent(5726,5.15003); + ssigpTa->SetBinContent(5727,5.28467); + ssigpTa->SetBinContent(5728,5.43489); + ssigpTa->SetBinContent(5729,5.57778); + ssigpTa->SetBinContent(5730,5.72311); + ssigpTa->SetBinContent(5731,5.87308); + ssigpTa->SetBinContent(5732,6.02003); + ssigpTa->SetBinContent(5733,6.16528); + ssigpTa->SetBinContent(5734,6.31075); + ssigpTa->SetBinContent(5735,6.46008); + ssigpTa->SetBinContent(5736,6.61911); + ssigpTa->SetBinContent(5737,6.78456); + ssigpTa->SetBinContent(5738,6.95492); + ssigpTa->SetBinContent(5739,7.12733); + ssigpTa->SetBinContent(5740,7.30308); + ssigpTa->SetBinContent(5741,7.48194); + ssigpTa->SetBinContent(5742,7.66594); + ssigpTa->SetBinContent(5743,7.85317); + ssigpTa->SetBinContent(5744,8.04169); + ssigpTa->SetBinContent(5745,8.25378); + ssigpTa->SetBinContent(5746,8.49847); + ssigpTa->SetBinContent(5747,8.81264); + ssigpTa->SetBinContent(5748,9.07772); + ssigpTa->SetBinContent(5749,9.32575); + ssigpTa->SetBinContent(5750,9.55897); + ssigpTa->SetBinContent(5751,9.46026); + ssigpTa->SetBinContent(5752,9.95015); + ssigpTa->SetEntries(5169); + + init = true; + } + + double percent = ssigpTa->Interpolate(eta, ptGeV); + return percent; + } + + // Fractional resolution in % + //double ITKPercentageresol(double pt [MeV], double eta) { + double UpgradePerformance::ITKPercentageresol_ExtBrl(double ptMeV, double eta){ + static TH2D *ssigpTa; + static bool init = false; + + double ptGeV = ptMeV/1000.; + if (fabs(eta)>3.976) return 0.; + if(!init){ + Double_t xAxis1[65] = {-3.9375, -3.875, -3.75, -3.625, -3.5, -3.375, -3.25, -3.125, -3, -2.875, -2.75, -2.625, -2.5, -2.375, -2.25, -2.125, -2, -1.875, -1.75, -1.625, -1.5, -1.375, -1.25, -1.125, -1, -0.875, -0.75, -0.625, -0.5, -0.375, -0.25, -0.125, 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75, 3.875, 3.97688}; + Double_t yAxis1[10] = {1, 3, 7.5, 15, 25, 40, 60, 85, 3.55e+03, 7.07e+03}; + + ssigpTa = new TH2D("ssigpTa","ssigpTa",64, xAxis1,9, yAxis1); + ssigpTa->SetBinContent(67,0.30531); + ssigpTa->SetBinContent(68,0.271396); + ssigpTa->SetBinContent(69,0.233037); + ssigpTa->SetBinContent(70,0.209338); + ssigpTa->SetBinContent(71,0.188908); + ssigpTa->SetBinContent(72,0.168226); + ssigpTa->SetBinContent(73,0.140979); + ssigpTa->SetBinContent(74,0.106893); + ssigpTa->SetBinContent(75,0.0836766); + ssigpTa->SetBinContent(76,0.0702595); + ssigpTa->SetBinContent(77,0.0616854); + ssigpTa->SetBinContent(78,0.0537246); + ssigpTa->SetBinContent(79,0.0453684); + ssigpTa->SetBinContent(80,0.0391921); + ssigpTa->SetBinContent(81,0.0339865); + ssigpTa->SetBinContent(82,0.0291589); + ssigpTa->SetBinContent(83,0.0257491); + ssigpTa->SetBinContent(84,0.0230564); + ssigpTa->SetBinContent(85,0.0206976); + ssigpTa->SetBinContent(86,0.0185704); + ssigpTa->SetBinContent(87,0.0166318); + ssigpTa->SetBinContent(88,0.015113); + ssigpTa->SetBinContent(89,0.013943); + ssigpTa->SetBinContent(90,0.0126062); + ssigpTa->SetBinContent(91,0.0115753); + ssigpTa->SetBinContent(92,0.0109282); + ssigpTa->SetBinContent(93,0.0105165); + ssigpTa->SetBinContent(94,0.0103138); + ssigpTa->SetBinContent(95,0.0101179); + ssigpTa->SetBinContent(96,0.00994723); + ssigpTa->SetBinContent(97,0.00990108); + ssigpTa->SetBinContent(98,0.00983187); + ssigpTa->SetBinContent(99,0.00985636); + ssigpTa->SetBinContent(100,0.00986291); + ssigpTa->SetBinContent(101,0.00993672); + ssigpTa->SetBinContent(102,0.0101379); + ssigpTa->SetBinContent(103,0.0104347); + ssigpTa->SetBinContent(104,0.0107581); + ssigpTa->SetBinContent(105,0.0113143); + ssigpTa->SetBinContent(106,0.0121554); + ssigpTa->SetBinContent(107,0.0130424); + ssigpTa->SetBinContent(108,0.0140677); + ssigpTa->SetBinContent(109,0.0152899); + ssigpTa->SetBinContent(110,0.0168646); + ssigpTa->SetBinContent(111,0.0189212); + ssigpTa->SetBinContent(112,0.0210735); + ssigpTa->SetBinContent(113,0.0237003); + ssigpTa->SetBinContent(114,0.0269943); + ssigpTa->SetBinContent(115,0.030533); + ssigpTa->SetBinContent(116,0.0345759); + ssigpTa->SetBinContent(117,0.0394294); + ssigpTa->SetBinContent(118,0.0459319); + ssigpTa->SetBinContent(119,0.0542856); + ssigpTa->SetBinContent(120,0.0634744); + ssigpTa->SetBinContent(121,0.0775213); + ssigpTa->SetBinContent(122,0.0988431); + ssigpTa->SetBinContent(123,0.121316); + ssigpTa->SetBinContent(124,0.142607); + ssigpTa->SetBinContent(125,0.162843); + ssigpTa->SetBinContent(126,0.180837); + ssigpTa->SetBinContent(127,0.202739); + ssigpTa->SetBinContent(128,0.229705); + ssigpTa->SetBinContent(129,0.272746); + ssigpTa->SetBinContent(130,0.30709); + ssigpTa->SetBinContent(133,0.402376); + ssigpTa->SetBinContent(134,0.344537); + ssigpTa->SetBinContent(135,0.289167); + ssigpTa->SetBinContent(136,0.24479); + ssigpTa->SetBinContent(137,0.208378); + ssigpTa->SetBinContent(138,0.179603); + ssigpTa->SetBinContent(139,0.148762); + ssigpTa->SetBinContent(140,0.115878); + ssigpTa->SetBinContent(141,0.091426); + ssigpTa->SetBinContent(142,0.0779508); + ssigpTa->SetBinContent(143,0.067948); + ssigpTa->SetBinContent(144,0.0581925); + ssigpTa->SetBinContent(145,0.0482232); + ssigpTa->SetBinContent(146,0.0406659); + ssigpTa->SetBinContent(147,0.0348766); + ssigpTa->SetBinContent(148,0.0297042); + ssigpTa->SetBinContent(149,0.0259929); + ssigpTa->SetBinContent(150,0.0232909); + ssigpTa->SetBinContent(151,0.0209654); + ssigpTa->SetBinContent(152,0.0188238); + ssigpTa->SetBinContent(153,0.0168639); + ssigpTa->SetBinContent(154,0.0153798); + ssigpTa->SetBinContent(155,0.0140815); + ssigpTa->SetBinContent(156,0.0127418); + ssigpTa->SetBinContent(157,0.0117417); + ssigpTa->SetBinContent(158,0.0111476); + ssigpTa->SetBinContent(159,0.010797); + ssigpTa->SetBinContent(160,0.0105326); + ssigpTa->SetBinContent(161,0.0102888); + ssigpTa->SetBinContent(162,0.0101073); + ssigpTa->SetBinContent(163,0.0100576); + ssigpTa->SetBinContent(164,0.0100809); + ssigpTa->SetBinContent(165,0.0100656); + ssigpTa->SetBinContent(166,0.0100676); + ssigpTa->SetBinContent(167,0.010113); + ssigpTa->SetBinContent(168,0.0102939); + ssigpTa->SetBinContent(169,0.0105545); + ssigpTa->SetBinContent(170,0.0108815); + ssigpTa->SetBinContent(171,0.0114219); + ssigpTa->SetBinContent(172,0.0122431); + ssigpTa->SetBinContent(173,0.0131426); + ssigpTa->SetBinContent(174,0.014143); + ssigpTa->SetBinContent(175,0.0153199); + ssigpTa->SetBinContent(176,0.0170293); + ssigpTa->SetBinContent(177,0.0191096); + ssigpTa->SetBinContent(178,0.0213064); + ssigpTa->SetBinContent(179,0.0238948); + ssigpTa->SetBinContent(180,0.0273598); + ssigpTa->SetBinContent(181,0.0310478); + ssigpTa->SetBinContent(182,0.0356099); + ssigpTa->SetBinContent(183,0.0411301); + ssigpTa->SetBinContent(184,0.0487059); + ssigpTa->SetBinContent(185,0.0583134); + ssigpTa->SetBinContent(186,0.0684577); + ssigpTa->SetBinContent(187,0.0830166); + ssigpTa->SetBinContent(188,0.104962); + ssigpTa->SetBinContent(189,0.128048); + ssigpTa->SetBinContent(190,0.151192); + ssigpTa->SetBinContent(191,0.174924); + ssigpTa->SetBinContent(192,0.203626); + ssigpTa->SetBinContent(193,0.241674); + ssigpTa->SetBinContent(194,0.288358); + ssigpTa->SetBinContent(195,0.344925); + ssigpTa->SetBinContent(196,0.399318); + ssigpTa->SetBinContent(199,0.588417); + ssigpTa->SetBinContent(200,0.505927); + ssigpTa->SetBinContent(201,0.399988); + ssigpTa->SetBinContent(202,0.314275); + ssigpTa->SetBinContent(203,0.246328); + ssigpTa->SetBinContent(204,0.200895); + ssigpTa->SetBinContent(205,0.165869); + ssigpTa->SetBinContent(206,0.129499); + ssigpTa->SetBinContent(207,0.104335); + ssigpTa->SetBinContent(208,0.0884829); + ssigpTa->SetBinContent(209,0.0762677); + ssigpTa->SetBinContent(210,0.0637362); + ssigpTa->SetBinContent(211,0.0513877); + ssigpTa->SetBinContent(212,0.0423713); + ssigpTa->SetBinContent(213,0.0360234); + ssigpTa->SetBinContent(214,0.0304423); + ssigpTa->SetBinContent(215,0.026517); + ssigpTa->SetBinContent(216,0.0236992); + ssigpTa->SetBinContent(217,0.0213095); + ssigpTa->SetBinContent(218,0.0192461); + ssigpTa->SetBinContent(219,0.0172452); + ssigpTa->SetBinContent(220,0.0157457); + ssigpTa->SetBinContent(221,0.0144474); + ssigpTa->SetBinContent(222,0.0131046); + ssigpTa->SetBinContent(223,0.0120596); + ssigpTa->SetBinContent(224,0.0114921); + ssigpTa->SetBinContent(225,0.0111104); + ssigpTa->SetBinContent(226,0.0107809); + ssigpTa->SetBinContent(227,0.0104216); + ssigpTa->SetBinContent(228,0.010213); + ssigpTa->SetBinContent(229,0.0102095); + ssigpTa->SetBinContent(230,0.0103024); + ssigpTa->SetBinContent(231,0.0103533); + ssigpTa->SetBinContent(232,0.0103285); + ssigpTa->SetBinContent(233,0.0103622); + ssigpTa->SetBinContent(234,0.010544); + ssigpTa->SetBinContent(235,0.0108425); + ssigpTa->SetBinContent(236,0.0111889); + ssigpTa->SetBinContent(237,0.0117603); + ssigpTa->SetBinContent(238,0.0126346); + ssigpTa->SetBinContent(239,0.0136179); + ssigpTa->SetBinContent(240,0.0145979); + ssigpTa->SetBinContent(241,0.0158237); + ssigpTa->SetBinContent(242,0.0174407); + ssigpTa->SetBinContent(243,0.0196167); + ssigpTa->SetBinContent(244,0.0217517); + ssigpTa->SetBinContent(245,0.0245507); + ssigpTa->SetBinContent(246,0.0280809); + ssigpTa->SetBinContent(247,0.0320685); + ssigpTa->SetBinContent(248,0.0366423); + ssigpTa->SetBinContent(249,0.0426771); + ssigpTa->SetBinContent(250,0.0516638); + ssigpTa->SetBinContent(251,0.0631572); + ssigpTa->SetBinContent(252,0.0747279); + ssigpTa->SetBinContent(253,0.0911755); + ssigpTa->SetBinContent(254,0.114872); + ssigpTa->SetBinContent(255,0.140412); + ssigpTa->SetBinContent(256,0.16604); + ssigpTa->SetBinContent(257,0.196659); + ssigpTa->SetBinContent(258,0.245068); + ssigpTa->SetBinContent(259,0.317714); + ssigpTa->SetBinContent(260,0.405334); + ssigpTa->SetBinContent(261,0.504091); + ssigpTa->SetBinContent(262,0.579566); + ssigpTa->SetBinContent(265,0.92693); + ssigpTa->SetBinContent(266,0.768376); + ssigpTa->SetBinContent(267,0.588887); + ssigpTa->SetBinContent(268,0.428622); + ssigpTa->SetBinContent(269,0.308539); + ssigpTa->SetBinContent(270,0.239311); + ssigpTa->SetBinContent(271,0.192008); + ssigpTa->SetBinContent(272,0.149113); + ssigpTa->SetBinContent(273,0.118231); + ssigpTa->SetBinContent(274,0.0999363); + ssigpTa->SetBinContent(275,0.0848229); + ssigpTa->SetBinContent(276,0.0699513); + ssigpTa->SetBinContent(277,0.0547896); + ssigpTa->SetBinContent(278,0.0445831); + ssigpTa->SetBinContent(279,0.0375089); + ssigpTa->SetBinContent(280,0.0315788); + ssigpTa->SetBinContent(281,0.0273691); + ssigpTa->SetBinContent(282,0.0243838); + ssigpTa->SetBinContent(283,0.0219912); + ssigpTa->SetBinContent(284,0.0197951); + ssigpTa->SetBinContent(285,0.017767); + ssigpTa->SetBinContent(286,0.0162173); + ssigpTa->SetBinContent(287,0.0149774); + ssigpTa->SetBinContent(288,0.0135977); + ssigpTa->SetBinContent(289,0.0125821); + ssigpTa->SetBinContent(290,0.0119574); + ssigpTa->SetBinContent(291,0.011522); + ssigpTa->SetBinContent(292,0.0111733); + ssigpTa->SetBinContent(293,0.0108264); + ssigpTa->SetBinContent(294,0.0105851); + ssigpTa->SetBinContent(295,0.0106562); + ssigpTa->SetBinContent(296,0.0107784); + ssigpTa->SetBinContent(297,0.0108275); + ssigpTa->SetBinContent(298,0.0108084); + ssigpTa->SetBinContent(299,0.0108065); + ssigpTa->SetBinContent(300,0.0110124); + ssigpTa->SetBinContent(301,0.0113448); + ssigpTa->SetBinContent(302,0.0117158); + ssigpTa->SetBinContent(303,0.0123794); + ssigpTa->SetBinContent(304,0.0133583); + ssigpTa->SetBinContent(305,0.014392); + ssigpTa->SetBinContent(306,0.015498); + ssigpTa->SetBinContent(307,0.0165811); + ssigpTa->SetBinContent(308,0.0181252); + ssigpTa->SetBinContent(309,0.0201903); + ssigpTa->SetBinContent(310,0.0225119); + ssigpTa->SetBinContent(311,0.0255001); + ssigpTa->SetBinContent(312,0.0296003); + ssigpTa->SetBinContent(313,0.03353); + ssigpTa->SetBinContent(314,0.0383759); + ssigpTa->SetBinContent(315,0.0447509); + ssigpTa->SetBinContent(316,0.054895); + ssigpTa->SetBinContent(317,0.0688271); + ssigpTa->SetBinContent(318,0.0833444); + ssigpTa->SetBinContent(319,0.102907); + ssigpTa->SetBinContent(320,0.132188); + ssigpTa->SetBinContent(321,0.162121); + ssigpTa->SetBinContent(322,0.193566); + ssigpTa->SetBinContent(323,0.235553); + ssigpTa->SetBinContent(324,0.310881); + ssigpTa->SetBinContent(325,0.442869); + ssigpTa->SetBinContent(326,0.602302); + ssigpTa->SetBinContent(327,0.769322); + ssigpTa->SetBinContent(328,0.901369); + ssigpTa->SetBinContent(331,1.3917); + ssigpTa->SetBinContent(332,1.15994); + ssigpTa->SetBinContent(333,0.861594); + ssigpTa->SetBinContent(334,0.596927); + ssigpTa->SetBinContent(335,0.403654); + ssigpTa->SetBinContent(336,0.296822); + ssigpTa->SetBinContent(337,0.232494); + ssigpTa->SetBinContent(338,0.174673); + ssigpTa->SetBinContent(339,0.136217); + ssigpTa->SetBinContent(340,0.113496); + ssigpTa->SetBinContent(341,0.0965284); + ssigpTa->SetBinContent(342,0.0787562); + ssigpTa->SetBinContent(343,0.0611796); + ssigpTa->SetBinContent(344,0.0488135); + ssigpTa->SetBinContent(345,0.0408061); + ssigpTa->SetBinContent(346,0.0338207); + ssigpTa->SetBinContent(347,0.0290171); + ssigpTa->SetBinContent(348,0.0257771); + ssigpTa->SetBinContent(349,0.0230483); + ssigpTa->SetBinContent(350,0.0208691); + ssigpTa->SetBinContent(351,0.0187282); + ssigpTa->SetBinContent(352,0.0171789); + ssigpTa->SetBinContent(353,0.0159147); + ssigpTa->SetBinContent(354,0.0145838); + ssigpTa->SetBinContent(355,0.0135158); + ssigpTa->SetBinContent(356,0.0128834); + ssigpTa->SetBinContent(357,0.0124814); + ssigpTa->SetBinContent(358,0.0121769); + ssigpTa->SetBinContent(359,0.0118853); + ssigpTa->SetBinContent(360,0.0117133); + ssigpTa->SetBinContent(361,0.01173); + ssigpTa->SetBinContent(362,0.0118033); + ssigpTa->SetBinContent(363,0.0117886); + ssigpTa->SetBinContent(364,0.011706); + ssigpTa->SetBinContent(365,0.0117353); + ssigpTa->SetBinContent(366,0.0119236); + ssigpTa->SetBinContent(367,0.0122298); + ssigpTa->SetBinContent(368,0.0126485); + ssigpTa->SetBinContent(369,0.0133212); + ssigpTa->SetBinContent(370,0.0144457); + ssigpTa->SetBinContent(371,0.0156275); + ssigpTa->SetBinContent(372,0.0166518); + ssigpTa->SetBinContent(373,0.0176988); + ssigpTa->SetBinContent(374,0.0190866); + ssigpTa->SetBinContent(375,0.0211358); + ssigpTa->SetBinContent(376,0.0235462); + ssigpTa->SetBinContent(377,0.0270283); + ssigpTa->SetBinContent(378,0.0315526); + ssigpTa->SetBinContent(379,0.0362863); + ssigpTa->SetBinContent(380,0.0414979); + ssigpTa->SetBinContent(381,0.0486447); + ssigpTa->SetBinContent(382,0.0603693); + ssigpTa->SetBinContent(383,0.0771753); + ssigpTa->SetBinContent(384,0.0953844); + ssigpTa->SetBinContent(385,0.120635); + ssigpTa->SetBinContent(386,0.157106); + ssigpTa->SetBinContent(387,0.196493); + ssigpTa->SetBinContent(388,0.237576); + ssigpTa->SetBinContent(389,0.293417); + ssigpTa->SetBinContent(390,0.409821); + ssigpTa->SetBinContent(391,0.615195); + ssigpTa->SetBinContent(392,0.882761); + ssigpTa->SetBinContent(393,1.1518); + ssigpTa->SetBinContent(394,1.35382); + ssigpTa->SetBinContent(397,2.05831); + ssigpTa->SetBinContent(398,1.70105); + ssigpTa->SetBinContent(399,1.25231); + ssigpTa->SetBinContent(400,0.847972); + ssigpTa->SetBinContent(401,0.549922); + ssigpTa->SetBinContent(402,0.389339); + ssigpTa->SetBinContent(403,0.29593); + ssigpTa->SetBinContent(404,0.217733); + ssigpTa->SetBinContent(405,0.16568); + ssigpTa->SetBinContent(406,0.136679); + ssigpTa->SetBinContent(407,0.114881); + ssigpTa->SetBinContent(408,0.0929453); + ssigpTa->SetBinContent(409,0.0707418); + ssigpTa->SetBinContent(410,0.0560116); + ssigpTa->SetBinContent(411,0.0460424); + ssigpTa->SetBinContent(412,0.0376533); + ssigpTa->SetBinContent(413,0.0318679); + ssigpTa->SetBinContent(414,0.0280861); + ssigpTa->SetBinContent(415,0.025206); + ssigpTa->SetBinContent(416,0.0228134); + ssigpTa->SetBinContent(417,0.0208317); + ssigpTa->SetBinContent(418,0.0193171); + ssigpTa->SetBinContent(419,0.0179839); + ssigpTa->SetBinContent(420,0.0164638); + ssigpTa->SetBinContent(421,0.0152336); + ssigpTa->SetBinContent(422,0.0145749); + ssigpTa->SetBinContent(423,0.0141885); + ssigpTa->SetBinContent(424,0.0139289); + ssigpTa->SetBinContent(425,0.0136761); + ssigpTa->SetBinContent(426,0.0135193); + ssigpTa->SetBinContent(427,0.0134873); + ssigpTa->SetBinContent(428,0.0135294); + ssigpTa->SetBinContent(429,0.0134763); + ssigpTa->SetBinContent(430,0.0134109); + ssigpTa->SetBinContent(431,0.0134182); + ssigpTa->SetBinContent(432,0.0136444); + ssigpTa->SetBinContent(433,0.0139062); + ssigpTa->SetBinContent(434,0.0141844); + ssigpTa->SetBinContent(435,0.0149356); + ssigpTa->SetBinContent(436,0.0161951); + ssigpTa->SetBinContent(437,0.0174873); + ssigpTa->SetBinContent(438,0.018573); + ssigpTa->SetBinContent(439,0.0195079); + ssigpTa->SetBinContent(440,0.0207949); + ssigpTa->SetBinContent(441,0.0228283); + ssigpTa->SetBinContent(442,0.0252549); + ssigpTa->SetBinContent(443,0.0289354); + ssigpTa->SetBinContent(444,0.0342073); + ssigpTa->SetBinContent(445,0.0396804); + ssigpTa->SetBinContent(446,0.0463669); + ssigpTa->SetBinContent(447,0.0550629); + ssigpTa->SetBinContent(448,0.0693075); + ssigpTa->SetBinContent(449,0.0909804); + ssigpTa->SetBinContent(450,0.114779); + ssigpTa->SetBinContent(451,0.146969); + ssigpTa->SetBinContent(452,0.195434); + ssigpTa->SetBinContent(453,0.248526); + ssigpTa->SetBinContent(454,0.306342); + ssigpTa->SetBinContent(455,0.387862); + ssigpTa->SetBinContent(456,0.549212); + ssigpTa->SetBinContent(457,0.863318); + ssigpTa->SetBinContent(458,1.26807); + ssigpTa->SetBinContent(459,1.68484); + ssigpTa->SetBinContent(460,1.98855); + ssigpTa->SetBinContent(463,19.3098); + ssigpTa->SetBinContent(464,11.308); + ssigpTa->SetBinContent(465,7.661); + ssigpTa->SetBinContent(466,5.09272); + ssigpTa->SetBinContent(467,2.88229); + ssigpTa->SetBinContent(468,2.23092); + ssigpTa->SetBinContent(469,1.76263); + ssigpTa->SetBinContent(470,1.15517); + ssigpTa->SetBinContent(471,0.928229); + ssigpTa->SetBinContent(472,0.766359); + ssigpTa->SetBinContent(473,0.624298); + ssigpTa->SetBinContent(474,0.50316); + ssigpTa->SetBinContent(475,0.329231); + ssigpTa->SetBinContent(476,0.268403); + ssigpTa->SetBinContent(477,0.227436); + ssigpTa->SetBinContent(478,0.172655); + ssigpTa->SetBinContent(479,0.141826); + ssigpTa->SetBinContent(480,0.129844); + ssigpTa->SetBinContent(481,0.117598); + ssigpTa->SetBinContent(482,0.108722); + ssigpTa->SetBinContent(483,0.0982137); + ssigpTa->SetBinContent(484,0.0959805); + ssigpTa->SetBinContent(485,0.091468); + ssigpTa->SetBinContent(486,0.080323); + ssigpTa->SetBinContent(487,0.070786); + ssigpTa->SetBinContent(488,0.0700397); + ssigpTa->SetBinContent(489,0.0702088); + ssigpTa->SetBinContent(490,0.0695863); + ssigpTa->SetBinContent(491,0.0693635); + ssigpTa->SetBinContent(492,0.0698056); + ssigpTa->SetBinContent(493,0.0689679); + ssigpTa->SetBinContent(494,0.0701788); + ssigpTa->SetBinContent(495,0.0709953); + ssigpTa->SetBinContent(496,0.0703343); + ssigpTa->SetBinContent(497,0.0695008); + ssigpTa->SetBinContent(498,0.071242); + ssigpTa->SetBinContent(499,0.0722281); + ssigpTa->SetBinContent(500,0.0719461); + ssigpTa->SetBinContent(501,0.0712323); + ssigpTa->SetBinContent(502,0.0799371); + ssigpTa->SetBinContent(503,0.0880082); + ssigpTa->SetBinContent(504,0.093457); + ssigpTa->SetBinContent(505,0.0978981); + ssigpTa->SetBinContent(506,0.100403); + ssigpTa->SetBinContent(507,0.110361); + ssigpTa->SetBinContent(508,0.118267); + ssigpTa->SetBinContent(509,0.129994); + ssigpTa->SetBinContent(510,0.162637); + ssigpTa->SetBinContent(511,0.183392); + ssigpTa->SetBinContent(512,0.224315); + ssigpTa->SetBinContent(513,0.272138); + ssigpTa->SetBinContent(514,0.327838); + ssigpTa->SetBinContent(515,0.499332); + ssigpTa->SetBinContent(516,0.635426); + ssigpTa->SetBinContent(517,0.754133); + ssigpTa->SetBinContent(518,1.10851); + ssigpTa->SetBinContent(519,1.39367); + ssigpTa->SetBinContent(520,1.76774); + ssigpTa->SetBinContent(521,2.23571); + ssigpTa->SetBinContent(522,2.92456); + ssigpTa->SetBinContent(523,5.20757); + ssigpTa->SetBinContent(524,8.02734); + ssigpTa->SetBinContent(525,11.4992); + ssigpTa->SetBinContent(526,18.7384); + ssigpTa->SetBinContent(529,63.6902); + ssigpTa->SetBinContent(530,60.3252); + ssigpTa->SetBinContent(531,40.6597); + ssigpTa->SetBinContent(532,26.5019); + ssigpTa->SetBinContent(533,17.2021); + ssigpTa->SetBinContent(534,11.5723); + ssigpTa->SetBinContent(535,8.7623); + ssigpTa->SetBinContent(536,6.5461); + ssigpTa->SetBinContent(537,4.82417); + ssigpTa->SetBinContent(538,3.95362); + ssigpTa->SetBinContent(539,3.23391); + ssigpTa->SetBinContent(540,2.46686); + ssigpTa->SetBinContent(541,1.84955); + ssigpTa->SetBinContent(542,1.37408); + ssigpTa->SetBinContent(543,1.11833); + ssigpTa->SetBinContent(544,0.903377); + ssigpTa->SetBinContent(545,0.736342); + ssigpTa->SetBinContent(546,0.646932); + ssigpTa->SetBinContent(547,0.595266); + ssigpTa->SetBinContent(548,0.542641); + ssigpTa->SetBinContent(549,0.507811); + ssigpTa->SetBinContent(550,0.480644); + ssigpTa->SetBinContent(551,0.451716); + ssigpTa->SetBinContent(552,0.407196); + ssigpTa->SetBinContent(553,0.369354); + ssigpTa->SetBinContent(554,0.352809); + ssigpTa->SetBinContent(555,0.352685); + ssigpTa->SetBinContent(556,0.352625); + ssigpTa->SetBinContent(557,0.352898); + ssigpTa->SetBinContent(558,0.35232); + ssigpTa->SetBinContent(559,0.354242); + ssigpTa->SetBinContent(560,0.356609); + ssigpTa->SetBinContent(561,0.359438); + ssigpTa->SetBinContent(562,0.357907); + ssigpTa->SetBinContent(563,0.35802); + ssigpTa->SetBinContent(564,0.361246); + ssigpTa->SetBinContent(565,0.365295); + ssigpTa->SetBinContent(566,0.363195); + ssigpTa->SetBinContent(567,0.3751); + ssigpTa->SetBinContent(568,0.402377); + ssigpTa->SetBinContent(569,0.441588); + ssigpTa->SetBinContent(570,0.47252); + ssigpTa->SetBinContent(571,0.492136); + ssigpTa->SetBinContent(572,0.51988); + ssigpTa->SetBinContent(573,0.552397); + ssigpTa->SetBinContent(574,0.599298); + ssigpTa->SetBinContent(575,0.687086); + ssigpTa->SetBinContent(576,0.794791); + ssigpTa->SetBinContent(577,0.955598); + ssigpTa->SetBinContent(578,1.13939); + ssigpTa->SetBinContent(579,1.37547); + ssigpTa->SetBinContent(580,1.85214); + ssigpTa->SetBinContent(581,2.48198); + ssigpTa->SetBinContent(582,3.19938); + ssigpTa->SetBinContent(583,4.23924); + ssigpTa->SetBinContent(584,5.52799); + ssigpTa->SetBinContent(585,7.28341); + ssigpTa->SetBinContent(586,9.19071); + ssigpTa->SetBinContent(587,11.6572); + ssigpTa->SetBinContent(588,17.5238); + ssigpTa->SetBinContent(589,27.5455); + ssigpTa->SetBinContent(590,42.0337); + ssigpTa->SetBinContent(591,60.7132); + ssigpTa->SetBinContent(592,63.1425); + ssigpTa->SetBinContent(595,162.5); + ssigpTa->SetBinContent(596,124.633); + ssigpTa->SetBinContent(597,97.9624); + ssigpTa->SetBinContent(598,65.8158); + ssigpTa->SetBinContent(599,41.8657); + ssigpTa->SetBinContent(600,29.1797); + ssigpTa->SetBinContent(601,21.3248); + ssigpTa->SetBinContent(602,15.5293); + ssigpTa->SetBinContent(603,11.9636); + ssigpTa->SetBinContent(604,9.4721); + ssigpTa->SetBinContent(605,7.62751); + ssigpTa->SetBinContent(606,6.00129); + ssigpTa->SetBinContent(607,4.37984); + ssigpTa->SetBinContent(608,3.38649); + ssigpTa->SetBinContent(609,2.69159); + ssigpTa->SetBinContent(610,2.15241); + ssigpTa->SetBinContent(611,1.77948); + ssigpTa->SetBinContent(612,1.55847); + ssigpTa->SetBinContent(613,1.40797); + ssigpTa->SetBinContent(614,1.29991); + ssigpTa->SetBinContent(615,1.20183); + ssigpTa->SetBinContent(616,1.14097); + ssigpTa->SetBinContent(617,1.06724); + ssigpTa->SetBinContent(618,0.968742); + ssigpTa->SetBinContent(619,0.881756); + ssigpTa->SetBinContent(620,0.846482); + ssigpTa->SetBinContent(621,0.837181); + ssigpTa->SetBinContent(622,0.836285); + ssigpTa->SetBinContent(623,0.836125); + ssigpTa->SetBinContent(624,0.839083); + ssigpTa->SetBinContent(625,0.839132); + ssigpTa->SetBinContent(626,0.847042); + ssigpTa->SetBinContent(627,0.851605); + ssigpTa->SetBinContent(628,0.850756); + ssigpTa->SetBinContent(629,0.849362); + ssigpTa->SetBinContent(630,0.858532); + ssigpTa->SetBinContent(631,0.86405); + ssigpTa->SetBinContent(632,0.871502); + ssigpTa->SetBinContent(633,0.891447); + ssigpTa->SetBinContent(634,0.962778); + ssigpTa->SetBinContent(635,1.04436); + ssigpTa->SetBinContent(636,1.11453); + ssigpTa->SetBinContent(637,1.17489); + ssigpTa->SetBinContent(638,1.22984); + ssigpTa->SetBinContent(639,1.32168); + ssigpTa->SetBinContent(640,1.44507); + ssigpTa->SetBinContent(641,1.62397); + ssigpTa->SetBinContent(642,1.93063); + ssigpTa->SetBinContent(643,2.26309); + ssigpTa->SetBinContent(644,2.73084); + ssigpTa->SetBinContent(645,3.41541); + ssigpTa->SetBinContent(646,4.39199); + ssigpTa->SetBinContent(647,5.98215); + ssigpTa->SetBinContent(648,7.82655); + ssigpTa->SetBinContent(649,10.0177); + ssigpTa->SetBinContent(650,13.4935); + ssigpTa->SetBinContent(651,17.308); + ssigpTa->SetBinContent(652,22.1032); + ssigpTa->SetBinContent(653,29.7418); + ssigpTa->SetBinContent(654,42.936); + ssigpTa->SetBinContent(655,67.9078); + ssigpTa->SetBinContent(656,100.773); + ssigpTa->SetBinContent(657,126.171); + ssigpTa->SetBinContent(658,160.372); + ssigpTa->SetEntries(576); + + init = true; + } + + double percent = ssigpTa->Interpolate(eta, ptGeV); + return percent; + } + + // Fractional resolution in % + //double ITKPercentageresol(double pt [MeV], double eta) { + double UpgradePerformance::ITKPercentageresol_InclBrl(double ptMeV, double eta){ + static TH2D *ssigpTa; + static bool init = false; + + double ptGeV = ptMeV/1000.; + if (fabs(eta)>3.976) return 0.; + if(!init){ + Double_t xAxis1[65] = {-3.9375, -3.875, -3.75, -3.625, -3.5, -3.375, -3.25, -3.125, -3, -2.875, -2.75, -2.625, -2.5, -2.375, -2.25, -2.125, -2, -1.875, -1.75, -1.625, -1.5, -1.375, -1.25, -1.125, -1, -0.875, -0.75, -0.625, -0.5, -0.375, -0.25, -0.125, 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75, 3.875, 3.97688}; + Double_t yAxis1[10] = {1, 3, 7.5, 15, 25, 40, 60, 85, 3.55e+03, 7.07e+03}; + + ssigpTa = new TH2D("ssigpTa","ssigpTa",64, xAxis1,9, yAxis1); + ssigpTa->SetBinContent(67,0.302825); + ssigpTa->SetBinContent(68,0.278106); + ssigpTa->SetBinContent(69,0.242543); + ssigpTa->SetBinContent(70,0.214204); + ssigpTa->SetBinContent(71,0.186216); + ssigpTa->SetBinContent(72,0.162243); + ssigpTa->SetBinContent(73,0.138132); + ssigpTa->SetBinContent(74,0.10886); + ssigpTa->SetBinContent(75,0.0882723); + ssigpTa->SetBinContent(76,0.0753747); + ssigpTa->SetBinContent(77,0.0655204); + ssigpTa->SetBinContent(78,0.0555123); + ssigpTa->SetBinContent(79,0.0457184); + ssigpTa->SetBinContent(80,0.0385657); + ssigpTa->SetBinContent(81,0.0334656); + ssigpTa->SetBinContent(82,0.029209); + ssigpTa->SetBinContent(83,0.0262394); + ssigpTa->SetBinContent(84,0.0236513); + ssigpTa->SetBinContent(85,0.0213531); + ssigpTa->SetBinContent(86,0.0190535); + ssigpTa->SetBinContent(87,0.0170161); + ssigpTa->SetBinContent(88,0.015657); + ssigpTa->SetBinContent(89,0.0143463); + ssigpTa->SetBinContent(90,0.0129262); + ssigpTa->SetBinContent(91,0.011719); + ssigpTa->SetBinContent(92,0.0110308); + ssigpTa->SetBinContent(93,0.010645); + ssigpTa->SetBinContent(94,0.0104098); + ssigpTa->SetBinContent(95,0.0101748); + ssigpTa->SetBinContent(96,0.00997196); + ssigpTa->SetBinContent(97,0.00974426); + ssigpTa->SetBinContent(98,0.00958808); + ssigpTa->SetBinContent(99,0.00961771); + ssigpTa->SetBinContent(100,0.00965853); + ssigpTa->SetBinContent(101,0.00980291); + ssigpTa->SetBinContent(102,0.00998836); + ssigpTa->SetBinContent(103,0.0103057); + ssigpTa->SetBinContent(104,0.0107097); + ssigpTa->SetBinContent(105,0.0113089); + ssigpTa->SetBinContent(106,0.0123345); + ssigpTa->SetBinContent(107,0.0135243); + ssigpTa->SetBinContent(108,0.0148689); + ssigpTa->SetBinContent(109,0.015968); + ssigpTa->SetBinContent(110,0.017175); + ssigpTa->SetBinContent(111,0.0189552); + ssigpTa->SetBinContent(112,0.0211871); + ssigpTa->SetBinContent(113,0.023812); + ssigpTa->SetBinContent(114,0.0269943); + ssigpTa->SetBinContent(115,0.0298899); + ssigpTa->SetBinContent(116,0.0334379); + ssigpTa->SetBinContent(117,0.0380549); + ssigpTa->SetBinContent(118,0.0449799); + ssigpTa->SetBinContent(119,0.0546161); + ssigpTa->SetBinContent(120,0.0652541); + ssigpTa->SetBinContent(121,0.0791868); + ssigpTa->SetBinContent(122,0.0992091); + ssigpTa->SetBinContent(123,0.120238); + ssigpTa->SetBinContent(124,0.141202); + ssigpTa->SetBinContent(125,0.162152); + ssigpTa->SetBinContent(126,0.185712); + ssigpTa->SetBinContent(127,0.217806); + ssigpTa->SetBinContent(128,0.248991); + ssigpTa->SetBinContent(129,0.280218); + ssigpTa->SetBinContent(130,0.300126); + ssigpTa->SetBinContent(133,0.41831); + ssigpTa->SetBinContent(134,0.362642); + ssigpTa->SetBinContent(135,0.305234); + ssigpTa->SetBinContent(136,0.251607); + ssigpTa->SetBinContent(137,0.205598); + ssigpTa->SetBinContent(138,0.172768); + ssigpTa->SetBinContent(139,0.143078); + ssigpTa->SetBinContent(140,0.113367); + ssigpTa->SetBinContent(141,0.0917029); + ssigpTa->SetBinContent(142,0.0793054); + ssigpTa->SetBinContent(143,0.069323); + ssigpTa->SetBinContent(144,0.0589073); + ssigpTa->SetBinContent(145,0.047842); + ssigpTa->SetBinContent(146,0.0396782); + ssigpTa->SetBinContent(147,0.0340484); + ssigpTa->SetBinContent(148,0.0296152); + ssigpTa->SetBinContent(149,0.026304); + ssigpTa->SetBinContent(150,0.0237863); + ssigpTa->SetBinContent(151,0.0213268); + ssigpTa->SetBinContent(152,0.0191172); + ssigpTa->SetBinContent(153,0.0172097); + ssigpTa->SetBinContent(154,0.0158145); + ssigpTa->SetBinContent(155,0.0146503); + ssigpTa->SetBinContent(156,0.0132187); + ssigpTa->SetBinContent(157,0.0120224); + ssigpTa->SetBinContent(158,0.011302); + ssigpTa->SetBinContent(159,0.0108657); + ssigpTa->SetBinContent(160,0.0105489); + ssigpTa->SetBinContent(161,0.010274); + ssigpTa->SetBinContent(162,0.0100359); + ssigpTa->SetBinContent(163,0.00988613); + ssigpTa->SetBinContent(164,0.00979926); + ssigpTa->SetBinContent(165,0.00972467); + ssigpTa->SetBinContent(166,0.00980999); + ssigpTa->SetBinContent(167,0.00988959); + ssigpTa->SetBinContent(168,0.0100939); + ssigpTa->SetBinContent(169,0.0103987); + ssigpTa->SetBinContent(170,0.0107931); + ssigpTa->SetBinContent(171,0.0114662); + ssigpTa->SetBinContent(172,0.0125282); + ssigpTa->SetBinContent(173,0.0138312); + ssigpTa->SetBinContent(174,0.0150466); + ssigpTa->SetBinContent(175,0.0161512); + ssigpTa->SetBinContent(176,0.0173263); + ssigpTa->SetBinContent(177,0.0190517); + ssigpTa->SetBinContent(178,0.0212629); + ssigpTa->SetBinContent(179,0.0240354); + ssigpTa->SetBinContent(180,0.0273099); + ssigpTa->SetBinContent(181,0.0306433); + ssigpTa->SetBinContent(182,0.0342938); + ssigpTa->SetBinContent(183,0.0392819); + ssigpTa->SetBinContent(184,0.047162); + ssigpTa->SetBinContent(185,0.0574508); + ssigpTa->SetBinContent(186,0.0681965); + ssigpTa->SetBinContent(187,0.0826509); + ssigpTa->SetBinContent(188,0.102663); + ssigpTa->SetBinContent(189,0.124523); + ssigpTa->SetBinContent(190,0.147645); + ssigpTa->SetBinContent(191,0.172028); + ssigpTa->SetBinContent(192,0.20638); + ssigpTa->SetBinContent(193,0.25799); + ssigpTa->SetBinContent(194,0.312852); + ssigpTa->SetBinContent(195,0.366997); + ssigpTa->SetBinContent(196,0.417549); + ssigpTa->SetBinContent(199,0.625229); + ssigpTa->SetBinContent(200,0.538419); + ssigpTa->SetBinContent(201,0.426936); + ssigpTa->SetBinContent(202,0.326886); + ssigpTa->SetBinContent(203,0.244703); + ssigpTa->SetBinContent(204,0.194237); + ssigpTa->SetBinContent(205,0.158315); + ssigpTa->SetBinContent(206,0.123332); + ssigpTa->SetBinContent(207,0.0992206); + ssigpTa->SetBinContent(208,0.0856772); + ssigpTa->SetBinContent(209,0.0750335); + ssigpTa->SetBinContent(210,0.0632285); + ssigpTa->SetBinContent(211,0.0508423); + ssigpTa->SetBinContent(212,0.0415123); + ssigpTa->SetBinContent(213,0.0353965); + ssigpTa->SetBinContent(214,0.0305427); + ssigpTa->SetBinContent(215,0.0271525); + ssigpTa->SetBinContent(216,0.0243407); + ssigpTa->SetBinContent(217,0.0218683); + ssigpTa->SetBinContent(218,0.0195884); + ssigpTa->SetBinContent(219,0.0176411); + ssigpTa->SetBinContent(220,0.0162989); + ssigpTa->SetBinContent(221,0.0150678); + ssigpTa->SetBinContent(222,0.0136415); + ssigpTa->SetBinContent(223,0.012448); + ssigpTa->SetBinContent(224,0.0117045); + ssigpTa->SetBinContent(225,0.0112398); + ssigpTa->SetBinContent(226,0.0108426); + ssigpTa->SetBinContent(227,0.0104886); + ssigpTa->SetBinContent(228,0.0102789); + ssigpTa->SetBinContent(229,0.010184); + ssigpTa->SetBinContent(230,0.01014); + ssigpTa->SetBinContent(231,0.0101438); + ssigpTa->SetBinContent(232,0.0101049); + ssigpTa->SetBinContent(233,0.0101676); + ssigpTa->SetBinContent(234,0.0103756); + ssigpTa->SetBinContent(235,0.0106981); + ssigpTa->SetBinContent(236,0.0110851); + ssigpTa->SetBinContent(237,0.0118014); + ssigpTa->SetBinContent(238,0.0129991); + ssigpTa->SetBinContent(239,0.0142548); + ssigpTa->SetBinContent(240,0.0154796); + ssigpTa->SetBinContent(241,0.0164886); + ssigpTa->SetBinContent(242,0.0176661); + ssigpTa->SetBinContent(243,0.0194148); + ssigpTa->SetBinContent(244,0.0215655); + ssigpTa->SetBinContent(245,0.0245431); + ssigpTa->SetBinContent(246,0.0282026); + ssigpTa->SetBinContent(247,0.0318013); + ssigpTa->SetBinContent(248,0.0359374); + ssigpTa->SetBinContent(249,0.0416142); + ssigpTa->SetBinContent(250,0.0504631); + ssigpTa->SetBinContent(251,0.062172); + ssigpTa->SetBinContent(252,0.0739705); + ssigpTa->SetBinContent(253,0.0891939); + ssigpTa->SetBinContent(254,0.111109); + ssigpTa->SetBinContent(255,0.135509); + ssigpTa->SetBinContent(256,0.161693); + ssigpTa->SetBinContent(257,0.193015); + ssigpTa->SetBinContent(258,0.245831); + ssigpTa->SetBinContent(259,0.330486); + ssigpTa->SetBinContent(260,0.434318); + ssigpTa->SetBinContent(261,0.542746); + ssigpTa->SetBinContent(262,0.623201); + ssigpTa->SetBinContent(265,0.995596); + ssigpTa->SetBinContent(266,0.829538); + ssigpTa->SetBinContent(267,0.630564); + ssigpTa->SetBinContent(268,0.449395); + ssigpTa->SetBinContent(269,0.309924); + ssigpTa->SetBinContent(270,0.232429); + ssigpTa->SetBinContent(271,0.185494); + ssigpTa->SetBinContent(272,0.142203); + ssigpTa->SetBinContent(273,0.112945); + ssigpTa->SetBinContent(274,0.0957407); + ssigpTa->SetBinContent(275,0.0826167); + ssigpTa->SetBinContent(276,0.0690124); + ssigpTa->SetBinContent(277,0.0545151); + ssigpTa->SetBinContent(278,0.044088); + ssigpTa->SetBinContent(279,0.0372386); + ssigpTa->SetBinContent(280,0.0318453); + ssigpTa->SetBinContent(281,0.0281473); + ssigpTa->SetBinContent(282,0.025304); + ssigpTa->SetBinContent(283,0.0226911); + ssigpTa->SetBinContent(284,0.0204682); + ssigpTa->SetBinContent(285,0.0184644); + ssigpTa->SetBinContent(286,0.0169648); + ssigpTa->SetBinContent(287,0.015693); + ssigpTa->SetBinContent(288,0.0142333); + ssigpTa->SetBinContent(289,0.0129683); + ssigpTa->SetBinContent(290,0.0122114); + ssigpTa->SetBinContent(291,0.0116982); + ssigpTa->SetBinContent(292,0.0112631); + ssigpTa->SetBinContent(293,0.0109009); + ssigpTa->SetBinContent(294,0.0107122); + ssigpTa->SetBinContent(295,0.0107012); + ssigpTa->SetBinContent(296,0.010754); + ssigpTa->SetBinContent(297,0.0107511); + ssigpTa->SetBinContent(298,0.0107141); + ssigpTa->SetBinContent(299,0.0107192); + ssigpTa->SetBinContent(300,0.0109204); + ssigpTa->SetBinContent(301,0.0112608); + ssigpTa->SetBinContent(302,0.0116673); + ssigpTa->SetBinContent(303,0.0124274); + ssigpTa->SetBinContent(304,0.0136883); + ssigpTa->SetBinContent(305,0.0150691); + ssigpTa->SetBinContent(306,0.0161921); + ssigpTa->SetBinContent(307,0.0172015); + ssigpTa->SetBinContent(308,0.0184128); + ssigpTa->SetBinContent(309,0.0201555); + ssigpTa->SetBinContent(310,0.022394); + ssigpTa->SetBinContent(311,0.0255109); + ssigpTa->SetBinContent(312,0.0296398); + ssigpTa->SetBinContent(313,0.0336521); + ssigpTa->SetBinContent(314,0.0382778); + ssigpTa->SetBinContent(315,0.0445322); + ssigpTa->SetBinContent(316,0.0548477); + ssigpTa->SetBinContent(317,0.0683803); + ssigpTa->SetBinContent(318,0.0819092); + ssigpTa->SetBinContent(319,0.100076); + ssigpTa->SetBinContent(320,0.126156); + ssigpTa->SetBinContent(321,0.154715); + ssigpTa->SetBinContent(322,0.187463); + ssigpTa->SetBinContent(323,0.229882); + ssigpTa->SetBinContent(324,0.306514); + ssigpTa->SetBinContent(325,0.446806); + ssigpTa->SetBinContent(326,0.625029); + ssigpTa->SetBinContent(327,0.81461); + ssigpTa->SetBinContent(328,0.980515); + ssigpTa->SetBinContent(331,1.52854); + ssigpTa->SetBinContent(332,1.27087); + ssigpTa->SetBinContent(333,0.933998); + ssigpTa->SetBinContent(334,0.628459); + ssigpTa->SetBinContent(335,0.409514); + ssigpTa->SetBinContent(336,0.292652); + ssigpTa->SetBinContent(337,0.227896); + ssigpTa->SetBinContent(338,0.171654); + ssigpTa->SetBinContent(339,0.132102); + ssigpTa->SetBinContent(340,0.110605); + ssigpTa->SetBinContent(341,0.0939319); + ssigpTa->SetBinContent(342,0.0774066); + ssigpTa->SetBinContent(343,0.0604369); + ssigpTa->SetBinContent(344,0.0481876); + ssigpTa->SetBinContent(345,0.040134); + ssigpTa->SetBinContent(346,0.0337438); + ssigpTa->SetBinContent(347,0.0293017); + ssigpTa->SetBinContent(348,0.0263205); + ssigpTa->SetBinContent(349,0.023721); + ssigpTa->SetBinContent(350,0.021542); + ssigpTa->SetBinContent(351,0.0195209); + ssigpTa->SetBinContent(352,0.0180105); + ssigpTa->SetBinContent(353,0.0166938); + ssigpTa->SetBinContent(354,0.015153); + ssigpTa->SetBinContent(355,0.0138792); + ssigpTa->SetBinContent(356,0.0130486); + ssigpTa->SetBinContent(357,0.0124835); + ssigpTa->SetBinContent(358,0.0120551); + ssigpTa->SetBinContent(359,0.0117579); + ssigpTa->SetBinContent(360,0.0116613); + ssigpTa->SetBinContent(361,0.0116691); + ssigpTa->SetBinContent(362,0.0117191); + ssigpTa->SetBinContent(363,0.0117512); + ssigpTa->SetBinContent(364,0.0117316); + ssigpTa->SetBinContent(365,0.011749); + ssigpTa->SetBinContent(366,0.0119405); + ssigpTa->SetBinContent(367,0.0122325); + ssigpTa->SetBinContent(368,0.0125852); + ssigpTa->SetBinContent(369,0.0133596); + ssigpTa->SetBinContent(370,0.0147422); + ssigpTa->SetBinContent(371,0.0161959); + ssigpTa->SetBinContent(372,0.0174357); + ssigpTa->SetBinContent(373,0.018485); + ssigpTa->SetBinContent(374,0.0196707); + ssigpTa->SetBinContent(375,0.0213993); + ssigpTa->SetBinContent(376,0.0236048); + ssigpTa->SetBinContent(377,0.0270538); + ssigpTa->SetBinContent(378,0.0315933); + ssigpTa->SetBinContent(379,0.036317); + ssigpTa->SetBinContent(380,0.0415299); + ssigpTa->SetBinContent(381,0.0488393); + ssigpTa->SetBinContent(382,0.0607867); + ssigpTa->SetBinContent(383,0.0771715); + ssigpTa->SetBinContent(384,0.0943235); + ssigpTa->SetBinContent(385,0.11752); + ssigpTa->SetBinContent(386,0.151066); + ssigpTa->SetBinContent(387,0.188767); + ssigpTa->SetBinContent(388,0.231597); + ssigpTa->SetBinContent(389,0.28974); + ssigpTa->SetBinContent(390,0.405041); + ssigpTa->SetBinContent(391,0.618942); + ssigpTa->SetBinContent(392,0.907471); + ssigpTa->SetBinContent(393,1.23228); + ssigpTa->SetBinContent(394,1.4704); + ssigpTa->SetBinContent(397,2.27986); + ssigpTa->SetBinContent(398,1.86615); + ssigpTa->SetBinContent(399,1.36063); + ssigpTa->SetBinContent(400,0.895061); + ssigpTa->SetBinContent(401,0.557255); + ssigpTa->SetBinContent(402,0.38876); + ssigpTa->SetBinContent(403,0.294401); + ssigpTa->SetBinContent(404,0.213651); + ssigpTa->SetBinContent(405,0.161093); + ssigpTa->SetBinContent(406,0.131996); + ssigpTa->SetBinContent(407,0.111604); + ssigpTa->SetBinContent(408,0.0907277); + ssigpTa->SetBinContent(409,0.0696755); + ssigpTa->SetBinContent(410,0.0546332); + ssigpTa->SetBinContent(411,0.044921); + ssigpTa->SetBinContent(412,0.0368257); + ssigpTa->SetBinContent(413,0.0315499); + ssigpTa->SetBinContent(414,0.0280534); + ssigpTa->SetBinContent(415,0.0254186); + ssigpTa->SetBinContent(416,0.0232239); + ssigpTa->SetBinContent(417,0.0213103); + ssigpTa->SetBinContent(418,0.0198122); + ssigpTa->SetBinContent(419,0.0184599); + ssigpTa->SetBinContent(420,0.016869); + ssigpTa->SetBinContent(421,0.0154623); + ssigpTa->SetBinContent(422,0.0145751); + ssigpTa->SetBinContent(423,0.0140266); + ssigpTa->SetBinContent(424,0.013661); + ssigpTa->SetBinContent(425,0.0135057); + ssigpTa->SetBinContent(426,0.0135154); + ssigpTa->SetBinContent(427,0.0135363); + ssigpTa->SetBinContent(428,0.0134944); + ssigpTa->SetBinContent(429,0.0134682); + ssigpTa->SetBinContent(430,0.013467); + ssigpTa->SetBinContent(431,0.0135135); + ssigpTa->SetBinContent(432,0.0136691); + ssigpTa->SetBinContent(433,0.0138814); + ssigpTa->SetBinContent(434,0.01418); + ssigpTa->SetBinContent(435,0.0149264); + ssigpTa->SetBinContent(436,0.0163867); + ssigpTa->SetBinContent(437,0.0180208); + ssigpTa->SetBinContent(438,0.0193653); + ssigpTa->SetBinContent(439,0.0204703); + ssigpTa->SetBinContent(440,0.0217); + ssigpTa->SetBinContent(441,0.0233511); + ssigpTa->SetBinContent(442,0.0255562); + ssigpTa->SetBinContent(443,0.0292021); + ssigpTa->SetBinContent(444,0.0344811); + ssigpTa->SetBinContent(445,0.0399634); + ssigpTa->SetBinContent(446,0.0464906); + ssigpTa->SetBinContent(447,0.0552774); + ssigpTa->SetBinContent(448,0.070038); + ssigpTa->SetBinContent(449,0.0907901); + ssigpTa->SetBinContent(450,0.112944); + ssigpTa->SetBinContent(451,0.143924); + ssigpTa->SetBinContent(452,0.188747); + ssigpTa->SetBinContent(453,0.238869); + ssigpTa->SetBinContent(454,0.299343); + ssigpTa->SetBinContent(455,0.382648); + ssigpTa->SetBinContent(456,0.550824); + ssigpTa->SetBinContent(457,0.872061); + ssigpTa->SetBinContent(458,1.32881); + ssigpTa->SetBinContent(459,1.81465); + ssigpTa->SetBinContent(460,2.22573); + ssigpTa->SetBinContent(463,21.5641); + ssigpTa->SetBinContent(464,12.8163); + ssigpTa->SetBinContent(465,8.9051); + ssigpTa->SetBinContent(466,5.46843); + ssigpTa->SetBinContent(467,2.90312); + ssigpTa->SetBinContent(468,2.23696); + ssigpTa->SetBinContent(469,1.75773); + ssigpTa->SetBinContent(470,1.10213); + ssigpTa->SetBinContent(471,0.833982); + ssigpTa->SetBinContent(472,0.709051); + ssigpTa->SetBinContent(473,0.600797); + ssigpTa->SetBinContent(474,0.486651); + ssigpTa->SetBinContent(475,0.325414); + ssigpTa->SetBinContent(476,0.259145); + ssigpTa->SetBinContent(477,0.224566); + ssigpTa->SetBinContent(478,0.170036); + ssigpTa->SetBinContent(479,0.144557); + ssigpTa->SetBinContent(480,0.130681); + ssigpTa->SetBinContent(481,0.117919); + ssigpTa->SetBinContent(482,0.111707); + ssigpTa->SetBinContent(483,0.10228); + ssigpTa->SetBinContent(484,0.0983125); + ssigpTa->SetBinContent(485,0.0940134); + ssigpTa->SetBinContent(486,0.0823725); + ssigpTa->SetBinContent(487,0.0745323); + ssigpTa->SetBinContent(488,0.0720143); + ssigpTa->SetBinContent(489,0.0699794); + ssigpTa->SetBinContent(490,0.0689341); + ssigpTa->SetBinContent(491,0.068161); + ssigpTa->SetBinContent(492,0.0690122); + ssigpTa->SetBinContent(493,0.0713494); + ssigpTa->SetBinContent(494,0.0723612); + ssigpTa->SetBinContent(495,0.0721793); + ssigpTa->SetBinContent(496,0.0707842); + ssigpTa->SetBinContent(497,0.0689267); + ssigpTa->SetBinContent(498,0.0695199); + ssigpTa->SetBinContent(499,0.0711967); + ssigpTa->SetBinContent(500,0.0715707); + ssigpTa->SetBinContent(501,0.0734314); + ssigpTa->SetBinContent(502,0.0805427); + ssigpTa->SetBinContent(503,0.0902541); + ssigpTa->SetBinContent(504,0.0952128); + ssigpTa->SetBinContent(505,0.0996744); + ssigpTa->SetBinContent(506,0.10218); + ssigpTa->SetBinContent(507,0.110438); + ssigpTa->SetBinContent(508,0.117139); + ssigpTa->SetBinContent(509,0.1318); + ssigpTa->SetBinContent(510,0.167252); + ssigpTa->SetBinContent(511,0.190781); + ssigpTa->SetBinContent(512,0.229543); + ssigpTa->SetBinContent(513,0.273375); + ssigpTa->SetBinContent(514,0.336827); + ssigpTa->SetBinContent(515,0.49101); + ssigpTa->SetBinContent(516,0.596771); + ssigpTa->SetBinContent(517,0.733069); + ssigpTa->SetBinContent(518,1.08062); + ssigpTa->SetBinContent(519,1.33108); + ssigpTa->SetBinContent(520,1.74066); + ssigpTa->SetBinContent(521,2.20907); + ssigpTa->SetBinContent(522,2.93802); + ssigpTa->SetBinContent(523,5.1485); + ssigpTa->SetBinContent(524,8.38387); + ssigpTa->SetBinContent(525,12.7372); + ssigpTa->SetBinContent(526,22.0213); + ssigpTa->SetBinContent(529,71.8105); + ssigpTa->SetBinContent(530,68.7159); + ssigpTa->SetBinContent(531,46.2939); + ssigpTa->SetBinContent(532,29.5014); + ssigpTa->SetBinContent(533,17.8771); + ssigpTa->SetBinContent(534,11.5878); + ssigpTa->SetBinContent(535,8.67092); + ssigpTa->SetBinContent(536,6.26263); + ssigpTa->SetBinContent(537,4.44057); + ssigpTa->SetBinContent(538,3.62951); + ssigpTa->SetBinContent(539,3.05859); + ssigpTa->SetBinContent(540,2.39129); + ssigpTa->SetBinContent(541,1.79714); + ssigpTa->SetBinContent(542,1.34814); + ssigpTa->SetBinContent(543,1.09406); + ssigpTa->SetBinContent(544,0.902837); + ssigpTa->SetBinContent(545,0.741477); + ssigpTa->SetBinContent(546,0.656494); + ssigpTa->SetBinContent(547,0.603886); + ssigpTa->SetBinContent(548,0.55715); + ssigpTa->SetBinContent(549,0.526126); + ssigpTa->SetBinContent(550,0.497882); + ssigpTa->SetBinContent(551,0.464739); + ssigpTa->SetBinContent(552,0.423335); + ssigpTa->SetBinContent(553,0.384838); + ssigpTa->SetBinContent(554,0.364341); + ssigpTa->SetBinContent(555,0.355774); + ssigpTa->SetBinContent(556,0.349206); + ssigpTa->SetBinContent(557,0.347483); + ssigpTa->SetBinContent(558,0.352277); + ssigpTa->SetBinContent(559,0.360839); + ssigpTa->SetBinContent(560,0.367589); + ssigpTa->SetBinContent(561,0.366764); + ssigpTa->SetBinContent(562,0.359834); + ssigpTa->SetBinContent(563,0.354143); + ssigpTa->SetBinContent(564,0.354497); + ssigpTa->SetBinContent(565,0.359035); + ssigpTa->SetBinContent(566,0.364904); + ssigpTa->SetBinContent(567,0.379772); + ssigpTa->SetBinContent(568,0.411759); + ssigpTa->SetBinContent(569,0.449085); + ssigpTa->SetBinContent(570,0.481306); + ssigpTa->SetBinContent(571,0.499317); + ssigpTa->SetBinContent(572,0.523765); + ssigpTa->SetBinContent(573,0.550889); + ssigpTa->SetBinContent(574,0.598158); + ssigpTa->SetBinContent(575,0.695232); + ssigpTa->SetBinContent(576,0.820364); + ssigpTa->SetBinContent(577,0.988802); + ssigpTa->SetBinContent(578,1.16607); + ssigpTa->SetBinContent(579,1.4061); + ssigpTa->SetBinContent(580,1.85758); + ssigpTa->SetBinContent(581,2.40942); + ssigpTa->SetBinContent(582,3.0721); + ssigpTa->SetBinContent(583,4.08491); + ssigpTa->SetBinContent(584,5.33852); + ssigpTa->SetBinContent(585,7.0914); + ssigpTa->SetBinContent(586,8.99523); + ssigpTa->SetBinContent(587,11.6029); + ssigpTa->SetBinContent(588,17.3369); + ssigpTa->SetBinContent(589,27.9904); + ssigpTa->SetBinContent(590,44.564); + ssigpTa->SetBinContent(591,68.306); + ssigpTa->SetBinContent(592,72.6957); + ssigpTa->SetBinContent(595,183.298); + ssigpTa->SetBinContent(596,141.681); + ssigpTa->SetBinContent(597,111.897); + ssigpTa->SetBinContent(598,72.7251); + ssigpTa->SetBinContent(599,44.2631); + ssigpTa->SetBinContent(600,29.5755); + ssigpTa->SetBinContent(601,21.0822); + ssigpTa->SetBinContent(602,14.9078); + ssigpTa->SetBinContent(603,11.0837); + ssigpTa->SetBinContent(604,8.7594); + ssigpTa->SetBinContent(605,7.202); + ssigpTa->SetBinContent(606,5.76455); + ssigpTa->SetBinContent(607,4.27326); + ssigpTa->SetBinContent(608,3.29775); + ssigpTa->SetBinContent(609,2.65499); + ssigpTa->SetBinContent(610,2.1352); + ssigpTa->SetBinContent(611,1.79855); + ssigpTa->SetBinContent(612,1.57696); + ssigpTa->SetBinContent(613,1.43024); + ssigpTa->SetBinContent(614,1.33483); + ssigpTa->SetBinContent(615,1.24529); + ssigpTa->SetBinContent(616,1.17859); + ssigpTa->SetBinContent(617,1.10398); + ssigpTa->SetBinContent(618,1.00294); + ssigpTa->SetBinContent(619,0.920033); + ssigpTa->SetBinContent(620,0.871823); + ssigpTa->SetBinContent(621,0.844588); + ssigpTa->SetBinContent(622,0.831432); + ssigpTa->SetBinContent(623,0.827014); + ssigpTa->SetBinContent(624,0.836643); + ssigpTa->SetBinContent(625,0.856207); + ssigpTa->SetBinContent(626,0.868763); + ssigpTa->SetBinContent(627,0.867924); + ssigpTa->SetBinContent(628,0.85534); + ssigpTa->SetBinContent(629,0.842024); + ssigpTa->SetBinContent(630,0.842836); + ssigpTa->SetBinContent(631,0.854004); + ssigpTa->SetBinContent(632,0.870583); + ssigpTa->SetBinContent(633,0.907685); + ssigpTa->SetBinContent(634,0.978009); + ssigpTa->SetBinContent(635,1.06629); + ssigpTa->SetBinContent(636,1.13289); + ssigpTa->SetBinContent(637,1.19039); + ssigpTa->SetBinContent(638,1.23876); + ssigpTa->SetBinContent(639,1.32092); + ssigpTa->SetBinContent(640,1.44404); + ssigpTa->SetBinContent(641,1.64837); + ssigpTa->SetBinContent(642,1.98509); + ssigpTa->SetBinContent(643,2.33773); + ssigpTa->SetBinContent(644,2.80388); + ssigpTa->SetBinContent(645,3.45953); + ssigpTa->SetBinContent(646,4.39325); + ssigpTa->SetBinContent(647,5.83543); + ssigpTa->SetBinContent(648,7.49573); + ssigpTa->SetBinContent(649,9.66533); + ssigpTa->SetBinContent(650,13.0915); + ssigpTa->SetBinContent(651,16.7921); + ssigpTa->SetBinContent(652,21.7755); + ssigpTa->SetBinContent(653,29.394); + ssigpTa->SetBinContent(654,43.0998); + ssigpTa->SetBinContent(655,69.455); + ssigpTa->SetBinContent(656,108.198); + ssigpTa->SetBinContent(657,140.509); + ssigpTa->SetBinContent(658,185.521); + ssigpTa->SetEntries(576); + + init = true; + } + + double percent = ssigpTa->Interpolate(eta, ptGeV); + return percent; + } + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TriggerPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TriggerPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7f8f31121e1cb0accb4c975b1e2290f9a1da404f --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/TriggerPerformanceFunctions.cxx @@ -0,0 +1,228 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGGERPERFORMANCEFUNCTIONS_CXX +#define TRIGGERPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +float UpgradePerformanceFunctions::getSingleElectronTriggerEfficiency(float ptMeV, float eta) { + float minPt = 22000.; + float minPtHighEta = 35000; + float maxEta = 4.0; + float eff = 0.95; + float effHighEta = 0.90; + if ( m_layout == LoI ) { + minPt = 25000.; + maxEta = 2.5; + eff = 0.88; + } else if ( m_layout == LoIVF ) { + minPt = 25000.; + eff = 0.88; + effHighEta = 0.88; + } else if ( m_layout == silver ) { + minPt = 28000.; + minPtHighEta = 40000.; + maxEta = 3.2; + } else if ( m_layout == bronze ) { + minPt = 28000.; + maxEta = 2.5; + eff = 0.91; + } + + // HGTD forward trigger 5 GeV improvement + if (m_bUseHGTD0 || m_bUseHGTD1) + minPtHighEta = 30000.; + + if ( ptMeV > 50000. && fabs(eta) < 2.5 ) return 1.0; + if ( ptMeV > 35000. && fabs(eta) < 2.5 && m_layout == gold) return 1.0; + if ( ptMeV > minPt && fabs(eta) < 2.5 ) + return eff; + if ( ptMeV > minPtHighEta && fabs(eta) < maxEta ) + return effHighEta; + // std::cout << "WARNING: no trigger efficiency is returned for pT "<<ptMeV/1000.<<" GeV, eta="<<eta<<", since it is assumed this will be the first unprescaled single electron trigger threshold !" << std::endl; + return 0.0; +} + +float UpgradePerformanceFunctions::getDiElectronTriggerEfficiency(float pt1MeV, float pt2MeV, float eta1, float eta2) { + if (pt1MeV<15000. || pt2MeV<15000. || fabs(eta1)>2.5 || fabs(eta2)>2.5) { + //std::cout << "WARNING: no trigger efficiency is returned for pT<15 GeV or eta>2.5, since it is assumed this will be the lowest unprescaled di-lepton trigger threshold !" << std::endl; + return 0.0; + } + float eff=0.95; //single lepton efficiency + if ( m_layout == LoI || m_layout == LoIVF) { + eff = 0.88; + } else if (m_layout == bronze ) { + eff = 0.91; + } + return eff*eff; +} + +float UpgradePerformanceFunctions::getSinglePhotonTriggerEfficiency(float etMeV, float eta) { + if (etMeV<120000. || fabs(eta)>2.4 ) { + std::cout << "WARNING: no trigger efficiency is returned for PT<120 GeV or eta>2.4 since it is assumed this will be the lowest photon trigger threshold !" << std::endl; + return 0.; + } + return 1.0; +} + +float UpgradePerformanceFunctions::getDiPhotonTriggerEfficiency(float et1MeV, float et2MeV, float eta1, float eta2) { + if (et1MeV<25000. || et2MeV<25000. || fabs(eta1)>2.4 || fabs(eta2)>2.4) { + std::cout << "WARNING: no trigger efficiency is returned for PT<25 GeV or eta >2.4 since it is assumed this will be the lowest diphoton trigger threshold !" << std::endl; + return 0.; + } + return 1.00; +} + +float UpgradePerformanceFunctions::muonEtaTriggerEfficiency(float eta) { + + // rpc L0 efficiency data 22 bins for 0<eta<1.1 + const float eta_bin = 0.05; + const float eff_gold[22] = {0.790656, 0.930483, 0.98033, 0.992508, 0.974555, 0.981241, 0.985142, 0.947444, 0.960144, 0.98223, 0.983938, 0.984972, 0.972907, 0.982902, 0.919753, 0.899409, 0.970952, 0.960322, 0.946016, 0.868755, 0.619748,0}; + const float eff_silver[22] = {0.466976, 0.640636, 0.78031, 0.875155, 0.786891, 0.817936, 0.857857, 0.735092, 0.614015, 0.732087, 0.820762, 0.799978, 0.911093, 0.971162, 0.911653, 0.899409, 0.970952, 0.960322, 0.946016, 0.868755, 0.619748, 0 }; + const float eff_bronze[22] = {0.466303, 0.638691, 0.776874, 0.874595, 0.785156, 0.816267, 0.856739, 0.73399, 0.610921, 0.730391, 0.820209, 0.798315, 0.82698, 0.716125, 0.565287, 0.486861, 0.529895, 0.562725, 0.48137, 0.238961, 0.116867, 0}; + //======= + + float eff = 0.98*0.98; //TGC*MDT efficiency + if (fabs(eta)>2.4) return 0.; + if (fabs(eta)>1.05) { + if ( m_layout == LoI || m_layout == LoIVF) eff=0.86; //obsolete numbers + if ( m_layout == bronze) eff*=0.98; //additional 2% loss from L1Track + } else { + int ibin=fabs(eta)/eta_bin; + float eff_rpc= eff=0.70; //obsolete numbers + if ( m_layout == gold ) { + eff_rpc=eff_gold[ibin]; + } else if ( m_layout == silver ) { + eff_rpc=eff_silver[ibin]; + } else if (m_layout == bronze) { + eff_rpc=eff_bronze[ibin]; + } + + if ( m_layout == gold ) eff=eff_rpc*0.98; //RPC recovery with BI RPC chambers + if ( m_layout == silver ) eff=eff_rpc*0.98; //only partial recovery with BI RPC chambers + if ( m_layout == bronze ) eff=eff_rpc*0.98*0.98; //inefficient RPC, and additional 2% L1Track inefficiency + } + return eff; +} + +float UpgradePerformanceFunctions::getSingleMuonTriggerEfficiency(float etMeV, float eta) { + //single-mu trigger efficiency w.r.t. reconstruction efficiency (tight=true) + //using 2012 values from K. Nagano + float minPt=25000.; + if ( m_layout == gold ) minPt=20000.; + if (etMeV > minPt) return muonEtaTriggerEfficiency(eta); + return 0.; +} + +float UpgradePerformanceFunctions::getDiMuonTriggerEfficiency(float et1MeV, float et2MeV, float eta1, float eta2) { + float eff=muonEtaTriggerEfficiency(eta1)*muonEtaTriggerEfficiency(eta2); + float minPt=15000.; + if (m_layout == gold) minPt=11000.; + + // Result is product of individual muon efficiencies + if (et1MeV > minPt && et2MeV > minPt) return eff; + return 0.; +} + +float UpgradePerformanceFunctions::getElectronMuonTriggerEfficiency(float elecEtMeV, float muonEtMeV, float elecEta, float muonEta) { + float minPt = 15000.; + float muonEff = muonEtaTriggerEfficiency(muonEta); + float elecEff = 0.95; + if (m_layout == bronze) elecEff = 0.91; + if (fabs(elecEta) > 2.5) elecEff = 0.; + // Result is product of individual efficiencies + if (elecEtMeV > minPt && muonEtMeV > minPt) return muonEff*elecEff; + return 0.; +} + +float UpgradePerformanceFunctions::getSingleTauTriggerEfficiency(float etMeV, float eta, short prong) { + if (etMeV<150000. || fabs(eta)>2.5 || prong>3) { + std::cout << "WARNING: no trigger efficiency is returned for ET<150 GeV or |eta|>2.5. since it is assumed this will be the first unprescaled single tau trigger threshold !" << std::endl; + return 0.; + } + return 0.80; +} + +float UpgradePerformanceFunctions::getDiTauTriggerEfficiency(float et1MeV, float et2MeV, + float eta1, float eta2, + short prong1, short prong2) { + float et1 = et1MeV; + float et2 = et2MeV; + if ( et1 < et2 ) { + et1 = et2MeV; + et2 = et1MeV; + } + float minPt1 = 40000.; + float minPt2 = 30000.; + float eff = 0.80; //single tau efficiency + if ( m_layout == silver || m_layout == bronze) { + minPt1 = 50000.; + minPt2 = 50000.; + } + if ( m_layout == bronze ) eff = 0.75; + if ( fabs(eta1)>2.5 || fabs(eta2)>2.5 || prong1>3 || prong2>3 ) return 0.; + if ( et1 > minPt1 && et2 > minPt2 ) return eff*eff; + return 0; +} + +// Hadronic trigger efficiencies from A. Sfyrla and S. Demers +// All input arguments are the "smeared" jet/MET/HT energies. +// (Users must have done the smearing before calling these methods.) + +float UpgradePerformanceFunctions::getSingleJetTriggerEfficiency(float smearedEtMeV, float eta) { + if (smearedEtMeV<m_JetTrig1jMin || fabs(eta)>m_JetTrigMaxEta) { + return 0.; + } else { + return 0.95; + } +} + +float UpgradePerformanceFunctions::getThreeJetTriggerEfficiency(float smearedEtMeV1, float eta1, float smearedEtMeV2, float eta2, float smearedEtMeV3, float eta3) { + if (smearedEtMeV1<m_JetTrig3jMin || fabs(eta1)>m_JetTrigMaxEta || + smearedEtMeV2<m_JetTrig3jMin || fabs(eta2)>m_JetTrigMaxEta || + smearedEtMeV3<m_JetTrig3jMin || fabs(eta3)>m_JetTrigMaxEta) { + return 0.; + } else { + return 0.95; + } +} + +float UpgradePerformanceFunctions::getFourJetTriggerEfficiency(float smearedEtMeV1, float eta1, float smearedEtMeV2, float eta2, float smearedEtMeV3, float eta3, float smearedEtMeV4, float eta4) { + if (smearedEtMeV1<m_JetTrig4jMin || fabs(eta1)>m_JetTrigMaxEta || + smearedEtMeV2<m_JetTrig4jMin || fabs(eta2)>m_JetTrigMaxEta || + smearedEtMeV3<m_JetTrig4jMin || fabs(eta3)>m_JetTrigMaxEta || + smearedEtMeV4<m_JetTrig4jMin || fabs(eta4)>m_JetTrigMaxEta) { + return 0.; + } else { + return 0.95; + } +} + +float UpgradePerformanceFunctions::getHTTriggerEfficiency(float smearedHTMeV) { + if (smearedHTMeV < 500000.) { + return 0.; + } else { + return 0.95; + } +} + +float UpgradePerformanceFunctions::getEtmissTriggerEfficiency(float smearedEtmissMeV) { + if (smearedEtmissMeV < 200000.) { + return 0.; + } else { + return 0.95; + } +} + +float UpgradePerformanceFunctions::getJetEtmissTriggerEfficiency(float smearedJetEtMeV, float jetEta, float smearedEtmissMeV) { + if (smearedJetEtMeV < 140000. || fabs(jetEta) < m_JetTrigMaxEta || + smearedEtmissMeV < 125000.) { + return 0.; + } else { + return 0.95; + } +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/UpgradePerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/UpgradePerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b9c697048633f7bfe75abb57ea6800b4a4f3d337 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/Root/UpgradePerformanceFunctions.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef UPGRADEPERFORMANCEFUNCTIONS_CXX +#define UPGRADEPERFORMANCEFUNCTIONS_CXX + +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +UpgradePerformanceFunctions::UpgradePerformanceFunctions() { + // This is the default constructor, so we use default settings + m_layout = gold; + m_avgMu = 200.; + + // Initialize the missing ET performance histograms + // For now, this is done inside the MissingETPerformanceFunctions + + // Initialize the tracking performance histograms + // For now, this is done inside the TrackingPerformanceFunctions + +} + +UpgradePerformanceFunctions::UpgradePerformanceFunctions(UpgradeLayout layout, double avgMu) { + m_layout = layout; + m_avgMu = avgMu; + if (avgMu != 80. && avgMu != 140. && avgMu != 200.) { + std::cout << "ERROR: mu value " << avgMu + << " not allowed. Allowed values are 80, 140, 200. Falling back to mu=" + << m_avgMu << std::endl; + } else { + m_avgMu = avgMu; + } +} + +void UpgradePerformanceFunctions::setLayout(UpgradeLayout layout) { + m_layout = layout; +} + +void UpgradePerformanceFunctions::setAvgMu(double avgMu) { + if (avgMu != 80. && avgMu != 140. && avgMu != 200.) { + std::cout << "ERROR: mu value " << avgMu + << " not allowed. Allowed values are 80, 140, 200. Falling back to mu=" + << m_avgMu << std::endl; + } else { + m_avgMu = avgMu; + } + +} + +UpgradePerformanceFunctions::UpgradeLayout UpgradePerformanceFunctions::getLayout() { + return m_layout; +} + +double UpgradePerformanceFunctions::getAvgMu() { + return m_avgMu; +} + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions.h b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions.h new file mode 100644 index 0000000000000000000000000000000000000000..4fefd54b466c2d65420b6cf555a0986e65bc45d6 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions/UpgradePerformanceFunctions.h @@ -0,0 +1,220 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef UPGRADEPERFORMANCEFUNCTIONS_H +#define UPGRADEPERFORMANCEFUNCTIONS_H + +#include <iostream> +#include <string> +#include <math.h> + +#include "TH2D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TLorentzVector.h" +#include "TH1F.h" +#include "TGraphErrors.h" +#include "TTree.h" + +class UpgradePerformanceFunctions { + + public: + + enum UpgradeLayout {LoI, LoIVF, gold, silver, bronze, InclBrl, ExtBrl, Step1p6}; + + enum ElectronCutLevel {looseElectron, mediumElectron, tightElectron}; + enum PhotonCutLevel{loosePhoton, tightPhoton}; + enum MuonCutLevel {looseMuon, tightMuon}; + enum METSyst {nominal, process, thresholdUp, thresholdDown, resoUp, resoDown}; + enum PileupEff{HS,PU}; + + UpgradePerformanceFunctions(); + UpgradePerformanceFunctions(UpgradeLayout layout, double avgMu); + ~UpgradePerformanceFunctions() {}; + + void setLayout(UpgradeLayout layout); + void setAvgMu(double avgMu); + UpgradeLayout getLayout(); + double getAvgMu(); + + // Electron performance functions + void setElectronWorkingPoint(ElectronCutLevel cutLevel); + void setElectronRandomSeed(unsigned seed); + float getElectronEfficiency(float ptMeV, float eta); + float getElectronFakeRate(float ptMeV, float eta); + float getElectronEnergyResolution(float eMeV, float eta); + float getElectronSmearedEnergy(float eMeV, float eta); + float getElectronFakeRescaledEnergy(float eMeV, float eta); + float getElectronChargeFlipProb(float eMeV, float eta); + float interpolateElectronIDMap(float *ptEtaMap,float pT,float eta); + float interpolateElectronResolutionMap(float *ptEtaMap,float pT,float eta); + + // Photon performance functions + void setPhotonWorkingPoint(PhotonCutLevel cutLevel); + void initPhotonFakeHistograms(TString PhotonFakePath); + void setPhotonRandomSeed(unsigned seed); + float getPhotonEfficiency(float ptMeV); + float getPhotonFakeRate(float ptMeV); // jet faking photon + float getPhotonPileupFakeRate(float ptMeV);// pileup jet faking photon + float getElectronToPhotonFakeRate(float ptMeV, float eta); + float getPhotonEnergyResolution(float eMeV, float eta); + float getPhotonSmearedEnergy(float eMeV, float eta); + TLorentzVector getPhotonSmearedVector(const TLorentzVector* init); + float getPhotonFakeRescaledEnergy(float eMeV); + float getPhotonFakeRescaledET(float eMeV); + float getPhotonPileupFakeRescaledET(float eMeV); + + // Muon performance functions + void setMuonWorkingPoint(MuonCutLevel cutLevel); + float getMuonEfficiency(float ptMeV, float eta); + float getMuonPtResolution(float ptMeV, float eta); + float getMuonQOverPtResolution(float ptMeV, float eta); + + // Tracking performance functions + float getTrackPtResolution(float ptMeV, float eta); + float getTrackInvPtResolution(float invptMeV, float eta); + float getTrackPtRelativeResolution(float ptMeV, float eta); + + // Tau performance functions + void setTauRandomSeed(unsigned seed); + float getTauEfficiency(float etMeV, float eta, short prong); + float getTauFakeRate(float etMeV, float eta, short prong); + float getTauEnergyResolution(float eMeV, float eta, short prong); + float getTauSmearedEnergy(float eMeV, float eta, short prong); + + // Jet performance functions + void setJetRandomSeed(unsigned seed); + float getJetSmearedEnergy(float ptMeV, float eta, bool useJetArea); + float getJetEnergyResolution(float ptMeV, float eta, bool useJetArea); + float getJetPtThresholdForFakeRate(float eta, float fakeRate, bool useTrackConfirmation); + + // Missing ET performance functions + void setMETRandomSeed(unsigned seed); + void loadMETHistograms(TString filename); + typedef std::pair<double,double> MET; + MET getMETSmeared(float sumEtMeV, float METxMeV, float METyMeV, METSyst systValue=nominal); + float getMETResolution(float sumEtMeV, METSyst systValue=nominal); + + // Flavour-tagging performance functions + void setFlavourTaggingCalibrationFilename(TString flavourTaggingCalibrationFilename); + float getFlavourTagEfficiency(float ptMeV, float eta, char flavour, TString tagger = "mv1", int operating_point = 70, bool track_confirmation = false); + + // Trigger performance functions + float getSingleElectronTriggerEfficiency(float ptMeV, float eta); + float getDiElectronTriggerEfficiency(float pt1MeV, float pt2MeV, float eta1, float eta2); + float getSinglePhotonTriggerEfficiency(float etMeV, float eta); + float getDiPhotonTriggerEfficiency(float et1MeV, float et2MeV, float eta1, float eta2); + float getSingleMuonTriggerEfficiency(float etMeV, float eta); + float getDiMuonTriggerEfficiency(float et1MeV, float et2MeV, float eta1, float eta2); + float getElectronMuonTriggerEfficiency(float elecEtMeV, float muonEtMeV, float elecEta, float muonEta); + float getSingleTauTriggerEfficiency(float etMeV, float eta, short prong); + float getDiTauTriggerEfficiency(float et1MeV, float et2MeV, float eta1, float eta2, short prong1, short prong2); + float getSingleJetTriggerEfficiency(float smearedEtMeV, float eta); + float getThreeJetTriggerEfficiency(float smearedEtMeV1, float eta1, float smearedEtMeV2, float eta2, float smearedEtMeV3, float eta3); + float getFourJetTriggerEfficiency(float smearedEtMeV1, float eta1, float smearedEtMeV2, float eta2, float smearedEtMeV3, float eta3, float smearedEtMeV4, float eta4); + float getHTTriggerEfficiency(float smearedHTMeV); + float getEtmissTriggerEfficiency(float smearedEtmissMeV); + float getJetEtmissTriggerEfficiency(float smearedJetEtMeV, float jetEta, float smearedEtmissMeV); + + // Pile-up overlay functions + void setPileupRandomSeed(unsigned seed); + void setPileupEfficiencyScheme(PileupEff puscheme); + void setPileupEff(float hseff = 0.9); // set efficiency either for HS or PU depending on your scheme + void setPileupUseTrackConf(bool usetr = false); // TC yes/no - user's choice + void setPileupJetPtThresholdMeV(float ptThresholdMeV=30000.); // default approved minimum of 30 GeV + void setPileupTemplatesPath(TString pileupTemplateFilenamePath); // user provides folder with PULibraries + + bool getPileupTrackConfSetting(); + float getPileupJetPtThresholdMeV(); + std::vector<TLorentzVector> getPileupJets(); + float getTrackJetConfirmEff(float ptMeV, float eta, TString jetType); + + // HGTD setters + void setUseHGTD0(bool usehgtd0 = false); // turn on the HGTD in the forward region for eta 2.4 - 4.3 + void setUseHGTD1(bool usehgtd1 = false); // turn on the HGTD in the forward region for eta 0.0 - 4.3 + float getHGTDMinEta(); // returns minimum eta for the HGTD depending on the scenario (0/1) + float getHGTDMaxEta(); // returns maximum eta for the HGTD, currently 4.3 + void extendJetTrigger(bool exttrig = false); // nominal = 3.2, exttrig = true => 3.8 + + private: + + // Member variables + UpgradeLayout m_layout; + double m_avgMu; + ElectronCutLevel m_eleCutLevel; + PhotonCutLevel m_photonCutLevel; + MuonCutLevel m_muonCutLevel; + PileupEff m_pueff; + + float m_BronzeEtaMax = 2.4; + float m_SilverEtaMax = 3.2; + float m_GoldEtaMax = 3.8; + static const int m_nPUPtBins = 4; + + float m_fEff; + bool m_bUseTrackConf; + float fEffNominalArray[m_nPUPtBins]; + float fEffMediumArray[m_nPUPtBins]; + float fEffExtendedArray[m_nPUPtBins]; + + // -- new stuff for HGTD --> to be included into the Golden Scenario + // -- first set of preliminary working points to contain only flat factors of + // - 90% HS vs 10% or 50% PU + // - 80% HS vs 10% or 50% PU + // -- the central region has to stay the same and correspond to the gold performance + // -- etamin_HGTD = 2.4 + // -- etamax_HGTD = 5.0 + + bool m_bUseHGTD0 = false; + bool m_bUseHGTD1 = false; + float m_HGTD0min = 2.4; + float m_HGTD1min = 0.0; + float m_HGTDmax = 4.3; + float m_HGTDHSEff; + float m_HGTDPUEff; + bool m_ExtHGTDTrig = false; + float m_HGTDMaxTrigEta = 3.8; + float m_HGTD0MinTrigPt = 71000.; + float m_HGTD0MinExtTrigPt = 72000.; + float m_HGTD1MinTrigPt = 58000.; + float m_HGTD1MinExtTrigPt = 60000.; + + float m_fPileupJetThresholdMeV; + float m_fPileupTCMaxPtMeV; + + float m_JetTrigMaxEta = 3.2; + float m_JetTrig1jMin = 180000.; + float m_JetTrig3jMin = 85000.; + float m_JetTrig4jMin = 75000.; + + // Default TRandom3 seed is 4357 + TRandom3 m_electronRandom; + TRandom3 m_photonRandom; + TRandom3 m_tauRandom; + TRandom3 m_jetRandom; + TRandom3 m_METRandom; + TRandom3 m_pileupRandom; + + // Missing ET templates + TH1F *m_SumEtH[4][6]; + TGraphErrors *m_Ress[4]; + + // Flavour tagging filename + TString m_flavourTaggingCalibrationFilename; + + // Pileup overlay templates + TTree *m_pileupTree30; + std::vector<float> *m_pileupPt30,*m_pileupEta30,*m_pileupPhi30,*m_pileupE30; + + float muonEtaTriggerEfficiency(float eta); + + void initializePileupTemplates(TString pileupTemplateFilename); // needs to be called by "setAvgMu" - PU Libraries only for mu 140 and 200 so far + + // Photon globals + std::vector<TH1D*> hsfakes; + std::vector<TH1D*> pufakes; + +}; + +#endif diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/cmt/Makefile.RootCore b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..6b2261d2e929d6a42190e6d18a594c851e8e24c0 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/cmt/Makefile.RootCore @@ -0,0 +1,60 @@ +# this makefile also gets parsed by shell scripts +# therefore it does not support full make syntax and features +# edit with care + +# for full documentation check: +# https://twiki.cern.ch/twiki/bin/viewauth/Atlas/RootCore#Package_Makefile + + +# the name of the package: +PACKAGE = UpgradePerformanceFunctions + +# the libraries to link with this one: +PACKAGE_PRELOAD = + +# additional compilation flags to pass (not propagated to dependent packages): +PACKAGE_CXXFLAGS = + +# additional compilation flags to pass (propagated to dependent packages): +PACKAGE_OBJFLAGS = + +# additional linker flags to pass (for compiling the library): +PACKAGE_LDFLAGS = + +# additional linker flags to pass (for compiling binaries): +PACKAGE_BINFLAGS = + +# additional linker flags to pass (propagated to client libraries): +PACKAGE_LIBFLAGS = + +# the list of packages we depend on: +PACKAGE_DEP = PathResolver + +# the list of packages we use if present, but that we can work without : +PACKAGE_TRYDEP = + +# list pattern of scripts to link directly into binary path: +PACKAGE_SCRIPTS = + +# whether to use pedantic compilation: +PACKAGE_PEDANTIC = 1 + +# whether to turn *off* optimization (set to dict to do it only for +# dictionaries): +PACKAGE_NOOPT = 0 + +# whether to build no library (needs to be set if no source files are +# present): +PACKAGE_NOCC = 0 + +# whether we build a reflex dictionary: +PACKAGE_REFLEX = 0 + +# the list of all unit tests that should be called in recursive testing, +# i.e. in unit tests that call other unit tests +# for that unit tests need to pass on all machines, and run very fast +PACKAGE_RECURSIVE_UT = + + + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/PhotonFakes.root b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/PhotonFakes.root new file mode 100644 index 0000000000000000000000000000000000000000..bada7a6eb5f496bcd9bebae33dcabf641137c3a0 Binary files /dev/null and b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/PhotonFakes.root differ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.0.root b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.0.root new file mode 100644 index 0000000000000000000000000000000000000000..f808de90480c4b1a168c1f516834dbad312227b8 Binary files /dev/null and b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.0.root differ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.1.root b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.1.root new file mode 100644 index 0000000000000000000000000000000000000000..ab6203a57aa1b580310b17531b0a8e9da2825d19 Binary files /dev/null and b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.1.root differ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.2.root b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.2.root new file mode 100644 index 0000000000000000000000000000000000000000..00053ed4933fe93aee054a526eb40b3e1f0c311c Binary files /dev/null and b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/flavor_tags_v1.2.root differ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/sumetPU_mu200_ttbar_gold.root b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/sumetPU_mu200_ttbar_gold.root new file mode 100644 index 0000000000000000000000000000000000000000..f30d581cf3ae21c52426b7550c20ae95dd73b56a Binary files /dev/null and b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/share/sumetPU_mu200_ttbar_gold.root differ diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/plotPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/plotPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..59e6d695a19c6e269fb1e04a4d0a3e511293db6f --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/plotPerformanceFunctions.cxx @@ -0,0 +1,1498 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <cmath> +#include <vector> +#include <string> +#include <sstream> +#include "TStyle.h" +#include "TString.h" +#include "TColor.h" +#include "TFile.h" +#include "TH2D.h" +#include "TGraph.h" +#include "TCanvas.h" +#include "TROOT.h" +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + + +void plotElectronEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt); +void plotElectronTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt); +void plotMuonEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt); +void plotMuonTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt); +void plotPhotonEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_plotPt); +void plotElectronEnergyResolution(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt); +void plotFlavourTagEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt, char flavour, TString Tagger, int operating_point); +void plotMETResolution(UpgradePerformanceFunctions *m_upgrade, float sumEtGeV, float METxGeV, float METyGeV); +void plotTrackJetConfirmEff(UpgradePerformanceFunctions *m_upgrade, float plot_pt); +void plotJetTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade); + +int main() { + // This hack is needed to force dictionary loading in ROOT 5 + gROOT->ProcessLine("#include <vector>"); + + // Style choices for axis on plots + Int_t font=42; // Helvetica + Double_t tsize=0.05; + gStyle->SetTextFont(font); + + gStyle->SetTextSize(tsize); + gStyle->SetLabelFont(font,"x"); + gStyle->SetTitleFont(font,"x"); + gStyle->SetLabelFont(font,"y"); + gStyle->SetTitleFont(font,"y"); + gStyle->SetLabelFont(font,"z"); + gStyle->SetTitleFont(font,"z"); + + gStyle->SetLabelSize(tsize,"x"); + gStyle->SetTitleSize(tsize,"x"); + gStyle->SetLabelSize(tsize,"y"); + gStyle->SetTitleSize(tsize,"y"); + gStyle->SetLabelSize(tsize,"z"); + gStyle->SetTitleSize(tsize,"z"); + + gStyle->SetPadTickX(1); + gStyle->SetPadTickY(1); + + UpgradePerformanceFunctions *m_upgrade = new UpgradePerformanceFunctions(); + m_upgrade->setLayout(UpgradePerformanceFunctions::Step1p6); + m_upgrade->setAvgMu(200.); + std::cout << "Layout is " << m_upgrade->getLayout() + << ", and mu value is " << m_upgrade->getAvgMu() << std::endl; + // m_upgrade->setUseHGTD0(true); + + // m_upgrade->extendJetTrigger(true); + // m_upgrade->setUseHGTD1(true); + + // plotElectronEfficiency(m_upgrade,3.0,32.0); + // plotElectronTriggerEfficiency(m_upgrade,3.0,32.0); + // plotElectronEnergyResolution(m_upgrade,3.3,100.0); + // plotMuonEfficiency(m_upgrade,2,80.0); + // plotMuonTriggerEfficiency(m_upgrade,0.61,45.0); + // plotPhotonEfficiency(m_upgrade,1.0,80.0); + // plotFlavourTagEfficiency(m_upgrade,1.5,45,'B',"mv1",70); + // plotMETResolution(m_upgrade, 100,200,0); + plotTrackJetConfirmEff(m_upgrade,35); + plotJetTriggerEfficiency(m_upgrade); + + return 0; +} + + +void plotElectronEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight electron efficiency for pt and eta + std::cout << "Generating Electron Efficiency Plots" << std::endl; + + m_upgrade->setElectronWorkingPoint(UpgradePerformanceFunctions::tightElectron); + m_upgrade->setElectronRandomSeed(1); + + TH2D *gold_ElectronEfficiency = new TH2D("gold_ElectronEfficiency","gold_ElectronEfficiency",1000,0,120,1000,0,5); + // TH2D *silver_ElectronEfficiency = new TH2D("silverElectronEfficiency","silver_ElectronEfficiency",1000,0,120,1000,0,5); + // TH2D *bronze_ElectronEfficiency = new TH2D("bronze_ElectronEfficiency","bronze_ElectronEfficiency",1000,0,120,1000,0,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = 0; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::Step1p6); + result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + gold_ElectronEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + // m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + // result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + // silver_ElectronEfficiency->SetBinContent(i,j,result_f); + // if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + // silver_pt.push_back(result_f); + // } + + // m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + // result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + // bronze_ElectronEfficiency->SetBinContent(i,j,result_f); + // if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + // bronze_pt.push_back(result_f); + // } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::Step1p6); + result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + gold_eta.push_back(result_f); + + // m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + // result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + // silver_eta.push_back(result_f); + + // m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + // result_f = m_upgrade->getElectronEfficiency(pt_f*1000,eta_f); + // bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 5.0/1000.0; //iterate eta from 0 to 5 in .005 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + // TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + // silver_graph_eta->SetLineColor(4); + // silver_graph_eta->SetMarkerColor(4); + // silver_graph_eta->GetXaxis()->SetTitle("Eta"); + // TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + // bronze_graph_eta->SetLineColor(1); + // bronze_graph_eta->SetMarkerColor(1); + // bronze_graph_eta->GetXaxis()->SetTitle("Eta"); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + // TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + // silver_graph_pt->SetLineColor(4); + // silver_graph_pt->SetMarkerColor(4); + // TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + // bronze_graph_pt->SetLineColor(1); + // bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + gStyle->SetNumberContours(100); + TCanvas *can = new TCanvas("can","Electron Efficiency",1000,1000); + can->Divide(2,2); + + can->cd(1); + gold_ElectronEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_ElectronEfficiency->GetYaxis()->SetTitle("Eta"); + gold_ElectronEfficiency->SetTitle("Tight Gold ElectronEfficiency"); + gold_ElectronEfficiency->SetTitle("Tight Gold ElectronEfficiency"); + gold_ElectronEfficiency->SetStats(0); + gold_ElectronEfficiency->Draw("colz"); + + // can->cd(2); + // silver_ElectronEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + // silver_ElectronEfficiency->GetYaxis()->SetTitle("Eta"); + // silver_ElectronEfficiency->SetTitle("Tight Silver ElectronEfficiency"); + // silver_ElectronEfficiency->SetStats(0); + // silver_ElectronEfficiency->Draw("colz"); + + // can->cd(3); + // bronze_ElectronEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + // bronze_ElectronEfficiency->GetYaxis()->SetTitle("Eta"); + // bronze_ElectronEfficiency->SetTitle("Tight Bronze ElectronEfficiency"); + // bronze_ElectronEfficiency->SetStats(0); + // bronze_ElectronEfficiency->Draw("colz"); + + can->cd(2); + std::stringstream eta_stringstream; + eta_stringstream << "Sweep of Electron Efficiency in eta for pt = " + << plot_pt << "GeV"; + std::string eta_string(eta_stringstream.str()); + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Electron Efficiency"); + gold_graph_eta->Draw("ALP"); + // silver_graph_eta->Draw("LP"); + // bronze_graph_eta->Draw("LP"); + + can->cd(3); + std::stringstream pt_stringstream; + pt_stringstream << "Sweep of Electron Efficiency in pt for eta = " << plot_eta; + std::string pt_string(pt_stringstream.str()); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Electron Efficiency"); + gold_graph_pt->Draw("ALP"); + // silver_graph_pt->Draw("LP"); + // bronze_graph_pt->Draw("LP"); + + can->Update(); + can->Print("ElectronEfficiency.pdf"); + can->Close(); + + return; +} + +void plotElectronTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight electron efficiency for pt and eta + std::cout << "Generating Electron Trigger Efficiency Plots" << std::endl; + + // m_upgrade->setElectronWorkingPoint(UpgradePerformanceFunctions::tightElectron); + // m_upgrade->setElectronRandomSeed(1); + + TH2D *gold_ElectronTriggerEfficiency = new TH2D("gold_ElectronTriggerEfficiency","gold_ElectronTriggerEfficiency",1000,0,120,1000,-5,5); + // TH2D *silver_ElectronTriggerEfficiency = new TH2D("silverElectronTriggerEfficiency","silver_ElectronTriggerEfficiency",1000,0,120,1000,-5,5); + // TH2D *bronze_ElectronTriggerEfficiency = new TH2D("bronze_ElectronTriggerEfficiency","bronze_ElectronTriggerEfficiency",1000,0,120,1000,-5,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = -5.; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::Step1p6); + result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + gold_ElectronTriggerEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + // m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + // result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + // silver_ElectronTriggerEfficiency->SetBinContent(i,j,result_f); + // if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + // silver_pt.push_back(result_f); + // } + + // m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + // result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + // bronze_ElectronTriggerEfficiency->SetBinContent(i,j,result_f); + // if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + // bronze_pt.push_back(result_f); + // } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::Step1p6); + result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + gold_eta.push_back(result_f); + + // m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + // result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + // silver_eta.push_back(result_f); + + // m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + // result_f = m_upgrade->getSingleElectronTriggerEfficiency(pt_f*1000,eta_f); + // bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 10.0/1000.0; //iterate eta from -5 to 5 in .01 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + // TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + // silver_graph_eta->SetLineColor(4); + // silver_graph_eta->SetMarkerColor(4); + // TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + // bronze_graph_eta->SetLineColor(1); + // bronze_graph_eta->SetMarkerColor(1); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + + // TGraph *gold_graph_pt2 = new TGraph(pt.size(),&pt[800],&gold_pt[800]); + // gold_graph_pt2->SetLineColor(2); + // gold_graph_pt2->SetMarkerColor(2); + + + // TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + // silver_graph_pt->SetLineColor(4); + // silver_graph_pt->SetMarkerColor(4); + // TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + // bronze_graph_pt->SetLineColor(1); + // bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + + TCanvas *can = new TCanvas("can","ElectronTrigger Efficiency",1000,1000); + can->Divide(2,2); + + can->cd(1); + gold_ElectronTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_ElectronTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + gold_ElectronTriggerEfficiency->SetTitle("Tight Gold ElectronTriggerEfficiency"); + gold_ElectronTriggerEfficiency->SetStats(0); + gold_ElectronTriggerEfficiency->Draw("colz"); + + // can->cd(2); + // silver_ElectronTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + // silver_ElectronTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + // silver_ElectronTriggerEfficiency->SetTitle("Tight Silver ElectronTriggerEfficiency"); + // silver_ElectronTriggerEfficiency->SetStats(0); + // silver_ElectronTriggerEfficiency->Draw("colz"); + + // can->cd(3); + // bronze_ElectronTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + // bronze_ElectronTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + // bronze_ElectronTriggerEfficiency->SetTitle("Tight Bronze ElectronTriggerEfficiency"); + // bronze_ElectronTriggerEfficiency->SetStats(0); + // bronze_ElectronTriggerEfficiency->Draw("colz"); + + can->cd(2); + std::stringstream eta_stringstream; + eta_stringstream << "Sweep of Electron Trigger Efficiency in eta for pt = " + << plot_pt << "GeV"; + std::string eta_string(eta_stringstream.str()); + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Electron Trigger Efficiency"); + gold_graph_eta->Draw("ALP"); + // silver_graph_eta->Draw("LP"); + // bronze_graph_eta->Draw("LP"); + + can->cd(3); + std::stringstream pt_stringstream; + pt_stringstream << "Sweep of Electron Trigger Efficiency in pt for eta = " << plot_eta; + std::string pt_string(pt_stringstream.str()); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Electron Trigger Efficiency"); + gold_graph_pt->Draw("ALP"); + // silver_graph_pt->Draw("LP"); + // bronze_graph_pt->Draw("LP"); + + // plot_eta = "3.0"; + // can->cd(4); + // std::stringstream pt_stringstream; + // pt_stringstream << "Sweep of Electron Trigger Efficiency in pt for eta = " << plot_eta; + // std::string pt_string(pt_stringstream.str()); + // const char *pt_title = pt_string.c_str(); + // gold_graph_pt2->SetTitle(pt_title); + // gold_graph_pt2->GetXaxis()->SetTitle("Pt (GeV)"); + // gold_graph_pt2->GetYaxis()->SetTitle("Electron Trigger Efficiency"); + // gold_graph_pt2->Draw("ALP"); + + can->Update(); + can->Print("ElectronTriggerEfficiency.pdf"); + can->Close(); + + return; +} + + +void plotJetTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade){ + + std::cout << "Generating Jet Trigger Efficiency Plots" << std::endl; + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + + TH1F *h_1jtrig_pt = new TH1F("gold_Jet1jTriggerEfficiencyPt","gold_Jet1jTriggerEfficiencyPt; p_{T}^{LeadJet} [GeV]",200,0.,200.); h_1jtrig_pt->Sumw2(); + TH1F *h_1jtrig_eta = new TH1F("gold_Jet1jTriggerEfficiencyEta","gold_Jet1jTriggerEfficiencyEta; |#eta^{LeadJet}|",100,0.,5.); h_1jtrig_eta->Sumw2(); + TH1F *h_3jtrig_pt = new TH1F("gold_Jet3jTriggerEfficiencyPt","gold_Jet3jTriggerEfficiencyPt; p_{T}^{ThirdJet} [GeV]",200,0.,200.); h_3jtrig_pt->Sumw2(); + TH1F *h_3jtrig_eta = new TH1F("gold_Jet3jTriggerEfficiencyEta","gold_Jet3jTriggerEfficiencyEta; |#eta^{ThirdJet}|",100,0.,5.); h_3jtrig_eta->Sumw2(); + TH1F *h_4jtrig_pt = new TH1F("gold_Jet4jTriggerEfficiencyPt","gold_Jet4jTriggerEfficiencyPt; p_{T}^{FourthJet} [GeV]",200,0.,200.); h_4jtrig_pt->Sumw2(); + TH1F *h_4jtrig_eta = new TH1F("gold_Jet4jTriggerEfficiencyEta","gold_Jet4jTriggerEfficiencyEta; |#eta^{FourthJet}|",100,0.0,5.); h_4jtrig_eta->Sumw2(); + + for(int j=0;j<100;j++){ //Begin eta loop + h_1jtrig_eta->Fill(j*0.05-0.001,m_upgrade->getSingleJetTriggerEfficiency(200000.,j*0.05)); + h_3jtrig_eta->Fill(j*0.05-0.001,m_upgrade->getThreeJetTriggerEfficiency(200000.,0.,200000.,0.,200000.,j*0.05)); + h_4jtrig_eta->Fill(j*0.05-0.001,m_upgrade->getFourJetTriggerEfficiency(200000.,0.,200000.,0.,200000.,0.,200000.,j*0.05)); + } + for(int j=0;j<200;j++){ //Begin pt loop + h_1jtrig_pt->Fill(j*1.,m_upgrade->getSingleJetTriggerEfficiency(j*1000.,0.)); + h_3jtrig_pt->Fill(j*1.,m_upgrade->getThreeJetTriggerEfficiency(200000.,0.,200000.,0.,j*1000.,0.)); + h_4jtrig_pt->Fill(j*1.,m_upgrade->getFourJetTriggerEfficiency(200000.,0.,200000.,0.,200000.,0.,j*1000.,0.)); + } + + TCanvas *can1 = new TCanvas("can1","Jet Trigger pT Efficiency",1000,1000); + + h_1jtrig_pt->GetXaxis()->SetTitle("p_{T} [GeV]"); + h_1jtrig_pt->GetYaxis()->SetTitle("Jet Trigger p_{T} Efficiency"); + + h_1jtrig_pt->SetTitle("Jet Trigger p_{T} Efficiency"); + + h_1jtrig_pt->SetMarkerColor(1); + h_1jtrig_pt->SetLineColor(1); + h_3jtrig_pt->SetMarkerColor(2); + h_4jtrig_pt->SetMarkerColor(4); + h_3jtrig_pt->SetLineColor(2); + h_4jtrig_pt->SetLineColor(4); + + h_1jtrig_pt->SetMaximum(1.3); + h_1jtrig_eta->SetMaximum(1.3); + + h_1jtrig_pt->Draw("hist"); + h_3jtrig_pt->Draw("hist same"); + h_4jtrig_pt->Draw("hist same"); + + can1->Print("JetTriggerPtEfficiency.pdf"); + + TCanvas *can2 = new TCanvas("can2","Jet Trigger eta Efficiency",1000,1000); + + h_1jtrig_eta->GetXaxis()->SetTitle("|#eta|"); + h_1jtrig_eta->GetYaxis()->SetTitle("Jet Trigger |#eta| Efficiency"); + + h_1jtrig_eta->SetTitle("Jet Trigger |#eta| Efficiency"); + + h_1jtrig_eta->SetMarkerColor(1); + h_1jtrig_eta->SetLineColor(1); + h_3jtrig_eta->SetMarkerColor(2); + h_4jtrig_eta->SetMarkerColor(4); + h_3jtrig_eta->SetLineColor(2); + h_4jtrig_eta->SetLineColor(4); + + h_1jtrig_eta->Draw("hist"); + h_3jtrig_eta->Draw("hist same"); + h_4jtrig_eta->Draw("hist same"); + + can2->Print("JetTriggerEtaEfficiency.pdf"); + + + +} + + +void plotMuonEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight muon efficiency for pt and eta + std::cout << "Generating Muon Efficiency Plots" << std::endl; + + m_upgrade->setMuonWorkingPoint(UpgradePerformanceFunctions::tightMuon); + + TH2D *gold_MuonEfficiency = new TH2D("gold_MuonEfficiency","gold_MuonEfficiency",1000,0,120,1000,0,5); + TH2D *silver_MuonEfficiency = new TH2D("silverMuonEfficiency","silver_MuonEfficiency",1000,0,120,1000,0,5); + TH2D *bronze_MuonEfficiency = new TH2D("bronze_MuonEfficiency","bronze_MuonEfficiency",1000,0,120,1000,0,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = 0; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + gold_MuonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + silver_MuonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + silver_pt.push_back(result_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + bronze_MuonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + bronze_pt.push_back(result_f); + } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + gold_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + silver_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getMuonEfficiency(pt_f*1000,eta_f); + bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 5.0/1000.0; //iterate eta from 0 to 5 in .005 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + silver_graph_eta->SetLineColor(4); + silver_graph_eta->SetMarkerColor(4); + silver_graph_eta->GetXaxis()->SetTitle("Eta"); + TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + bronze_graph_eta->SetLineColor(1); + bronze_graph_eta->SetMarkerColor(1); + bronze_graph_eta->GetXaxis()->SetTitle("Eta"); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + silver_graph_pt->SetLineColor(4); + silver_graph_pt->SetMarkerColor(4); + TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + bronze_graph_pt->SetLineColor(1); + bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + gStyle->SetNumberContours(100); + TCanvas *can = new TCanvas("can","Muon Efficiency",1000,1000); + can->Divide(2,3); + + can->cd(1); + gold_MuonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_MuonEfficiency->GetYaxis()->SetTitle("Eta"); + gold_MuonEfficiency->SetTitle("Tight Gold MuonEfficiency"); + gold_MuonEfficiency->SetTitle("Tight Gold MuonEfficiency"); + gold_MuonEfficiency->SetStats(0); + gold_MuonEfficiency->Draw("colz"); + + can->cd(2); + silver_MuonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + silver_MuonEfficiency->GetYaxis()->SetTitle("Eta"); + silver_MuonEfficiency->SetTitle("Tight Silver MuonEfficiency"); + silver_MuonEfficiency->SetStats(0); + silver_MuonEfficiency->Draw("colz"); + + can->cd(3); + bronze_MuonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + bronze_MuonEfficiency->GetYaxis()->SetTitle("Eta"); + bronze_MuonEfficiency->SetTitle("Tight Bronze MuonEfficiency"); + bronze_MuonEfficiency->SetStats(0); + bronze_MuonEfficiency->Draw("colz"); + + can->cd(4); + std::stringstream eta_stringstream; + eta_stringstream << "Sweep of Muon Efficiency in eta for pt = " + << plot_pt << "GeV"; + std::string eta_string(eta_stringstream.str()); + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Muon Efficiency"); + gold_graph_eta->Draw("ALP"); + silver_graph_eta->Draw("LP"); + bronze_graph_eta->Draw("LP"); + + can->cd(5); + std::stringstream pt_stringstream; + pt_stringstream << "Sweep of Muon Efficiency in pt for eta = " << plot_eta; + std::string pt_string(pt_stringstream.str()); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Muon Efficiency"); + gold_graph_pt->Draw("ALP"); + silver_graph_pt->Draw("LP"); + bronze_graph_pt->Draw("LP"); + + can->Update(); + can->Print("MuonEfficiency.pdf"); + can->Close(); + + return; +} + + +void plotMuonTriggerEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight muon efficiency for pt and eta + std::cout << "Generating Muon Trigger Efficiency Plots" << std::endl; + + TH2D *gold_MuonTriggerEfficiency = new TH2D("gold_MuonTriggerEfficiency","gold_MuonTriggerEfficiency",1000,0,120,1000,-3,3); + TH2D *silver_MuonTriggerEfficiency = new TH2D("silverMuonTriggerEfficiency","silver_MuonTriggerEfficiency",1000,0,120,1000,-3,3); + TH2D *bronze_MuonTriggerEfficiency = new TH2D("bronze_MuonTriggerEfficiency","bronze_MuonTriggerEfficiency",1000,0,120,1000,-3,3); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = -3.; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + gold_MuonTriggerEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + silver_MuonTriggerEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + silver_pt.push_back(result_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + bronze_MuonTriggerEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + bronze_pt.push_back(result_f); + } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + gold_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + silver_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getSingleMuonTriggerEfficiency(pt_f*1000,eta_f); + bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 6.0/1000.0; //iterate eta from -3 to 3 in .006 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + silver_graph_eta->SetLineColor(4); + silver_graph_eta->SetMarkerColor(4); + TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + bronze_graph_eta->SetLineColor(1); + bronze_graph_eta->SetMarkerColor(1); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + silver_graph_pt->SetLineColor(4); + silver_graph_pt->SetMarkerColor(4); + TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + bronze_graph_pt->SetLineColor(1); + bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + + TCanvas *can = new TCanvas("can","MuonTrigger Efficiency",1000,1000); + can->Divide(2,3); + + can->cd(1); + gold_MuonTriggerEfficiency->SetTitle("Tight Gold MuonTriggerEfficiency"); + gold_MuonTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_MuonTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + gold_MuonTriggerEfficiency->SetStats(0); + gold_MuonTriggerEfficiency->Draw("colz"); + + can->cd(2); + silver_MuonTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + silver_MuonTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + silver_MuonTriggerEfficiency->SetTitle("Tight Silver MuonTriggerEfficiency"); + silver_MuonTriggerEfficiency->SetStats(0); + silver_MuonTriggerEfficiency->Draw("colz"); + + can->cd(3); + bronze_MuonTriggerEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + bronze_MuonTriggerEfficiency->GetYaxis()->SetTitle("Eta"); + bronze_MuonTriggerEfficiency->SetTitle("Tight Bronze MuonTriggerEfficiency"); + bronze_MuonTriggerEfficiency->SetStats(0); + bronze_MuonTriggerEfficiency->Draw("colz"); + + can->cd(4); + std::stringstream eta_stringstream; + eta_stringstream << "Sweep of Muon Trigger Efficiency in eta for pt = " + << plot_pt << "GeV"; + std::string eta_string(eta_stringstream.str()); + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Muon Trigger Efficiency"); + gold_graph_eta->Draw("ALP"); + silver_graph_eta->Draw("LP"); + bronze_graph_eta->Draw("LP"); + + can->cd(5); + std::stringstream pt_stringstream; + pt_stringstream << "Sweep of Muon Trigger Efficiency in pt for eta = " << plot_eta; + std::string pt_string(pt_stringstream.str()); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Muon Trigger Efficiency"); + gold_graph_pt->Draw("ALP"); + silver_graph_pt->Draw("LP"); + bronze_graph_pt->Draw("LP"); + + can->Update(); + can->Print("MuonTriggerEfficiency.pdf"); + can->Close(); + + return; +} + +void plotPhotonEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight photon efficiency for pt and eta + std::cout << "Generating photon Efficiency Plots" << std::endl; + + m_upgrade->setPhotonWorkingPoint(UpgradePerformanceFunctions::tightPhoton); + m_upgrade->setPhotonRandomSeed(1); + + TH2D *gold_PhotonEfficiency = new TH2D("gold_PhotonEfficiency","gold_PhotonEfficiency",1000,0,120,1000,0,5); + TH2D *silver_PhotonEfficiency = new TH2D("silverPhotonEfficiency","silver_PhotonEfficiency",1000,0,120,1000,0,5); + TH2D *bronze_PhotonEfficiency = new TH2D("bronze_PhotonEfficiency","bronze_PhotonEfficiency",1000,0,120,1000,0,5); + TH2D *gold_PhotonFakeRate = new TH2D("gold_PhotonFakeRate","gold_PhotonFakeRate",1000,0,120,1000,0,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = 0; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + gold_PhotonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + silver_PhotonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + silver_pt.push_back(result_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + bronze_PhotonEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + bronze_pt.push_back(result_f); + } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + gold_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + silver_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getPhotonEfficiency(pt_f*1000); + bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 5.0/1000.0; //iterate eta from 0 to 5 in .005 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + silver_graph_eta->SetLineColor(4); + silver_graph_eta->SetMarkerColor(4); + silver_graph_eta->GetXaxis()->SetTitle("Eta"); + TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + bronze_graph_eta->SetLineColor(1); + bronze_graph_eta->SetMarkerColor(1); + bronze_graph_eta->GetXaxis()->SetTitle("Eta"); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + silver_graph_pt->SetLineColor(4); + silver_graph_pt->SetMarkerColor(4); + TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + bronze_graph_pt->SetLineColor(1); + bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + gStyle->SetNumberContours(100); + TCanvas *can = new TCanvas("can","Photon Efficiency",1000,1000); + can->Divide(2,3); + + can->cd(1); + gold_PhotonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_PhotonEfficiency->GetYaxis()->SetTitle("Eta"); + gold_PhotonEfficiency->SetTitle("Tight Gold PhotonEfficiency"); + gold_PhotonEfficiency->SetTitle("Tight Gold PhotonEfficiency"); + gold_PhotonEfficiency->SetStats(0); + gold_PhotonEfficiency->Draw("colz"); + + can->cd(2); + silver_PhotonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + silver_PhotonEfficiency->GetYaxis()->SetTitle("Eta"); + silver_PhotonEfficiency->SetTitle("Tight Silver PhotonEfficiency"); + silver_PhotonEfficiency->SetStats(0); + silver_PhotonEfficiency->Draw("colz"); + + can->cd(3); + bronze_PhotonEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + bronze_PhotonEfficiency->GetYaxis()->SetTitle("Eta"); + bronze_PhotonEfficiency->SetTitle("Tight Bronze PhotonEfficiency"); + bronze_PhotonEfficiency->SetStats(0); + bronze_PhotonEfficiency->Draw("colz"); + + can->cd(4); + std::stringstream eta_stringstream; + eta_stringstream << "Sweep of Photon Efficiency in eta for pt = " + << plot_pt << "GeV"; + std::string eta_string(eta_stringstream.str()); + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Photon Efficiency"); + gold_graph_eta->Draw("ALP"); + silver_graph_eta->Draw("LP"); + bronze_graph_eta->Draw("LP"); + + can->cd(5); + std::stringstream pt_stringstream; + pt_stringstream << "Sweep of Photon Efficiency in pt for eta = " << plot_eta; + std::string pt_string(pt_stringstream.str()); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Photon Efficiency"); + gold_graph_pt->Draw("ALP"); + silver_graph_pt->Draw("LP"); + bronze_graph_pt->Draw("LP"); + + can->Update(); + can->Print("PhotonEfficiency.pdf"); + can->Close(); + + return; +} + +void plotElectronEnergyResolution(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt) { + // Make plot of Tight electron efficiency for pt and eta + std::cout << "Generating Electron Energy Resolution Plots" << std::endl; + + m_upgrade->setElectronWorkingPoint(UpgradePerformanceFunctions::tightElectron); + m_upgrade->setElectronRandomSeed(1); + + TH2D *gold_ElectronEnergyResolution = new TH2D("gold_ElectronEnergyResolution","gold_ElectronEnergyResolution",1000,0,120,1000,0,5); + TH2D *silver_ElectronEnergyResolution = new TH2D("silverElectronEnergyResolution","silver_ElectronEnergyResolution",1000,0,120,1000,0,5); + TH2D *bronze_ElectronEnergyResolution = new TH2D("bronze_ElectronEnergyResolution","bronze_ElectronEnergyResolution",1000,0,120,1000,0,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> silver_eta; //Store silver eta scan + std::vector<float> bronze_eta; //Store bronze eta scan + std::vector<float> gold_pt; //Store gold pt scan + std::vector<float> silver_pt; //Store silver pt scan + std::vector<float> bronze_pt; //Store bronze pt scan + + float pt_f = 0; + float eta_f = 0; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + gold_ElectronEnergyResolution->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + silver_ElectronEnergyResolution->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + silver_pt.push_back(result_f); + } + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + bronze_ElectronEnergyResolution->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + bronze_pt.push_back(result_f); + } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + gold_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + silver_eta.push_back(result_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getElectronEnergyResolution(pt_f*1000,eta_f); + bronze_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 5.0/1000.0; //iterate eta from 0 to 5 in .005 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + TGraph *silver_graph_eta = new TGraph(eta.size(),&eta[0],&silver_eta[0]); + silver_graph_eta->SetLineColor(4); + silver_graph_eta->SetMarkerColor(4); + TGraph *bronze_graph_eta = new TGraph(eta.size(),&eta[0],&bronze_eta[0]); + bronze_graph_eta->SetLineColor(1); + bronze_graph_eta->SetMarkerColor(1); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + TGraph *silver_graph_pt = new TGraph(pt.size(),&pt[0],&silver_pt[0]); + silver_graph_pt->SetLineColor(4); + silver_graph_pt->SetMarkerColor(4); + TGraph *bronze_graph_pt = new TGraph(pt.size(),&pt[0],&bronze_pt[0]); + bronze_graph_pt->SetLineColor(1); + bronze_graph_pt->SetMarkerColor(1); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + + TCanvas *can = new TCanvas("can","Electron EnergyResolution",1000,1000); + can->Divide(2,3); + + can->cd(1); + gold_ElectronEnergyResolution->SetTitle("Tight Gold Electron Energy Resolution"); + gold_ElectronEnergyResolution->GetXaxis()->SetTitle("Pt (GeV)"); + gold_ElectronEnergyResolution->GetYaxis()->SetTitle("Eta"); + gold_ElectronEnergyResolution->SetStats(0); + gold_ElectronEnergyResolution->Draw("colz"); + + can->cd(2); + silver_ElectronEnergyResolution->SetTitle("Tight Silver Electron Energy Resolution"); + silver_ElectronEnergyResolution->GetXaxis()->SetTitle("Pt (GeV)"); + silver_ElectronEnergyResolution->GetYaxis()->SetTitle("Eta"); + silver_ElectronEnergyResolution->SetStats(0); + silver_ElectronEnergyResolution->Draw("colz"); + + can->cd(3); + bronze_ElectronEnergyResolution->SetTitle("Tight Bronze Electron Energy Resolution"); + bronze_ElectronEnergyResolution->GetXaxis()->SetTitle("Pt (GeV)"); + bronze_ElectronEnergyResolution->GetYaxis()->SetTitle("Eta"); + bronze_ElectronEnergyResolution->SetStats(0); + bronze_ElectronEnergyResolution->Draw("colz"); + + can->cd(4); + std::string eta_string = "Sweep of Electron Energy Resolution in eta for pt = " + std::to_string(plot_pt) + "GeV"; + const char *eta_title = eta_string.c_str(); + gold_graph_eta->SetTitle(eta_title); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Abolute Electron Energy Resolution"); + gold_graph_eta->Draw("ALP"); + silver_graph_eta->Draw("LP"); + bronze_graph_eta->Draw("LP"); + + can->cd(5); + std::string pt_string = "Sweep of Electron Energy Resolution in pt for eta = " + std::to_string(plot_eta); + const char *pt_title = pt_string.c_str(); + gold_graph_pt->SetTitle(pt_title); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Abolute Electron Energy Resolution"); + gold_graph_pt->Draw("ALP"); + silver_graph_pt->Draw("LP"); + bronze_graph_pt->Draw("LP"); + + can->Update(); + can->Print("ElectronEnergyResolution.pdf"); + can->Close(); + + return; +} + +void plotFlavourTagEfficiency(UpgradePerformanceFunctions *m_upgrade, float plot_eta, float plot_pt, char flavour, TString Tagger, int operating_point) { + // Make plot of choosen Flavour tagging efficiency for pt and eta + std::cout << "Generating " << flavour << "Tagging Efficiency plots" << std::endl; + + //Choose file containing histograms for Flavour tagging + m_upgrade->setFlavourTaggingCalibrationFilename("UpgradePerformanceFunctions/flavor_tags_v1.1.root"); + + TH2D *gold_FlavourTagEfficiency = new TH2D("gold_FlavourTagEfficiency","gold_FlavourTagEfficiency",1000,0,120,1000,0,5); + + std::vector<float> eta; //Store x values for eta scan + std::vector<float> pt; //Store x values for pt scan + std::vector<float> gold_eta; //Store gold eta scan + std::vector<float> gold_pt; //Store gold pt scan + + float pt_f = 0; + float eta_f = 0; + float result_f = 0; + + for(int j=0;j<1000;j++){ //Begin eta loop + + for(int i=0;i<1000;i++){ //Begin pt loop + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getFlavourTagEfficiency(pt_f*1000,eta_f,flavour,Tagger,operating_point); + gold_FlavourTagEfficiency->SetBinContent(i,j,result_f); + if(eta_f < (plot_eta + .004) && eta_f > (plot_eta - .004)) { + plot_eta = eta_f; + gold_pt.push_back(result_f); + pt.push_back(pt_f); + } + + if(pt_f < (plot_pt + .11) && pt_f > (plot_pt - .11)){ + plot_pt = pt_f; + eta.push_back(eta_f); + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getFlavourTagEfficiency(pt_f*1000,eta_f,flavour,Tagger,operating_point); + gold_eta.push_back(result_f); + } + + pt_f = pt_f + 120.0/1000.0; //iterate pt from 0 to 120 in .12(GeV) steps + } // End pt loop + + eta_f = eta_f + 5.0/1000.0; //iterate eta from 0 to 5 in .005 steps + pt_f = 0; + } //End eta loop + + // Create eta scan TGraph objects and edit for plotting + TGraph *gold_graph_eta = new TGraph(eta.size(),&eta[0],&gold_eta[0]); + gold_graph_eta->SetLineColor(2); + gold_graph_eta->SetMarkerColor(2); + + // Create pt scan TGraph objects and edit for plotting + TGraph *gold_graph_pt = new TGraph(pt.size(),&pt[0],&gold_pt[0]); + gold_graph_pt->SetLineColor(2); + gold_graph_pt->SetMarkerColor(2); + + gStyle->SetPalette(55);// Rainbow palette for TH2D + + TCanvas *can = new TCanvas("can","Flavour Tagging Efficiency",1000,1000); + can->Divide(2,2); + + std::string flavour_string(1,flavour); + + can->cd(1); + std::string gold_histo_name = "Gold " + flavour_string + "-Tagging Efficiency"; + gold_FlavourTagEfficiency->SetTitle(gold_histo_name.c_str()); + gold_FlavourTagEfficiency->GetXaxis()->SetTitle("Pt (GeV)"); + gold_FlavourTagEfficiency->GetYaxis()->SetTitle("Eta"); + gold_FlavourTagEfficiency->SetStats(0); + gold_FlavourTagEfficiency->Draw("colz"); + + can->cd(3); + std::string eta_string = "Sweep of " + flavour_string + "-Tagging efficiency in eta for pt = " + std::to_string(plot_pt) + "GeV"; + gold_graph_eta->SetTitle(eta_string.c_str()); + gold_graph_eta->GetXaxis()->SetTitle("Eta"); + gold_graph_eta->GetYaxis()->SetTitle("Flavour Tagging Efficiency"); + gold_graph_eta->Draw("ALP"); + + can->cd(4); + std::string pt_string = "Sweep of " + flavour_string + "-Tagging efficiency in pt for eta = " + std::to_string(plot_eta); + gold_graph_pt->SetTitle(pt_string.c_str()); + gold_graph_pt->GetXaxis()->SetTitle("Pt (GeV)"); + gold_graph_pt->GetYaxis()->SetTitle("Flavour Tagging Efficiency"); + gold_graph_pt->Draw("ALP"); + + std::string filename = flavour_string + "-TagEfficiency.pdf"; + + can->Update(); + can->Print(filename.c_str()); + can->Close(); + + return; +} + + +void plotMETResolution(UpgradePerformanceFunctions *m_upgrade, float sumEtGeV, float METxGeV, float METyGeV){ + // Make plot of Missing Transverse Energy performance + std::cout << "Generating Missing Transverse Energy performance plots" << std::endl; + + //Choose file containing histograms for Missing Transverse Energy + m_upgrade->loadMETHistograms("UpgradePerformanceFunctions/sumetPU_mu200_ttbar_gold.root"); + + // Set random number generator seed for MET smearing function + m_upgrade->setMETRandomSeed(1); + + // Set average pileup for analysis (only mu = 200 exists currently) + std::cout << "Resetting average pileup value to 200" << std::endl; + m_upgrade->setAvgMu(200.); + + // Storage container for MET result defined by UpgradePerformaceFunctions + UpgradePerformanceFunctions::MET met_result; // Definition: typedef std::pair<double,double> MET + met_result.first = 0; // initialize METxMeV to 0 + met_result.second = 0; // initialize METyMeV to 0 + + TH1D *SmearedMETx = new TH1D("SmearedMETx","SmearedMETx",100,-200,200); + TH1D *SmearedMETy = new TH1D("SmearedMETy","SmearedMETy",100,-200,200); + TH1D *SmearedMETphi = new TH1D("SmearedMETphi","SmearedMETphiSmeared",100,-4,4); + + std::vector<float> gold_resol; //Store gold MET resolution + std::vector<float> silver_resol; //Store silver MET resolution + std::vector<float> bronze_resol; //Store bronze MET resolution + std::vector<float> sumEt; // Store sum Et for plotting + + float result_f = 0; + float temp_sumEt = 0; + float temp_METx = 0; + float temp_METy = 0; + float temp_phi = 0; + float truth_phi = atan2(METyGeV,METxGeV); + + for(int i=0;i<1000000;i++){ //Create 100000 smeared events + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); // Only gold implemented + met_result = m_upgrade->getMETSmeared(sumEtGeV*1000,METxGeV*1000,METyGeV*1000); + + temp_METx = met_result.first/1000; // Smeared METx in GeV + temp_METy = met_result.second/1000; // Smeared METy in GeV + temp_phi = atan2(temp_METy,temp_METx); + + SmearedMETx->Fill(temp_METx - METxGeV); // Center Distribution at 0 + SmearedMETy->Fill(temp_METy - METyGeV); // Center distribution at 0 + + if((temp_phi-truth_phi) <= -M_PI) { + temp_phi = temp_phi + 2*M_PI - truth_phi; + } + else { + temp_phi = temp_phi - truth_phi; + } + SmearedMETphi->Fill(temp_phi); + + } //End METSmeared loop + + for(int i=0;i<70000;i++) { // Generate points for MET Resolution plot + temp_sumEt = i * 100; + sumEt.push_back(temp_sumEt/1000); + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + result_f = m_upgrade->getMETResolution(temp_sumEt); + gold_resol.push_back(result_f/1000.0); + + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + result_f = m_upgrade->getMETResolution(temp_sumEt); + silver_resol.push_back(result_f/1000.0); + + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + result_f = m_upgrade->getMETResolution(temp_sumEt); + bronze_resol.push_back(result_f/1000.0); + } //End METResolution loop + + // Create sumEt scan TGraph objects and edit for plotting + TGraph *bronze_graph_resol = new TGraph(sumEt.size(),&sumEt[0],&bronze_resol[0]); + bronze_graph_resol->SetLineColor(1); + bronze_graph_resol->SetMarkerColor(1); + TGraph *silver_graph_resol = new TGraph(sumEt.size(),&sumEt[0],&silver_resol[0]); + silver_graph_resol->SetLineColor(4); + silver_graph_resol->SetMarkerColor(4); + TGraph *gold_graph_resol = new TGraph(sumEt.size(),&sumEt[0],&gold_resol[0]); + gold_graph_resol->SetLineColor(2); + gold_graph_resol->SetMarkerColor(2); + + TCanvas *can = new TCanvas("can","Missing Transverse Energy Performance",1000,1000); + can->Divide(2,2); + + can->cd(1); + SmearedMETx->SetTitle("Smeared MET on X-axis"); + SmearedMETx->GetXaxis()->SetTitle("[Smeared METx - True METx] (GeV)"); + SmearedMETx->SetStats(0); + SmearedMETx->Draw(); + + can->cd(2); + SmearedMETy->SetTitle("Smeared MET on Y-axis"); + SmearedMETy->GetXaxis()->SetTitle("[Smeared METy - True METy] (GeV)"); + SmearedMETy->SetStats(0); + SmearedMETy->Draw(); + + can->cd(3); + SmearedMETphi->SetTitle("Smeared MET in phi"); + SmearedMETphi->GetXaxis()->SetTitle("[Smeared Phi - True Phi] (radians)"); + SmearedMETphi->SetStats(0); + SmearedMETphi->Draw(); + + can->cd(4); + bronze_graph_resol->SetTitle("MET resolution vs raw sumEt"); + bronze_graph_resol->GetXaxis()->SetTitle("raw sumEt (GeV)"); + bronze_graph_resol->GetYaxis()->SetTitle("Absolute MET resolution (GeV)"); + bronze_graph_resol->Draw("ALP"); + silver_graph_resol->Draw("LP"); + gold_graph_resol->Draw("LP"); + + can->Update(); + can->Print("METPerformance.pdf"); + can->Close(); + + return; +} + + +void plotTrackJetConfirmEff(UpgradePerformanceFunctions *m_upgrade, float plot_pt) { + // Make plot of Missing Transverse Energy performance + std::cout << "Generating Track-Jet Confirmation Efficiency plots" << std::endl; + + // m_upgrade->setUseHGTD1(true); + + //Initialize jet parameters + m_upgrade->setJetRandomSeed(1); + m_upgrade->setPileupUseTrackConf(true); + m_upgrade->setPileupRandomSeed(1); + m_upgrade->setPileupJetPtThresholdMeV(30000.); + + // Set pileup (options currently incude 140 and 200 + m_upgrade->setAvgMu(200.); + + TCanvas *can = new TCanvas("can","Track-jet confirmation efficiency",1000,1000); + //can->Divide(2,2); + + // Vectors for storing Track Jet Confirmation Efficiency for gold, silver, bronze + std::vector<float> gold_HS; + std::vector<float> gold_PU; + std::vector<float> silver_HS; + std::vector<float> silver_PU; + std::vector<float> bronze_HS; + std::vector<float> bronze_PU; + + std::vector<float> eta; + + float temp_eta = 0; + float store_result = 0; + + for(int j=0;j<2;j++) { // First loop Scheme = HS, Second loop Scheme = PU + if(j == 0){ // First loop Scheme = HS + std::cout << "First Track-jet confirmation loop Scheme = HS and PileupEff = .9" <<std::endl; + m_upgrade->setPileupEfficiencyScheme(UpgradePerformanceFunctions::PileupEff::HS); + m_upgrade->setPileupEff(0.9); + } + else { // Second loop Scheme = PU + std::cout << "Second Track-jet confirmation loop Scheme = PU and PileupEff = .02" <<std::endl; + m_upgrade->setPileupEfficiencyScheme(UpgradePerformanceFunctions::PileupEff::PU); + m_upgrade->setPileupEff(0.02); + } + + // **** Gold Loop **** // + temp_eta = 0; // Start eta at 0 + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + m_upgrade->setPileupTemplatesPath("/afs/cern.ch/atlas/www/GROUPS/DATABASE/GroupData/UpgradePerformanceFunctions"); + for(int i=0;i<1000;i++){ // Gold loop to fill vectors + eta.push_back(temp_eta); + + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"HS"); + gold_HS.push_back(store_result); + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"PU"); + gold_PU.push_back(store_result); + + temp_eta = temp_eta + 5.0/1000.0; + } // End Gold loop to fill vectors + + // **** Silver Loop **** // + temp_eta = 0; // Start eta at 0 + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + m_upgrade->setPileupTemplatesPath("/afs/cern.ch/atlas/www/GROUPS/DATABASE/GroupData/UpgradePerformanceFunctions"); + for(int i=0;i<1000;i++){ // Silver loop to fill vectors + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"HS"); + silver_HS.push_back(store_result); + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"PU"); + silver_PU.push_back(store_result); + + temp_eta = temp_eta + 5.0/1000.0; + } // End Silver loop to fill vectors + + // **** Bronze Loop **** // + temp_eta = 0; // Start eta at 0 + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + m_upgrade->setPileupTemplatesPath("/afs/cern.ch/atlas/www/GROUPS/DATABASE/GroupData/UpgradePerformanceFunctions"); + for(int i=0;i<1000;i++){ // Bronze loop to fill vectors + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"HS"); + bronze_HS.push_back(store_result); + store_result = m_upgrade->getTrackJetConfirmEff(plot_pt*1000,temp_eta,"PU"); + bronze_PU.push_back(store_result); + + temp_eta = temp_eta + 5.0/1000.0; + } // End Bronze loop to fill vectors + + + if(j == 0) { // Generate and draw plots for Scheme = HS and PileupEff = .9 + + // Create Track Jet Confirmation Efficiency for jets from Hard Scatter + TGraph *bronze_graph1_HS = new TGraph(eta.size(),&eta[0],&bronze_HS[0]); + bronze_graph1_HS->SetLineColor(1); + bronze_graph1_HS->SetMarkerColor(1); + TGraph *silver_graph1_HS = new TGraph(eta.size(),&eta[0],&silver_HS[0]); + silver_graph1_HS->SetLineColor(4); + silver_graph1_HS->SetMarkerColor(4); + TGraph *gold_graph1_HS = new TGraph(eta.size(),&eta[0],&gold_HS[0]); + gold_graph1_HS->SetLineColor(2); + gold_graph1_HS->SetMarkerColor(2); + + // Create Track Jet Confirmation Efficiency for jets from Pileup + TGraph *bronze_graph1_PU = new TGraph(eta.size(),&eta[0],&bronze_PU[0]); + bronze_graph1_PU->SetLineColor(1); + bronze_graph1_PU->SetMarkerColor(1); + TGraph *silver_graph1_PU = new TGraph(eta.size(),&eta[0],&silver_PU[0]); + silver_graph1_PU->SetLineColor(4); + silver_graph1_PU->SetMarkerColor(4); + TGraph *gold_graph1_PU = new TGraph(eta.size(),&eta[0],&gold_PU[0]); + gold_graph1_PU->SetLineColor(2); + gold_graph1_PU->SetMarkerColor(2); + + // can->cd(1); + // gold_graph1_PU->SetTitle("TrackJetConfirmEff for PU with Scheme = HS and PileupEff = .9"); + // gold_graph1_PU->GetXaxis()->SetTitle("Eta"); + // gold_graph1_PU->GetYaxis()->SetTitle("TrackJetConfirmEff"); + // gold_graph1_PU->Draw("ALP"); + // silver_graph1_PU->Draw("LP"); + // bronze_graph1_PU->Draw("LP"); + + // can->cd(2); + // gold_graph1_HS->SetTitle("TrackJetConfirmEff for HS with Scheme = HS and PileupEff = .9"); + // gold_graph1_HS->GetXaxis()->SetTitle("Eta"); + // gold_graph1_HS->GetYaxis()->SetTitle("TrackJetConfirmEff"); + // gold_graph1_HS->Draw("ALP"); + // silver_graph1_HS->Draw("LP"); + // bronze_graph1_HS->Draw("LP"); + + // Clear out vectors for second loop plots + gold_HS.clear(); + gold_PU.clear(); + silver_HS.clear(); + silver_PU.clear(); + bronze_HS.clear(); + bronze_PU.clear(); + eta.clear(); + } + + else { // Generate and draw plots for Scheme = PU and PileupEff = .02 + // Create Track Jet Confirmation Efficiency for jets from Hard Scatter + TGraph *bronze_graph2_HS = new TGraph(eta.size(),&eta[0],&bronze_HS[0]); + bronze_graph2_HS->SetLineColor(1); + bronze_graph2_HS->SetMarkerColor(1); + TGraph *silver_graph2_HS = new TGraph(eta.size(),&eta[0],&silver_HS[0]); + silver_graph2_HS->SetLineColor(4); + silver_graph2_HS->SetMarkerColor(4); + TGraph *gold_graph2_HS = new TGraph(eta.size(),&eta[0],&gold_HS[0]); + gold_graph2_HS->SetLineColor(2); + gold_graph2_HS->SetMarkerColor(2); + + // Create Track Jet Confirmation Efficiency for jets from Pileup + TGraph *bronze_graph2_PU = new TGraph(eta.size(),&eta[0],&bronze_PU[0]); + bronze_graph2_PU->SetLineColor(1); + bronze_graph2_PU->SetMarkerColor(1); + TGraph *silver_graph2_PU = new TGraph(eta.size(),&eta[0],&silver_PU[0]); + silver_graph2_PU->SetLineColor(4); + silver_graph2_PU->SetMarkerColor(4); + TGraph *gold_graph2_PU = new TGraph(eta.size(),&eta[0],&gold_PU[0]); + gold_graph2_PU->SetLineColor(2); + gold_graph2_PU->SetMarkerColor(2); + + // can->cd(3); + // gold_graph2_PU->SetTitle("TrackJetConfirmEff for PU with Scheme = PU and PileupEff = .02"); + // gold_graph2_PU->GetXaxis()->SetTitle("Eta"); + // gold_graph2_PU->GetYaxis()->SetTitle("TrackJetConfirmEff"); + // gold_graph2_PU->Draw("ALP"); + // silver_graph2_PU->Draw("LP"); + // bronze_graph2_PU->Draw("LP"); + + // can->cd(4); + gold_graph2_HS->SetTitle("TrackJetConfirmEff for HS with Scheme = PU and PileupEff = .02"); + gold_graph2_HS->GetXaxis()->SetTitle("Eta"); + gold_graph2_HS->GetYaxis()->SetTitle("TrackJetConfirmEff"); + gold_graph2_HS->Draw("ALP"); + // silver_graph2_HS->Draw("LP"); + // bronze_graph2_HS->Draw("LP"); + } + } + + can->Update(); + can->Print("TrackJetConfirmEff.pdf"); + can->Close(); + + return; +} diff --git a/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/testPerformanceFunctions.cxx b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/testPerformanceFunctions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..332054c5e0666a7bba25a5cf75cafa38c3580584 --- /dev/null +++ b/PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions/util/testPerformanceFunctions.cxx @@ -0,0 +1,146 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include "TROOT.h" +#include "UpgradePerformanceFunctions/UpgradePerformanceFunctions.h" + +int main() { + std::cout << "This is a test." << std::endl; + // This hack is needed to force dictionary loading in ROOT 5 + gROOT->ProcessLine("#include <vector>"); + + UpgradePerformanceFunctions *m_upgrade = new UpgradePerformanceFunctions(); + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + m_upgrade->setAvgMu(200.); + std::cout << "Layout is " << m_upgrade->getLayout() + << ", and mu value is " << m_upgrade->getAvgMu() << std::endl; + m_upgrade->setElectronWorkingPoint(UpgradePerformanceFunctions::looseElectron); + m_upgrade->setElectronRandomSeed(1); + m_upgrade->setMuonWorkingPoint(UpgradePerformanceFunctions::tightMuon); + m_upgrade->setPhotonWorkingPoint(UpgradePerformanceFunctions::tightPhoton); + m_upgrade->loadMETHistograms("UpgradePerformanceFunctions/sumetPU_mu200_ttbar_gold.root"); + m_upgrade->setJetRandomSeed(1); + m_upgrade->setPileupRandomSeed(1); + m_upgrade->setPileupUseTrackConf(true); + m_upgrade->setUseHGTD1(true); + //m_upgrade->setUseHGTD0(false); + m_upgrade->setPileupJetPtThresholdMeV(30000.); + m_upgrade->setPileupEfficiencyScheme(UpgradePerformanceFunctions::PU); + m_upgrade->setPileupEff(0.02); + // m_upgrade->setHGTDPUEff(0.1); + // m_upgrade->setHGTDHSEff(0.9); + // m_upgrade->setPileupTemplatesPath("/afs/cern.ch/atlas/www/GROUPS/DATABASE/GroupData/UpgradePerformanceFunctions/"); + m_upgrade->setPileupTemplatesPath("/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/UpgradePerformanceFunctions/"); + m_upgrade->initPhotonFakeHistograms("UpgradePerformanceFunctions/PhotonFakes.root"); + + // This is just a test of some methods without realistic input. + std::cout << "ElectronToPhotonFakeRate at pT=50 GeV is " + << m_upgrade->getElectronToPhotonFakeRate(50.*1000., 0.0) + << std::endl; + + std::cout << "Photon efficiency at pT=50 GeV is " + << m_upgrade->getPhotonEfficiency(50.*1000.) << std::endl; + std::cout << "Photon efficiency at pT=10 GeV is " + << m_upgrade->getPhotonEfficiency(10.*1000.) << std::endl; + std::cout << "Jet-to-photon fake rate at pT=50 GeV is " + << m_upgrade->getPhotonFakeRate(50.*1000.) << std::endl; + std::cout << "Jet-to-photon fake rate at pT=10 GeV is " + << m_upgrade->getPhotonFakeRate(10.*1000.) << std::endl; + std::cout << "Photon pileup fake rate at pT=50 GeV is " + << m_upgrade->getPhotonPileupFakeRate(50.*1000.) << std::endl; + + // Test of the photon fake energy rescaling + std::cout << "Photon fake rescaled ET at ET=50 GeV is " + << m_upgrade->getPhotonFakeRescaledET(50.*1000.) << " MeV" << std::endl; + std::cout << "Photon pileup fake rescaled ET=50 GeV is " + << m_upgrade->getPhotonPileupFakeRescaledET(50.*1000.) << " MeV" << std::endl; + + float eventMETreso = m_upgrade->getMETResolution(100000.0); + std::cout << "MET resolution test result is " << eventMETreso << std::endl; + + std::cout << "Muon trigger efficiency at pT=200 GeV, eta=1.0 is " + << m_upgrade->getSingleMuonTriggerEfficiency(200000.,1.0) + << std::endl; + + std::cout << "Muon trigger efficiency at pT=200 GeV, eta=1.1 is " + << m_upgrade->getSingleMuonTriggerEfficiency(200000.,1.1) + << std::endl; + + float muonEfficiency = m_upgrade->getMuonEfficiency(2000000., 1.5); + std::cout << "Muon efficiency at pT=2000 GeV, eta=1.5 is " + << muonEfficiency << std::endl; + + float muonPtResolution = m_upgrade->getMuonPtResolution(500000., 2.0); + std::cout << "Muon pT resolution at pT=500 GeV, eta=2.0 is " + << muonPtResolution << " MeV" << std::endl; + muonPtResolution = m_upgrade->getMuonPtResolution(2000000., 1.5); + std::cout << "Muon pT resolution at pT=2000 GeV, eta=1.5 is " + << muonPtResolution << " MeV" << std::endl; + muonPtResolution = m_upgrade->getMuonPtResolution(12000., 0.15); + std::cout << "Muon pT resolution at pT=12 GeV, eta=0.15 is " + << muonPtResolution << " MeV" << std::endl; + + float muonQOverPtResolution = m_upgrade->getMuonQOverPtResolution(12000., 0.15); + std::cout << "Muon qOverPT resolution at pT=12 GeV, eta=0.15 is " + << muonQOverPtResolution << "/MeV" << std::endl; + + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + std::cout << "electron efficiency (gold) = " << m_upgrade->getElectronEfficiency(40000., 1.0) << std::endl; + std::cout << "muon efficiency (gold) = " << m_upgrade->getMuonEfficiency(40000., 2.8) << std::endl; + m_upgrade->setLayout(UpgradePerformanceFunctions::silver); + std::cout << "electron efficiency (silver) = " << m_upgrade->getElectronEfficiency(40000., 1.0) << std::endl; + std::cout << "muon efficiency (silver) = " << m_upgrade->getMuonEfficiency(40000., 2.8) << std::endl; + m_upgrade->setLayout(UpgradePerformanceFunctions::bronze); + std::cout << "electron efficiency (bronze) = " << m_upgrade->getElectronEfficiency(40000., 1.0) << std::endl; + std::cout << "muon efficiency (bronze) = " << m_upgrade->getMuonEfficiency(40000., 2.8) << std::endl; + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + + std::vector<TLorentzVector> pileupJets = m_upgrade->getPileupJets(); + std::cout << "Found " << pileupJets.size() << " pileup jets above threshold" << std::endl; + std::cout << "Track Confirmation Efficiency for PU pT=40 GeV, eta=1.0 is " + << m_upgrade->getTrackJetConfirmEff(40000., 1.0, "PU") << std::endl; + std::cout << "Track Confirmation Efficiency for HS pT=40 GeV, eta=1.0 is " + << m_upgrade->getTrackJetConfirmEff(40000., 1.0, "HS") << std::endl; + std::cout << "Track Confirmation Efficiency for PU pT=40 GeV, eta=4.5 is " + << m_upgrade->getTrackJetConfirmEff(40000., 4.5, "PU") << std::endl; + std::cout << "Track Confirmation Efficiency for HS pT=40 GeV, eta=4.5 is " + << m_upgrade->getTrackJetConfirmEff(40000., 4.5, "HS") << std::endl; + + // Temporarily change layout for flavour tagging + m_upgrade->setLayout(UpgradePerformanceFunctions::gold); + m_upgrade->setFlavourTaggingCalibrationFilename("UpgradePerformanceFunctions/flavor_tags_v1.1.root"); + + std::cout << "b-tagging efficiency for pT=40 GeV, eta=1.0 (no TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'B', "mv1", 70) << std::endl; + std::cout << "c-tagging efficiency for pT=40 GeV, eta=1.0 (no TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'C', "mv1", 70) << std::endl; + std::cout << "b-tagging efficiency for pT=40 GeV, eta=1.0 (w/ TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'B', "mv1", 70, true) << std::endl; + std::cout << "c-tagging efficiency for pT=40 GeV, eta=1.0 (w/ TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'C', "mv1", 70, true) << std::endl; + + std::cout << "b-tagging 85 efficiency for pT=40 GeV, eta=1.0 (no TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'B', "mv1", 85) << std::endl; + std::cout << "c-tagging 85 efficiency for pT=40 GeV, eta=1.0 (no TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'C', "mv1", 85) << std::endl; + std::cout << "b-tagging 85 efficiency for pT=40 GeV, eta=1.0 (w/ TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'B', "mv1", 85, true) << std::endl; + std::cout << "c-tagging 85 efficiency for pT=40 GeV, eta=1.0 (w/ TC) is " + << m_upgrade->getFlavourTagEfficiency(40000., 1.0, 'C', "mv1", 85, true) << std::endl; + + std::cout << "Single electron trigger efficiency for pT=20 GeV, eta=1.0 is " + << m_upgrade->getSingleElectronTriggerEfficiency(20000., 1.0) << std::endl; + std::cout << "Dielectron trigger efficiency for pT=20 GeV, eta=1.0 is " + << m_upgrade->getDiElectronTriggerEfficiency(20000., 20000., 1.0, 1.0) << std::endl; + + std::cout << "Four-jet trigger efficiency for pT=100 GeV, eta=1.0 is " + << m_upgrade->getFourJetTriggerEfficiency(100000., 1.0, + 100000., 1.0, + 100000., 1.0, + 100000., 1.0) + << std::endl; + + return 0; +} diff --git a/Projects/AnalysisTop/AnalysisTopReleaseEnvironmentConfig.cmake b/Projects/AnalysisTop/AnalysisTopReleaseEnvironmentConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..402d07410ae445789abe73ef3f61ac64bd6c2ffc --- /dev/null +++ b/Projects/AnalysisTop/AnalysisTopReleaseEnvironmentConfig.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id: AnalysisTopReleaseEnvironmentConfig.cmake 784551 2016-11-16 12:46:32Z krasznaa $ +# +# This file holds the compile and runtime environment configuration specific +# for the analysis release. +# + +# This is a standalone project, so set the appropriate compile flags: +add_definitions( -DROOTCORE ) +add_definitions( -DXAOD_STANDALONE ) +add_definitions( -DXAOD_ANALYSIS ) +add_definitions( -DROOTCORE_RELEASE_SERIES=25 ) + +# And the same variables for CMake as well: +set( ROOTCORE TRUE CACHE BOOL + "Flag specifying that this is a \"RootCore\" release" ) +set( XAOD_STANDALONE TRUE CACHE BOOL + "Flag specifying that this is a standalone build" ) +set( XAOD_ANALYSIS TRUE CACHE BOOL + "Flag specifying that this is an analysis release" ) + +# Vatriable that should be picked up by the environment creation code: +set( AnalysisTopReleaseEnvironment_ENVIRONMENT + SET ROOTCOREDIR \${AnalysisTop_DIR} + SET ROOTCOREBIN \${AnalysisTop_DIR} ) diff --git a/Projects/AnalysisTop/CMakeLists.txt b/Projects/AnalysisTop/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbfcbe790ea22eec9bc61ba02ac070129b6acc93 --- /dev/null +++ b/Projects/AnalysisTop/CMakeLists.txt @@ -0,0 +1,93 @@ +# $Id: CMakeLists.txt 787093 2016-11-29 13:43:09Z krasznaa $ +# +# This is the main CMakeLists.txt file for building the AnalysisTop +# software release. +# + +# The minimum required CMake version: +cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) + +# Read in the project's version from a file called version.txt. But let it be +# overridden from the command line if necessary. +file( READ ${CMAKE_SOURCE_DIR}/version.txt _version ) +string( STRIP ${_version} _version ) +set( ANALYSISBASE_PROJECT_VERSION ${_version} + CACHE STRING "Version of the AnalysisTop project to build" ) +unset( _version ) + +# This project is built on top of AnalysisBaseExternals: +find_package( AnalysisBaseExternals REQUIRED ) + +# Find Python. This is needed because AnalysisBaseExternals sets up +# a wrong value for PYTHONHOME. And nothing in AnalysisBase builds +# against Python to correct it. +find_package( PythonInterp ) + +# Add the project's modules directory to CMAKE_MODULE_PATH: +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules ) +list( REMOVE_DUPLICATES CMAKE_MODULE_PATH ) + +# Install the files from modules/: +install( DIRECTORY ${CMAKE_SOURCE_DIR}/modules/ + DESTINATION cmake/modules + USE_SOURCE_PERMISSIONS + PATTERN ".svn" EXCLUDE + PATTERN "*~" EXCLUDE ) + +# Include the AnalysisBase specific function(s) (probably no need to make AnalysisTop specific): +include( AnalysisBaseFunctions ) + +# Set up the build/runtime environment: +set( AnalysisTopReleaseEnvironment_DIR ${CMAKE_SOURCE_DIR} ) +find_package( AnalysisTopReleaseEnvironment REQUIRED ) + +# Add the directory to the global include path, where the project +# will create the RootCore/Packages.h header: +include_directories( ${CMAKE_BINARY_DIR}/RootCore/include ) + +# Set up CTest: +atlas_ctest_setup() + + +# Declare project name and version +atlas_project( AnalysisTop ${ANALYSISTOP_PROJECT_VERSION} + USE AnalysisBaseExternals ${AnalysisBaseExternals_VERSION} + PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) + +# Generate the RootCore/Packages.h header: +analysisbase_generate_release_header() + +# Set up the load_packages.C script: +configure_file( ${CMAKE_SOURCE_DIR}/scripts/load_packages.C.in + ${CMAKE_SCRIPT_OUTPUT_DIRECTORY}/load_packages.C @ONLY ) +install( FILES ${CMAKE_SCRIPT_OUTPUT_DIRECTORY}/load_packages.C + DESTINATION ${CMAKE_INSTALL_SCRIPTDIR} ) + +# Configure and install the post-configuration file: +configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY ) +install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) + +# Generate replacement rules for the installed paths: +set( _replacements ) +if( NOT "$ENV{NICOS_PROJECT_HOME}" STREQUAL "" ) + get_filename_component( _buildDir $ENV{NICOS_PROJECT_HOME} PATH ) + list( APPEND _replacements ${_buildDir} "\${AnalysisTop_DIR}/../../../.." ) +endif() +if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" ) + list( APPEND _replacements $ENV{NICOS_PROJECT_RELNAME} + "\${AnalysisTop_VERSION}" ) +endif() + +# Generate the environment configuration file(s): +lcg_generate_env( + SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh ) +lcg_generate_env( + SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh + REPLACE ${_replacements} ) +install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh + DESTINATION . RENAME env_setup.sh ) + +# Set up the release packaging: +atlas_cpack_setup() diff --git a/Projects/AnalysisTop/PostConfig.cmake.in b/Projects/AnalysisTop/PostConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..10a35114b974f7117b3c52984d545e3692a7d72f --- /dev/null +++ b/Projects/AnalysisTop/PostConfig.cmake.in @@ -0,0 +1,21 @@ +# $Id: PostConfig.cmake.in 787191 2016-11-29 19:41:54Z krasznaa $ +# +# File setting up some basic properties for the installed analysis releases. +# + +# Make all compilation see the RootCore/Packages.h file: +include_directories( $ENV{AnalysisTop_DIR}/RootCore/include ) + +# This is a standalone project, so set the appropriate compile flags: +add_definitions( -DROOTCORE ) +add_definitions( -DXAOD_STANDALONE ) +add_definitions( -DXAOD_ANALYSIS ) +add_definitions( -DROOTCORE_RELEASE_SERIES=$ENV{ROOTCORE_RELEASE_SERIES} ) + +# And some variables for CMake as well: +set( ROOTCORE TRUE CACHE BOOL + "Flag specifying that this is a \"RootCore\" release" ) +set( XAOD_STANDALONE TRUE CACHE BOOL + "Flag specifying that this is a standalone build" ) +set( XAOD_ANALYSIS TRUE CACHE BOOL + "Flag specifying that this is an analysis release" ) diff --git a/Projects/AnalysisTop/build.sh b/Projects/AnalysisTop/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..91e630f9a15d90b73a6726935947b2f45d9a7752 --- /dev/null +++ b/Projects/AnalysisTop/build.sh @@ -0,0 +1,160 @@ +#!/bin/bash +# +# Script for building the release on top of externals built using the +# script in this directory. +# + +# Function printing the usage information for the script +usage() { + echo "Usage: build.sh [-t type] [-b dir] [-g generator] [-c] [-m] [-i] [-p] [-a]" + echo "" + echo " General flags:" + echo " -t: The (optional) CMake build type to use." + echo " -b: The (optional) build directory to use." + echo " -g: The (optional) CMake generator to use." + echo " -a: Abort on error." + echo " Build step selection:" + echo " -c: Execute the CMake step." + echo " -m: Execute the make/build step." + echo " -i: Execute the install step." + echo " -p: Execute the CPack step." + echo "" + echo " If none of the c, m, i or p options are set then the script will do" + echo " *all* steps. Otherwise only the enabled steps are run - it's your" + echo " reponsibility to ensure that precusors are in good shape" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +GENERATOR="Unix Makefiles" +EXE_CMAKE="" +EXE_MAKE="" +EXE_INSTALL="" +EXE_CPACK="" +NIGHTLY=true +while getopts ":t:b:g:hcmipa" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + g) + GENERATOR=$OPTARG + ;; + c) + EXE_CMAKE="1" + ;; + m) + EXE_MAKE="1" + ;; + i) + EXE_INSTALL="1" + ;; + p) + EXE_CPACK="1" + ;; + a) + NIGHTLY=false + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +if [ -z "$EXE_CMAKE" -a -z "$EXE_MAKE" -a -z "$EXE_INSTALL" -a \ + -z "$EXE_CPACK" ]; then + EXE_CMAKE="1" + EXE_MAKE="1" + EXE_INSTALL="1" + EXE_CPACK="1" +fi + +# Stop on errors from here on out: +set -e + +# Source in our environment +AnalysisTopSrcDir=$(dirname ${BASH_SOURCE[0]}) +if [ -z "$BUILDDIR" ]; then + BUILDDIR=${AnalysisTopSrcDir}/../../../build +fi +mkdir -p ${BUILDDIR} +BUILDDIR=$(cd ${BUILDDIR} && pwd) +source $AnalysisTopSrcDir/build_env.sh -b $BUILDDIR + +# create the actual build directory +mkdir -p ${BUILDDIR}/build/AnalysisTop +cd ${BUILDDIR}/build/AnalysisTop + +# consider a pipe failed if ANY of the commands fails +set -o pipefail + +# CMake: +if [ -n "$EXE_CMAKE" ]; then + # Remove the CMakeCache.txt file, to force CMake to find externals + # from scratch in an incremental build. + rm -f CMakeCache.txt + + # The package specific log files can only be generated with the Makefile + # and Ninja generators. Very notably it doesn't work with IDEs in general. + USE_LAUNCHERS="" + if [ "${GENERATOR}" = "Ninja" ] || [ "${GENERATOR}" = "Unix Makefiles" ]; then + USE_LAUNCHERS=-DCTEST_USE_LAUNCHERS:BOOL=TRUE + fi + + # Now run the actual CMake configuration: + time cmake -G "${GENERATOR}" \ + -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ + ${USE_LAUNCHERS} \ + ${AnalysisTopSrcDir} 2>&1 | tee cmake_config.log +fi + +# For nightly builds we want to get as far as we can: +if [ "$NIGHTLY" = true ]; then + # At this point stop worrying about errors: + set +e +fi + +# Run the build: +if [ -n "$EXE_MAKE" ]; then + if [ "$NIGHTLY" = true ]; then + # In order to build the project in a nightly setup, allowing for some + # build steps to fail while still continuing, we need to use "make" + # directly. Only allowing the usage of the Makefile generator. + time make -k 2>&1 | tee cmake_build.log + else + # However in a non-nightly setup we can just rely on CMake to start + # the build for us. In this case we can use any generator we'd like + # for the build. Notice however that the installation step can still + # be only done correctly by using GNU Make directly. + time cmake --build . 2>&1 | tee cmake_build.log + fi +fi + +# Install the results: +if [ -n "$EXE_INSTALL" ]; then + time make install/fast \ + DESTDIR=${BUILDDIR}/install/AnalysisTop/${NICOS_PROJECT_VERSION} \ + 2>&1 | tee cmake_install.log +fi + +# Build an RPM for the release: +if [ -n "$EXE_CPACK" ]; then + time cpack 2>&1 | tee cmake_cpack.log + FILES=$(ls AnalysisTop*.rpm AnalysisTop*.dmg AnalysisTop*.tar.gz) + cp ${FILES} ${BUILDDIR}/ +fi diff --git a/Projects/AnalysisTop/build_env.sh b/Projects/AnalysisTop/build_env.sh new file mode 100644 index 0000000000000000000000000000000000000000..e14984ea27089df9c646057bc71d3c2c8bd50ca4 --- /dev/null +++ b/Projects/AnalysisTop/build_env.sh @@ -0,0 +1,88 @@ +# This script sets up the build enironment for an AnalysisTop +# build, on top of a built set of externals. +# +# This script is kept separate from the build.sh +# wrapper so it can be sourced separately from it when +# clients want to manage their own build and just want +# to setup the build environment + +env_usage() { + echo "Usage: build_env.sh [-b build dir]" +} + +# This function actually sets up the environment for us +# (factorise it here in case it needs skipped) +env_setup() { + + # As this script can be sourced we need to support zsh and + # possibly other Bourne shells + if [ "x${BASH_SOURCE[0]}" = "x" ]; then + # This trick should do the right thing under ZSH: + thisdir=$(dirname `print -P %x`) + if [ $? != 0 ]; then + echo "ERROR: This script must be sourced from BASH or ZSH" + return 1 + fi + else + # The BASH solution is a bit more straight forward: + thisdir=$(dirname ${BASH_SOURCE[0]}) + fi + AnalysisTopSrcDir=$(cd ${thisdir};pwd) + + # The directory holding the helper scripts: + scriptsdir=${AnalysisTopSrcDir}/../../Build/AtlasBuildScripts + + # Check if the user specified any source/build directories: + if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${AnalysisTopSrcDir}/../../../build + fi + + # Set up the environment for the build: + export NICOS_PROJECT_VERSION=`cat ${AnalysisTopSrcDir}/version.txt` + export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AnalysisTop + + # Set up the AnalysisBaseExternals project: + extDir=${BUILDDIR}/install/AnalysisBaseExternals/${NICOS_PROJECT_VERSION}/InstallArea + if [ ! -d ${extDir} ]; then + echo "Didn't find the AnalysisBaseExternals project under ${extDir}" + fi + echo "Setting up AnalysisBaseExternals from: ${extDir}" + source ${extDir}/*/setup.sh +} + +# we need to reset the option index as we are sourcing this script +# http://stackoverflow.com/questions/23581368/bug-in-parsing-args-with-getopts-in-bash +OPTIND=1 + +# Parse the command line arguments: +BUILDDIR="" +while getopts "b:h" opt; do + case $opt in + b) + BUILDDIR=$OPTARG + ;; + h) + env_usage + ABORT=1 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + env_usage + ABORT=1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + env_usage + ABORT=1 + ;; + esac +done + +# Put a big wrapper around bad argument case, because +# a sourced script should not call "exit". This is quite +# annoying... +if [ -z "$ABORT" ]; then + env_setup +fi diff --git a/Projects/AnalysisTop/build_externals.sh b/Projects/AnalysisTop/build_externals.sh new file mode 100755 index 0000000000000000000000000000000000000000..b09c9059241ba4a86620ceb01f3d27d159552d90 --- /dev/null +++ b/Projects/AnalysisTop/build_externals.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# +# Script building all the externals necessary for the nightly build. +# + +# Stop on errors: +set -e + +# Function printing the usage information for the script +usage() { + echo "Usage: build_externals.sh [-t build_type] [-b build_dir] [-f] [-c]" + echo " -f: Force rebuild of externals, otherwise if script" + echo " finds an external build present it will simply exit" + echo " -c: Build the externals for the continuous integration (CI) system," + echo " skipping the build of the externals RPMs." + echo "If a build_dir is not given the default is '../build'" + echo "relative to the athena checkout" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +FORCE="" +CI="" +while getopts ":t:b:fch" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + f) + FORCE="1" + ;; + c) + CI="1" + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# We are in BASH, get the path of this script in a simple way: +thisdir=$(dirname ${BASH_SOURCE[0]}) +thisdir=$(cd ${thisdir};pwd) + +# Go to the main directory of the repository: +cd ${thisdir}/../.. + +# Check if the user specified any source/build directories: +if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${thisdir}/../../../build +fi +mkdir -p ${BUILDDIR} +BUILDDIR=$(cd $BUILDDIR; pwd) + +if [ "$FORCE" = "1" ]; then + echo "Force deleting existing build area..." + rm -fr ${BUILDDIR}/install/AnalysisBaseExternals + rm -fr ${BUILDDIR}/src/AnalysisBaseExternals + rm -fr ${BUILDDIR}/build/AnalysisBaseExternals +fi + +# Create some directories: +mkdir -p ${BUILDDIR}/install + +# Set some environment variables that the builds use internally: +export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt` +export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} +export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + +# The directory holding the helper scripts: +scriptsdir=${thisdir}/../../Build/AtlasBuildScripts +scriptsdir=$(cd ${scriptsdir}; pwd) + +# Flag for triggering the build of RPMs for the externals: +RPMOPTIONS="-r ${BUILDDIR}" +if [ "$CI" = "1" ]; then + RPMOPTIONS= +fi + +# Read in the tag/branch to use for AnalysisBaseExternals: +AnalysisBaseExternalsVersion=$(awk '/^AnalysisBaseExternalsVersion/{print $3}' ${thisdir}/externals.txt) + +# Check out AnalysisBaseExternals from the right branch/tag: +${scriptsdir}/checkout_atlasexternals.sh \ + -t ${AnalysisBaseExternalsVersion} \ + -s ${BUILDDIR}/src/AnalysisBaseExternals + +# Build AnalysisBaseExternals: +export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AnalysisBaseExternals +${scriptsdir}/build_atlasexternals.sh \ + -s ${BUILDDIR}/src/AnalysisBaseExternals \ + -b ${BUILDDIR}/build/AnalysisBaseExternals \ + -i ${BUILDDIR}/install/AnalysisBaseExternals/${NICOS_PROJECT_VERSION} \ + -p AnalysisBaseExternals ${RPMOPTIONS} -t ${BUILDTYPE} \ + -v ${NICOS_PROJECT_VERSION} diff --git a/Projects/AnalysisTop/externals.txt b/Projects/AnalysisTop/externals.txt new file mode 100644 index 0000000000000000000000000000000000000000..afa6c89b27c277bb60e35465284e1844ad7c23af --- /dev/null +++ b/Projects/AnalysisTop/externals.txt @@ -0,0 +1,4 @@ +# Versions of the various externals to build before starting the build of +# this project, when doing a full stack nightly build. + +AnalysisBaseExternalsVersion = 1.0.11 diff --git a/Projects/AnalysisTop/modules/AnalysisBaseFunctions.cmake b/Projects/AnalysisTop/modules/AnalysisBaseFunctions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..1260c3e73a9237ffa1ef00487a7ce434ba4a4da4 --- /dev/null +++ b/Projects/AnalysisTop/modules/AnalysisBaseFunctions.cmake @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id: AnalysisBaseFunctions.cmake 787191 2016-11-29 19:41:54Z krasznaa $ +# +# This module collects CMake functions that are useful when setting up an +# analysis release. +# + +# Function generating a RootCore/Packages.h header +# +# This function should be called in the main CMakeLists.txt file of the +# project, after the atlas_project(...) call, in order to generate a header file +# called "RootCore/Packages.h", in the format that RootCore generates it in. +# With one define statement per package that was found in he release. +# +# Usage: analysisbase_generate_release_header() +# +function( analysisbase_generate_release_header ) + + # Get the list of packages that were found: + get_property( _packages GLOBAL PROPERTY ATLAS_EXPORTED_PACKAGES ) + + # Generate a "RootCore/Package.h" file, in the same format that + # RootCore does/did: + set( _packagesFileName + ${CMAKE_BINARY_DIR}/RootCore/include/RootCore/Packages.h ) + file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/RootCore/include/RootCore ) + file( WRITE ${_packagesFileName} + "// Auto-generated file, please do not edit\n" + "#ifndef ROOTCORE_PACKAGES_H\n" + "#define ROOTCORE_PACKAGES_H\n\n" ) + foreach( pkgname ${_packages} ) + file( APPEND ${_packagesFileName} + "#define ROOTCORE_PACKAGE_${pkgname}\n" ) + endforeach() + file( APPEND ${_packagesFileName} "\n#endif // not ROOTCORE_PACKAGES_H\n" ) + unset( _packagesFileName ) + unset( _packages ) + + # Install the header in the usual place: + install( DIRECTORY ${CMAKE_BINARY_DIR}/RootCore/include/ + DESTINATION RootCore/include ) + +endfunction( analysisbase_generate_release_header ) diff --git a/Projects/AnalysisTop/package_filters.txt b/Projects/AnalysisTop/package_filters.txt new file mode 100644 index 0000000000000000000000000000000000000000..a68258ed3d5d664e8ce09f5ef9c21c0732ca8465 --- /dev/null +++ b/Projects/AnalysisTop/package_filters.txt @@ -0,0 +1,113 @@ +# +# Packages to build as part of AnalysisBase: +# ++ AsgExternal/Asg_Test ++ AtlasTest/TestTools ++ Calorimeter/CaloGeoHelpers ++ Control/AthContainersInterfaces ++ Control/AthContainers ++ Control/AthLinksSA ++ Control/AthToolSupport/.* ++ Control/CxxUtils ++ Control/xAODRootAccess.* ++ DataQuality/GoodRunsLists ++ DetectorDescription/GeoPrimitives ++ DetectorDescription/IRegionSelector ++ DetectorDescription/RoiDescriptor ++ Event/EventPrimitives ++ Event/FourMomUtils +- Event/xAOD/.*AthenaPool ++ Event/xAOD/xAODMetaDataCnv ++ Event/xAOD/xAODTriggerCnv +- Event/xAOD/.*Cnv ++ Event/xAOD/.* ++ Generators/TruthUtils ++ InnerDetector/InDetRecTools/InDetTrackSelectionTool ++ InnerDetector/InDetRecTools/TrackVertexAssociationTool ++ MuonSpectrometer/MuonIdHelpers ++ PhysicsAnalysis/AnalysisCommon/AssociationUtils ++ PhysicsAnalysis/AnalysisCommon/CPAnalysisExamples ++ PhysicsAnalysis/AnalysisCommon/FsrUtils ++ PhysicsAnalysis/AnalysisCommon/IsolationSelection ++ PhysicsAnalysis/AnalysisCommon/PATCore ++ PhysicsAnalysis/AnalysisCommon/PATInterfaces ++ PhysicsAnalysis/AnalysisCommon/PMGTools ++ PhysicsAnalysis/AnalysisCommon/ParticleJetTools ++ PhysicsAnalysis/AnalysisCommon/PileupReweighting ++ PhysicsAnalysis/AnalysisCommon/ReweightUtils ++ PhysicsAnalysis/D3PDTools/.* +- PhysicsAnalysis/ElectronPhotonID/ElectronPhotonTagTools ++ PhysicsAnalysis/ElectronPhotonID/.* ++ PhysicsAnalysis/HiggsPhys/Run2/HZZ/Tools/ZMassConstraint ++ PhysicsAnalysis/Interfaces/.* ++ PhysicsAnalysis/JetMissingEtID/JetSelectorTools ++ PhysicsAnalysis/JetPhys/SemileptonicCorr ++ PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/CalibrationDataInterface ++ PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency ++ PhysicsAnalysis/MCTruthClassifier ++ PhysicsAnalysis/MuonID/MuonIDAnalysis/.* ++ PhysicsAnalysis/MuonID/MuonSelectorTools ++ PhysicsAnalysis/SUSYPhys/SUSYTools ++ PhysicsAnalysis/TauID/DiTauMassTools ++ PhysicsAnalysis/TauID/TauAnalysisTools ++ PhysicsAnalysis/TauID/TauCorrUncert ++ PhysicsAnalysis/TopPhys/QuickAna ++ PhysicsAnalysis/TrackingID/.* ++ Reconstruction/EventShapes/EventShapeInterface +- Reconstruction/Jet/JetAnalysisTools/JetAnalysisEDM +- Reconstruction/Jet/JetEvent.* +- Reconstruction/Jet/JetMonitoring ++ Reconstruction/Jet/JetReclustering +- Reconstruction/Jet/JetRec.+ +- Reconstruction/Jet/JetSimTools +- Reconstruction/Jet/JetValidation ++ Reconstruction/Jet/Jet.* ++ Reconstruction/MET/METInterface ++ Reconstruction/MET/METUtilities ++ Reconstruction/MVAUtils ++ Reconstruction/PFlow/PFlowUtils ++ Reconstruction/egamma/egammaLayerRecalibTool ++ Reconstruction/egamma/egammaMVACalib ++ Reconstruction/egamma/egammaRecEvent ++ Reconstruction/tauRecTools ++ Tools/PathResolver ++ Trigger/TrigAnalysis/TrigAnalysisInterfaces ++ Trigger/TrigAnalysis/TrigBunchCrossingTool ++ Trigger/TrigAnalysis/TrigDecisionTool ++ Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching ++ Trigger/TrigAnalysis/TriggerMatchingTool ++ Trigger/TrigConfiguration/TrigConfBase ++ Trigger/TrigConfiguration/TrigConfHLTData ++ Trigger/TrigConfiguration/TrigConfInterfaces ++ Trigger/TrigConfiguration/TrigConfL1Data ++ Trigger/TrigConfiguration/TrigConfxAOD ++ Trigger/TrigEvent/TrigDecisionInterface ++ Trigger/TrigEvent/TrigNavStructure ++ Trigger/TrigEvent/TrigRoiConversion ++ Trigger/TrigEvent/TrigSteeringEvent ++ Trigger/TrigValidation/TrigAnalysisTest +# +# Packages to build as part of AnalysisTop: +# ++ PhysicsAnalysis/UpgradePhys/SmearingFunctions/UpgradePerformanceFunctions ++ PhysicsAnalysis/TopPhys/KLFitter ++ PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation ++ PhysicsAnalysis/TopPhys/xAOD/TopAnalysis ++ PhysicsAnalysis/TopPhys/xAOD/TopCPTools ++ PhysicsAnalysis/TopPhys/xAOD/TopConfiguration ++ PhysicsAnalysis/TopPhys/xAOD/TopCorrections ++ PhysicsAnalysis/TopPhys/xAOD/TopEvent ++ PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools ++ PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools ++ PhysicsAnalysis/TopPhys/xAOD/TopExamples ++ PhysicsAnalysis/TopPhys/xAOD/TopFakes ++ PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade ++ PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure ++ PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools ++ PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel ++ PhysicsAnalysis/TopPhys/xAOD/TopPartons ++ PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker +# +# No other packages +# +- .* diff --git a/Projects/AnalysisTop/project.cmake b/Projects/AnalysisTop/project.cmake new file mode 100644 index 0000000000000000000000000000000000000000..76571324d7e4f80cac6ee342ad9db212612dfa4b --- /dev/null +++ b/Projects/AnalysisTop/project.cmake @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Project file for AnalysisTop +set( PROJECT_NAME "AnalysisTop" ) +set( PROJECT_VERSION "2.6.3" ) + +# Other projects that this one depends on +set( PROJECT_DEPS "AnalysisTopExternals" "2.6.3" ) diff --git a/Projects/AnalysisTop/scripts/load_packages.C.in b/Projects/AnalysisTop/scripts/load_packages.C.in new file mode 100644 index 0000000000000000000000000000000000000000..0b0d21db72d81fdad07a4277867bb9c861ee515b --- /dev/null +++ b/Projects/AnalysisTop/scripts/load_packages.C.in @@ -0,0 +1,48 @@ +// $Id: load_packages.C.in 784551 2016-11-16 12:46:32Z krasznaa $ +// +// This is a much simplified version of the RootCore script with the same +// name, basically just here to provide the existing scripts/tests with a +// file that they can use. + +// System include(s): +#include <stdexcept> + +// ROOT include(s): +#include <TSystem.h> +#include <TROOT.h> + +/// Function setting up interactive ROOT to use the analysis release +/// +/// In order to use macros or PyROOT scripts that make use of symbols +/// defined in the analysis release, the user has to execute this macro. +/// It takes care of setting up the compilation options of ACLiC, and +/// of calling xAOD::Init(). +/// +/// @param options An unused parameter, just to mimic the RootCore function +/// +void load_packages( const char* options = "" ) { + + // Make sure that some reasonable environment is set up: + const char* ROOTCOREDIR = gSystem->Getenv( "ROOTCOREDIR" ); + if( ! ROOTCOREDIR ) { + throw std::runtime_error( "ROOTCOREDIR not set, please set " + "the environment" ); + } + const std::string dir = ROOTCOREDIR; + + const char* ROOTCOREBIN = gSystem->Getenv( "ROOTCOREBIN" ); + if( ! ROOTCOREBIN ) { + throw std::runtime_error( "ROOTCOREBIN not set, please set " + "the environment"); + } + const std::string bin = ROOTCOREBIN; + + // Set the compilation options for ACLiC: + gSystem->AddIncludePath( "@CMAKE_CXX_FLAGS@" ); + + // Load the xAODRootAccess library, in a hard-coded way: + gSystem->Load( "libxAODRootAccess" ); + gROOT->ProcessLine( "xAOD::Init().ignore()" ); + + return; +} diff --git a/Projects/AnalysisTop/version.txt b/Projects/AnalysisTop/version.txt new file mode 100644 index 0000000000000000000000000000000000000000..b295a689e748195bd03e94e0343e70df461571d9 --- /dev/null +++ b/Projects/AnalysisTop/version.txt @@ -0,0 +1 @@ +21.2.0